Documentation ¶
Index ¶
- Variables
- func FloatToRat(v float64) *big.Rat
- func IntToRat(v int64) *big.Rat
- func IsWeekend(date time.Time) bool
- func RatToFloat(v *big.Rat) float64
- func ToRat(v string) *big.Rat
- func TruncDate(t time.Time) time.Time
- type API
- func (api *API) AddStock(s *Stock) (err error)
- func (api *API) AddUser(user *User) (err error)
- func (api *API) Close()
- func (api *API) CurrentHour() time.Time
- func (api *API) DeleteHistory(symbol string)
- func (api *API) GetAllTrackedSymbols() (symbols []string, err error)
- func (api *API) GetCurrentHourlyPrices(force bool, symbols ...string) (prices map[string]Decimal)
- func (api *API) GetLastTradeDay(symbol string) (date DateTime, tradeDay int64, err error)
- func (api *API) GetMinBuyDate(symbol string) NullDateTime
- func (api *API) GetStock(stockID StockID) (s *Stock, err error)
- func (api *API) GetStockDetailsForSymbol(symbol string) (details []StockDetail, err error)
- func (api *API) GetStockDetailsForUser(userID UserID) (details []StockDetail, err error)
- func (api *API) GetUser(userID UserID) (user *User, err error)
- func (api *API) GetUserByEmail(email string) (user *User, err error)
- func (api *API) LastTradingDate() time.Time
- func (api *API) RecordHistory(symbol string)
- func (api *API) RemoveStock(stockID StockID) (err error)
- func (api *API) Today() time.Time
- func (api *API) UpdateNotifyTimes(n *Stock) (err error)
- func (api *API) UpdateStock(n *Stock) (err error)
- type DateTime
- type Decimal
- type Detail
- type Float64
- type NullDateTime
- type NullDecimal
- type NullFloat64
- type Stock
- type StockDetail
- type StockID
- type User
- type UserEmail
- type UserID
Constants ¶
This section is empty.
Variables ¶
View Source
var DateTimeNull = NullDateTime{Valid: false}
View Source
var DecimalNull = NullDecimal{Value: nil, Valid: false}
View Source
var LocNY, _ = time.LoadLocation("America/New_York")
Get the New York location for stock timezone:
Functions ¶
func FloatToRat ¶
func RatToFloat ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
Our API context struct:
func (*API) CurrentHour ¶
func (*API) DeleteHistory ¶
Deletes all historical and statistical data for a symbol.
func (*API) GetAllTrackedSymbols ¶
Gets all actively tracked stock symbols (owned or watching):
func (*API) GetCurrentHourlyPrices ¶
Checks if the current hourly price has been fetched from Yahoo or not and fetches it into the StockHourly table if needed.
func (*API) GetLastTradeDay ¶
Gets the last date trading occurred for a stock symbol.
func (*API) GetMinBuyDate ¶
func (api *API) GetMinBuyDate(symbol string) NullDateTime
Get the earliest buy date for a symbol.
func (*API) GetStockDetailsForSymbol ¶
func (api *API) GetStockDetailsForSymbol(symbol string) (details []StockDetail, err error)
func (*API) GetStockDetailsForUser ¶
func (api *API) GetStockDetailsForUser(userID UserID) (details []StockDetail, err error)
func (*API) LastTradingDate ¶
func (*API) RecordHistory ¶
Fetches historical data from Yahoo Finance into the database.
func (*API) UpdateNotifyTimes ¶
Only updates last notification times:
func (*API) UpdateStock ¶
Only updates notify flag columns:
type DateTime ¶
func ToDateTime ¶
func (DateTime) DateString ¶
func (DateTime) MarshalJSON ¶
func (*DateTime) UnmarshalJSON ¶
type Decimal ¶
func (Decimal) CurrencyString ¶
func (Decimal) MarshalJSON ¶
func (*Decimal) UnmarshalJSON ¶
type Detail ¶
type Detail struct { CurrPrice NullDecimal CurrHour NullDateTime FetchedDateTime NullDateTime N1CloseDate NullDateTime N1ClosePrice NullDecimal N1SMAPercent NullFloat64 N1Avg200Day NullFloat64 N1Avg50Day NullFloat64 N2CloseDate NullDateTime N2ClosePrice NullDecimal N2SMAPercent NullFloat64 TStopPrice NullDecimal GainLossPercent NullFloat64 GainLossDollar NullDecimal }
type Float64 ¶
type Float64 struct {
Value float64
}
func (Float64) MarshalJSON ¶
func (*Float64) UnmarshalJSON ¶
type NullDateTime ¶
func ToNullDateTime ¶
func ToNullDateTime(format, s string) NullDateTime
func (NullDateTime) Format ¶
func (d NullDateTime) Format(format string) string
func (NullDateTime) MarshalJSON ¶
func (d NullDateTime) MarshalJSON() ([]byte, error)
func (NullDateTime) String ¶
func (d NullDateTime) String() string
func (*NullDateTime) UnmarshalJSON ¶
func (d *NullDateTime) UnmarshalJSON(data []byte) error
type NullDecimal ¶
func ToNullDecimal ¶
func ToNullDecimal(v string) NullDecimal
func (NullDecimal) CurrencyString ¶
func (d NullDecimal) CurrencyString() string
func (NullDecimal) MarshalJSON ¶
func (d NullDecimal) MarshalJSON() ([]byte, error)
func (NullDecimal) String ¶
func (d NullDecimal) String() string
func (*NullDecimal) UnmarshalJSON ¶
func (d *NullDecimal) UnmarshalJSON(data []byte) error
type NullFloat64 ¶
func ToNullFloat64 ¶
func ToNullFloat64(v string) NullFloat64
func (NullFloat64) MarshalJSON ¶
func (d NullFloat64) MarshalJSON() ([]byte, error)
func (NullFloat64) String ¶
func (d NullFloat64) String() string
func (*NullFloat64) UnmarshalJSON ¶
func (d *NullFloat64) UnmarshalJSON(data []byte) error
type Stock ¶
type Stock struct { StockID StockID UserID UserID Symbol string BuyDate DateTime BuyPrice Decimal IsWatched bool // false = owned, true = watched TStopPercent NullDecimal BuyStopPrice NullDecimal SellStopPrice NullDecimal RisePercent NullDecimal FallPercent NullDecimal NotifyTStop bool NotifyBuyStop bool NotifySellStop bool NotifyRise bool NotifyFall bool NotifyBullBear bool LastTimeTStop NullDateTime LastTimeBuyStop NullDateTime LastTimeSellStop NullDateTime LastTimeRise NullDateTime LastTimeFall NullDateTime LastTimeBullBear NullDateTime }
A stock owned/watched by UserID.
type StockDetail ¶
A stock with calculated stats:
type User ¶
func (*User) PrimaryEmail ¶
Click to show internal directories.
Click to hide internal directories.