Documentation ¶
Index ¶
- Constants
- Variables
- func BarBucketKey(symbol, timeframe string) string
- func QuoteBucketKey(symbol string) string
- func TradeBucketKey(symbol string) string
- type Bar
- func (model *Bar) Add(epoch int64, open, high, low, close enum.Price, volume enum.Size)
- func (model *Bar) BuildCsm() *io.ColumnSeriesMap
- func (model *Bar) GetCs() *io.ColumnSeries
- func (model Bar) Key() string
- func (model *Bar) Len() int
- func (model *Bar) Symbol() string
- func (model *Bar) Write() error
- type ConsolidatedUpdateInfo
- type Quote
- func (model *Quote) Add(epoch int64, nanos int, bidPrice float64, askPrice float64, bidSize int, ...)
- func (model *Quote) BuildCsm() *io.ColumnSeriesMap
- func (model Quote) Key() string
- func (model *Quote) Len() int
- func (model *Quote) SetLimit(limit int)
- func (model *Quote) Symbol() string
- func (model *Quote) Write() error
- type Trade
Constants ¶
const ( TradeSuffix string = "TRADE" TradeTimeframe string = "1Sec" )
Variables ¶
var ConditionToUpdateInfo = map[enum.TradeCondition]ConsolidatedUpdateInfo{ enum.NoTradeCondition: {true, true, true}, enum.RegularSale: {true, true, true}, enum.Acquisition: {true, true, true}, enum.AveragePriceTrade: {false, false, true}, enum.AutomaticExecution: {true, true, true}, enum.BunchedTrade: {true, true, true}, enum.BunchedSoldTrade: {true, false, true}, enum.CashSale: {false, false, true}, enum.ClosingPrints: {true, true, true}, enum.CrossTrade: {true, true, true}, enum.DerivativelyPriced: {true, false, true}, enum.Distribution: {true, true, true}, enum.ExtendedHoursTrade: {false, false, true}, enum.IntermarketSweep: {true, true, true}, enum.MarketCenterOfficialClose: {false, false, false}, enum.MarketCenterOfficialOpen: {false, false, false}, enum.NextDay: {false, false, true}, enum.PriceVariationTrade: {false, false, true}, enum.PriorReferencePrice: {true, false, true}, enum.Rule155Trade: {true, true, true}, enum.OpeningPrints: {true, true, true}, enum.StoppedStock: {true, true, true}, enum.ReopeningPrints: {true, true, true}, enum.Seller: {true, false, true}, enum.SoldLast: {true, true, true}, enum.SoldOutOfSequence: {true, false, true}, enum.SplitTrade: {true, true, true}, enum.YellowFlagRegularTrade: {true, true, true}, enum.OddLotTrade: {false, false, true}, enum.CorrectedConsolidatedClose: {true, true, false}, enum.ContingentTrade: {false, false, true}, enum.QualifiedContingentTrade: {false, false, true}, }
Functions ¶
func BarBucketKey ¶
BarBucketKey returns a string bucket key for a given symbol and timeframe
func QuoteBucketKey ¶
BarBucketKey returns a string bucket key for a given symbol and timeframe
func TradeBucketKey ¶
TradeBucketKey returns a string bucket key for a given symbol and timeframe
Types ¶
type Bar ¶
type Bar struct { Tbk *io.TimeBucketKey Csm io.ColumnSeriesMap Epoch []int64 Open, High, Low, Close []enum.Price Volume []enum.Size WriteTime time.Duration }
Bar is a data model to persist arrays of Ask-Bid quotes
func NewBar ¶
NewBar creates a new Bar object and initializes it's internal column buffers to the given capacity
func (*Bar) Add ¶
Add adds a new data point to the internal buffers, and increment the internal index by one
func (*Bar) BuildCsm ¶
func (model *Bar) BuildCsm() *io.ColumnSeriesMap
BuildCsm prepares an io.ColumnSeriesMap object and populates it's columns with the contents of the internal buffers it is included in the .Write() method so use only when you need to work with the ColumnSeriesMap before writing it to disk
func (*Bar) GetCs ¶
func (model *Bar) GetCs() *io.ColumnSeries
type ConsolidatedUpdateInfo ¶
type Quote ¶
type Quote struct { Tbk *io.TimeBucketKey Epoch []int64 Nanos []int32 BidPrice []float64 AskPrice []float64 BidSize []uint64 AskSize []uint64 BidExchange []byte AskExchange []byte Cond []byte WriteTime time.Duration // contains filtered or unexported fields }
Quote defines schema and helper functions for storing Ask-Bid quote data
func NewQuote ¶
NewBar creates a new Bar object and initializes it's internal column buffers to the given length
func (*Quote) Add ¶
func (model *Quote) Add(epoch int64, nanos int, bidPrice float64, askPrice float64, bidSize int, askSize int, bidExchange, askExchange enum.Exchange, cond enum.QuoteCondition)
Add adds a new data point to the internal buffers, and increment the internal index by one
func (*Quote) BuildCsm ¶
func (model *Quote) BuildCsm() *io.ColumnSeriesMap
BuildCsm prepares an io.ColumnSeriesMap object and populates it's columns with the contents of the internal buffers it is included in the .Write() method so use only when you need to work with the ColumnSeriesMap before writing it to disk
func (*Quote) SetLimit ¶
SetLimit sets a limit on how many entries are actually used when .Write() is called It is useful if the model's buffers populated through the exported buffers directly (Open[i], Close[i], etc) and the actual amount of inserted data is less than the initailly specified length parameter.
type Trade ¶
type Trade struct { Tbk *io.TimeBucketKey Epoch []int64 Nanos []int32 Price []enum.Price Size []enum.Size Exchange []enum.Exchange TapeID []enum.Tape Cond1 []enum.TradeCondition Cond2 []enum.TradeCondition Cond3 []enum.TradeCondition Cond4 []enum.TradeCondition WriteTime time.Duration // contains filtered or unexported fields }
Trade defines schema and helper functions for storing trade data
func NewTrade ¶
NewTrade creates a new Trade object and initializes it's internal column buffers to the given capacity
func (*Trade) Add ¶
func (model *Trade) Add(epoch int64, nanos int, price enum.Price, size enum.Size, exchange enum.Exchange, tapeid enum.Tape, conditions ...enum.TradeCondition)
Add adds a new data point to the internal buffers, and increment the internal index by one
func (*Trade) GetCs ¶
func (model *Trade) GetCs() *io.ColumnSeries