drop kline fields from the trading context

This commit is contained in:
c9s 2020-07-11 16:40:07 +08:00
parent 73276996a7
commit 73ae2603d9
2 changed files with 3 additions and 16 deletions

View File

@ -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
}

View File

@ -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 {