configuration

package
v0.0.0-...-8c3ffa5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Lines        []Line
	APISecretKey string
	SNSTopic     string
}

Conf as read from configuration file.

func Load

func Load() Conf

Load from the mystock.json configuration file.

func (*Conf) Tickers

func (c *Conf) Tickers() []string

Tickers returns the list of Tickers mentionned in the configuration. This is mostly used to cache them initially.

type Line

type Line struct {
	// Informative, human readable name
	Name string
	// Unique ticker identifying the  stock shares
	Ticker string
	// Date of purchase - use special type to allow easier unmarshalling
	Date MyTime
	// Historical/average purchase price
	Price float64
	// number of shares
	Volume float64
}

Line defines a line of the shares portfolio as they are described in the mystock.json file

type MyTime

type MyTime struct {
	time.Time
}

MyTime wraps the time.Time object so that it can be unmarshalled to json using different layout.

func (*MyTime) IsSet

func (mt *MyTime) IsSet() bool

IsSet check for zero value.

func (*MyTime) MarshalJSON

func (mt *MyTime) MarshalJSON() ([]byte, error)

MarshalJSON in simplified format.

func (*MyTime) String

func (mt *MyTime) String() string

func (*MyTime) UnmarshalJSON

func (mt *MyTime) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON let MyTime be Unmarshalled in a flexible way.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL