mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
xmaker: profit object can be nil
This commit is contained in:
parent
f96e0d6552
commit
7367ea73b8
|
@ -929,6 +929,7 @@ 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 profit != nil {
|
||||||
if s.CircuitBreaker != nil {
|
if s.CircuitBreaker != nil {
|
||||||
s.CircuitBreaker.RecordProfit(profit.Profit, trade.Time.Time())
|
s.CircuitBreaker.RecordProfit(profit.Profit, trade.Time.Time())
|
||||||
}
|
}
|
||||||
|
@ -937,6 +938,7 @@ func (s *Strategy) CrossRun(
|
||||||
|
|
||||||
s.ProfitStats.AddProfit(*profit)
|
s.ProfitStats.AddProfit(*profit)
|
||||||
s.Environment.RecordPosition(s.Position, trade, 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