ccxt: Binance COIN-M futures fetchPositions() raises KeyError: 'precision'
fetchPositions() on Binance COIN-M futures raises KeyError: ‘precision’, could not reproduce this error with a fresh application but an older running instance produce this error always. Issue might be related to the changes for #11123 .
- OS: Ubuntu 20.04.3
- Programming Language version: Python 3.8.10
- CCXT version: 1.66.23
exchange_id = 'binance'
exchange_class = getattr(ccxt, exchange_id)
options['defaultType'] = 'delivery'
binancecoinm = exchange_class({
'apiKey': 'apikey',
'secret': 'secret',
'enableRateLimit': True
'options': options,
})
position = binancecoinm.fetchPositions()
Exception happened during processing of request from ('myip', myport)
Traceback (most recent call last):
File "/usr/lib/python3.8/socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.8/socketserver.py", line 747, in __init__
self.handle()
File "/usr/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "server.py", line 67, in do_POST
strategist.webhook_signal_analyzer(request_data)
File "/home/ubuntu/Bot/strategist.py", line 56, in webhook_signal_analyzer
position = binancecoinm.fetchPositions()
File "/home/ubuntu/.local/lib/python3.8/site-packages/ccxt/binance.py", line 4486, in fetch_positions
return self.fetch_positions_risk(symbols, params)
File "/home/ubuntu/.local/lib/python3.8/site-packages/ccxt/binance.py", line 4587, in fetch_positions_risk
parsed = self.parse_position_risk(response[i])
File "/home/ubuntu/.local/lib/python3.8/site-packages/ccxt/binance.py", line 4387, in parse_position_risk
collateralString = Precise.string_div(Precise.string_mul(leftSide, contractsAbs), '1', market['precision']['quote'])
KeyError: 'precision'
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
Verbose output for error for USD-M trading. @aidanjbailey it happens without serverload too, maybe expired contracts for delivery futures could be the reason because i only see this error after running the instance for days.
@kasimsuzen I cannot reproduce it with CCXT 1.72.79+, let us know if you have this issue with the most recent version of CCXT. Feel free to reopen it or just ask further questions if any: