refactor: 逐批次实时写入DB,删除persistTrade
This commit is contained in:
+4
-4
@@ -85,13 +85,13 @@ func (d *DB) SaveTrade(t *TradeRecord) (int64, error) {
|
||||
func (d *DB) UpdateTradeStatus(id int64, t *TradeRecord) error {
|
||||
_, err := d.Exec(`UPDATE trades SET
|
||||
status=?, exit_spread=?, long_exit=?, short_exit=?,
|
||||
long_pnl=?, short_pnl=?, net_pnl=?,
|
||||
scale_count=?, exit_reason=?, convergence=?, closed_at=?
|
||||
long_pnl=?, short_pnl=?, fee_entry=?, fee_exit=?, net_pnl=?,
|
||||
amount_usd=?, scale_count=?, exit_reason=?, convergence=?, closed_at=?
|
||||
WHERE id=?`,
|
||||
t.Status, t.ExitSpread,
|
||||
t.LongExit, t.ShortExit,
|
||||
t.LongPnl, t.ShortPnl, t.NetPnl,
|
||||
t.ScaleCount, t.ExitReason, t.Convergence, t.ClosedAt,
|
||||
t.LongPnl, t.ShortPnl, t.FeeEntry, t.FeeExit, t.NetPnl,
|
||||
t.AmountUSD, t.ScaleCount, t.ExitReason, t.Convergence, t.ClosedAt,
|
||||
id,
|
||||
)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user