python-binance
python-binance copied to clipboard
APIError(code=0): Invalid JSON error message from Binance:
Note that this is my first python program and my first post on github. The code used to work fine, all of the sudden it doesnt work anymore. It could be due to the things that are going on with binance and options, just want to make sure that it is not something I overlooked.
Code used to run fine, now suddenly returns " APIError(code=0): Invalid JSON error message from Binance:"
To Reproduce
from binance.client import Client
from binance.exceptions import BinanceAPIException
import bin_config
client = Client(bin_config.apikey, bin_config.apiSecurity)
OptionsInfo = client.options_info()
for s in OptionsInfo['data']:
instrument_name = client.options_order_book(symbol=s['symbol'])
#print(s['symbol'])
Expected behavior Should return order book
Environment (please complete the following information):
- Python version: [e.g. 3.5]: 3.7.4
- Virtual Env: [e.g. virtualenv, conda]:
- OS: Windows
- python-binance version: (1.0.12)
Logs or Additional context binance.exceptions.BinanceAPIException: APIError(code=0): Invalid JSON error message from Binance:
I'm getting this error when sending
params={
'symbol': SYMBOL_TO_TRADE,
'side': tp_sl_side,
'quantity': str(quantity),
'price': str(tp_price),
'stopPrice': str(tp_stop_price),
'stopLimitPrice': str(sl_price),
'stopLimitTimeInForce':'GTC',
'isIsolated': isIsolated,
'sideEffectType': 'MARGIN_BUY'
}
oco_order = cls.client._post('margin/order/oco', True, data=params)
Did you find a solution?
Traceback (most recent call last):
File "/Users/harshdeep.sangwan/PycharmProjects/pythonProject1/binance futures.py", line 264, in I'm getting this error
.venv/lib/python3.10/site-packages/binance/client.py", line 368, in _handle_response raise BinanceAPIException(response, response.status_code, response.text) binance.exceptions.BinanceAPIException: APIError(code=0): Invalid JSON error message from Binance: