mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
Merge pull request #1716 from c9s/c9s/xmaker/stb-improvements
FIX: [xmaker] profit object can be nil
This commit is contained in:
commit
ea93bf959a
|
@ -928,7 +928,9 @@ func (s *Strategy) CrossRun(
|
|||
}
|
||||
})
|
||||
|
||||
// TODO: remove this nil value behavior, check all OnProfit usage and remove the EmitProfit call with nil profit
|
||||
s.tradeCollector.OnProfit(func(trade types.Trade, profit *types.Profit) {
|
||||
if profit != nil {
|
||||
if s.CircuitBreaker != nil {
|
||||
s.CircuitBreaker.RecordProfit(profit.Profit, trade.Time.Time())
|
||||
}
|
||||
|
@ -937,6 +939,7 @@ func (s *Strategy) CrossRun(
|
|||
|
||||
s.ProfitStats.AddProfit(*profit)
|
||||
s.Environment.RecordPosition(s.Position, trade, profit)
|
||||
}
|
||||
})
|
||||
|
||||
s.tradeCollector.OnPositionUpdate(func(position *types.Position) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user