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.

bittrex fetch_open_orders returning incorrect None on retry after DDoSProtection error

See original GitHub issue

ATTENTION!!!

MUST READ THIS BEFORE SUBMITTING ISSUES (read the link, then delete this message before submitting):

https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue

  • OS: Windows 10
  • Programming Language version: Python 3.6.3
  • CCXT version: ‘1.18.458’
  • Exchange: bittrex
  • Method: fetch_open_orders

I had two processes running side by side that got throttled. I have them on a 60 second sleep before restart. Other requests such as cancel_order, request_order have no problems restarting. However, fetch_open_orders somehow always retrieves None on the retry call. Meanwhile, I have other trades open so the result should not be None(I get this bug repeatedly). Here is the output:

Placing an order on PART/BTC for these parameters: sell, closing, 166.0 units at price 0.00037268

bittrex.fetch_open_orders failed with exception DDoSProtection:  bittrex {"success":false,"message":"Call to GetOpenOrders was throttled. Try again in 60 seconds.","result":null}
Traceback (most recent call last):
...
  File "C:\Users\nt\Documents\Bots\RobotZai2-2c.py", line 311, in run_fighter
    self.create_order(trade, current_best_entry)
  File "C:\Users\nt\Documents\Bots\RobotZai2-2c.py", line 281, in create_order
    trade.trade_update('id')
  File "C:\Users\nt\Documents\Bots\RobotZai2-2c.py", line 522, in trade_update
    open_orders.reverse()
AttributeError: 'NoneType' object has no attribute 'reverse'

Here is the code


def api_call(message, *args):
    response = eval(message)(*args)
    except ccxt.OrderNotFound as e:     #Typically get this one when order was filled on exchange side between calls
        print(message + ' failed with exception OrderNotFound: ', str(e))
        return 'OrderNotFound'
    except ccxt.RequestTimeout as e:
        print(message + ' failed with exception RequestTimeout: ', str(e))
        time.sleep(1)
        bittrex.rateLimit = (bittrex.rateLimit * 2)
        api_call(message, *args)
    except ccxt.DDoSProtection as e:
        print(message + ' failed with exception DDoSProtection: ', str(e))
        time.sleep(bittrex.throttleDelay)
        bittrex.rateLimit = (bittrex.rateLimit * 2)
        api_call(message, *args)
    except Exception as e:
        print(message + ' failed with exception General: ', str(e))
        sys.exit()
    else:
        return response      

#Called from here when getting the order_id for a new order
open_orders = api_call('bittrex.fetch_open_orders')
open_orders.reverse()

I’m sorry, I can’t figure out how to properly indent here…I added a photo of the code in case it is unclear. I would appreciate help with this issue, thank you. image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
IgorMBorushekcommented, Jun 15, 2019

I see what my problem was, fixed it, thank you very much!

0reactions
kroitorcommented, Jun 18, 2019

By the way, I think binding response to the result is a no go because unless I’m mistaken, if there is an exception in the recursive call, response won’t be bound. So I implemented it like this:

That was exactly the version i posted here initially, but then I edited it for your case with response )) You’re absolutely right )

Read more comments on GitHub >

github_iconTop Results From Across the Web

using Bittrex - DDoSProtection error · Issue #2038 - GitHub
When I run freqtrade with bittrex I get a bunch of html code as output. Examples include. It's much to large to replicate...
Read more >
ccxt Documentation - Read the Docs
The ccxt library currently supports the following 115 cryptocurrency exchange markets and trading APIs: id name ver doc countries. _1broker.
Read more >
Troubleshooting common error codes - Bittrex Support
Some common error codes you might run across are described in the table below with some troubleshooting tips for how to solve the...
Read more >
Site Status - Bittrex
This page displays status information for Bittrex's wallets and markets, updated on a 5-minute interval. If you are experiencing a problem that is...
Read more >
Bittrex Developers
See the error code and response data for more details. 401 - Unauthorized, The request failed to authenticate (example: a valid api key...
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