refactor: 逐批次实时写入DB,删除persistTrade

This commit is contained in:
jackyu66git
2026-05-04 05:29:04 +08:00
parent ec725ed11a
commit a9a21de5a2
2 changed files with 219 additions and 205 deletions
+4 -4
View File
@@ -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