mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
drop kline fields from the trading context
This commit is contained in:
parent
73276996a7
commit
73ae2603d9
|
@ -1,11 +1,6 @@
|
|||
package bbgo
|
||||
|
||||
import "github.com/c9s/bbgo/pkg/bbgo/types"
|
||||
|
||||
type TradingContext struct {
|
||||
KLineWindowSize int
|
||||
KLineWindows map[string]types.KLineWindow
|
||||
|
||||
Symbol string
|
||||
|
||||
// Market is the market configuration of a symbol
|
||||
|
@ -22,15 +17,5 @@ func (c *TradingContext) SetCurrentPrice(price float64) {
|
|||
c.ProfitAndLossCalculator.SetCurrentPrice(price)
|
||||
}
|
||||
|
||||
func (c *TradingContext) AddKLine(kline types.KLine) types.KLineWindow {
|
||||
var klineWindow = c.KLineWindows[kline.Interval]
|
||||
klineWindow.Add(kline)
|
||||
|
||||
if c.KLineWindowSize > 0 {
|
||||
klineWindow.Truncate(c.KLineWindowSize)
|
||||
}
|
||||
|
||||
return klineWindow
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ func (s *PrivateStream) read(ctx context.Context, eventC chan interface{}) {
|
|||
continue
|
||||
}
|
||||
|
||||
log.Infof("[binance] event: %+v", e)
|
||||
// log.Infof("[binance] event: %+v", e)
|
||||
|
||||
switch e := e.(type) {
|
||||
|
||||
|
@ -165,6 +165,8 @@ func (s *PrivateStream) read(ctx context.Context, eventC chan interface{}) {
|
|||
}
|
||||
|
||||
case *ExecutionReportEvent:
|
||||
log.Info(e.Event, " ", e)
|
||||
|
||||
s.EmitExecutionReportEvent(e)
|
||||
|
||||
switch e.CurrentExecutionType {
|
||||
|
|
Loading…
Reference in New Issue
Block a user