Giter Club home page Giter Club logo

Comments (3)

ivanyyw avatar ivanyyw commented on July 18, 2024 1

I used to get this APIError(code=-2013): Order does not exist. error and it causes the whole script run into infinite loop "Failed to Buy/Sell. Trying Again."

I wonder is there a better way to catch this API error code and re-try to check after "seconds" and continue script.. Since Binance might takes longer time to get update the order id..

from binance-trade-bot.

ivanyyw avatar ivanyyw commented on July 18, 2024 1

I used to get this APIError(code=-2013): Order does not exist. error and it causes the whole script run into infinite loop "Failed to Buy/Sell. Trying Again."
I wonder is there a better way to catch this API error code and re-try to check after "seconds" and continue script.. Since Binance might takes longer time to get update the order id..

In theory that was the fix applied for #9, but the issue still persists

I found a way to eliminate this issue, but i'm not sure whether its best approach.
I noticed the triggering happen whenever client.get_order() calling.

If the binance server was slow updating the order id, the API return with -2013 error.
By normal, this exception was caught in exceptions.py and returned to crypto_trading.py with Trying loop.

By using the same exceptions.py to be intercept at our code:

from binance.exceptions import BinanceAPIException

try:
     stat = client.get_order(symbol=alt_symbol+crypto_symbol, orderId=order[u'orderId'])
except BinanceAPIException as e:
     logger.info(e)
     time.sleep(10)

If API returns with APIError(code=-2013): it will sleep for 10 before trying get_order again.

Hope it helps!

from binance-trade-bot.

nfacha avatar nfacha commented on July 18, 2024

I used to get this APIError(code=-2013): Order does not exist. error and it causes the whole script run into infinite loop "Failed to Buy/Sell. Trying Again."

I wonder is there a better way to catch this API error code and re-try to check after "seconds" and continue script.. Since Binance might takes longer time to get update the order id..

In theory that was the fix applied for #9, but the issue still persists

from binance-trade-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.