Fix KeyError for prefixed coins in historical candle fetch
Bypass SDK's name_to_coin lookup in candles_snapshot by calling http_info.post directly with the raw coin name. This fixes KeyError for symbols like xyz:GOLD, xyz:CL, mkts:USTECH that aren't in the name_to_coin dictionary. The WebSocket subscription already bypassed this lookup (line 154), but the historical fetch path did not.
This commit is contained in:
@ -162,7 +162,8 @@ class CandleFetcher:
|
||||
max_retries = 3
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
return self.info.candles_snapshot(coin, self.interval, start_ms, end_ms)
|
||||
req = {"coin": coin, "interval": self.interval, "startTime": start_ms, "endTime": end_ms}
|
||||
return self.info.post("/info", {"type": "candleSnapshot", "req": req})
|
||||
except ClientError as e:
|
||||
if e.status_code == 429 and attempt < max_retries - 1:
|
||||
logging.warning("Rate limited. Retrying in 2 seconds...")
|
||||
|
||||
Reference in New Issue
Block a user