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,15 +928,18 @@ 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) {
|
s.tradeCollector.OnProfit(func(trade types.Trade, profit *types.Profit) {
|
||||||
if s.CircuitBreaker != nil {
|
if profit != nil {
|
||||||
s.CircuitBreaker.RecordProfit(profit.Profit, trade.Time.Time())
|
if s.CircuitBreaker != nil {
|
||||||
|
s.CircuitBreaker.RecordProfit(profit.Profit, trade.Time.Time())
|
||||||
|
}
|
||||||
|
|
||||||
|
bbgo.Notify(profit)
|
||||||
|
|
||||||
|
s.ProfitStats.AddProfit(*profit)
|
||||||
|
s.Environment.RecordPosition(s.Position, trade, profit)
|
||||||
}
|
}
|
||||||
|
|
||||||
bbgo.Notify(profit)
|
|
||||||
|
|
||||||
s.ProfitStats.AddProfit(*profit)
|
|
||||||
s.Environment.RecordPosition(s.Position, trade, profit)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
s.tradeCollector.OnPositionUpdate(func(position *types.Position) {
|
s.tradeCollector.OnPositionUpdate(func(position *types.Position) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user