core

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DailyInterval   HistoryInterval = "daily"
	WeeklyInterval  HistoryInterval = "weekly"
	MonthlyInterval HistoryInterval = "monthly"
	YearlyInterval  HistoryInterval = "yearly"

	OneMinInterval  IntradayInterval = "1min"
	FiveMinInterval IntradayInterval = "5min"
	TickInterval    IntradayInterval = "tick"
)
View Source
const (
	ScanUnknown  = ScanStateType("unknown")
	ScanScanning = ScanStateType("scanning")
	ScanScanned  = ScanStateType("scanned")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityStatusType

type ActivityStatusType int
const (
	ActivityEnabled  ActivityStatusType = 1
	ActivityDisabled ActivityStatusType = 0 //default
)

func (*ActivityStatusType) Scan

func (ast *ActivityStatusType) Scan(value interface{}) error

func (*ActivityStatusType) String added in v0.0.24

func (ast *ActivityStatusType) String() string

func (ActivityStatusType) Value

func (ast ActivityStatusType) Value() (driver.Value, error)

type AgentSelectionType

type AgentSelectionType string
const (
	AgentSelectionNone         AgentSelectionType = "none"
	AgentSelectionAlly         AgentSelectionType = "ally_invest"
	AgentSelectionTDAmeritrade AgentSelectionType = "td_ameritrade"
)

func (*AgentSelectionType) Scan

func (ast *AgentSelectionType) Scan(value interface{}) error

func (AgentSelectionType) Value

func (ast AgentSelectionType) Value() (driver.Value, error)

type DateType

type DateType struct {
	// contains filtered or unexported fields
}

func NewDateType

func NewDateType(year, month, day int) DateType

func NewDateTypeFromTime

func NewDateTypeFromTime(toConvert time.Time) DateType

func NewDateTypeFromUnix

func NewDateTypeFromUnix(timestamp int64) DateType

func (DateType) Add added in v0.0.24

func (tt DateType) Add(duration time.Duration) TimestampType

func (DateType) AddDate

func (tt DateType) AddDate(years int, months int, days int) DateType

func (DateType) Before

func (tt DateType) Before(date DateType) bool

func (DateType) Day

func (tt DateType) Day() time.Weekday

func (DateType) Equal added in v0.0.24

func (tt DateType) Equal(date DateType) bool

func (DateType) IsWeekDay

func (tt DateType) IsWeekDay() bool

func (DateType) IsZero added in v0.0.23

func (tt DateType) IsZero() bool

func (*DateType) Scan

func (tt *DateType) Scan(value interface{}) error

func (DateType) String

func (tt DateType) String() string

func (DateType) Time

func (tt DateType) Time() time.Time

func (DateType) Unix

func (tt DateType) Unix() int64

func (DateType) Value

func (tt DateType) Value() (driver.Value, error)

type DivFrequencyType

type DivFrequencyType string
const (
	AnnualDiv     DivFrequencyType = "A"
	SemiAnnualDiv DivFrequencyType = "S"
	QuarterlyDiv  DivFrequencyType = "Q"
	MonthlyDiv    DivFrequencyType = "M"
	NoDiv         DivFrequencyType = "N"
)

type EquityType

type EquityType string
const (
	UnknownEquity EquityType = "UNKNOWN"
	CallEquity    EquityType = "CALL"
	PutEquity     EquityType = "PUT"
)

func (*EquityType) Scan

func (vst *EquityType) Scan(value interface{}) error

func (EquityType) Value

func (vst EquityType) Value() (driver.Value, error)

type HistoryInterval added in v0.0.24

type HistoryInterval string

type HistoryStatusType added in v0.0.24

type HistoryStatusType int

HistorystatusType is a big flag value

const (
	HistoryStatusDisabled HistoryStatusType = 0 //default value
	HistoryStatusDaily    HistoryStatusType = 1 //bit flag
	HistoryStatusWeekly   HistoryStatusType = 2 //bit flag
	HistoryStatusMonthly  HistoryStatusType = 4 //bit flag
	HistoryStatusYearly   HistoryStatusType = 8 //bit flag
)

func (*HistoryStatusType) HasDaily added in v0.0.24

func (hst *HistoryStatusType) HasDaily() bool

func (*HistoryStatusType) HasMonthly added in v0.0.24

func (hst *HistoryStatusType) HasMonthly() bool

func (*HistoryStatusType) HasWeekly added in v0.0.24

func (hst *HistoryStatusType) HasWeekly() bool

func (*HistoryStatusType) HasYearly added in v0.0.24

func (hst *HistoryStatusType) HasYearly() bool

func (*HistoryStatusType) Scan added in v0.0.24

func (hst *HistoryStatusType) Scan(value interface{}) error

func (HistoryStatusType) String added in v0.0.24

func (hst HistoryStatusType) String() string

func (HistoryStatusType) Value added in v0.0.24

func (hst HistoryStatusType) Value() (driver.Value, error)

type IntradayInterval added in v0.0.24

type IntradayInterval string

type IntradayStateType added in v0.0.24

type IntradayStateType int
const (
	IntradayStateActive IntradayStateType = 1
	IntradayStateDaily  IntradayStateType = 0 //Default
)

func (*IntradayStateType) IsActive added in v0.0.24

func (ihst *IntradayStateType) IsActive() bool

func (*IntradayStateType) IsDaily added in v0.0.24

func (ihst *IntradayStateType) IsDaily() bool

func (*IntradayStateType) Scan added in v0.0.24

func (ihst *IntradayStateType) Scan(value interface{}) error

func (IntradayStateType) String added in v0.0.24

func (ihst IntradayStateType) String() string

func (IntradayStateType) Value added in v0.0.24

func (ihst IntradayStateType) Value() (driver.Value, error)

type IntradayStatusType added in v0.0.24

type IntradayStatusType int

IntradayStatusType is a bitflag value

const (
	IntradaystatusDisabled IntradayStatusType = 0 //default value
	IntradayStatus1Min     IntradayStatusType = 1 //bit flag
	IntradayStatus5Min     IntradayStatusType = 2 //bit flag
	IntradayStatusTicks    IntradayStatusType = 4 //bit flag
)

func (*IntradayStatusType) Has1Min added in v0.0.24

func (ist *IntradayStatusType) Has1Min() bool

func (*IntradayStatusType) Has5Min added in v0.0.24

func (ist *IntradayStatusType) Has5Min() bool

func (*IntradayStatusType) HasTicks added in v0.0.24

func (ist *IntradayStatusType) HasTicks() bool

func (*IntradayStatusType) Scan added in v0.0.24

func (ist *IntradayStatusType) Scan(value interface{}) error

func (IntradayStatusType) String added in v0.0.24

func (ist IntradayStatusType) String() string

func (IntradayStatusType) Value added in v0.0.24

func (ist IntradayStatusType) Value() (driver.Value, error)

type NullDivFrequency

type NullDivFrequency struct {
	DivFreq DivFrequencyType
	Valid   bool
}

func (*NullDivFrequency) Scan

func (nsqt *NullDivFrequency) Scan(value interface{}) error

func (*NullDivFrequency) Value

func (nsqt *NullDivFrequency) Value() (driver.Value, error)

type NullEquityType

type NullEquityType struct {
	Type  EquityType
	Valid bool
}

func (*NullEquityType) Scan

func (net *NullEquityType) Scan(value interface{}) error

func (*NullEquityType) Value

func (nsqt *NullEquityType) Value() (driver.Value, error)

type OptionStatusType added in v0.0.24

type OptionStatusType int
const (
	OptionsDisabled OptionStatusType = 0 //default
	OptionsEnabled  OptionStatusType = 1
)

func (*OptionStatusType) Scan added in v0.0.24

func (ost *OptionStatusType) Scan(value interface{}) error

func (OptionStatusType) String added in v0.0.24

func (ost OptionStatusType) String() string

func (OptionStatusType) Value added in v0.0.24

func (ost OptionStatusType) Value() (driver.Value, error)

type OptionSymbolType

type OptionSymbolType struct {
	Expiration  DateType
	OptionType  EquityType
	StrikePrice float64
	Symbol      StockSymbolType
}

type ScanStateType added in v0.0.17

type ScanStateType string

func (*ScanStateType) Scan added in v0.0.17

func (vst *ScanStateType) Scan(value interface{}) error

func (ScanStateType) Value added in v0.0.17

func (vst ScanStateType) Value() (driver.Value, error)

type SibylAgent

type SibylAgent interface {
	GetHistory(ctx context.Context, symbol StockSymbolType, interval HistoryInterval, startDate, endDate DateType) ([]*SibylHistoryRecord, error)
	GetIntraday(ctx context.Context, symbol StockSymbolType, interval IntradayInterval, startDate, endDate TimestampType) ([]*SibylIntradayRecord, error)
	GetQuotes(ctx context.Context, stockSymbols map[StockSymbolType]bool, optionSymbols map[OptionSymbolType]bool) ([]*SibylStockQuoteRecord, []*SibylOptionQuoteRecord, error)
	GetStableQuotes(ctx context.Context, stockSymbols map[StockSymbolType]bool, optionSymbols map[OptionSymbolType]bool) ([]*SibylStableStockQuoteRecord, []*SibylStableOptionQuoteRecord, error)
	GetStockOptionSymbols(ctx context.Context, symbol StockSymbolType) ([]*OptionSymbolType, error)
	VerifyStockSymbol(ctx context.Context, symbol StockSymbolType) (good, hasOptions bool, exchange, exchangeName, name string, err error)
}

type SibylCreds

type SibylCreds struct {
	// contains filtered or unexported fields
}

func DefaultSibylCreds

func DefaultSibylCreds() *SibylCreds

func NewSibylCreds

func NewSibylCreds(
	agentSelection AgentSelectionType,
	consumerKey string,
	consumerSecret string,
	token string,
	tokenSecret string,
	urlRedirect string,
	accessToken string,
	refreshToken string,
	expireTimestamp int64,
	refreshExpireTimestamp int64,
) *SibylCreds

func (*SibylCreds) AccessToken

func (sc *SibylCreds) AccessToken() string

func (*SibylCreds) AgentSelection

func (sc *SibylCreds) AgentSelection() AgentSelectionType

func (*SibylCreds) ConsumerKey

func (sc *SibylCreds) ConsumerKey() string

func (*SibylCreds) ConsumerSecret

func (sc *SibylCreds) ConsumerSecret() string

func (*SibylCreds) ExpireTimestamp

func (sc *SibylCreds) ExpireTimestamp() int64

func (*SibylCreds) RefreshExpireTimestamp

func (sc *SibylCreds) RefreshExpireTimestamp() int64

func (*SibylCreds) RefreshToken

func (sc *SibylCreds) RefreshToken() string

func (*SibylCreds) String

func (sc *SibylCreds) String() string

func (*SibylCreds) StringBlindWithDelimiter

func (sc *SibylCreds) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

func (*SibylCreds) Token

func (sc *SibylCreds) Token() string

func (*SibylCreds) TokenSecret

func (sc *SibylCreds) TokenSecret() string

func (*SibylCreds) UrlRedirect

func (sc *SibylCreds) UrlRedirect() string

type SibylHistoryRecord

type SibylHistoryRecord struct {
	ClosePrice sql.NullFloat64
	HighPrice  sql.NullFloat64
	Interval   HistoryStatusType
	LowPrice   sql.NullFloat64
	OpenPrice  sql.NullFloat64
	Symbol     StockSymbolType // this is (and must be) guaranteed to be a NON - Null value
	Timestamp  DateType        // millis // this is (and must be) guaranteed to be a NON - Null value
	Volume     sql.NullInt64
}

func (*SibylHistoryRecord) String

func (shr *SibylHistoryRecord) String() string

func (*SibylHistoryRecord) StringBlindWithDelimiter

func (shr *SibylHistoryRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type SibylIntradayRecord

type SibylIntradayRecord struct {
	HighPrice sql.NullFloat64
	Interval  IntradayStatusType //this is used to identify which type: ticks, 1min, 5min
	LastPrice sql.NullFloat64
	LowPrice  sql.NullFloat64
	OpenPrice sql.NullFloat64
	Symbol    StockSymbolType // this is (and must be) guaranteed to be a NON - Null value
	Timestamp TimestampType   // this is (and must be) guaranteed to be a NON - Null value
	Volume    sql.NullInt64
}

func (*SibylIntradayRecord) String

func (si *SibylIntradayRecord) String() string

func (*SibylIntradayRecord) StringBlindWithDelimiter

func (si *SibylIntradayRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type SibylOptionQuoteRecord

type SibylOptionQuoteRecord struct {
	Ask                sql.NullFloat64 // both   //
	AskTime            sql.NullInt64   // both   //
	AskSize            sql.NullInt64   // both   //
	Bid                sql.NullFloat64 // both   //
	BidTime            sql.NullInt64   // both   // millis
	BidSize            sql.NullInt64   // both   //
	Change             sql.NullFloat64 // both   //  (+/-) number
	Delta              sql.NullFloat64 // option //  "idelta"
	EquityType         EquityType      // both   //  "put_call"     //CALL or PUT // this is (and must be) guaranteed to be a NON - Null value
	Expiration         DateType        // option //  millis // this is (and must be) guaranteed to be a NON - Null value
	Gamma              sql.NullFloat64 // option //  "igamma"
	HighPrice          sql.NullFloat64 // both   //  "hi"`
	ImpliedVolatility  sql.NullFloat64 // option //
	LastTradePrice     sql.NullFloat64 // both   //  ally LastTrade ... TD mark or regularMarketLastPrice
	LastTradeTimestamp sql.NullInt64   // both   //  ally DateTime   TD :tradeTimeInLong
	LastTradeVolume    sql.NullInt64   // both   //  ally incr_vl   TD : lastSize
	LowPrice           sql.NullFloat64 // both   //  "lo"
	OpenInterest       sql.NullInt64   // option //  "openinterest"
	Rho                sql.NullFloat64 // option //  "irho"
	StrikePrice        float64         // option // // this is (and must be) guaranteed to be a NON - Null value
	Symbol             StockSymbolType // both   //  either the stock symbol or root symbol ex. CAT // this is (and must be) guaranteed to be a NON - Null value
	Theta              sql.NullFloat64 // option //  "itheta"
	Timestamp          TimestampType   // both   //  millis // this is the GMT timestamp (ms from epoch) of the this quote // this is (and must be) guaranteed to be a NON - Null value
	Vega               sql.NullFloat64 // option //  "ivega"
}

func (*SibylOptionQuoteRecord) String

func (sbq *SibylOptionQuoteRecord) String() string

func (*SibylOptionQuoteRecord) StringBlindWithDelimiter

func (sbq *SibylOptionQuoteRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type SibylOptionRecord

type SibylOptionRecord struct {
	Expiration  DateType
	OptionType  EquityType
	StrikePrice float64
	Symbol      StockSymbolType
}

func (*SibylOptionRecord) String

func (so *SibylOptionRecord) String() string

func (*SibylOptionRecord) StringBlindWithDelimiter

func (so *SibylOptionRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type SibylStableOptionQuoteRecord

type SibylStableOptionQuoteRecord struct {
	ClosePrice             sql.NullFloat64 // both   // previous day close
	ContractSize           sql.NullInt64   // option // contract size for option
	EquityType             EquityType      // both   //  "put_call"    //CALL or PUT
	Expiration             DateType        // option // millis // this is (and must be) guaranteed to be a NON - Null value
	HighPrice52Wk          sql.NullFloat64 // both   //
	HighPrice52WkTimestamp sql.NullInt64   // both   // ally only //
	LowPrice52Wk           sql.NullFloat64 // both   //
	LowPrice52WkTimestamp  sql.NullInt64   // both   // ally only //millis -- ally only
	Multiplier             sql.NullInt64   // option // "prem_mult"
	OpenPrice              sql.NullFloat64 // both   //  "opn"
	StrikePrice            float64         // option // // this is (and must be) guaranteed to be a NON - Null value
	Symbol                 StockSymbolType // both   //  either the stock symbol or root symbol ex. CAT // this is (and must be) guaranteed to be a NON - Null value
	Timestamp              DateType        // both   // millis // Since these values should be stable the date is just the month/day/year // this is (and must be) guaranteed to be a NON - Null value
}

func (*SibylStableOptionQuoteRecord) String

func (ssq *SibylStableOptionQuoteRecord) String() string

func (*SibylStableOptionQuoteRecord) StringBlindWithDelimiter

func (ssq *SibylStableOptionQuoteRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type SibylStableStockQuoteRecord

type SibylStableStockQuoteRecord struct {
	AnnualDividend         sql.NullFloat64  // stock  // ally : iad   TD   divAmount
	BookValue              sql.NullFloat64  // stock  //  "prbook"
	ClosePrice             sql.NullFloat64  // both   // previous day close
	Div                    sql.NullFloat64  // stock  // ally only //(= AnnualDiv/ divFreq) Latest announced cash dividend
	DivExTimestamp         sql.NullInt64    // stock  // millis  // date of last dividend
	DivFreq                NullDivFrequency // stock  // Ally
	DivPayTimestamp        sql.NullInt64    // stock  // millis // Ally
	Eps                    sql.NullFloat64  // stock  // "eps"
	HighPrice52Wk          sql.NullFloat64  // both   //
	HighPrice52WkTimestamp sql.NullInt64    // both   // ally only //
	LowPrice52Wk           sql.NullFloat64  // both   //
	LowPrice52WkTimestamp  sql.NullInt64    // both   // ally only //millis -- ally only
	OpenPrice              sql.NullFloat64  // both   //  "opn"
	PriceEarnings          sql.NullFloat64  // stock  //  "pe"
	SharesOutstanding      sql.NullInt64    // stock  //
	Symbol                 StockSymbolType  // both   //  either the stock symbol or root symbol ex. CAT // this is (and must be) guaranteed to be a NON - Null value
	Timestamp              DateType         // both   // millis // Since these values should be stable the date is just the month/day/year // this is (and must be) guaranteed to be a NON - Null value
	Volatility             sql.NullFloat64  // stock  // one year volatility measure
	Yield                  sql.NullFloat64  // stock  //
}

func (*SibylStableStockQuoteRecord) String

func (ssq *SibylStableStockQuoteRecord) String() string

func (*SibylStableStockQuoteRecord) StringBlindWithDelimiter

func (ssq *SibylStableStockQuoteRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type SibylStockQuoteRecord

type SibylStockQuoteRecord struct {
	Ask                 sql.NullFloat64 // both   //
	AskTime             sql.NullInt64   // both   //
	AskSize             sql.NullInt64   // both   //
	Beta                sql.NullFloat64 // stock  //
	Bid                 sql.NullFloat64 // both   //
	BidTime             sql.NullInt64   // both   // millis
	BidSize             sql.NullInt64   // both   //
	Change              sql.NullFloat64 // both   //  (+/-) number
	HighPrice           sql.NullFloat64 // both   //  "hi"`
	LastTradePrice      sql.NullFloat64 // both   //  ally LastTrade ... TD mark or regularMarketLastPrice
	LastTradeTimestamp  sql.NullInt64   // both   //  ally DateTime   TD :tradeTimeInLong
	LastTradeVolume     sql.NullInt64   // both   //  ally incr_vl   TD : lastSize
	LowPrice            sql.NullFloat64 // both   //  "lo"
	Symbol              StockSymbolType // both   //  either the stock symbol or root symbol ex. CAT // this is (and must be) guaranteed to be a NON - Null value
	Timestamp           TimestampType   // both   //  millis // this is the GMT timestamp (ms from epoch) of the this quote // this is (and must be) guaranteed to be a NON - Null value
	Volume              sql.NullInt64   // stock  //
	VolWeightedAvgPrice sql.NullFloat64 // stock  //
}

func (*SibylStockQuoteRecord) String

func (sbq *SibylStockQuoteRecord) String() string

func (*SibylStockQuoteRecord) StringBlindWithDelimiter

func (sbq *SibylStockQuoteRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type SibylStockRecord

type SibylStockRecord struct {
	DownloadStatus        ActivityStatusType
	Exchange              string
	ExchangeDescription   string
	HistoryStatus         HistoryStatusType
	HistoryTimestamp      DateType
	IntradayState         IntradayStateType
	IntradayStatus        IntradayStatusType
	IntradayTimestamp1Min TimestampType
	IntradayTimestamp5Min TimestampType
	IntradayTimestampTick TimestampType
	Name                  string
	OptionListTimestamp   DateType
	OptionStatus          OptionStatusType
	QuotesStatus          ActivityStatusType
	StableQuotesStatus    ActivityStatusType
	Symbol                StockSymbolType
	ValidationStatus      ValidationStatusType
	ValidationTimestamp   DateType
}

func (*SibylStockRecord) String

func (ss *SibylStockRecord) String() string

func (*SibylStockRecord) StringBlindWithDelimiter

func (ss *SibylStockRecord) StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string

type StockSymbolType

type StockSymbolType string

func (*StockSymbolType) Scan

func (vst *StockSymbolType) Scan(value interface{}) error

func (StockSymbolType) Value

func (vst StockSymbolType) Value() (driver.Value, error)

type TimestampType

type TimestampType struct {
	// contains filtered or unexported fields
}

func NewTimestampTypeFromDate added in v0.0.24

func NewTimestampTypeFromDate(date DateType) TimestampType

func NewTimestampTypeFromTime

func NewTimestampTypeFromTime(time time.Time) TimestampType

func NewTimestampTypeFromUnix

func NewTimestampTypeFromUnix(timestamp int64) TimestampType

func (TimestampType) Add added in v0.0.23

func (tt TimestampType) Add(duration time.Duration) TimestampType

func (TimestampType) AddDate

func (tt TimestampType) AddDate(years int, months int, days int) TimestampType

func (TimestampType) After added in v0.0.23

func (tt TimestampType) After(date TimestampType) bool

func (TimestampType) Before

func (tt TimestampType) Before(date TimestampType) bool

func (TimestampType) Date added in v0.0.24

func (tt TimestampType) Date() DateType

func (TimestampType) Equal added in v0.0.23

func (tt TimestampType) Equal(date TimestampType) bool

func (TimestampType) IsWeekDay

func (tt TimestampType) IsWeekDay() bool

func (TimestampType) IsZero added in v0.0.23

func (tt TimestampType) IsZero() bool

func (*TimestampType) Scan

func (tt *TimestampType) Scan(value interface{}) error

func (TimestampType) String

func (tt TimestampType) String() string

func (TimestampType) Time

func (tt TimestampType) Time() time.Time

func (TimestampType) Truncate added in v0.0.23

func (tt TimestampType) Truncate(d time.Duration) TimestampType

func (TimestampType) Unix

func (tt TimestampType) Unix() int64

func (TimestampType) Value

func (tt TimestampType) Value() (driver.Value, error)

func (TimestampType) Weekday added in v0.0.24

func (tt TimestampType) Weekday() time.Weekday

type ValidationStatusType

type ValidationStatusType int
const (
	ValidationPending ValidationStatusType = 0 //default
	ValidationValid   ValidationStatusType = 1
	ValidationInvalid ValidationStatusType = 2
)

func (*ValidationStatusType) Scan

func (vst *ValidationStatusType) Scan(value interface{}) error

func (ValidationStatusType) String added in v0.0.24

func (vst ValidationStatusType) String() string

func (ValidationStatusType) Value

func (vst ValidationStatusType) Value() (driver.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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