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/async_support/gate.py
CHANGED
@@ -1537,6 +1537,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1537
1537
|
async def fetch_currencies(self, params={}):
|
1538
1538
|
"""
|
1539
1539
|
fetches all available currencies on an exchange
|
1540
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details
|
1540
1541
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1541
1542
|
:returns dict: an associative dictionary of currencies
|
1542
1543
|
"""
|
@@ -1642,6 +1643,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1642
1643
|
async def fetch_funding_rate(self, symbol: str, params={}):
|
1643
1644
|
"""
|
1644
1645
|
fetch the current funding rate
|
1646
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
|
1645
1647
|
:param str symbol: unified market symbol
|
1646
1648
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1647
1649
|
:returns dict: a `funding rate structure <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure>`
|
@@ -1701,6 +1703,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1701
1703
|
async def fetch_funding_rates(self, symbols: Optional[List[str]] = None, params={}):
|
1702
1704
|
"""
|
1703
1705
|
fetch the funding rate for multiple markets
|
1706
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
1704
1707
|
:param str[]|None symbols: list of unified market symbols
|
1705
1708
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1706
1709
|
:returns dict: a dictionary of `funding rates structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure>`, indexe by market symbols
|
@@ -2141,6 +2144,8 @@ class gate(Exchange, ImplicitAPI):
|
|
2141
2144
|
async def fetch_funding_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2142
2145
|
"""
|
2143
2146
|
fetch the history of funding payments paid and received on self account
|
2147
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
|
2148
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
|
2144
2149
|
:param str symbol: unified market symbol
|
2145
2150
|
:param int [since]: the earliest time in ms to fetch funding history for
|
2146
2151
|
:param int [limit]: the maximum number of funding history structures to retrieve
|
@@ -2796,6 +2801,7 @@ class gate(Exchange, ImplicitAPI):
|
|
2796
2801
|
async def fetch_funding_rate_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2797
2802
|
"""
|
2798
2803
|
fetches historical funding rate prices
|
2804
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history
|
2799
2805
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
2800
2806
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
2801
2807
|
:param int [limit]: the maximum amount of `funding rate structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure>` to fetch
|
@@ -2881,6 +2887,10 @@ class gate(Exchange, ImplicitAPI):
|
|
2881
2887
|
async def fetch_trades(self, symbol: str, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2882
2888
|
"""
|
2883
2889
|
get the list of most recent trades for a particular symbol
|
2890
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades
|
2891
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history
|
2892
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2
|
2893
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#options-trade-history
|
2884
2894
|
:param str symbol: unified symbol of the market to fetch trades for
|
2885
2895
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
2886
2896
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -2978,6 +2988,10 @@ class gate(Exchange, ImplicitAPI):
|
|
2978
2988
|
async def fetch_order_trades(self, id: str, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2979
2989
|
"""
|
2980
2990
|
fetch all the trades made from a single order
|
2991
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
|
2992
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
|
2993
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
|
2994
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
|
2981
2995
|
:param str id: order id
|
2982
2996
|
:param str symbol: unified market symbol
|
2983
2997
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -3279,6 +3293,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3279
3293
|
async def fetch_deposits(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3280
3294
|
"""
|
3281
3295
|
fetch all deposits made to an account
|
3296
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records
|
3282
3297
|
:param str code: unified currency code
|
3283
3298
|
:param int [since]: the earliest time in ms to fetch deposits for
|
3284
3299
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
@@ -3310,6 +3325,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3310
3325
|
async def fetch_withdrawals(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3311
3326
|
"""
|
3312
3327
|
fetch all withdrawals made from an account
|
3328
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records
|
3313
3329
|
:param str code: unified currency code
|
3314
3330
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
3315
3331
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
@@ -3341,6 +3357,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3341
3357
|
async def withdraw(self, code: str, amount, address, tag=None, params={}):
|
3342
3358
|
"""
|
3343
3359
|
make a withdrawal
|
3360
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#withdraw
|
3344
3361
|
:param str code: unified currency code
|
3345
3362
|
:param float amount: the amount to withdraw
|
3346
3363
|
:param str address: the address to withdraw to
|
@@ -3478,6 +3495,13 @@ class gate(Exchange, ImplicitAPI):
|
|
3478
3495
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
|
3479
3496
|
"""
|
3480
3497
|
Create an order on the exchange
|
3498
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-an-order
|
3499
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order
|
3500
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
|
3501
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2
|
3502
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
|
3503
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3
|
3504
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
|
3481
3505
|
:param str symbol: Unified CCXT market symbol
|
3482
3506
|
:param str type: 'limit' or 'market' *"market" is contract only*
|
3483
3507
|
:param str side: 'buy' or 'sell'
|
@@ -4205,6 +4229,7 @@ class gate(Exchange, ImplicitAPI):
|
|
4205
4229
|
async def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4206
4230
|
"""
|
4207
4231
|
fetch all unfilled currently open orders
|
4232
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
|
4208
4233
|
:param str symbol: unified market symbol
|
4209
4234
|
:param int [since]: the earliest time in ms to fetch open orders for
|
4210
4235
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -4219,6 +4244,13 @@ class gate(Exchange, ImplicitAPI):
|
|
4219
4244
|
async def fetch_closed_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4220
4245
|
"""
|
4221
4246
|
fetches information on multiple closed orders made by the user
|
4247
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-orders
|
4248
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
4249
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders
|
4250
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders
|
4251
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
|
4252
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
|
4253
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
|
4222
4254
|
:param str symbol: unified market symbol of the market orders were made in
|
4223
4255
|
:param int [since]: the earliest time in ms to fetch orders for
|
4224
4256
|
:param int [limit]: the maximum number of orde structures to retrieve
|
@@ -4418,6 +4450,10 @@ class gate(Exchange, ImplicitAPI):
|
|
4418
4450
|
async def cancel_order(self, id: str, symbol: Optional[str] = None, params={}):
|
4419
4451
|
"""
|
4420
4452
|
Cancels an open order
|
4453
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order
|
4454
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2
|
4455
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3
|
4456
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4
|
4421
4457
|
:param str id: Order id
|
4422
4458
|
:param str symbol: Unified market symbol
|
4423
4459
|
:param dict [params]: Parameters specified by the exchange api
|
@@ -4526,6 +4562,10 @@ class gate(Exchange, ImplicitAPI):
|
|
4526
4562
|
async def cancel_all_orders(self, symbol: Optional[str] = None, params={}):
|
4527
4563
|
"""
|
4528
4564
|
cancel all open orders
|
4565
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
|
4566
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched
|
4567
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
|
4568
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
|
4529
4569
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
4530
4570
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
4531
4571
|
:returns dict[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
@@ -4646,6 +4686,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4646
4686
|
async def set_leverage(self, leverage, symbol: Optional[str] = None, params={}):
|
4647
4687
|
"""
|
4648
4688
|
set the level of leverage for a market
|
4689
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage
|
4690
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2
|
4649
4691
|
:param float leverage: the rate of leverage
|
4650
4692
|
:param str symbol: unified market symbol
|
4651
4693
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
@@ -4984,6 +5026,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4984
5026
|
async def fetch_leverage_tiers(self, symbols: Optional[List[str]] = None, params={}):
|
4985
5027
|
"""
|
4986
5028
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
5029
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
5030
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
4987
5031
|
:param str[]|None symbols: list of unified market symbols
|
4988
5032
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
4989
5033
|
:returns dict: a dictionary of `leverage tiers structures <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`, indexed by market symbols
|
@@ -5234,11 +5278,11 @@ class gate(Exchange, ImplicitAPI):
|
|
5234
5278
|
'currency': currency['id'],
|
5235
5279
|
'amount': self.currency_to_precision(code, amount),
|
5236
5280
|
}
|
5237
|
-
|
5281
|
+
response = None
|
5282
|
+
params = self.omit(params, ['marginMode'])
|
5238
5283
|
if symbol is None:
|
5239
|
-
|
5284
|
+
response = await self.privateMarginPostCrossRepayments(self.extend(request, params))
|
5240
5285
|
else:
|
5241
|
-
method = 'privateMarginPostLoansLoanIdRepayment'
|
5242
5286
|
market = self.market(symbol)
|
5243
5287
|
request['currency_pair'] = market['id']
|
5244
5288
|
request['mode'] = 'partial'
|
@@ -5246,8 +5290,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5246
5290
|
if loanId is None:
|
5247
5291
|
raise ArgumentsRequired(self.id + ' repayMargin() requires loan_id param for isolated margin')
|
5248
5292
|
request['loan_id'] = loanId
|
5249
|
-
|
5250
|
-
|
5293
|
+
params = self.omit(params, ['loan_id', 'id'])
|
5294
|
+
response = await self.privateMarginPostLoansLoanIdRepayment(self.extend(request, params))
|
5251
5295
|
#
|
5252
5296
|
# Cross
|
5253
5297
|
#
|
@@ -5311,9 +5355,9 @@ class gate(Exchange, ImplicitAPI):
|
|
5311
5355
|
'currency': currency['id'],
|
5312
5356
|
'amount': self.currency_to_precision(code, amount),
|
5313
5357
|
}
|
5314
|
-
|
5358
|
+
response = None
|
5315
5359
|
if symbol is None:
|
5316
|
-
|
5360
|
+
response = await self.privateMarginPostCrossLoans(self.extend(request, params))
|
5317
5361
|
else:
|
5318
5362
|
market = self.market(symbol)
|
5319
5363
|
request['currency_pair'] = market['id']
|
@@ -5322,9 +5366,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5322
5366
|
# is the smallest tick size currently offered by gateio
|
5323
5367
|
request['rate'] = self.safe_string(params, 'rate', '0.0001')
|
5324
5368
|
request['auto_renew'] = True
|
5325
|
-
|
5326
|
-
|
5327
|
-
response = await getattr(self, method)(self.extend(request, params))
|
5369
|
+
params = self.omit(params, ['rate'])
|
5370
|
+
response = await self.privateMarginPostLoans(self.extend(request, params))
|
5328
5371
|
#
|
5329
5372
|
# Cross
|
5330
5373
|
#
|
@@ -5532,6 +5575,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5532
5575
|
async def reduce_margin(self, symbol: str, amount, params={}):
|
5533
5576
|
"""
|
5534
5577
|
remove margin from a position
|
5578
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
5579
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
5535
5580
|
:param str symbol: unified market symbol
|
5536
5581
|
:param float amount: the amount of margin to remove
|
5537
5582
|
:param dict [params]: extra parameters specific to the exmo api endpoint
|
@@ -5542,6 +5587,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5542
5587
|
async def add_margin(self, symbol: str, amount, params={}):
|
5543
5588
|
"""
|
5544
5589
|
add margin
|
5590
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
5591
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
5545
5592
|
:param str symbol: unified market symbol
|
5546
5593
|
:param float amount: amount of margin to add
|
5547
5594
|
:param dict [params]: extra parameters specific to the exmo api endpoint
|
@@ -6041,6 +6088,7 @@ class gate(Exchange, ImplicitAPI):
|
|
6041
6088
|
async def fetch_underlying_assets(self, params={}):
|
6042
6089
|
"""
|
6043
6090
|
fetches the market ids of underlying assets for a specific contract market type
|
6091
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings
|
6044
6092
|
:param dict [params]: exchange specific params
|
6045
6093
|
:param str [params.type]: the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
6046
6094
|
:returns dict[]: a list of `underlying assets <https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure>`
|
ccxt/async_support/huobi.py
CHANGED
@@ -1069,7 +1069,6 @@ class huobi(Exchange, ImplicitAPI):
|
|
1069
1069
|
'GET': 'Themis', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
|
1070
1070
|
'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
|
1071
1071
|
'HIT': 'HitChain',
|
1072
|
-
'HOT': 'Hydro Protocol', # conflict with HOT(Holo) https://github.com/ccxt/ccxt/issues/4929
|
1073
1072
|
# https://github.com/ccxt/ccxt/issues/7399
|
1074
1073
|
# https://coinmarketcap.com/currencies/pnetwork/
|
1075
1074
|
# https://coinmarketcap.com/currencies/penta/markets/
|
ccxt/async_support/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/
|
@@ -413,6 +413,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
413
413
|
|
414
414
|
async 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
|
async 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
|
await self.load_markets()
|
463
471
|
response = await self.publicGetTickers(params)
|
464
472
|
#
|
@@ -645,6 +653,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
645
653
|
|
646
654
|
async 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
|
async 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
|
async 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
|
async 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
|
async 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
|
async 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
|
await 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
|
async 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
|
async 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
|
await 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
|
async 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
|
async 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
|
await self.load_markets()
|
1880
1922
|
response = await self.publicGetInstruments(params)
|
1881
1923
|
#
|
@@ -2045,6 +2087,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2045
2087
|
|
2046
2088
|
async 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/async_support/mexc.py
CHANGED
@@ -7,6 +7,7 @@ from ccxt.async_support.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 await self.create_swap_order(market, type, side, amount, price, marginMode, query)
|
2008
2010
|
|
2009
|
-
|
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
|
+
async def create_spot_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2050
|
+
await 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 = await self.spotPrivatePostMarginOrder(self.extend(request, params))
|
2055
|
+
else:
|
2056
|
+
response = await 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
|
+
async 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
|
+
await 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 = await 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
|
async 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/async_support/okx.py
CHANGED
ccxt/async_support/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
|