mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
bbgo: document strategy id and pnl field
This commit is contained in:
parent
cde75eee89
commit
1c1fbb1633
|
@ -474,6 +474,8 @@ func (environ *Environment) BindSync(config *SyncConfig) {
|
||||||
trade.IsIsolated = session.IsolatedFutures
|
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 {
|
if err := environ.TradeService.Insert(trade); err != nil {
|
||||||
log.WithError(err).Errorf("trade insert error: %+v", trade)
|
log.WithError(err).Errorf("trade insert error: %+v", trade)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,12 @@ type Trade struct {
|
||||||
IsFutures bool `json:"isFutures" db:"is_futures"`
|
IsFutures bool `json:"isFutures" db:"is_futures"`
|
||||||
IsIsolated bool `json:"isIsolated" db:"is_isolated"`
|
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"`
|
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"`
|
PnL sql.NullFloat64 `json:"pnl" db:"pnl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user