bbgo: document strategy id and pnl field

This commit is contained in:
c9s 2022-04-27 13:30:07 +08:00
parent cde75eee89
commit 1c1fbb1633
No known key found for this signature in database
GPG Key ID: F0A7E4490F2EBC8C
2 changed files with 7 additions and 0 deletions

View File

@ -474,6 +474,8 @@ func (environ *Environment) BindSync(config *SyncConfig) {
trade.IsIsolated = session.IsolatedFutures
}
// The StrategyID field and the PnL field needs to be updated by the strategy.
// trade.StrategyID, trade.PnL
if err := environ.TradeService.Insert(trade); err != nil {
log.WithError(err).Errorf("trade insert error: %+v", trade)
}

View File

@ -71,7 +71,12 @@ type Trade struct {
IsFutures bool `json:"isFutures" db:"is_futures"`
IsIsolated bool `json:"isIsolated" db:"is_isolated"`
// The following fields are null-able fields
// StrategyID is the strategy that execute this trade
StrategyID sql.NullString `json:"strategyID" db:"strategy"`
// PnL is the profit and loss value of the executed trade
PnL sql.NullFloat64 `json:"pnl" db:"pnl"`
}