question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ccxt.base.errors.ExchangeNotAvailable: binance {"code":-1001,"msg":"Internal error; unable to process your request. Please try again."}

See original GitHub issue

-OS: Windows -Programming Language version: Python 3.10 -CCXT version: 1.77.62

Hello

I received below error while my script is trying to open short position with create_market_sell_order

Why did i receive this error? (ccxt.base.errors.ExchangeNotAvailable: binance {“code”:-1001,“msg”:“Internal error; unable to process your request. Please try again.”}) Thank you

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/ccxt/base/exchange.py", line 655, in fetch
    response.raise_for_status()
  File "/opt/conda/lib/python3.7/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://fapi.binance.com/fapi/v1/order

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ETH_5_30_post10_T4_Au.py", line 344, in <module>
    exchange_f.create_market_sell_order(coin, np.sum(buy_short_1))
  File "/opt/conda/lib/python3.7/site-packages/ccxt/base/exchange.py", line 2398, in create_market_sell_order
    return self.create_order(symbol, 'market', 'sell', amount, None, params)
  File "/opt/conda/lib/python3.7/site-packages/ccxt/binance.py", line 2788, in create_order
    response = getattr(self, method)(self.extend(request, params))
  File "/opt/conda/lib/python3.7/site-packages/ccxt/base/exchange.py", line 495, in inner
    return entry(_self, **inner_kwargs)
  File "/opt/conda/lib/python3.7/site-packages/ccxt/binance.py", line 5070, in request
    response = self.fetch2(path, api, method, params, headers, body, config, context)
  File "/opt/conda/lib/python3.7/site-packages/ccxt/base/exchange.py", line 542, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "/opt/conda/lib/python3.7/site-packages/ccxt/base/exchange.py", line 671, in fetch
    skip_further_error_handling = self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
  File "/opt/conda/lib/python3.7/site-packages/ccxt/binance.py", line 5048, in handle_errors
    self.throw_exactly_matched_exception(self.exceptions['exact'], error, feedback)
  File "/opt/conda/lib/python3.7/site-packages/ccxt/base/exchange.py", line 560, in throw_exactly_matched_exception
    raise exact[string](message)
ccxt.base.errors.ExchangeNotAvailable: binance {"code":-1001,"msg":"Internal error; unable to process your request. Please try again."}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kroitorcommented, Jun 10, 2022

@euphrates85 just make a retry loop or add some handling – what your program should do in case of a networking error or in case of an error on the exchange side. There will be errors, you can’t avoid them, so you have to catch/intercept them and add your handling to exceptional situations. This is how all APIs work.

A basic example:

max_attempts = 3
for i in range(0, max_attempts):
    try:
         order = exchange.create_order(...)
         break
     except Exception as e:
         print(type(e).__name__, str(e))
0reactions
euphrates85commented, Jun 16, 2022

Sorry for taking your time again but one more question i have. I also received “ConnectionResetError: [Errno 104] Connection reset by peer” error. Does your answer to try several times solve this error as well? I am asking because here they said that i have to reinitialize binance client object. Again thank you in advance for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ccxt/binance.py at master - GitHub
from ccxt.base.errors import ExchangeNotAvailable ... Please try again later. ... {"code":-1001,"msg":"'Internal error; unable to process your request.
Read more >
Why do I get this Python script execution error? - ccxt binance ...
It is a strange phenomenon. The code works normally on Windows (PC), but an error message occurs in Google Cloud as well as...
Read more >
freqtrade.exceptions.operationalexception: could not load ...
InvalidNonce: binance {"code":-1021,"msg":"Timestamp for this request is outside of the recvWindow."} 2022-01-12 10:10:40,578 - freqtrade.commands.
Read more >
python/ccxt/binance.py - searchcode
484 '-1001': ExchangeNotAvailable, # 'Internal error; unable to process your request. Please try again.' 485 '-1002': AuthenticationError, # 'You are not ...
Read more >
Exchanges — ccxt 2.4.71 documentation
The CCXT library currently supports the following 104 cryptocurrency exchange markets and trading APIs: Besides making basic market and limit orders, some ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found