mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
xmaker: profit object can be nil
This commit is contained in:
parent
f96e0d6552
commit
7367ea73b8
|
@ -929,14 +929,16 @@ func (s *Strategy) CrossRun(
|
||||||
})
|
})
|
||||||
|
|
||||||
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