FTX fetch_open_orders and fetch_orders don't fetch trigger orders
See original GitHub issue- OS: Windows
- Programming Language version: Python
- CCXT version: 1.41.82
I set up a test account and opened three orders: A low limit buy, a market stop loss and a trailing stop loss order - of those three only the limit order gets returned by fetch_orders
and fetch_open_orders
.
This is not the correct behavior according to #6669 (see https://github.com/ccxt/ccxt/issues/6669#issuecomment-603703325) and apparently has been fixed/implemented there - it seems to be broken again (or I am just dumb, which is always an option)
exchange = ccxt.ftx()
exchange.apiKey = "<key>"
exchange.secret = "<secret>"
exchange.headers = {'FTX-SUBACCOUNT': "<mysubaccount>", }
pp(exchange.fetch_orders('BULL/USD'))
pp(exchange.fetch_open_orders('BULL/USD'))
EDIT:
cancel_all_orders
also does NOT cancel trigger orders. Seems to be a bug in this piece of code:
def cancel_all_orders(self, symbol=None, params={}):
self.load_markets()
conditionalOrdersOnly = self.safe_value(params, 'conditionalOrdersOnly')
request = {
# 'market': market['id'], # optional
# 'conditionalOrdersOnly': False, # cancel conditional orders only
# 'limitOrdersOnly': False, # cancel existing limit orders(non-conditional orders) only
}
if conditionalOrdersOnly:
request['conditionalOrdersOnly'] = conditionalOrdersOnly
else:
request['limitOrdersOnly'] = True
request['limitOrdersOnly']
in the last line should probably NOT be set to true just because conditionalOrdersOnly
is not set to true.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
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 >Advanced Order Types - FTX.US
These orders do not enter the order-book until the market price reaches a trigger price, at which point they are sent as orders...
Read more >python/ccxt/async_support/ftx.py - searchcode
1# -*- coding: utf-8 -*- 2 3# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED ... 58 'fetchOHLCV': True, 59 'fetchOpenOrders': True,...
Read more >ccxt-dev/ccxt - Gitter
the corresponding unified method would be fetchOrder. or fetchOpenOrders ← if you have seen your order here and don't see it here anymore,...
Read more >python - Get Executed Orders with CCXT - FTX - Stack Overflow
I wonder if there is a way to get notified when an order is executed by using the CCXT with FTX Exchange. I've...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I checked that, and while the former (“FTX cannot return both the regular orders and the stop orders at the same time”) seems to be true, the latter (“The same goes to canceling them.”) does not seem to be the case.
I tested it with the vanilla FTX-API and their endpoint cancelled all my orders for all markets. Here is some code with the vanilla FTX-API that calls all three endpoints. I created a limit order and a trailing stop order for this.
It would probably be a good idea to add a comment about the special behavior of the
fetch_open_orders
andfetch_orders
method inftx.py
- I would have honestly expected for ccxt to just make 2 API calls and merge the result, since https://github.com/ccxt/ccxt/wiki/Manual#all-orders says “Some exchanges don’t have an endpoint for fetching all orders, ccxt will emulate it where possible”. I guess that’s problematic in terms of API call counting to not run into rate limiting?Thanks for the reply though - at least I now know how to fetch all orders (make 2 calls and merge them manually). I need this to first get all open orders, then make a new trailing stop order for the amount I already have plus the amount I plan to buy, then make a market buy order for the amount I want to buy and finally delete all the orders i first fetched - I think that’s the safest way to make buying failsafe (In case a failure occurs at any point I am not ending up with bought currency without a stop order).
Thanks for your help again!
@kroitor Also, when I try to use the
fetchAllOrders
with theprivateGetConditionalOrders
method on FTX Futures, I get an empty list as return (btw, the stop order went through).Code: