ccxt 4.2.36__py2.py3-none-any.whl → 4.2.37__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +1 -1
- ccxt/abstract/bitfinex2.py +122 -122
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +122 -55
- ccxt/async_support/bitfinex2.py +122 -122
- ccxt/async_support/bitmex.py +22 -3
- ccxt/async_support/bybit.py +11 -4
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +122 -55
- ccxt/bitfinex2.py +122 -122
- ccxt/bitmex.py +22 -3
- ccxt/bybit.py +11 -4
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/gemini.py +165 -3
- ccxt/test/test_async.py +8 -6
- ccxt/test/test_sync.py +8 -6
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/METADATA +6 -6
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/RECORD +21 -21
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/WHEEL +0 -0
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/top_level.txt +0 -0
ccxt/bitfinex2.py
CHANGED
@@ -153,149 +153,149 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
153
153
|
'api': {
|
154
154
|
'public': {
|
155
155
|
'get': {
|
156
|
-
'conf/{config}': 2.
|
157
|
-
'conf/pub:{action}:{object}': 2.
|
158
|
-
'conf/pub:{action}:{object}:{detail}': 2.
|
159
|
-
'conf/pub:map:{object}': 2.
|
160
|
-
'conf/pub:map:{object}:{detail}': 2.
|
161
|
-
'conf/pub:map:currency:{detail}': 2.
|
162
|
-
'conf/pub:map:currency:sym': 2.
|
163
|
-
'conf/pub:map:currency:label': 2.
|
164
|
-
'conf/pub:map:currency:unit': 2.
|
165
|
-
'conf/pub:map:currency:undl': 2.
|
166
|
-
'conf/pub:map:currency:pool': 2.
|
167
|
-
'conf/pub:map:currency:explorer': 2.
|
168
|
-
'conf/pub:map:currency:tx:fee': 2.
|
169
|
-
'conf/pub:map:tx:method': 2.
|
170
|
-
'conf/pub:list:{object}': 2.
|
171
|
-
'conf/pub:list:{object}:{detail}': 2.
|
172
|
-
'conf/pub:list:currency': 2.
|
173
|
-
'conf/pub:list:pair:exchange': 2.
|
174
|
-
'conf/pub:list:pair:margin': 2.
|
175
|
-
'conf/pub:list:pair:futures': 2.
|
176
|
-
'conf/pub:list:competitions': 2.
|
177
|
-
'conf/pub:info:{object}': 2.
|
178
|
-
'conf/pub:info:{object}:{detail}': 2.
|
179
|
-
'conf/pub:info:pair': 2.
|
180
|
-
'conf/pub:info:pair:futures': 2.
|
181
|
-
'conf/pub:info:tx:status': 2.
|
182
|
-
'conf/pub:fees': 2.
|
156
|
+
'conf/{config}': 2.7, # 90 requests a minute, 90/60 = 1.5, 1000 / (250 * 2.66) = 1.503, use 2.7 instead of 2.66 to ensure rateLimitExceeded is not triggered
|
157
|
+
'conf/pub:{action}:{object}': 2.7,
|
158
|
+
'conf/pub:{action}:{object}:{detail}': 2.7,
|
159
|
+
'conf/pub:map:{object}': 2.7,
|
160
|
+
'conf/pub:map:{object}:{detail}': 2.7,
|
161
|
+
'conf/pub:map:currency:{detail}': 2.7,
|
162
|
+
'conf/pub:map:currency:sym': 2.7, # maps symbols to their API symbols, BAB > BCH
|
163
|
+
'conf/pub:map:currency:label': 2.7, # verbose friendly names, BNT > Bancor
|
164
|
+
'conf/pub:map:currency:unit': 2.7, # maps symbols to unit of measure where applicable
|
165
|
+
'conf/pub:map:currency:undl': 2.7, # maps derivatives symbols to their underlying currency
|
166
|
+
'conf/pub:map:currency:pool': 2.7, # maps symbols to underlying network/protocol they operate on
|
167
|
+
'conf/pub:map:currency:explorer': 2.7, # maps symbols to their recognised block explorer URLs
|
168
|
+
'conf/pub:map:currency:tx:fee': 2.7, # maps currencies to their withdrawal fees https://github.com/ccxt/ccxt/issues/7745
|
169
|
+
'conf/pub:map:tx:method': 2.7,
|
170
|
+
'conf/pub:list:{object}': 2.7,
|
171
|
+
'conf/pub:list:{object}:{detail}': 2.7,
|
172
|
+
'conf/pub:list:currency': 2.7,
|
173
|
+
'conf/pub:list:pair:exchange': 2.7,
|
174
|
+
'conf/pub:list:pair:margin': 2.7,
|
175
|
+
'conf/pub:list:pair:futures': 2.7,
|
176
|
+
'conf/pub:list:competitions': 2.7,
|
177
|
+
'conf/pub:info:{object}': 2.7,
|
178
|
+
'conf/pub:info:{object}:{detail}': 2.7,
|
179
|
+
'conf/pub:info:pair': 2.7,
|
180
|
+
'conf/pub:info:pair:futures': 2.7,
|
181
|
+
'conf/pub:info:tx:status': 2.7, # [deposit, withdrawal] statuses 1 = active, 0 = maintenance
|
182
|
+
'conf/pub:fees': 2.7,
|
183
183
|
'platform/status': 8, # 30 requests per minute = 0.5 requests per second =>( 1000ms / rateLimit ) / 0.5 = 8
|
184
|
-
'tickers': 2.
|
185
|
-
'ticker/{symbol}': 2.
|
186
|
-
'tickers/hist': 2.
|
187
|
-
'trades/{symbol}/hist': 2.
|
184
|
+
'tickers': 2.7, # 90 requests a minute = 1.5 requests per second =>( 1000 / rateLimit ) / 1.5 = 2.666666666
|
185
|
+
'ticker/{symbol}': 2.7,
|
186
|
+
'tickers/hist': 2.7,
|
187
|
+
'trades/{symbol}/hist': 2.7,
|
188
188
|
'book/{symbol}/{precision}': 1, # 240 requests a minute
|
189
189
|
'book/{symbol}/P0': 1,
|
190
190
|
'book/{symbol}/P1': 1,
|
191
191
|
'book/{symbol}/P2': 1,
|
192
192
|
'book/{symbol}/P3': 1,
|
193
193
|
'book/{symbol}/R0': 1,
|
194
|
-
'stats1/{key}:{size}:{symbol}:{side}/{section}': 2.
|
195
|
-
'stats1/{key}:{size}:{symbol}:{side}/last': 2.
|
196
|
-
'stats1/{key}:{size}:{symbol}:{side}/hist': 2.
|
197
|
-
'stats1/{key}:{size}:{symbol}/{section}': 2.
|
198
|
-
'stats1/{key}:{size}:{symbol}/last': 2.
|
199
|
-
'stats1/{key}:{size}:{symbol}/hist': 2.
|
200
|
-
'stats1/{key}:{size}:{symbol}:long/last': 2.
|
201
|
-
'stats1/{key}:{size}:{symbol}:long/hist': 2.
|
202
|
-
'stats1/{key}:{size}:{symbol}:short/last': 2.
|
203
|
-
'stats1/{key}:{size}:{symbol}:short/hist': 2.
|
204
|
-
'candles/trade:{timeframe}:{symbol}:{period}/{section}': 2.
|
205
|
-
'candles/trade:{timeframe}:{symbol}/{section}': 2.
|
206
|
-
'candles/trade:{timeframe}:{symbol}/last': 2.
|
207
|
-
'candles/trade:{timeframe}:{symbol}/hist': 2.
|
208
|
-
'status/{type}': 2.
|
209
|
-
'status/deriv': 2.
|
210
|
-
'status/deriv/{symbol}/hist': 2.
|
194
|
+
'stats1/{key}:{size}:{symbol}:{side}/{section}': 2.7,
|
195
|
+
'stats1/{key}:{size}:{symbol}:{side}/last': 2.7,
|
196
|
+
'stats1/{key}:{size}:{symbol}:{side}/hist': 2.7,
|
197
|
+
'stats1/{key}:{size}:{symbol}/{section}': 2.7,
|
198
|
+
'stats1/{key}:{size}:{symbol}/last': 2.7,
|
199
|
+
'stats1/{key}:{size}:{symbol}/hist': 2.7,
|
200
|
+
'stats1/{key}:{size}:{symbol}:long/last': 2.7,
|
201
|
+
'stats1/{key}:{size}:{symbol}:long/hist': 2.7,
|
202
|
+
'stats1/{key}:{size}:{symbol}:short/last': 2.7,
|
203
|
+
'stats1/{key}:{size}:{symbol}:short/hist': 2.7,
|
204
|
+
'candles/trade:{timeframe}:{symbol}:{period}/{section}': 2.7,
|
205
|
+
'candles/trade:{timeframe}:{symbol}/{section}': 2.7,
|
206
|
+
'candles/trade:{timeframe}:{symbol}/last': 2.7,
|
207
|
+
'candles/trade:{timeframe}:{symbol}/hist': 2.7,
|
208
|
+
'status/{type}': 2.7,
|
209
|
+
'status/deriv': 2.7,
|
210
|
+
'status/deriv/{symbol}/hist': 2.7,
|
211
211
|
'liquidations/hist': 80, # 3 requests a minute = 0.05 requests a second =>( 1000ms / rateLimit ) / 0.05 = 80
|
212
|
-
'rankings/{key}:{timeframe}:{symbol}/{section}': 2.
|
213
|
-
'rankings/{key}:{timeframe}:{symbol}/hist': 2.
|
214
|
-
'pulse/hist': 2.
|
215
|
-
'pulse/profile/{nickname}': 2.
|
212
|
+
'rankings/{key}:{timeframe}:{symbol}/{section}': 2.7,
|
213
|
+
'rankings/{key}:{timeframe}:{symbol}/hist': 2.7,
|
214
|
+
'pulse/hist': 2.7,
|
215
|
+
'pulse/profile/{nickname}': 2.7,
|
216
216
|
'funding/stats/{symbol}/hist': 10, # ratelimit not in docs
|
217
217
|
},
|
218
218
|
'post': {
|
219
|
-
'calc/trade/avg': 2.
|
220
|
-
'calc/fx': 2.
|
219
|
+
'calc/trade/avg': 2.7,
|
220
|
+
'calc/fx': 2.7,
|
221
221
|
},
|
222
222
|
},
|
223
223
|
'private': {
|
224
224
|
'post': {
|
225
225
|
# 'auth/r/orders/{symbol}/new', # outdated
|
226
226
|
# 'auth/r/stats/perf:{timeframe}/hist', # outdated
|
227
|
-
'auth/r/wallets': 2.
|
228
|
-
'auth/r/wallets/hist': 2.
|
229
|
-
'auth/r/orders': 2.
|
230
|
-
'auth/r/orders/{symbol}': 2.
|
231
|
-
'auth/w/order/submit': 2.
|
232
|
-
'auth/w/order/update': 2.
|
233
|
-
'auth/w/order/cancel': 2.
|
234
|
-
'auth/w/order/multi': 2.
|
235
|
-
'auth/w/order/cancel/multi': 2.
|
236
|
-
'auth/r/orders/{symbol}/hist': 2.
|
237
|
-
'auth/r/orders/hist': 2.
|
238
|
-
'auth/r/order/{symbol}:{id}/trades': 2.
|
239
|
-
'auth/r/trades/{symbol}/hist': 2.
|
240
|
-
'auth/r/trades/hist': 2.
|
241
|
-
'auth/r/ledgers/{currency}/hist': 2.
|
242
|
-
'auth/r/ledgers/hist': 2.
|
243
|
-
'auth/r/info/margin/{key}': 2.
|
244
|
-
'auth/r/info/margin/base': 2.
|
245
|
-
'auth/r/info/margin/sym_all': 2.
|
246
|
-
'auth/r/positions': 2.
|
247
|
-
'auth/w/position/claim': 2.
|
248
|
-
'auth/w/position/increase:': 2.
|
249
|
-
'auth/r/position/increase/info': 2.
|
250
|
-
'auth/r/positions/hist': 2.
|
251
|
-
'auth/r/positions/audit': 2.
|
252
|
-
'auth/r/positions/snap': 2.
|
253
|
-
'auth/w/deriv/collateral/set': 2.
|
254
|
-
'auth/w/deriv/collateral/limits': 2.
|
255
|
-
'auth/r/funding/offers': 2.
|
256
|
-
'auth/r/funding/offers/{symbol}': 2.
|
257
|
-
'auth/w/funding/offer/submit': 2.
|
258
|
-
'auth/w/funding/offer/cancel': 2.
|
259
|
-
'auth/w/funding/offer/cancel/all': 2.
|
260
|
-
'auth/w/funding/close': 2.
|
261
|
-
'auth/w/funding/auto': 2.
|
262
|
-
'auth/w/funding/keep': 2.
|
263
|
-
'auth/r/funding/offers/{symbol}/hist': 2.
|
264
|
-
'auth/r/funding/offers/hist': 2.
|
265
|
-
'auth/r/funding/loans': 2.
|
266
|
-
'auth/r/funding/loans/hist': 2.
|
267
|
-
'auth/r/funding/loans/{symbol}': 2.
|
268
|
-
'auth/r/funding/loans/{symbol}/hist': 2.
|
269
|
-
'auth/r/funding/credits': 2.
|
270
|
-
'auth/r/funding/credits/hist': 2.
|
271
|
-
'auth/r/funding/credits/{symbol}': 2.
|
272
|
-
'auth/r/funding/credits/{symbol}/hist': 2.
|
273
|
-
'auth/r/funding/trades/{symbol}/hist': 2.
|
274
|
-
'auth/r/funding/trades/hist': 2.
|
275
|
-
'auth/r/info/funding/{key}': 2.
|
276
|
-
'auth/r/info/user': 2.
|
277
|
-
'auth/r/summary': 2.
|
278
|
-
'auth/r/logins/hist': 2.
|
279
|
-
'auth/r/permissions': 2.
|
280
|
-
'auth/w/token': 2.
|
281
|
-
'auth/r/audit/hist': 2.
|
282
|
-
'auth/w/transfer': 2.
|
227
|
+
'auth/r/wallets': 2.7,
|
228
|
+
'auth/r/wallets/hist': 2.7,
|
229
|
+
'auth/r/orders': 2.7,
|
230
|
+
'auth/r/orders/{symbol}': 2.7,
|
231
|
+
'auth/w/order/submit': 2.7,
|
232
|
+
'auth/w/order/update': 2.7,
|
233
|
+
'auth/w/order/cancel': 2.7,
|
234
|
+
'auth/w/order/multi': 2.7,
|
235
|
+
'auth/w/order/cancel/multi': 2.7,
|
236
|
+
'auth/r/orders/{symbol}/hist': 2.7,
|
237
|
+
'auth/r/orders/hist': 2.7,
|
238
|
+
'auth/r/order/{symbol}:{id}/trades': 2.7,
|
239
|
+
'auth/r/trades/{symbol}/hist': 2.7,
|
240
|
+
'auth/r/trades/hist': 2.7,
|
241
|
+
'auth/r/ledgers/{currency}/hist': 2.7,
|
242
|
+
'auth/r/ledgers/hist': 2.7,
|
243
|
+
'auth/r/info/margin/{key}': 2.7,
|
244
|
+
'auth/r/info/margin/base': 2.7,
|
245
|
+
'auth/r/info/margin/sym_all': 2.7,
|
246
|
+
'auth/r/positions': 2.7,
|
247
|
+
'auth/w/position/claim': 2.7,
|
248
|
+
'auth/w/position/increase:': 2.7,
|
249
|
+
'auth/r/position/increase/info': 2.7,
|
250
|
+
'auth/r/positions/hist': 2.7,
|
251
|
+
'auth/r/positions/audit': 2.7,
|
252
|
+
'auth/r/positions/snap': 2.7,
|
253
|
+
'auth/w/deriv/collateral/set': 2.7,
|
254
|
+
'auth/w/deriv/collateral/limits': 2.7,
|
255
|
+
'auth/r/funding/offers': 2.7,
|
256
|
+
'auth/r/funding/offers/{symbol}': 2.7,
|
257
|
+
'auth/w/funding/offer/submit': 2.7,
|
258
|
+
'auth/w/funding/offer/cancel': 2.7,
|
259
|
+
'auth/w/funding/offer/cancel/all': 2.7,
|
260
|
+
'auth/w/funding/close': 2.7,
|
261
|
+
'auth/w/funding/auto': 2.7,
|
262
|
+
'auth/w/funding/keep': 2.7,
|
263
|
+
'auth/r/funding/offers/{symbol}/hist': 2.7,
|
264
|
+
'auth/r/funding/offers/hist': 2.7,
|
265
|
+
'auth/r/funding/loans': 2.7,
|
266
|
+
'auth/r/funding/loans/hist': 2.7,
|
267
|
+
'auth/r/funding/loans/{symbol}': 2.7,
|
268
|
+
'auth/r/funding/loans/{symbol}/hist': 2.7,
|
269
|
+
'auth/r/funding/credits': 2.7,
|
270
|
+
'auth/r/funding/credits/hist': 2.7,
|
271
|
+
'auth/r/funding/credits/{symbol}': 2.7,
|
272
|
+
'auth/r/funding/credits/{symbol}/hist': 2.7,
|
273
|
+
'auth/r/funding/trades/{symbol}/hist': 2.7,
|
274
|
+
'auth/r/funding/trades/hist': 2.7,
|
275
|
+
'auth/r/info/funding/{key}': 2.7,
|
276
|
+
'auth/r/info/user': 2.7,
|
277
|
+
'auth/r/summary': 2.7,
|
278
|
+
'auth/r/logins/hist': 2.7,
|
279
|
+
'auth/r/permissions': 2.7,
|
280
|
+
'auth/w/token': 2.7,
|
281
|
+
'auth/r/audit/hist': 2.7,
|
282
|
+
'auth/w/transfer': 2.7, # ratelimit not in docs...
|
283
283
|
'auth/w/deposit/address': 24, # 10 requests a minute = 0.166 requests per second =>( 1000ms / rateLimit ) / 0.166 = 24
|
284
284
|
'auth/w/deposit/invoice': 24, # ratelimit not in docs
|
285
285
|
'auth/w/withdraw': 24, # ratelimit not in docs
|
286
|
-
'auth/r/movements/{currency}/hist': 2.
|
287
|
-
'auth/r/movements/hist': 2.
|
288
|
-
'auth/r/alerts': 5.
|
289
|
-
'auth/w/alert/set': 2.
|
290
|
-
'auth/w/alert/price:{symbol}:{price}/del': 2.
|
291
|
-
'auth/w/alert/{type}:{symbol}:{price}/del': 2.
|
292
|
-
'auth/calc/order/avail': 2.
|
293
|
-
'auth/w/settings/set': 2.
|
294
|
-
'auth/r/settings': 2.
|
295
|
-
'auth/w/settings/del': 2.
|
296
|
-
'auth/r/pulse/hist': 2.
|
286
|
+
'auth/r/movements/{currency}/hist': 2.7,
|
287
|
+
'auth/r/movements/hist': 2.7,
|
288
|
+
'auth/r/alerts': 5.34, # 45 requests a minute = 0.75 requests per second =>( 1000ms / rateLimit ) / 0.749 => 5.34
|
289
|
+
'auth/w/alert/set': 2.7,
|
290
|
+
'auth/w/alert/price:{symbol}:{price}/del': 2.7,
|
291
|
+
'auth/w/alert/{type}:{symbol}:{price}/del': 2.7,
|
292
|
+
'auth/calc/order/avail': 2.7,
|
293
|
+
'auth/w/settings/set': 2.7,
|
294
|
+
'auth/r/settings': 2.7,
|
295
|
+
'auth/w/settings/del': 2.7,
|
296
|
+
'auth/r/pulse/hist': 2.7,
|
297
297
|
'auth/w/pulse/add': 16, # 15 requests a minute = 0.25 requests per second =>( 1000ms / rateLimit ) / 0.25 => 16
|
298
|
-
'auth/w/pulse/del': 2.
|
298
|
+
'auth/w/pulse/del': 2.7,
|
299
299
|
},
|
300
300
|
},
|
301
301
|
},
|
ccxt/bitmex.py
CHANGED
@@ -292,6 +292,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
292
292
|
def fetch_currencies(self, params={}):
|
293
293
|
"""
|
294
294
|
fetches all available currencies on an exchange
|
295
|
+
:see: https://www.bitmex.com/api/explorer/#not /Wallet/Wallet_getAssetsConfig
|
295
296
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
296
297
|
:returns dict: an associative dictionary of currencies
|
297
298
|
"""
|
@@ -752,6 +753,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
752
753
|
def fetch_balance(self, params={}) -> Balances:
|
753
754
|
"""
|
754
755
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
756
|
+
:see: https://www.bitmex.com/api/explorer/#not /User/User_getMargin
|
755
757
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
756
758
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
757
759
|
"""
|
@@ -812,6 +814,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
812
814
|
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
813
815
|
"""
|
814
816
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
817
|
+
:see: https://www.bitmex.com/api/explorer/#not /OrderBook/OrderBook_getL2
|
815
818
|
:param str symbol: unified symbol of the market to fetch the order book for
|
816
819
|
:param int [limit]: the maximum amount of order book entries to return
|
817
820
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -850,6 +853,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
850
853
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
851
854
|
"""
|
852
855
|
fetches information on an order made by the user
|
856
|
+
:see: https://www.bitmex.com/api/explorer/#not /Order/Order_getOrders
|
853
857
|
:param str symbol: unified symbol of the market the order was made in
|
854
858
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
855
859
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -907,6 +911,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
907
911
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
908
912
|
"""
|
909
913
|
fetch all unfilled currently open orders
|
914
|
+
:see: https://www.bitmex.com/api/explorer/#not /Order/Order_getOrders
|
910
915
|
:param str symbol: unified market symbol
|
911
916
|
:param int [since]: the earliest time in ms to fetch open orders for
|
912
917
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -923,6 +928,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
923
928
|
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
924
929
|
"""
|
925
930
|
fetches information on multiple closed orders made by the user
|
931
|
+
:see: https://www.bitmex.com/api/explorer/#not /Order/Order_getOrders
|
926
932
|
:param str symbol: unified market symbol of the market orders were made in
|
927
933
|
:param int [since]: the earliest time in ms to fetch orders for
|
928
934
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -935,8 +941,8 @@ class bitmex(Exchange, ImplicitAPI):
|
|
935
941
|
|
936
942
|
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
937
943
|
"""
|
938
|
-
:see: https://www.bitmex.com/api/explorer/#not /Execution/Execution_getTradeHistory
|
939
944
|
fetch all trades made by the user
|
945
|
+
:see: https://www.bitmex.com/api/explorer/#not /Execution/Execution_getTradeHistory
|
940
946
|
:param str symbol: unified market symbol
|
941
947
|
:param int [since]: the earliest time in ms to fetch trades for
|
942
948
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -1132,6 +1138,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1132
1138
|
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1133
1139
|
"""
|
1134
1140
|
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
1141
|
+
:see: https://www.bitmex.com/api/explorer/#not /User/User_getWalletHistory
|
1135
1142
|
:param str code: unified currency code, default is None
|
1136
1143
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1137
1144
|
:param int [limit]: max number of ledger entrys to return, default is None
|
@@ -1179,6 +1186,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1179
1186
|
def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
1180
1187
|
"""
|
1181
1188
|
fetch history of deposits and withdrawals
|
1189
|
+
:see: https://www.bitmex.com/api/explorer/#not /User/User_getWalletHistory
|
1182
1190
|
:param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
|
1183
1191
|
:param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
|
1184
1192
|
:param int [limit]: max number of deposit/withdrawals to return, default is None
|
@@ -1290,6 +1298,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1290
1298
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
1291
1299
|
"""
|
1292
1300
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
1301
|
+
:see: https://www.bitmex.com/api/explorer/#not /Instrument/Instrument_get
|
1293
1302
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
1294
1303
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1295
1304
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1308,6 +1317,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1308
1317
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1309
1318
|
"""
|
1310
1319
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1320
|
+
:see: https://www.bitmex.com/api/explorer/#not /Instrument/Instrument_getActiveAndIndices
|
1311
1321
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1312
1322
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1313
1323
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1386,8 +1396,8 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1386
1396
|
|
1387
1397
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1388
1398
|
"""
|
1389
|
-
:see: https://www.bitmex.com/api/explorer/#not /Trade/Trade_getBucketed
|
1390
1399
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1400
|
+
:see: https://www.bitmex.com/api/explorer/#not /Trade/Trade_getBucketed
|
1391
1401
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1392
1402
|
:param str timeframe: the length of time each candle represents
|
1393
1403
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -1683,8 +1693,8 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1683
1693
|
|
1684
1694
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1685
1695
|
"""
|
1686
|
-
:see: https://www.bitmex.com/api/explorer/#not /Trade/Trade_get
|
1687
1696
|
get the list of most recent trades for a particular symbol
|
1697
|
+
:see: https://www.bitmex.com/api/explorer/#not /Trade/Trade_get
|
1688
1698
|
:param str symbol: unified symbol of the market to fetch trades for
|
1689
1699
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1690
1700
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -1866,6 +1876,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1866
1876
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1867
1877
|
"""
|
1868
1878
|
cancels an open order
|
1879
|
+
:see: https://www.bitmex.com/api/explorer/#not /Order/Order_cancel
|
1869
1880
|
:param str id: order id
|
1870
1881
|
:param str symbol: not used by bitmex cancelOrder()
|
1871
1882
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1891,6 +1902,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1891
1902
|
def cancel_orders(self, ids, symbol: Str = None, params={}):
|
1892
1903
|
"""
|
1893
1904
|
cancel multiple orders
|
1905
|
+
:see: https://www.bitmex.com/api/explorer/#not /Order/Order_cancel
|
1894
1906
|
:param str[] ids: order ids
|
1895
1907
|
:param str symbol: not used by bitmex cancelOrders()
|
1896
1908
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1912,6 +1924,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1912
1924
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
1913
1925
|
"""
|
1914
1926
|
cancel all open orders
|
1927
|
+
:see: https://www.bitmex.com/api/explorer/#not /Order/Order_cancelAll
|
1915
1928
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
1916
1929
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1917
1930
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1967,6 +1980,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
1967
1980
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
1968
1981
|
"""
|
1969
1982
|
fetch all open positions
|
1983
|
+
:see: https://www.bitmex.com/api/explorer/#not /Position/Position_get
|
1970
1984
|
:param str[]|None symbols: list of unified market symbols
|
1971
1985
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1972
1986
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -2220,6 +2234,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2220
2234
|
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2221
2235
|
"""
|
2222
2236
|
make a withdrawal
|
2237
|
+
:see: https://www.bitmex.com/api/explorer/#not /User/User_requestWithdrawal
|
2223
2238
|
:param str code: unified currency code
|
2224
2239
|
:param float amount: the amount to withdraw
|
2225
2240
|
:param str address: the address to withdraw to
|
@@ -2265,6 +2280,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2265
2280
|
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2266
2281
|
"""
|
2267
2282
|
fetch the funding rate for multiple markets
|
2283
|
+
:see: https://www.bitmex.com/api/explorer/#not /Instrument/Instrument_getActiveAndIndices
|
2268
2284
|
:param str[]|None symbols: list of unified market symbols
|
2269
2285
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2270
2286
|
:returns dict: a dictionary of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
|
@@ -2312,6 +2328,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2312
2328
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2313
2329
|
"""
|
2314
2330
|
Fetches the history of funding rates
|
2331
|
+
:see: https://www.bitmex.com/api/explorer/#not /Funding/Funding_get
|
2315
2332
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
2316
2333
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
2317
2334
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
@@ -2386,6 +2403,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2386
2403
|
def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
2387
2404
|
"""
|
2388
2405
|
set the level of leverage for a market
|
2406
|
+
:see: https://www.bitmex.com/api/explorer/#not /Position/Position_updateLeverage
|
2389
2407
|
:param float leverage: the rate of leverage
|
2390
2408
|
:param str symbol: unified market symbol
|
2391
2409
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2408,6 +2426,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2408
2426
|
def set_margin_mode(self, marginMode, symbol: Str = None, params={}):
|
2409
2427
|
"""
|
2410
2428
|
set margin mode to 'cross' or 'isolated'
|
2429
|
+
:see: https://www.bitmex.com/api/explorer/#not /Position/Position_isolateMargin
|
2411
2430
|
:param str marginMode: 'cross' or 'isolated'
|
2412
2431
|
:param str symbol: unified market symbol
|
2413
2432
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
ccxt/bybit.py
CHANGED
@@ -3525,9 +3525,19 @@ class bybit(Exchange, ImplicitAPI):
|
|
3525
3525
|
if isStopLoss:
|
3526
3526
|
slTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
|
3527
3527
|
request['stopLoss'] = self.price_to_precision(symbol, slTriggerPrice)
|
3528
|
+
slLimitPrice = self.safe_value(stopLoss, 'price')
|
3529
|
+
if slLimitPrice is not None:
|
3530
|
+
request['tpslMode'] = 'Partial'
|
3531
|
+
request['slOrderType'] = 'Limit'
|
3532
|
+
request['slLimitPrice'] = self.price_to_precision(symbol, slLimitPrice)
|
3528
3533
|
if isTakeProfit:
|
3529
3534
|
tpTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
|
3530
3535
|
request['takeProfit'] = self.price_to_precision(symbol, tpTriggerPrice)
|
3536
|
+
tpLimitPrice = self.safe_value(takeProfit, 'price')
|
3537
|
+
if tpLimitPrice is not None:
|
3538
|
+
request['tpslMode'] = 'Partial'
|
3539
|
+
request['tpOrderType'] = 'Limit'
|
3540
|
+
request['tpLimitPrice'] = self.price_to_precision(symbol, tpLimitPrice)
|
3531
3541
|
if market['spot']:
|
3532
3542
|
# only works for spot market
|
3533
3543
|
if triggerPrice is not None:
|
@@ -5621,9 +5631,6 @@ class bybit(Exchange, ImplicitAPI):
|
|
5621
5631
|
timestamp = self.parse8601(self.safe_string(position, 'updated_at'))
|
5622
5632
|
if timestamp is None:
|
5623
5633
|
timestamp = self.safe_integer_n(position, ['updatedTime', 'updatedAt'])
|
5624
|
-
# default to cross of USDC margined positions
|
5625
|
-
tradeMode = self.safe_integer(position, 'tradeMode', 0)
|
5626
|
-
marginMode = 'isolated' if tradeMode else 'cross'
|
5627
5634
|
collateralString = self.safe_string(position, 'positionBalance')
|
5628
5635
|
entryPrice = self.omit_zero(self.safe_string_2(position, 'entryPrice', 'avgPrice'))
|
5629
5636
|
liquidationPrice = self.omit_zero(self.safe_string(position, 'liqPrice'))
|
@@ -5680,7 +5687,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5680
5687
|
'markPrice': self.safe_number(position, 'markPrice'),
|
5681
5688
|
'lastPrice': None,
|
5682
5689
|
'collateral': self.parse_number(collateralString),
|
5683
|
-
'marginMode':
|
5690
|
+
'marginMode': None,
|
5684
5691
|
'side': side,
|
5685
5692
|
'percentage': None,
|
5686
5693
|
'stopLossPrice': self.safe_number_2(position, 'stop_loss', 'stopLoss'),
|