bbgo: do not write trade when writing position

This commit is contained in:
c9s 2022-05-04 15:48:30 +08:00
parent 0e417f6f71
commit 450517d159
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -702,17 +702,6 @@ func (environ *Environment) RecordPosition(position *types.Position, trade types
log.WithError(err).Errorf("can not insert position record") log.WithError(err).Errorf("can not insert position record")
} }
} }
// if:
// 1) we are not using sync
// 2) and not sync-ing trades from the user data stream
if environ.TradeService != nil && (environ.syncConfig == nil ||
(environ.syncConfig.UserDataStream == nil) ||
(environ.syncConfig.UserDataStream != nil && !environ.syncConfig.UserDataStream.Trades)) {
if err := environ.TradeService.Insert(trade); err != nil {
log.WithError(err).Errorf("can not insert trade record: %+v", trade)
}
}
} }
func (environ *Environment) RecordProfit(profit types.Profit) { func (environ *Environment) RecordProfit(profit types.Profit) {