record profits

This commit is contained in:
c9s 2022-03-06 15:37:41 +08:00
parent 3a15738fec
commit f6ec2e78e6

View File

@ -571,7 +571,7 @@ func (environ *Environment) Sync(ctx context.Context, userConfig ...*Config) err
return nil return nil
} }
func (environ *Environment) RecordProfit(strategyID, strategyInstanceID string, profit types.Profit) { func (environ *Environment) RecordProfit(profit types.Profit) {
if environ.DatabaseService == nil { if environ.DatabaseService == nil {
return return
} }
@ -579,7 +579,9 @@ func (environ *Environment) RecordProfit(strategyID, strategyInstanceID string,
return return
} }
if err := environ.ProfitService.Insert(profit) ; err != nil {
log.WithError(err).Errorf("can not insert profit record: %+v", profit)
}
} }
func (environ *Environment) SyncSession(ctx context.Context, session *ExchangeSession, defaultSymbols ...string) error { func (environ *Environment) SyncSession(ctx context.Context, session *ExchangeSession, defaultSymbols ...string) error {