mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix: drift pnl and cumpnl
This commit is contained in:
parent
9f8b8d97d0
commit
14aa667d59
|
@ -397,9 +397,11 @@ func (s *Strategy) initTickerFunctions(ctx context.Context) {
|
|||
var err error
|
||||
if numPending, err = s.smartCancel(ctx, pricef, atr); err != nil {
|
||||
log.WithError(err).Errorf("cannot cancel orders")
|
||||
s.positionLock.Unlock()
|
||||
return
|
||||
}
|
||||
if numPending > 0 {
|
||||
s.positionLock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -645,9 +647,10 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
method.Bind(session, s.GeneralOrderExecutor)
|
||||
}
|
||||
|
||||
profit := types.Float64Slice{1.}
|
||||
profit := types.Float64Slice{1., 1.}
|
||||
price, _ := s.Session.LastPrice(s.Symbol)
|
||||
cumProfit := types.Float64Slice{s.CalcAssetValue(price).Float64()}
|
||||
initAsset := s.CalcAssetValue(price).Float64()
|
||||
cumProfit := types.Float64Slice{initAsset, initAsset}
|
||||
modify := func(p float64) float64 {
|
||||
return p
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user