mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
fix profit pointer check
This commit is contained in:
parent
8cf57cae29
commit
28666d4e98
|
@ -718,6 +718,8 @@ func (environ *Environment) RecordPosition(position *types.Position, trade types
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set profit info to position
|
||||||
|
if profit != nil {
|
||||||
if position.Strategy == "" && profit.Strategy != "" {
|
if position.Strategy == "" && profit.Strategy != "" {
|
||||||
position.Strategy = profit.Strategy
|
position.Strategy = profit.Strategy
|
||||||
}
|
}
|
||||||
|
@ -725,6 +727,7 @@ func (environ *Environment) RecordPosition(position *types.Position, trade types
|
||||||
if position.StrategyInstanceID == "" && profit.StrategyInstanceID != "" {
|
if position.StrategyInstanceID == "" && profit.StrategyInstanceID != "" {
|
||||||
position.StrategyInstanceID = profit.StrategyInstanceID
|
position.StrategyInstanceID = profit.StrategyInstanceID
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if profit != nil {
|
if profit != nil {
|
||||||
if err := environ.PositionService.Insert(position, trade, profit.Profit); err != nil {
|
if err := environ.PositionService.Insert(position, trade, profit.Profit); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user