fix profit pointer check

This commit is contained in:
c9s 2022-06-13 10:33:28 +08:00
parent 8cf57cae29
commit 28666d4e98
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -718,12 +718,15 @@ func (environ *Environment) RecordPosition(position *types.Position, trade types
return return
} }
if position.Strategy == "" && profit.Strategy != "" { // set profit info to position
position.Strategy = profit.Strategy if profit != nil {
} if position.Strategy == "" && profit.Strategy != "" {
position.Strategy = profit.Strategy
}
if position.StrategyInstanceID == "" && profit.StrategyInstanceID != "" { if position.StrategyInstanceID == "" && profit.StrategyInstanceID != "" {
position.StrategyInstanceID = profit.StrategyInstanceID position.StrategyInstanceID = profit.StrategyInstanceID
}
} }
if profit != nil { if profit != nil {