ccxt 4.1.28__py2.py3-none-any.whl → 4.1.30__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/bybit.py +1 -0
- ccxt/abstract/okex.py +1 -0
- ccxt/abstract/okex5.py +1 -0
- ccxt/abstract/okx.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/functions.py +1 -1
- ccxt/async_support/bitget.py +265 -16
- ccxt/async_support/bitopro.py +4 -4
- ccxt/async_support/bitrue.py +33 -16
- ccxt/async_support/bybit.py +4 -0
- ccxt/async_support/cryptocom.py +29 -0
- ccxt/async_support/gate.py +58 -10
- ccxt/async_support/huobi.py +0 -1
- ccxt/async_support/huobijp.py +0 -1
- ccxt/async_support/krakenfutures.py +48 -4
- ccxt/async_support/mexc.py +86 -4
- ccxt/async_support/okx.py +1 -0
- ccxt/async_support/phemex.py +2 -0
- ccxt/base/exchange.py +1 -1
- ccxt/bitget.py +265 -16
- ccxt/bitopro.py +4 -4
- ccxt/bitrue.py +33 -16
- ccxt/bybit.py +4 -0
- ccxt/cryptocom.py +29 -0
- ccxt/gate.py +58 -10
- ccxt/huobi.py +0 -1
- ccxt/huobijp.py +0 -1
- ccxt/krakenfutures.py +48 -4
- ccxt/mexc.py +86 -4
- ccxt/okx.py +1 -0
- ccxt/phemex.py +2 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/huobi.py +4 -0
- {ccxt-4.1.28.dist-info → ccxt-4.1.30.dist-info}/METADATA +4 -4
- {ccxt-4.1.28.dist-info → ccxt-4.1.30.dist-info}/RECORD +39 -39
- {ccxt-4.1.28.dist-info → ccxt-4.1.30.dist-info}/WHEEL +0 -0
- {ccxt-4.1.28.dist-info → ccxt-4.1.30.dist-info}/top_level.txt +0 -0
ccxt/gate.py
CHANGED
@@ -1536,6 +1536,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1536
1536
|
def fetch_currencies(self, params={}):
|
1537
1537
|
"""
|
1538
1538
|
fetches all available currencies on an exchange
|
1539
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details
|
1539
1540
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1540
1541
|
:returns dict: an associative dictionary of currencies
|
1541
1542
|
"""
|
@@ -1641,6 +1642,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1641
1642
|
def fetch_funding_rate(self, symbol: str, params={}):
|
1642
1643
|
"""
|
1643
1644
|
fetch the current funding rate
|
1645
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
|
1644
1646
|
:param str symbol: unified market symbol
|
1645
1647
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1646
1648
|
:returns dict: a `funding rate structure <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure>`
|
@@ -1700,6 +1702,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1700
1702
|
def fetch_funding_rates(self, symbols: Optional[List[str]] = None, params={}):
|
1701
1703
|
"""
|
1702
1704
|
fetch the funding rate for multiple markets
|
1705
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
1703
1706
|
:param str[]|None symbols: list of unified market symbols
|
1704
1707
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1705
1708
|
:returns dict: a dictionary of `funding rates structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure>`, indexe by market symbols
|
@@ -2140,6 +2143,8 @@ class gate(Exchange, ImplicitAPI):
|
|
2140
2143
|
def fetch_funding_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2141
2144
|
"""
|
2142
2145
|
fetch the history of funding payments paid and received on self account
|
2146
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
|
2147
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
|
2143
2148
|
:param str symbol: unified market symbol
|
2144
2149
|
:param int [since]: the earliest time in ms to fetch funding history for
|
2145
2150
|
:param int [limit]: the maximum number of funding history structures to retrieve
|
@@ -2795,6 +2800,7 @@ class gate(Exchange, ImplicitAPI):
|
|
2795
2800
|
def fetch_funding_rate_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2796
2801
|
"""
|
2797
2802
|
fetches historical funding rate prices
|
2803
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history
|
2798
2804
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
2799
2805
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
2800
2806
|
:param int [limit]: the maximum amount of `funding rate structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure>` to fetch
|
@@ -2880,6 +2886,10 @@ class gate(Exchange, ImplicitAPI):
|
|
2880
2886
|
def fetch_trades(self, symbol: str, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2881
2887
|
"""
|
2882
2888
|
get the list of most recent trades for a particular symbol
|
2889
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades
|
2890
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history
|
2891
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2
|
2892
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#options-trade-history
|
2883
2893
|
:param str symbol: unified symbol of the market to fetch trades for
|
2884
2894
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
2885
2895
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -2977,6 +2987,10 @@ class gate(Exchange, ImplicitAPI):
|
|
2977
2987
|
def fetch_order_trades(self, id: str, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2978
2988
|
"""
|
2979
2989
|
fetch all the trades made from a single order
|
2990
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
|
2991
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
|
2992
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
|
2993
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
|
2980
2994
|
:param str id: order id
|
2981
2995
|
:param str symbol: unified market symbol
|
2982
2996
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -3278,6 +3292,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3278
3292
|
def fetch_deposits(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3279
3293
|
"""
|
3280
3294
|
fetch all deposits made to an account
|
3295
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records
|
3281
3296
|
:param str code: unified currency code
|
3282
3297
|
:param int [since]: the earliest time in ms to fetch deposits for
|
3283
3298
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
@@ -3309,6 +3324,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3309
3324
|
def fetch_withdrawals(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3310
3325
|
"""
|
3311
3326
|
fetch all withdrawals made from an account
|
3327
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records
|
3312
3328
|
:param str code: unified currency code
|
3313
3329
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
3314
3330
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
@@ -3340,6 +3356,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3340
3356
|
def withdraw(self, code: str, amount, address, tag=None, params={}):
|
3341
3357
|
"""
|
3342
3358
|
make a withdrawal
|
3359
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#withdraw
|
3343
3360
|
:param str code: unified currency code
|
3344
3361
|
:param float amount: the amount to withdraw
|
3345
3362
|
:param str address: the address to withdraw to
|
@@ -3477,6 +3494,13 @@ class gate(Exchange, ImplicitAPI):
|
|
3477
3494
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
|
3478
3495
|
"""
|
3479
3496
|
Create an order on the exchange
|
3497
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-an-order
|
3498
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order
|
3499
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
|
3500
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2
|
3501
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
|
3502
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3
|
3503
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
|
3480
3504
|
:param str symbol: Unified CCXT market symbol
|
3481
3505
|
:param str type: 'limit' or 'market' *"market" is contract only*
|
3482
3506
|
:param str side: 'buy' or 'sell'
|
@@ -4204,6 +4228,7 @@ class gate(Exchange, ImplicitAPI):
|
|
4204
4228
|
def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4205
4229
|
"""
|
4206
4230
|
fetch all unfilled currently open orders
|
4231
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
|
4207
4232
|
:param str symbol: unified market symbol
|
4208
4233
|
:param int [since]: the earliest time in ms to fetch open orders for
|
4209
4234
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -4218,6 +4243,13 @@ class gate(Exchange, ImplicitAPI):
|
|
4218
4243
|
def fetch_closed_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4219
4244
|
"""
|
4220
4245
|
fetches information on multiple closed orders made by the user
|
4246
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-orders
|
4247
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
4248
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders
|
4249
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders
|
4250
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
|
4251
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
|
4252
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
|
4221
4253
|
:param str symbol: unified market symbol of the market orders were made in
|
4222
4254
|
:param int [since]: the earliest time in ms to fetch orders for
|
4223
4255
|
:param int [limit]: the maximum number of orde structures to retrieve
|
@@ -4417,6 +4449,10 @@ class gate(Exchange, ImplicitAPI):
|
|
4417
4449
|
def cancel_order(self, id: str, symbol: Optional[str] = None, params={}):
|
4418
4450
|
"""
|
4419
4451
|
Cancels an open order
|
4452
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order
|
4453
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2
|
4454
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3
|
4455
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4
|
4420
4456
|
:param str id: Order id
|
4421
4457
|
:param str symbol: Unified market symbol
|
4422
4458
|
:param dict [params]: Parameters specified by the exchange api
|
@@ -4525,6 +4561,10 @@ class gate(Exchange, ImplicitAPI):
|
|
4525
4561
|
def cancel_all_orders(self, symbol: Optional[str] = None, params={}):
|
4526
4562
|
"""
|
4527
4563
|
cancel all open orders
|
4564
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
|
4565
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched
|
4566
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
|
4567
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
|
4528
4568
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
4529
4569
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
4530
4570
|
:returns dict[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
@@ -4645,6 +4685,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4645
4685
|
def set_leverage(self, leverage, symbol: Optional[str] = None, params={}):
|
4646
4686
|
"""
|
4647
4687
|
set the level of leverage for a market
|
4688
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage
|
4689
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2
|
4648
4690
|
:param float leverage: the rate of leverage
|
4649
4691
|
:param str symbol: unified market symbol
|
4650
4692
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
@@ -4983,6 +5025,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4983
5025
|
def fetch_leverage_tiers(self, symbols: Optional[List[str]] = None, params={}):
|
4984
5026
|
"""
|
4985
5027
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
5028
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
5029
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
4986
5030
|
:param str[]|None symbols: list of unified market symbols
|
4987
5031
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
4988
5032
|
:returns dict: a dictionary of `leverage tiers structures <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`, indexed by market symbols
|
@@ -5233,11 +5277,11 @@ class gate(Exchange, ImplicitAPI):
|
|
5233
5277
|
'currency': currency['id'],
|
5234
5278
|
'amount': self.currency_to_precision(code, amount),
|
5235
5279
|
}
|
5236
|
-
|
5280
|
+
response = None
|
5281
|
+
params = self.omit(params, ['marginMode'])
|
5237
5282
|
if symbol is None:
|
5238
|
-
|
5283
|
+
response = self.privateMarginPostCrossRepayments(self.extend(request, params))
|
5239
5284
|
else:
|
5240
|
-
method = 'privateMarginPostLoansLoanIdRepayment'
|
5241
5285
|
market = self.market(symbol)
|
5242
5286
|
request['currency_pair'] = market['id']
|
5243
5287
|
request['mode'] = 'partial'
|
@@ -5245,8 +5289,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5245
5289
|
if loanId is None:
|
5246
5290
|
raise ArgumentsRequired(self.id + ' repayMargin() requires loan_id param for isolated margin')
|
5247
5291
|
request['loan_id'] = loanId
|
5248
|
-
|
5249
|
-
|
5292
|
+
params = self.omit(params, ['loan_id', 'id'])
|
5293
|
+
response = self.privateMarginPostLoansLoanIdRepayment(self.extend(request, params))
|
5250
5294
|
#
|
5251
5295
|
# Cross
|
5252
5296
|
#
|
@@ -5310,9 +5354,9 @@ class gate(Exchange, ImplicitAPI):
|
|
5310
5354
|
'currency': currency['id'],
|
5311
5355
|
'amount': self.currency_to_precision(code, amount),
|
5312
5356
|
}
|
5313
|
-
|
5357
|
+
response = None
|
5314
5358
|
if symbol is None:
|
5315
|
-
|
5359
|
+
response = self.privateMarginPostCrossLoans(self.extend(request, params))
|
5316
5360
|
else:
|
5317
5361
|
market = self.market(symbol)
|
5318
5362
|
request['currency_pair'] = market['id']
|
@@ -5321,9 +5365,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5321
5365
|
# is the smallest tick size currently offered by gateio
|
5322
5366
|
request['rate'] = self.safe_string(params, 'rate', '0.0001')
|
5323
5367
|
request['auto_renew'] = True
|
5324
|
-
|
5325
|
-
|
5326
|
-
response = getattr(self, method)(self.extend(request, params))
|
5368
|
+
params = self.omit(params, ['rate'])
|
5369
|
+
response = self.privateMarginPostLoans(self.extend(request, params))
|
5327
5370
|
#
|
5328
5371
|
# Cross
|
5329
5372
|
#
|
@@ -5531,6 +5574,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5531
5574
|
def reduce_margin(self, symbol: str, amount, params={}):
|
5532
5575
|
"""
|
5533
5576
|
remove margin from a position
|
5577
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
5578
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
5534
5579
|
:param str symbol: unified market symbol
|
5535
5580
|
:param float amount: the amount of margin to remove
|
5536
5581
|
:param dict [params]: extra parameters specific to the exmo api endpoint
|
@@ -5541,6 +5586,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5541
5586
|
def add_margin(self, symbol: str, amount, params={}):
|
5542
5587
|
"""
|
5543
5588
|
add margin
|
5589
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
5590
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
5544
5591
|
:param str symbol: unified market symbol
|
5545
5592
|
:param float amount: amount of margin to add
|
5546
5593
|
:param dict [params]: extra parameters specific to the exmo api endpoint
|
@@ -6040,6 +6087,7 @@ class gate(Exchange, ImplicitAPI):
|
|
6040
6087
|
def fetch_underlying_assets(self, params={}):
|
6041
6088
|
"""
|
6042
6089
|
fetches the market ids of underlying assets for a specific contract market type
|
6090
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings
|
6043
6091
|
:param dict [params]: exchange specific params
|
6044
6092
|
:param str [params.type]: the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
6045
6093
|
:returns dict[]: a list of `underlying assets <https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure>`
|
ccxt/huobi.py
CHANGED
@@ -1068,7 +1068,6 @@ class huobi(Exchange, ImplicitAPI):
|
|
1068
1068
|
'GET': 'Themis', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
|
1069
1069
|
'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
|
1070
1070
|
'HIT': 'HitChain',
|
1071
|
-
'HOT': 'Hydro Protocol', # conflict with HOT(Holo) https://github.com/ccxt/ccxt/issues/4929
|
1072
1071
|
# https://github.com/ccxt/ccxt/issues/7399
|
1073
1072
|
# https://coinmarketcap.com/currencies/pnetwork/
|
1074
1073
|
# https://coinmarketcap.com/currencies/penta/markets/
|
ccxt/huobijp.py
CHANGED
@@ -333,7 +333,6 @@ class huobijp(Exchange, ImplicitAPI):
|
|
333
333
|
'GET': 'Themis', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
|
334
334
|
'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
|
335
335
|
'HIT': 'HitChain',
|
336
|
-
'HOT': 'Hydro Protocol', # conflict with HOT(Holo) https://github.com/ccxt/ccxt/issues/4929
|
337
336
|
# https://github.com/ccxt/ccxt/issues/7399
|
338
337
|
# https://coinmarketcap.com/currencies/pnetwork/
|
339
338
|
# https://coinmarketcap.com/currencies/penta/markets/
|
ccxt/krakenfutures.py
CHANGED
@@ -413,6 +413,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
413
413
|
|
414
414
|
def fetch_order_book(self, symbol: str, limit: Optional[int] = None, params={}):
|
415
415
|
"""
|
416
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
|
416
417
|
Fetches a list of open orders in a market
|
417
418
|
:param str symbol: Unified market symbol
|
418
419
|
:param int [limit]: Not used by krakenfutures
|
@@ -459,6 +460,13 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
459
460
|
return self.parse_order_book(response['orderBook'], symbol, timestamp)
|
460
461
|
|
461
462
|
def fetch_tickers(self, symbols: Optional[List[str]] = None, params={}):
|
463
|
+
"""
|
464
|
+
fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
465
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
|
466
|
+
:param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
467
|
+
:param dict [params]: extra parameters specific to the krakenfutures api endpoint
|
468
|
+
:returns dict: an array of `ticker structures <https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure>`
|
469
|
+
"""
|
462
470
|
self.load_markets()
|
463
471
|
response = self.publicGetTickers(params)
|
464
472
|
#
|
@@ -645,6 +653,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
645
653
|
|
646
654
|
def fetch_trades(self, symbol: str, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
647
655
|
"""
|
656
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
|
648
657
|
* @descriptions Fetch a history of filled trades that self account has made
|
649
658
|
:param str symbol: Unified CCXT market symbol
|
650
659
|
:param int [since]: Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
|
@@ -936,6 +945,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
936
945
|
|
937
946
|
def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
|
938
947
|
"""
|
948
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
|
939
949
|
Edit an open order on the exchange
|
940
950
|
:param str id: order id
|
941
951
|
:param str symbol: Not used by Krakenfutures
|
@@ -963,6 +973,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
963
973
|
|
964
974
|
def cancel_order(self, id: str, symbol: Optional[str] = None, params={}):
|
965
975
|
"""
|
976
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
|
977
|
+
Cancel an open order on the exchange
|
966
978
|
:param str id: Order id
|
967
979
|
:param str symbol: Not used by Krakenfutures
|
968
980
|
:param dict [params]: Exchange specific params
|
@@ -1037,6 +1049,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1037
1049
|
|
1038
1050
|
def cancel_all_orders(self, symbol: Optional[str] = None, params={}):
|
1039
1051
|
"""
|
1052
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
|
1040
1053
|
Cancels all orders on the exchange, including trigger orders
|
1041
1054
|
:param str symbol: Unified market symbol
|
1042
1055
|
:param dict [params]: Exchange specific params
|
@@ -1050,6 +1063,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1050
1063
|
|
1051
1064
|
def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
1052
1065
|
"""
|
1066
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
|
1053
1067
|
Gets all open orders, including trigger orders, for an account from the exchange api
|
1054
1068
|
:param str symbol: Unified market symbol
|
1055
1069
|
:param int [since]: Timestamp(ms) of earliest order.(Not used by kraken api but filtered internally by CCXT)
|
@@ -1429,6 +1443,16 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1429
1443
|
})
|
1430
1444
|
|
1431
1445
|
def fetch_my_trades(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
1446
|
+
"""
|
1447
|
+
fetch all trades made by the user
|
1448
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
|
1449
|
+
:param str symbol: unified market symbol
|
1450
|
+
:param int [since]: *not used by the api* the earliest time in ms to fetch trades for
|
1451
|
+
:param int [limit]: the maximum number of trades structures to retrieve
|
1452
|
+
:param dict [params]: extra parameters specific to the bybit api endpoint
|
1453
|
+
:param int [params.until]: the latest time in ms to fetch entries for
|
1454
|
+
:returns Trade[]: a list of `trade structures <https://github.com/ccxt/ccxt/wiki/Manual#trade-structure>`
|
1455
|
+
"""
|
1432
1456
|
self.load_markets()
|
1433
1457
|
market = None
|
1434
1458
|
if symbol is not None:
|
@@ -1458,9 +1482,10 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1458
1482
|
|
1459
1483
|
def fetch_balance(self, params={}):
|
1460
1484
|
"""
|
1485
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
|
1461
1486
|
Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response
|
1462
1487
|
:param dict [params]: Exchange specific parameters
|
1463
|
-
:param str [params.type]: The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to '
|
1488
|
+
:param str [params.type]: The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'flex' *
|
1464
1489
|
:param str [params.symbol]: A unified market symbol, when assigned the balance for a trading market that matches the symbol is returned
|
1465
1490
|
:returns: A `balance structure <https://github.com/ccxt/ccxt/wiki/Manual#balance-structure>`
|
1466
1491
|
"""
|
@@ -1562,7 +1587,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1562
1587
|
raise ArgumentsRequired(self.id + ' fetchBalance requires symbol argument for margin accounts')
|
1563
1588
|
type = symbol
|
1564
1589
|
if type is None:
|
1565
|
-
type = '
|
1590
|
+
type = 'flex' if (symbol is None) else symbol
|
1566
1591
|
accountName = self.parse_account(type)
|
1567
1592
|
accounts = self.safe_value(response, 'accounts')
|
1568
1593
|
account = self.safe_value(accounts, accountName)
|
@@ -1748,6 +1773,15 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1748
1773
|
}
|
1749
1774
|
|
1750
1775
|
def fetch_funding_rate_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
1776
|
+
"""
|
1777
|
+
fetches historical funding rate prices
|
1778
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
|
1779
|
+
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
1780
|
+
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
1781
|
+
:param int [limit]: the maximum amount of `funding rate structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure>` to fetch
|
1782
|
+
:param dict [params]: extra parameters specific to the api endpoint
|
1783
|
+
:returns dict[]: a list of `funding rate structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure>`
|
1784
|
+
"""
|
1751
1785
|
self.check_required_symbol('fetchFundingRateHistory', symbol)
|
1752
1786
|
self.load_markets()
|
1753
1787
|
market = self.market(symbol)
|
@@ -1777,7 +1811,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1777
1811
|
result.append({
|
1778
1812
|
'info': item,
|
1779
1813
|
'symbol': symbol,
|
1780
|
-
'fundingRate': self.safe_number(item, '
|
1814
|
+
'fundingRate': self.safe_number(item, 'relativeFundingRate'),
|
1781
1815
|
'timestamp': self.parse8601(datetime),
|
1782
1816
|
'datetime': datetime,
|
1783
1817
|
})
|
@@ -1786,6 +1820,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1786
1820
|
|
1787
1821
|
def fetch_positions(self, symbols: Optional[List[str]] = None, params={}):
|
1788
1822
|
"""
|
1823
|
+
:see: https://docs.futures.kraken.com/#websocket-api-private-feeds-open-positions
|
1789
1824
|
Fetches current contract trading positions
|
1790
1825
|
:param str[] symbols: List of unified symbols
|
1791
1826
|
:param dict [params]: Not used by krakenfutures
|
@@ -1863,7 +1898,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1863
1898
|
'entryPrice': self.safe_number(position, 'price'),
|
1864
1899
|
'notional': None,
|
1865
1900
|
'leverage': leverage,
|
1866
|
-
'unrealizedPnl':
|
1901
|
+
'unrealizedPnl': None,
|
1867
1902
|
'contracts': self.safe_number(position, 'size'),
|
1868
1903
|
'contractSize': self.safe_number(market, 'contractSize'),
|
1869
1904
|
'marginRatio': None,
|
@@ -1876,6 +1911,13 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1876
1911
|
}
|
1877
1912
|
|
1878
1913
|
def fetch_leverage_tiers(self, symbols: Optional[List[str]] = None, params={}):
|
1914
|
+
"""
|
1915
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
|
1916
|
+
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
1917
|
+
:param str[]|None symbols: list of unified market symbols
|
1918
|
+
:param dict [params]: extra parameters specific to the krakenfutures api endpoint
|
1919
|
+
:returns dict: a dictionary of `leverage tiers structures <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`, indexed by market symbols
|
1920
|
+
"""
|
1879
1921
|
self.load_markets()
|
1880
1922
|
response = self.publicGetInstruments(params)
|
1881
1923
|
#
|
@@ -2045,6 +2087,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2045
2087
|
|
2046
2088
|
def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
|
2047
2089
|
"""
|
2090
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
|
2091
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
|
2048
2092
|
transfers currencies between sub-accounts
|
2049
2093
|
:param str code: Unified currency code
|
2050
2094
|
:param float amount: Size of the transfer
|
ccxt/mexc.py
CHANGED
@@ -7,6 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.mexc import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
from ccxt.base.types import OrderSide
|
10
|
+
from ccxt.base.types import OrderRequest
|
10
11
|
from ccxt.base.types import OrderType
|
11
12
|
from ccxt.base.types import IndexType
|
12
13
|
from typing import Optional
|
@@ -53,6 +54,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
53
54
|
'cancelOrders': None,
|
54
55
|
'createDepositAddress': True,
|
55
56
|
'createOrder': True,
|
57
|
+
'createOrders': True,
|
56
58
|
'createReduceOnlyOrder': True,
|
57
59
|
'deposit': None,
|
58
60
|
'editOrder': None,
|
@@ -2006,7 +2008,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
2006
2008
|
else:
|
2007
2009
|
return self.create_swap_order(market, type, side, amount, price, marginMode, query)
|
2008
2010
|
|
2009
|
-
def
|
2011
|
+
def create_spot_order_request(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2010
2012
|
symbol = market['symbol']
|
2011
2013
|
orderSide = 'BUY' if (side == 'buy') else 'SELL'
|
2012
2014
|
request = {
|
@@ -2035,16 +2037,23 @@ class mexc(Exchange, ImplicitAPI):
|
|
2035
2037
|
if clientOrderId is not None:
|
2036
2038
|
request['newClientOrderId'] = clientOrderId
|
2037
2039
|
params = self.omit(params, ['type', 'clientOrderId'])
|
2038
|
-
method = 'spotPrivatePostOrder'
|
2039
2040
|
if marginMode is not None:
|
2040
2041
|
if marginMode != 'isolated':
|
2041
2042
|
raise BadRequest(self.id + ' createOrder() does not support marginMode ' + marginMode + ' for spot-margin trading')
|
2042
|
-
method = 'spotPrivatePostMarginOrder'
|
2043
2043
|
postOnly = None
|
2044
2044
|
postOnly, params = self.handle_post_only(type == 'market', type == 'LIMIT_MAKER', params)
|
2045
2045
|
if postOnly:
|
2046
2046
|
request['type'] = 'LIMIT_MAKER'
|
2047
|
-
|
2047
|
+
return self.extend(request, params)
|
2048
|
+
|
2049
|
+
def create_spot_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2050
|
+
self.load_markets()
|
2051
|
+
request = self.create_spot_order_request(market, type, side, amount, price, marginMode, params)
|
2052
|
+
response = None
|
2053
|
+
if marginMode is not None:
|
2054
|
+
response = self.spotPrivatePostMarginOrder(self.extend(request, params))
|
2055
|
+
else:
|
2056
|
+
response = self.spotPrivatePostOrder(self.extend(request, params))
|
2048
2057
|
#
|
2049
2058
|
# spot
|
2050
2059
|
#
|
@@ -2160,6 +2169,63 @@ class mexc(Exchange, ImplicitAPI):
|
|
2160
2169
|
data = self.safe_string(response, 'data')
|
2161
2170
|
return self.parse_order(data, market)
|
2162
2171
|
|
2172
|
+
def create_orders(self, orders: List[OrderRequest], params={}):
|
2173
|
+
"""
|
2174
|
+
*spot only* *all orders must have the same symbol* create a list of trade orders
|
2175
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#batch-orders
|
2176
|
+
:param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
2177
|
+
:param dict [params]: extra parameters specific to api endpoint
|
2178
|
+
:returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
2179
|
+
"""
|
2180
|
+
self.load_markets()
|
2181
|
+
ordersRequests = []
|
2182
|
+
symbol = None
|
2183
|
+
for i in range(0, len(orders)):
|
2184
|
+
rawOrder = orders[i]
|
2185
|
+
marketId = self.safe_string(rawOrder, 'symbol')
|
2186
|
+
market = self.market(marketId)
|
2187
|
+
if not market['spot']:
|
2188
|
+
raise NotSupported(self.id + ' createOrders() is only supported for spot markets')
|
2189
|
+
if symbol is None:
|
2190
|
+
symbol = marketId
|
2191
|
+
else:
|
2192
|
+
if symbol != marketId:
|
2193
|
+
raise BadRequest(self.id + ' createOrders() requires all orders to have the same symbol')
|
2194
|
+
type = self.safe_string(rawOrder, 'type')
|
2195
|
+
side = self.safe_string(rawOrder, 'side')
|
2196
|
+
amount = self.safe_value(rawOrder, 'amount')
|
2197
|
+
price = self.safe_value(rawOrder, 'price')
|
2198
|
+
orderParams = self.safe_value(rawOrder, 'params', {})
|
2199
|
+
marginMode = None
|
2200
|
+
marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
|
2201
|
+
orderRequest = self.create_spot_order_request(market, type, side, amount, price, marginMode, orderParams)
|
2202
|
+
ordersRequests.append(orderRequest)
|
2203
|
+
request = {
|
2204
|
+
'batchOrders': ordersRequests,
|
2205
|
+
}
|
2206
|
+
response = self.spotPrivatePostBatchOrders(request)
|
2207
|
+
#
|
2208
|
+
# [
|
2209
|
+
# {
|
2210
|
+
# "symbol": "BTCUSDT",
|
2211
|
+
# "orderId": "1196315350023612316",
|
2212
|
+
# "newClientOrderId": "hio8279hbdsds",
|
2213
|
+
# "orderListId": -1
|
2214
|
+
# },
|
2215
|
+
# {
|
2216
|
+
# "newClientOrderId": "123456",
|
2217
|
+
# "msg": "The minimum transaction volume cannot be less than:0.5USDT",
|
2218
|
+
# "code": 30002
|
2219
|
+
# },
|
2220
|
+
# {
|
2221
|
+
# "symbol": "BTCUSDT",
|
2222
|
+
# "orderId": "1196315350023612318",
|
2223
|
+
# "orderListId": -1
|
2224
|
+
# }
|
2225
|
+
# ]
|
2226
|
+
#
|
2227
|
+
return self.parse_orders(response)
|
2228
|
+
|
2163
2229
|
def fetch_order(self, id: str, symbol: Optional[str] = None, params={}):
|
2164
2230
|
"""
|
2165
2231
|
fetches information on an order made by the user
|
@@ -2955,6 +3021,22 @@ class mexc(Exchange, ImplicitAPI):
|
|
2955
3021
|
# "updateTime": "1648984276000",
|
2956
3022
|
# }
|
2957
3023
|
#
|
3024
|
+
# createOrders error
|
3025
|
+
#
|
3026
|
+
# {
|
3027
|
+
# "newClientOrderId": "123456",
|
3028
|
+
# "msg": "The minimum transaction volume cannot be less than:0.5USDT",
|
3029
|
+
# "code": 30002
|
3030
|
+
# }
|
3031
|
+
#
|
3032
|
+
code = self.safe_integer(order, 'code')
|
3033
|
+
if code is not None:
|
3034
|
+
# error upon placing multiple orders
|
3035
|
+
return self.safe_order({
|
3036
|
+
'info': order,
|
3037
|
+
'status': 'rejected',
|
3038
|
+
'clientOrderId': self.safe_string(order, 'newClientOrderId'),
|
3039
|
+
})
|
2958
3040
|
id = None
|
2959
3041
|
if isinstance(order, str):
|
2960
3042
|
id = order
|
ccxt/okx.py
CHANGED
ccxt/phemex.py
CHANGED
@@ -1756,6 +1756,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
1756
1756
|
type, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
1757
1757
|
method = 'privateGetSpotWallets'
|
1758
1758
|
request = {}
|
1759
|
+
if (type != 'spot') and (type != 'swap'):
|
1760
|
+
raise BadRequest(self.id + ' does not support ' + type + ' markets, only spot and swap')
|
1759
1761
|
if type == 'swap':
|
1760
1762
|
code = self.safe_string(params, 'code')
|
1761
1763
|
settle = None
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/huobi.py
CHANGED
@@ -344,6 +344,7 @@ class huobi(ccxt.async_support.huobi):
|
|
344
344
|
# id: 1583473663565,
|
345
345
|
# rep: 'market.btcusdt.mbp.150',
|
346
346
|
# status: 'ok',
|
347
|
+
# ts: 1698359289261,
|
347
348
|
# data: {
|
348
349
|
# seqNum: 104999417756,
|
349
350
|
# bids: [
|
@@ -372,6 +373,9 @@ class huobi(ccxt.async_support.huobi):
|
|
372
373
|
sequence = self.safe_integer(tick, 'seqNum')
|
373
374
|
nonce = self.safe_integer(data, 'seqNum')
|
374
375
|
snapshot['nonce'] = nonce
|
376
|
+
timestamp = self.safe_integer(message, 'ts')
|
377
|
+
snapshot['timestamp'] = timestamp
|
378
|
+
snapshot['datetime'] = self.iso8601(timestamp)
|
375
379
|
snapshotLimit = self.safe_integer(subscription, 'limit')
|
376
380
|
snapshotOrderBook = self.order_book(snapshot, snapshotLimit)
|
377
381
|
client.resolve(snapshotOrderBook, id)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 4.1.
|
3
|
+
Version: 4.1.30
|
4
4
|
Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges
|
5
5
|
Home-page: https://ccxt.com
|
6
6
|
Author: Igor Kroitor
|
@@ -254,13 +254,13 @@ console.log(version, Object.keys(exchanges));
|
|
254
254
|
|
255
255
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
256
256
|
|
257
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
258
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
257
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.30/dist/ccxt.browser.js
|
258
|
+
* unpkg: https://unpkg.com/ccxt@4.1.30/dist/ccxt.browser.js
|
259
259
|
|
260
260
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
261
261
|
|
262
262
|
```HTML
|
263
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
263
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.30/dist/ccxt.browser.js"></script>
|
264
264
|
```
|
265
265
|
|
266
266
|
Creates a global `ccxt` object:
|