mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-18 01:44:38 +08:00
fix: address code review issues for GetOpenOrders
- Add error logging for OKX/Bitget API failures (was silently swallowed) - Fix Lighter position side logic to handle reduce-only orders - Change verbose debug logs from Infof to Debugf level
This commit is contained in:
@@ -713,10 +713,20 @@ func (t *LighterTraderV2) GetOpenOrders(symbol string) ([]OpenOrder, error) {
|
||||
orderType = "TAKE_PROFIT_MARKET"
|
||||
}
|
||||
|
||||
// Determine position side based on order direction
|
||||
// Determine position side based on order direction and reduce-only flag
|
||||
positionSide := "LONG"
|
||||
if side == "SELL" {
|
||||
positionSide = "SHORT"
|
||||
if order.ReduceOnly {
|
||||
// For reduce-only orders, position side is opposite to order side
|
||||
if side == "BUY" {
|
||||
positionSide = "SHORT" // Buying to close short
|
||||
} else {
|
||||
positionSide = "LONG" // Selling to close long
|
||||
}
|
||||
} else {
|
||||
// For opening orders
|
||||
if side == "SELL" {
|
||||
positionSide = "SHORT"
|
||||
}
|
||||
}
|
||||
|
||||
// Parse price and quantity from string fields
|
||||
|
||||
Reference in New Issue
Block a user