Documentation ¶
Overview ¶
Package monitor provides monitoring of personnanl portfolio of stocks versus market data and statistics, as retrieved from cache/quandl.
Index ¶
- type Alert
- type Check
- type Measure
- type Monitor
- type Order
- type Portfolio
- type Query
- func (q *Query) Count() float64
- func (q *Query) Dump()
- func (q *Query) DumpRecords()
- func (q *Query) Limit(n int) *Query
- func (q *Query) Measure(ms ...string) *Query
- func (q *Query) MinMax() (min, max float64)
- func (q *Query) OrderDate(order Order) *Query
- func (q *Query) Select(fields ...string) *Query
- func (q *Query) Since(d time.Duration) *Query
- type VLine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert func(interface{}) error
Alert is a function that will alert me if special conditions are detected upon checking.
type Check ¶
Check performs regular checks on the portfolio. If the current situation needs to alert the user, return a message. or an empty string if no message needed, no attention needed. Return non nil error if unable to conduct the check.
func CheckGainLoss ¶
CheckGainLoss provides a check for total value percent change. Percent is expressed as a decimal number, ie 0.3 means 30% change threshold, not 0.3% !
func CheckPriceChange ¶
CheckPriceChange alerts if price change more than threshold. Percent is expressed as a decimal number, ie 0.3 means 30% change threshold, not 0.3% !
func CheckPriceChangeAll ¶
CheckPriceChangeAll will check for price change line by line. retun a function that will aggregate the per-ticker functions.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor allows to monitor share price evolution and send alerts.
func NewMonitor ¶
NewMonitor creates and initialize a new Monitor object. The portfolio is initialized from the configuration file. The cache is created, and the local database created as needed.
func (*Monitor) CheckAll ¶
func (m *Monitor) CheckAll()
CheckAll perform the registred checks and alert if needed.
func (*Monitor) LastClosingPrice ¶
LastClosingPrice last known closing price (in cache) for ticker.
func (*Monitor) LoadPortfolio ¶
LoadPortfolio constructs and updates a portfolio object from the current Monitor object.
type Query ¶
Query is a warpper around gorm.DB
func (*Query) DumpRecords ¶
func (q *Query) DumpRecords()
DumpRecords the selected rows. Assume record format.
func (*Query) OrderDate ¶
OrderDate specify order. Valid Order are : ASC or DESC It is case insensitive. Invalid values are silently ignored.