Open xmatthias opened 1 year ago
Hello @xmatthias, can you check the version of the endpoint used? (v3/v5)
v3 it seems
fetch Request: bybit GET https://api.bybit.com/user/v3/private/query-api?api_key=&recv_window=5000×tamp=1693491080590&sign=xxx RequestHeaders: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'} RequestBody: None
fetch Response: bybit GET https://api.bybit.com/user/v3/private/query-api?api_key=&recv_window=5000×tamp=1693491080590&sign=05497d5ec3f2e79bde30f3d5b905a5c44904ea25c7b3a8f713ab151be5752e66 200 ResponseHeaders: {'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '693', 'Connection': 'keep-alive', 'Date': 'Thu, 31 Aug 2023 14:11:20 GMT', 'X-Bapi-Limit': '10', 'X-Bapi-Limit-Status': '9', 'X-Bapi-Limit-Reset-Timestamp': '1693491080681', 'Ret_code': '0', 'Traceid': '430dbb9cc66bde4473add060d361c3e2', 'Timenow': '1693491080693', 'Server': 'Openresty', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 8a6f67a9421de326f43e9107751b580e.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'FRA56-P4', 'X-Amz-Cf-Id': 'oVOnmwnVwh2MvFFABJirrtJQW-=='} ResponseBody: {"retCode":0,"retMsg":"","result":{"id":"15075334","note":"FT_local","apiKey":"6RvMxqP1fTCyqX7voi","readOnly":0,"secret":"","permissions":{"ContractTrade":["Order","Position"],"Spot":["SpotTrade"],"Wallet":["SubMemberTransfer","AccountTransfer"],"Options":[],"Derivatives":["DerivativesTrade"],"CopyTrading":[],"BlockTrade":[],"Exchange":[],"NFT":[],"Affiliate":[]},"ips":["185.187.223.195"],"type":1,"deadlineDay":-2,"expiredAt":"1970-01-01T00:00:00Z","createdAt":"2022-12-05T19:24:07Z","unified":0,"uta":0,"userID":44846619,"inviterID":799875,"vipLevel":"No VIP","mktMakerLevel":"0","affiliateID":35953,"rsaPublicKey":"","isMaster":true,"parentUid":"0"},"retExtInfo":{},"time":1693491080693}
---------------------------------------------------------------------------
BadRequest Traceback (most recent call last)
Cell In[4], line 2
1 ct.verbose = True
----> 2 ct.fetch_orders('BTC/USDT:USDT', since=ct.milliseconds() - 86400000, params=None)
File [~/.pyenv/versions/3.11.4/envs/trade_3114/lib/python3.11/site-packages/ccxt/bybit.py:5202](https://file+.vscode-resource.vscode-cdn.net/home/xmatt/devel/cryptos/stuff/~/.pyenv/versions/3.11.4/envs/trade_3114/lib/python3.11/site-packages/ccxt/bybit.py:5202), in bybit.fetch_orders(self, symbol, since, limit, params)
5200 return self.fetch_unified_margin_orders(symbol, since, limit, query)
5201 else:
-> 5202 return self.fetch_derivatives_orders(symbol, since, limit, query)
File [~/.pyenv/versions/3.11.4/envs/trade_3114/lib/python3.11/site-packages/ccxt/bybit.py:5114](https://file+.vscode-resource.vscode-cdn.net/home/xmatt/devel/cryptos/stuff/~/.pyenv/versions/3.11.4/envs/trade_3114/lib/python3.11/site-packages/ccxt/bybit.py:5114), in bybit.fetch_derivatives_orders(self, symbol, since, limit, params)
5112 else:
5113 if since is not None:
-> 5114 raise BadRequest(self.id + ' fetchOrders() requires until/endTime when since is provided.')
5115 response = self.privateGetV5OrderHistory(self.extend(request, params))
5116 #
5117 # {
5118 # "retCode": 0,
(...)
5164 # }
5165 #
BadRequest: bybit fetchOrders() requires until/endTime when since is provided.
Retested with '4.0.101', same behavior, which is clear considering it's not even making a call to the exchange ...
---------------------------------------------------------------------------
BadRequest Traceback (most recent call last)
[/home/xmatt/devel/cryptos/stuff/ccxt_bybit.ipynb](https://file+.vscode-resource.vscode-cdn.net/home/xmatt/devel/cryptos/stuff/ccxt_bybit.ipynb) Cell 4 line 3
[1](vscode-notebook-cell:/home/xmatt/devel/cryptos/stuff/ccxt_bybit.ipynb#W3sZmlsZQ%3D%3D?line=0) ct.verbose = True
----> [3](vscode-notebook-cell:/home/xmatt/devel/cryptos/stuff/ccxt_bybit.ipynb#W3sZmlsZQ%3D%3D?line=2) ct.fetch_orders('BTC/USDT:USDT', since=ct.milliseconds() - 86400000, ) #params={'until':ct.milliseconds()})
File [~/.pyenv/versions/3.11.4/envs/trade_3114/lib/python3.11/site-packages/ccxt/bybit.py:4179](https://file+.vscode-resource.vscode-cdn.net/home/xmatt/devel/cryptos/stuff/~/.pyenv/versions/3.11.4/envs/trade_3114/lib/python3.11/site-packages/ccxt/bybit.py:4179), in bybit.fetch_orders(self, symbol, since, limit, params)
4177 else:
4178 if since is not None:
-> 4179 raise BadRequest(self.id + ' fetchOrders() requires until/endTime when since is provided.')
4180 response = self.privateGetV5OrderHistory(self.extend(request, params))
4181 #
4182 # {
4183 # "retCode": 0,
(...)
4229 # }
4230 #
BadRequest: bybit fetchOrders() requires until/endTime when since is provided.
Operating System
linux
Programming Languages
Python
CCXT Version
4.0.71
Description
when using bybit's
fetch_orders()
call, it requires the (non-default) "until / endDate" attribute to work correctly.While not necessarily a problem - i think this could be easily emulated by using "now" if it's not provided yet, making the call work identical to other exchanges (e.g. binance) - where no additional "until" argument is required.
Code
edit seems like the distance between start and end time can't exceed 7 days - which makes this a bit more difficult to emulate i guess it might be worth it to emulate if since is within the 7 day range - but otherwise, i guess it should be left to the user (though the docstring should include this as required argument).