python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

APIError(code=0): Invalid JSON error message from Binance:

Open countblackjack opened this issue 3 years ago • 3 comments

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:

Binance

countblackjack avatar Jul 15 '21 21:07 countblackjack

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?

Karlheinzniebuhr avatar Jul 15 '22 21:07 Karlheinzniebuhr

Traceback (most recent call last): File "/Users/harshdeep.sangwan/PycharmProjects/pythonProject1/binance futures.py", line 264, in y = client.futures_position_information(symbol=symbol) File "/opt/anaconda3/lib/python3.9/site-packages/binance/client.py", line 5417, in futures_position_information return self._request_futures_api('get', 'positionRisk', True, data=params) File "/opt/anaconda3/lib/python3.9/site-packages/binance/client.py", line 339, in _request_futures_api return self._request(method, uri, signed, True, **kwargs) File "/opt/anaconda3/lib/python3.9/site-packages/binance/client.py", line 315, in _request return self._handle_response(self.response) File "/opt/anaconda3/lib/python3.9/site-packages/binance/client.py", line 324, in _handle_response raise BinanceAPIException(response, response.status_code, response.text) binance.exceptions.BinanceAPIException: APIError(code=0): Invalid JSON error message from Binance: Binance

出错啦!您访问的网页不存在。

Sorry! The page you’re looking for cannot be found.

I'm getting this error

harsh-sangwan avatar Aug 04 '23 09:08 harsh-sangwan

.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:

502 Bad Gateway

502 Bad Gateway


nginx

Acutapugione avatar Nov 01 '23 11:11 Acutapugione