feat: add exchange_id field to trader_positions table

- Add exchange_id column to track which exchange the position is from
- Update all SELECT/INSERT queries to include exchange_id
- Set exchange_id when creating position record in AutoTrader
- Add migration to add column to existing tables
This commit is contained in:
tinkle-community
2025-12-06 01:35:26 +08:00
parent f116d80cda
commit afb2d158ac
2 changed files with 16 additions and 9 deletions

View File

@@ -1548,6 +1548,7 @@ func (at *AutoTrader) recordPositionChange(orderID, symbol, side, action string,
// 开仓:创建新的仓位记录
pos := &store.TraderPosition{
TraderID: at.id,
ExchangeID: at.exchange, // 记录具体的交易所ID
Symbol: symbol,
Side: side, // LONG or SHORT
Quantity: quantity,