Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlgoScore ¶
type AlgoScore struct { AlgoName string Symbol string // stats and scores OrdersCount int TradesCount int TradesWon int TradesLost int WinStreak int LossStreak int NetPnl float64 NetPnlPercentAverage float64 NetPnlPercentStdDev float64 SQN float64 }
AlgoScore struct
type AlgoStrategy ¶
type AlgoStrategy interface { Setup(symbol string, b *Book) []string OnDayStart(b *Book) OnDayEnd(b *Book) OnTick(t kstreamdb.TickData, b *Book) OnPeriodic(t time.Time, b *Book) // Invokes every sec OnClose(b *Book) }
AlgoStrategy Interface
type BacktestEngine ¶
type BacktestEngine struct {
// contains filtered or unexported fields
}
BacktestEngine struct
func (*BacktestEngine) RegisterAlgo ¶
func (bt *BacktestEngine) RegisterAlgo(a interface{})
RegisterAlgo BacktestEngine
func (*BacktestEngine) Run ¶
func (bt *BacktestEngine) Run(feed *kstreamdb.DB, oms OrderManager)
Run BacktestEngine
func (*BacktestEngine) RunAlgoBetweenDate ¶
func (bt *BacktestEngine) RunAlgoBetweenDate(feed *kstreamdb.DB, oms OrderManager, algoName string, startDate time.Time, endDate time.Time)
RunAlgoBetweenDate method
func (*BacktestEngine) Scores ¶
func (bt *BacktestEngine) Scores() []AlgoScore
Scores returns the scores calculated
type Book ¶
type Book struct { CashAllocated float64 Cash float64 Position int IsMarketOrder bool PendingOrderQuantity int PendingOrderPrice float64 OrderCount int }
Book struct
func (*Book) QuantityAffordable ¶
QuantityAffordable book
type CandleStick ¶
CandleStick struct
type CandlesData ¶
type CandlesData struct { Candles []CandleStick Open []float64 High []float64 Low []float64 Close []float64 Volume []float64 LTP float64 // contains filtered or unexported fields }
CandlesData struct
func NewCandlesData ¶
func NewCandlesData(periodInSeconds int) *CandlesData
NewCandlesData Instantiates a CandlesData Buffer
func (*CandlesData) HasChanged ¶
func (f *CandlesData) HasChanged(t time.Time) bool
HasChanged method, call with timestamp, to harvest candless return true is a new candle is formed
type Engine ¶
type Engine interface { RegisterAlgo(algo interface{}) Run(feed *kstreamdb.DB, oms OrderManager) SubscribeChannel(Symbol string, a AlgoStrategy) }
Engine Interface
type OrderFlowMonitor ¶
type OrderFlowMonitor struct { LastTick kstreamdb.TickData TotalBidsQuantityTaken uint32 TotalAsksQuantityTaken uint32 TicksUpdated uint32 Prices map[uint32]*PriceCell Bids [5]kstreamdb.DepthItem Asks [5]kstreamdb.DepthItem }
OrderFlowMonitor struct
func NewOrderFlowMonitor ¶
func NewOrderFlowMonitor() *OrderFlowMonitor
NewOrderFlowMonitor creates a new orderflow monitor
func (*OrderFlowMonitor) GetPriceCell ¶
func (r *OrderFlowMonitor) GetPriceCell(p float32) *PriceCell
GetPriceCell returns the price cell
func (*OrderFlowMonitor) StringifyPriceCell ¶
func (r *OrderFlowMonitor) StringifyPriceCell(p float32) string
StringifyPriceCell Stringify the Price Bucket
func (*OrderFlowMonitor) StringifyTotals ¶
func (r *OrderFlowMonitor) StringifyTotals() string
StringifyTotals stringyfies total
func (*OrderFlowMonitor) Update ¶
func (r *OrderFlowMonitor) Update(t kstreamdb.TickData)
Update processes the tick
type OrderManager ¶
type OrderManager interface { PlaceLimitOrder(symbol string, qty int, price float64, a AlgoStrategy) PlaceMarketOrder(symbol string, qty int, price float64, a AlgoStrategy) }
OrderManager Interface
type PlaybackFeed ¶
type PlaybackFeed struct {
// contains filtered or unexported fields
}
PlaybackFeed struct
func (*PlaybackFeed) Run ¶
func (f *PlaybackFeed) Run(fCallback func(t kstreamdb.TickData))
Run PlaybackFeed
func (*PlaybackFeed) SetDate ¶
func (f *PlaybackFeed) SetDate(dt time.Time)
SetDate for PlaybackFeed