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:
tinkle-community
2026-01-13 13:38:09 +08:00
parent 13189fa3aa
commit aa7aa94275
4 changed files with 31 additions and 9 deletions

View File

@@ -214,7 +214,7 @@ func (t *LighterTraderV2) GetActiveOrders(symbol string) ([]OrderResponse, error
endpoint := fmt.Sprintf("%s/api/v1/accountActiveOrders?account_index=%d&market_id=%d",
t.baseURL, t.accountIndex, marketIndex)
logger.Infof("📋 LIGHTER GetActiveOrders: endpoint=%s", endpoint)
logger.Debugf("📋 LIGHTER GetActiveOrders: endpoint=%s", endpoint)
// Send GET request
req, err := http.NewRequest("GET", endpoint, nil)
@@ -237,7 +237,7 @@ func (t *LighterTraderV2) GetActiveOrders(symbol string) ([]OrderResponse, error
return nil, fmt.Errorf("failed to read response: %w", err)
}
logger.Infof("📋 LIGHTER GetActiveOrders raw response: %s", string(body))
logger.Debugf("📋 LIGHTER GetActiveOrders raw response: %s", string(body))
// Parse response - Lighter API uses "orders" field, not "data"
var apiResp struct {