ccxt 4.2.64__py2.py3-none-any.whl → 4.2.65__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/abstract/blofin.py +1 -0
- ccxt/abstract/kucoin.py +9 -0
- ccxt/abstract/kucoinfutures.py +9 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +2 -2
- ccxt/async_support/binance.py +26 -4
- ccxt/async_support/bingx.py +11 -4
- ccxt/async_support/bitmex.py +2 -1
- ccxt/async_support/blofin.py +34 -1
- ccxt/async_support/btcmarkets.py +9 -0
- ccxt/async_support/coinbase.py +9 -2
- ccxt/async_support/delta.py +92 -2
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/kucoin.py +84 -61
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/woo.py +1 -1
- ccxt/base/exchange.py +14 -3
- ccxt/binance.py +26 -4
- ccxt/bingx.py +11 -4
- ccxt/bitmex.py +2 -1
- ccxt/blofin.py +34 -1
- ccxt/btcmarkets.py +9 -0
- ccxt/coinbase.py +9 -2
- ccxt/delta.py +92 -2
- ccxt/gate.py +1 -1
- ccxt/kucoin.py +84 -61
- ccxt/okx.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/currencycom.py +1 -1
- ccxt/static_dependencies/ethereum/utils/__init__.py +0 -6
- ccxt/static_dependencies/ethereum/utils/curried/__init__.py +0 -4
- ccxt/test/base/test_shared_methods.py +1 -1
- ccxt/woo.py +1 -1
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/METADATA +4 -4
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/RECORD +38 -41
- ccxt/static_dependencies/ethereum/utils/__json/eth_networks.json +0 -1
- ccxt/static_dependencies/ethereum/utils/network.py +0 -88
- ccxt-4.2.64.data/data/ccxt/eth_networks.json +0 -1
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/WHEEL +0 -0
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/blofin.py
CHANGED
@@ -19,6 +19,7 @@ class ImplicitAPI:
|
|
19
19
|
private_get_account_balance = privateGetAccountBalance = Entry('account/balance', 'private', 'GET', {'cost': 1})
|
20
20
|
private_get_account_positions = privateGetAccountPositions = Entry('account/positions', 'private', 'GET', {'cost': 1})
|
21
21
|
private_get_account_leverage_info = privateGetAccountLeverageInfo = Entry('account/leverage-info', 'private', 'GET', {'cost': 1})
|
22
|
+
private_get_account_margin_mode = privateGetAccountMarginMode = Entry('account/margin-mode', 'private', 'GET', {'cost': 1})
|
22
23
|
private_get_account_batch_leverage_info = privateGetAccountBatchLeverageInfo = Entry('account/batch-leverage-info', 'private', 'GET', {'cost': 1})
|
23
24
|
private_get_trade_orders_tpsl_pending = privateGetTradeOrdersTpslPending = Entry('trade/orders-tpsl-pending', 'private', 'GET', {'cost': 1})
|
24
25
|
private_get_trade_orders_history = privateGetTradeOrdersHistory = Entry('trade/orders-history', 'private', 'GET', {'cost': 1})
|
ccxt/abstract/kucoin.py
CHANGED
@@ -188,3 +188,12 @@ class ImplicitAPI:
|
|
188
188
|
futuresprivate_delete_orders = futuresPrivateDeleteOrders = Entry('orders', 'futuresPrivate', 'DELETE', {'cost': 45})
|
189
189
|
futuresprivate_delete_stoporders = futuresPrivateDeleteStopOrders = Entry('stopOrders', 'futuresPrivate', 'DELETE', {'cost': 22.5})
|
190
190
|
webexchange_get_currency_currency_chain_info = webExchangeGetCurrencyCurrencyChainInfo = Entry('currency/currency/chain-info', 'webExchange', 'GET', {'cost': 1})
|
191
|
+
broker_get_broker_nd_info = brokerGetBrokerNdInfo = Entry('broker/nd/info', 'broker', 'GET', {'cost': 2})
|
192
|
+
broker_get_broker_nd_account = brokerGetBrokerNdAccount = Entry('broker/nd/account', 'broker', 'GET', {'cost': 2})
|
193
|
+
broker_get_broker_nd_account_apikey = brokerGetBrokerNdAccountApikey = Entry('broker/nd/account/apikey', 'broker', 'GET', {'cost': 2})
|
194
|
+
broker_get_broker_nd_rebase_download = brokerGetBrokerNdRebaseDownload = Entry('broker/nd/rebase/download', 'broker', 'GET', {'cost': 3})
|
195
|
+
broker_post_broker_nd_transfer = brokerPostBrokerNdTransfer = Entry('broker/nd/transfer', 'broker', 'POST', {'cost': 1})
|
196
|
+
broker_post_broker_nd_account = brokerPostBrokerNdAccount = Entry('broker/nd/account', 'broker', 'POST', {'cost': 3})
|
197
|
+
broker_post_broker_nd_account_apikey = brokerPostBrokerNdAccountApikey = Entry('broker/nd/account/apikey', 'broker', 'POST', {'cost': 3})
|
198
|
+
broker_post_broker_nd_account_update_apikey = brokerPostBrokerNdAccountUpdateApikey = Entry('broker/nd/account/update-apikey', 'broker', 'POST', {'cost': 3})
|
199
|
+
broker_delete_broker_nd_account_apikey = brokerDeleteBrokerNdAccountApikey = Entry('broker/nd/account/apikey', 'broker', 'DELETE', {'cost': 3})
|
ccxt/abstract/kucoinfutures.py
CHANGED
@@ -205,3 +205,12 @@ class ImplicitAPI:
|
|
205
205
|
futuresprivate_delete_sub_api_key = futuresPrivateDeleteSubApiKey = Entry('sub/api-key', 'futuresPrivate', 'DELETE', {'cost': 1})
|
206
206
|
webexchange_get_currency_currency_chain_info = webExchangeGetCurrencyCurrencyChainInfo = Entry('currency/currency/chain-info', 'webExchange', 'GET', {'cost': 1})
|
207
207
|
webexchange_get_contract_symbol_funding_rates = webExchangeGetContractSymbolFundingRates = Entry('contract/{symbol}/funding-rates', 'webExchange', 'GET', {'cost': 1})
|
208
|
+
broker_get_broker_nd_info = brokerGetBrokerNdInfo = Entry('broker/nd/info', 'broker', 'GET', {'cost': 2})
|
209
|
+
broker_get_broker_nd_account = brokerGetBrokerNdAccount = Entry('broker/nd/account', 'broker', 'GET', {'cost': 2})
|
210
|
+
broker_get_broker_nd_account_apikey = brokerGetBrokerNdAccountApikey = Entry('broker/nd/account/apikey', 'broker', 'GET', {'cost': 2})
|
211
|
+
broker_get_broker_nd_rebase_download = brokerGetBrokerNdRebaseDownload = Entry('broker/nd/rebase/download', 'broker', 'GET', {'cost': 3})
|
212
|
+
broker_post_broker_nd_transfer = brokerPostBrokerNdTransfer = Entry('broker/nd/transfer', 'broker', 'POST', {'cost': 1})
|
213
|
+
broker_post_broker_nd_account = brokerPostBrokerNdAccount = Entry('broker/nd/account', 'broker', 'POST', {'cost': 3})
|
214
|
+
broker_post_broker_nd_account_apikey = brokerPostBrokerNdAccountApikey = Entry('broker/nd/account/apikey', 'broker', 'POST', {'cost': 3})
|
215
|
+
broker_post_broker_nd_account_update_apikey = brokerPostBrokerNdAccountUpdateApikey = Entry('broker/nd/account/update-apikey', 'broker', 'POST', {'cost': 3})
|
216
|
+
broker_delete_broker_nd_account_apikey = brokerDeleteBrokerNdAccountApikey = Entry('broker/nd/account/apikey', 'broker', 'DELETE', {'cost': 3})
|
ccxt/async_support/__init__.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.2.
|
5
|
+
__version__ = '4.2.65'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -944,7 +944,7 @@ class Exchange(BaseExchange):
|
|
944
944
|
await self.load_markets()
|
945
945
|
if not self.has['fetchBorrowRates']:
|
946
946
|
raise NotSupported(self.id + ' fetchIsolatedBorrowRate() is not supported yet')
|
947
|
-
borrowRates = await self.
|
947
|
+
borrowRates = await self.fetch_isolated_borrow_rates(params)
|
948
948
|
rate = self.safe_dict(borrowRates, symbol)
|
949
949
|
if rate is None:
|
950
950
|
raise ExchangeError(self.id + ' fetchIsolatedBorrowRate() could not find the borrow rate for market symbol ' + symbol)
|
ccxt/async_support/binance.py
CHANGED
@@ -2375,7 +2375,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2375
2375
|
else:
|
2376
2376
|
return subType == 'linear'
|
2377
2377
|
|
2378
|
-
def set_sandbox_mode(self, enable):
|
2378
|
+
def set_sandbox_mode(self, enable: bool):
|
2379
2379
|
super(binance, self).set_sandbox_mode(enable)
|
2380
2380
|
self.options['sandboxMode'] = enable
|
2381
2381
|
|
@@ -2522,6 +2522,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2522
2522
|
:see: https://binance-docs.github.io/apidocs/futures/en/#check-server-time # swap
|
2523
2523
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#check-server-time # future
|
2524
2524
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2525
|
+
:param str [params.subType]: "linear" or "inverse"
|
2525
2526
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
2526
2527
|
"""
|
2527
2528
|
defaultType = self.safe_string_2(self.options, 'fetchTime', 'defaultType', 'spot')
|
@@ -3252,6 +3253,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3252
3253
|
:param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None
|
3253
3254
|
:param str[]|None [params.symbols]: unified market symbols, only used in isolated margin mode
|
3254
3255
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch the balance for a portfolio margin account
|
3256
|
+
:param str [params.subType]: "linear" or "inverse"
|
3255
3257
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
3256
3258
|
"""
|
3257
3259
|
await self.load_markets()
|
@@ -3792,6 +3794,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3792
3794
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#symbol-order-book-ticker # future
|
3793
3795
|
:param str[]|None symbols: unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
3794
3796
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3797
|
+
:param str [params.subType]: "linear" or "inverse"
|
3795
3798
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
3796
3799
|
"""
|
3797
3800
|
await self.load_markets()
|
@@ -3825,6 +3828,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3825
3828
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker # future
|
3826
3829
|
:param str[]|None symbols: unified symbols of the markets to fetch the last prices
|
3827
3830
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3831
|
+
:param str [params.subType]: "linear" or "inverse"
|
3828
3832
|
:returns dict: a dictionary of lastprices structures
|
3829
3833
|
"""
|
3830
3834
|
await self.load_markets()
|
@@ -3924,6 +3928,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3924
3928
|
:see: https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics # option
|
3925
3929
|
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
3926
3930
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3931
|
+
:param str [params.subType]: "linear" or "inverse"
|
3927
3932
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
3928
3933
|
"""
|
3929
3934
|
await self.load_markets()
|
@@ -6103,6 +6108,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6103
6108
|
:param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading
|
6104
6109
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch open orders in the portfolio margin account
|
6105
6110
|
:param boolean [params.stop]: set to True if you would like to fetch portfolio margin account conditional orders
|
6111
|
+
:param str [params.subType]: "linear" or "inverse"
|
6106
6112
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
6107
6113
|
"""
|
6108
6114
|
await self.load_markets()
|
@@ -8019,6 +8025,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8019
8025
|
:param str symbol: unified market symbol
|
8020
8026
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8021
8027
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch trading fees in a portfolio margin account
|
8028
|
+
:param str [params.subType]: "linear" or "inverse"
|
8022
8029
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
8023
8030
|
"""
|
8024
8031
|
await self.load_markets()
|
@@ -8077,6 +8084,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8077
8084
|
:see: https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
8078
8085
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
8079
8086
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8087
|
+
:param str [params.subType]: "linear" or "inverse"
|
8080
8088
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
8081
8089
|
"""
|
8082
8090
|
await self.load_markets()
|
@@ -8312,6 +8320,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8312
8320
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8313
8321
|
:param int [params.until]: timestamp in ms of the latest funding rate
|
8314
8322
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
8323
|
+
:param str [params.subType]: "linear" or "inverse"
|
8315
8324
|
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
8316
8325
|
"""
|
8317
8326
|
await self.load_markets()
|
@@ -8374,6 +8383,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8374
8383
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
8375
8384
|
:param str[]|None symbols: list of unified market symbols
|
8376
8385
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8386
|
+
:param str [params.subType]: "linear" or "inverse"
|
8377
8387
|
:returns dict: a dictionary of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
|
8378
8388
|
"""
|
8379
8389
|
await self.load_markets()
|
@@ -8944,6 +8954,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8944
8954
|
:param str[]|None symbols: list of unified market symbols
|
8945
8955
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8946
8956
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch the leverage tiers for a portfolio margin account
|
8957
|
+
:param str [params.subType]: "linear" or "inverse"
|
8947
8958
|
:returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
|
8948
8959
|
"""
|
8949
8960
|
await self.load_markets()
|
@@ -9230,6 +9241,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9230
9241
|
:param str[]|None symbols: list of unified market symbols
|
9231
9242
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
9232
9243
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch positions in a portfolio margin account
|
9244
|
+
:param str [params.subType]: "linear" or "inverse"
|
9233
9245
|
:returns dict: data on account positions
|
9234
9246
|
"""
|
9235
9247
|
if symbols is not None:
|
@@ -9272,6 +9284,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9272
9284
|
:param str[]|None symbols: list of unified market symbols
|
9273
9285
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
9274
9286
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch positions for a portfolio margin account
|
9287
|
+
:param str [params.subType]: "linear" or "inverse"
|
9275
9288
|
:returns dict: data on the positions risk
|
9276
9289
|
"""
|
9277
9290
|
if symbols is not None:
|
@@ -9418,6 +9431,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9418
9431
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
9419
9432
|
:param int [params.until]: timestamp in ms of the latest funding history entry
|
9420
9433
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch the funding history for a portfolio margin account
|
9434
|
+
:param str [params.subType]: "linear" or "inverse"
|
9421
9435
|
:returns dict: a `funding history structure <https://docs.ccxt.com/#/?id=funding-history-structure>`
|
9422
9436
|
"""
|
9423
9437
|
await self.load_markets()
|
@@ -9564,6 +9578,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9564
9578
|
:param str symbol: not used by binance setPositionMode()
|
9565
9579
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
9566
9580
|
:param boolean [params.portfolioMargin]: set to True if you would like to set the position mode for a portfolio margin account
|
9581
|
+
:param str [params.subType]: "linear" or "inverse"
|
9567
9582
|
:returns dict: response from the exchange
|
9568
9583
|
"""
|
9569
9584
|
defaultType = self.safe_string(self.options, 'defaultType', 'future')
|
@@ -9587,11 +9602,13 @@ class binance(Exchange, ImplicitAPI):
|
|
9587
9602
|
response = await self.papiPostCmPositionSideDual(self.extend(request, params))
|
9588
9603
|
else:
|
9589
9604
|
response = await self.dapiPrivatePostPositionSideDual(self.extend(request, params))
|
9590
|
-
|
9605
|
+
elif self.is_linear(type, subType):
|
9591
9606
|
if isPortfolioMargin:
|
9592
9607
|
response = await self.papiPostUmPositionSideDual(self.extend(request, params))
|
9593
9608
|
else:
|
9594
9609
|
response = await self.fapiPrivatePostPositionSideDual(self.extend(request, params))
|
9610
|
+
else:
|
9611
|
+
raise BadRequest(self.id + ' setPositionMode() supports linear and inverse contracts only')
|
9595
9612
|
#
|
9596
9613
|
# {
|
9597
9614
|
# "code": 200,
|
@@ -9609,6 +9626,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9609
9626
|
:see: https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
|
9610
9627
|
:param str[] [symbols]: a list of unified market symbols
|
9611
9628
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
9629
|
+
:param str [params.subType]: "linear" or "inverse"
|
9612
9630
|
:returns dict: a list of `leverage structures <https://docs.ccxt.com/#/?id=leverage-structure>`
|
9613
9631
|
"""
|
9614
9632
|
await self.load_markets()
|
@@ -9856,6 +9874,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9856
9874
|
:param int [params.until]: timestamp in ms of the latest ledger entry
|
9857
9875
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
9858
9876
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch the ledger for a portfolio margin account
|
9877
|
+
:param str [params.subType]: "linear" or "inverse"
|
9859
9878
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
9860
9879
|
"""
|
9861
9880
|
await self.load_markets()
|
@@ -10855,6 +10874,8 @@ class binance(Exchange, ImplicitAPI):
|
|
10855
10874
|
:param int [params.until]: timestamp in ms of the latest liquidation
|
10856
10875
|
:param boolean [params.paginate]: *spot only* default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
10857
10876
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch liquidations in a portfolio margin account
|
10877
|
+
:param str [params.type]: "spot"
|
10878
|
+
:param str [params.subType]: "linear" or "inverse"
|
10858
10879
|
:returns dict: an array of `liquidation structures <https://docs.ccxt.com/#/?id=liquidation-structure>`
|
10859
10880
|
"""
|
10860
10881
|
await self.load_markets()
|
@@ -11155,8 +11176,8 @@ class binance(Exchange, ImplicitAPI):
|
|
11155
11176
|
"""
|
11156
11177
|
fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
11157
11178
|
:param str symbol: unified symbol of the market to fetch the order book for
|
11158
|
-
:param dict params: extra parameters specific to the exchange API endpoint
|
11159
|
-
:param str params
|
11179
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
11180
|
+
:param str [params.subType]: "linear" or "inverse"
|
11160
11181
|
:returns dict: an object detailing whether the market is in hedged or one-way mode
|
11161
11182
|
"""
|
11162
11183
|
market = None
|
@@ -11188,6 +11209,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11188
11209
|
:see: https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
11189
11210
|
:param str symbol: unified symbol of the market the order was made in
|
11190
11211
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
11212
|
+
:param str [params.subType]: "linear" or "inverse"
|
11191
11213
|
:returns dict: a list of `margin mode structures <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
11192
11214
|
"""
|
11193
11215
|
await self.load_markets()
|
ccxt/async_support/bingx.py
CHANGED
@@ -1770,6 +1770,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1770
1770
|
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
1771
1771
|
trailingAmount = self.safe_string(params, 'trailingAmount')
|
1772
1772
|
trailingPercent = self.safe_string_2(params, 'trailingPercent', 'priceRate')
|
1773
|
+
trailingType = self.safe_string(params, 'trailingType', 'TRAILING_STOP_MARKET')
|
1773
1774
|
isTriggerOrder = triggerPrice is not None
|
1774
1775
|
isStopLossPriceOrder = stopLossPrice is not None
|
1775
1776
|
isTakeProfitPriceOrder = takeProfitPrice is not None
|
@@ -1805,7 +1806,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1805
1806
|
elif (type == 'LIMIT') or (type == 'TAKE_PROFIT'):
|
1806
1807
|
request['type'] = 'TAKE_PROFIT'
|
1807
1808
|
elif isTrailing:
|
1808
|
-
request['type'] =
|
1809
|
+
request['type'] = trailingType
|
1809
1810
|
if isTrailingAmountOrder:
|
1810
1811
|
request['price'] = self.parse_to_numeric(trailingAmount)
|
1811
1812
|
elif isTrailingPercentOrder:
|
@@ -1850,7 +1851,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1850
1851
|
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
1851
1852
|
request['positionSide'] = positionSide
|
1852
1853
|
request['quantity'] = self.parse_to_numeric(self.amount_to_precision(symbol, amount))
|
1853
|
-
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
1854
|
+
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
1854
1855
|
return self.extend(request, params)
|
1855
1856
|
|
1856
1857
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
|
@@ -1878,14 +1879,20 @@ class bingx(Exchange, ImplicitAPI):
|
|
1878
1879
|
:param float [params.takeProfit.triggerPrice]: take profit trigger price
|
1879
1880
|
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
1880
1881
|
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
1882
|
+
:param boolean [params.test]: *swap only* whether to use the test endpoint or not, default is False
|
1881
1883
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1882
1884
|
"""
|
1883
1885
|
await self.load_markets()
|
1884
1886
|
market = self.market(symbol)
|
1887
|
+
test = self.safe_bool(params, 'test', False)
|
1888
|
+
params = self.omit(params, 'test')
|
1885
1889
|
request = self.create_order_request(symbol, type, side, amount, price, params)
|
1886
1890
|
response = None
|
1887
1891
|
if market['swap']:
|
1888
|
-
|
1892
|
+
if test:
|
1893
|
+
response = await self.swapV2PrivatePostTradeOrderTest(request)
|
1894
|
+
else:
|
1895
|
+
response = await self.swapV2PrivatePostTradeOrder(request)
|
1889
1896
|
else:
|
1890
1897
|
response = await self.spotV1PrivatePostTradeOrder(request)
|
1891
1898
|
#
|
@@ -3792,7 +3799,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3792
3799
|
:param str [params.newClientOrderId]: custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId.
|
3793
3800
|
:param str [params.positionSide]: *contract only* position direction, required for single position, for both long and short positions only LONG or SHORT can be chosen, defaults to LONG if empty
|
3794
3801
|
:param str [params.reduceOnly]: *contract only* True or False, default=false for single position mode. self parameter is not accepted for both long and short positions mode
|
3795
|
-
:param float [params.priceRate]: *contract only* for type TRAILING_STOP_Market, Max = 1
|
3802
|
+
:param float [params.priceRate]: *contract only* for type TRAILING_STOP_Market or TRAILING_TP_SL, Max = 1
|
3796
3803
|
:param str [params.workingType]: *contract only* StopPrice trigger price types, MARK_PRICE(default), CONTRACT_PRICE, or INDEX_PRICE
|
3797
3804
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3798
3805
|
"""
|
ccxt/async_support/bitmex.py
CHANGED
@@ -2388,7 +2388,8 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2388
2388
|
params = self.omit(params, ['until', 'till'])
|
2389
2389
|
if until is not None:
|
2390
2390
|
request['endTime'] = self.iso8601(until)
|
2391
|
-
|
2391
|
+
if (since is None) and (until is None):
|
2392
|
+
request['reverse'] = True
|
2392
2393
|
response = await self.publicGetFunding(self.extend(request, params))
|
2393
2394
|
#
|
2394
2395
|
# [
|
ccxt/async_support/blofin.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.blofin import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Order, TransferEntry, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, MarginMode, Market, Order, TransferEntry, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -91,6 +91,8 @@ class blofin(Exchange, ImplicitAPI):
|
|
91
91
|
'fetchLeverage': True,
|
92
92
|
'fetchLeverages': True,
|
93
93
|
'fetchLeverageTiers': False,
|
94
|
+
'fetchMarginMode': True,
|
95
|
+
'fetchMarginModes': False,
|
94
96
|
'fetchMarketLeverageTiers': False,
|
95
97
|
'fetchMarkets': True,
|
96
98
|
'fetchMarkOHLCV': False,
|
@@ -194,6 +196,7 @@ class blofin(Exchange, ImplicitAPI):
|
|
194
196
|
'account/balance': 1,
|
195
197
|
'account/positions': 1,
|
196
198
|
'account/leverage-info': 1,
|
199
|
+
'account/margin-mode': 1,
|
197
200
|
'account/batch-leverage-info': 1,
|
198
201
|
'trade/orders-tpsl-pending': 1,
|
199
202
|
'trade/orders-history': 1,
|
@@ -1954,6 +1957,36 @@ class blofin(Exchange, ImplicitAPI):
|
|
1954
1957
|
data = self.safe_list(response, 'data', [])
|
1955
1958
|
return self.parse_orders(data, market, since, limit)
|
1956
1959
|
|
1960
|
+
async def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
|
1961
|
+
"""
|
1962
|
+
fetches the margin mode of a trading pair
|
1963
|
+
:see: https://docs.blofin.com/index.html#get-margin-mode
|
1964
|
+
:param str symbol: unified symbol of the market to fetch the margin mode for
|
1965
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1966
|
+
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
1967
|
+
"""
|
1968
|
+
await self.load_markets()
|
1969
|
+
market = self.market(symbol)
|
1970
|
+
response = await self.privateGetAccountMarginMode(params)
|
1971
|
+
#
|
1972
|
+
# {
|
1973
|
+
# "code": "0",
|
1974
|
+
# "msg": "success",
|
1975
|
+
# "data": {
|
1976
|
+
# "marginMode": "cross"
|
1977
|
+
# }
|
1978
|
+
# }
|
1979
|
+
#
|
1980
|
+
data = self.safe_dict(response, 'data', {})
|
1981
|
+
return self.parse_margin_mode(data, market)
|
1982
|
+
|
1983
|
+
def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
|
1984
|
+
return {
|
1985
|
+
'info': marginMode,
|
1986
|
+
'symbol': market['symbol'],
|
1987
|
+
'marginMode': self.safe_string(marginMode, 'marginMode'),
|
1988
|
+
}
|
1989
|
+
|
1957
1990
|
def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
1958
1991
|
if response is None:
|
1959
1992
|
return None # fallback to default error handler
|
ccxt/async_support/btcmarkets.py
CHANGED
@@ -870,6 +870,15 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
870
870
|
return await self.privateDeleteOrdersId(self.extend(request, params))
|
871
871
|
|
872
872
|
def calculate_fee(self, symbol, type, side, amount, price, takerOrMaker='taker', params={}):
|
873
|
+
"""
|
874
|
+
calculates the presumptive fee that would be charged for an order
|
875
|
+
:param str symbol: unified market symbol
|
876
|
+
:param str type: not used by btcmarkets.calculate_fee :param string side: not used by btcmarkets.calculate_fee :param float amount: how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
877
|
+
:param float price: the price for the order to be filled at, in units of the quote currency
|
878
|
+
:param str takerOrMaker: 'taker' or 'maker'
|
879
|
+
:param dict params:
|
880
|
+
:returns dict: contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
|
881
|
+
"""
|
873
882
|
market = self.markets[symbol]
|
874
883
|
currency = None
|
875
884
|
cost = None
|
ccxt/async_support/coinbase.py
CHANGED
@@ -3522,7 +3522,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3522
3522
|
def sign(self, path, api=[], method='GET', params={}, headers=None, body=None):
|
3523
3523
|
version = api[0]
|
3524
3524
|
signed = api[1] == 'private'
|
3525
|
-
|
3525
|
+
isV3 = version == 'v3'
|
3526
|
+
pathPart = 'api/v3' if (isV3) else 'v2'
|
3526
3527
|
fullPath = '/' + pathPart + '/' + self.implode_params(path, params)
|
3527
3528
|
query = self.omit(params, self.extract_params(path))
|
3528
3529
|
savedPath = fullPath
|
@@ -3556,8 +3557,14 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3556
3557
|
if query:
|
3557
3558
|
body = self.json(query)
|
3558
3559
|
payload = body
|
3559
|
-
|
3560
|
+
else:
|
3561
|
+
if not isV3:
|
3562
|
+
if query:
|
3563
|
+
payload += '?' + self.urlencode(query)
|
3564
|
+
# v3: 'GET' doesn't need payload in the signature. inside url is enough
|
3560
3565
|
# https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
|
3566
|
+
# v2: 'GET' require payload in the signature
|
3567
|
+
# https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-key-authentication
|
3561
3568
|
auth = timestampString + method + savedPath + payload
|
3562
3569
|
signature = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256)
|
3563
3570
|
headers = {
|
ccxt/async_support/delta.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.delta import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Market, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
9
|
+
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, MarginMode, Market, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -61,7 +61,8 @@ class delta(Exchange, ImplicitAPI):
|
|
61
61
|
'fetchLedger': True,
|
62
62
|
'fetchLeverage': True,
|
63
63
|
'fetchLeverageTiers': False, # An infinite number of tiers, see examples/js/delta-maintenance-margin-rate-max-leverage.js
|
64
|
-
'fetchMarginMode':
|
64
|
+
'fetchMarginMode': True,
|
65
|
+
'fetchMarginModes': False,
|
65
66
|
'fetchMarketLeverageTiers': False,
|
66
67
|
'fetchMarkets': True,
|
67
68
|
'fetchMarkOHLCV': True,
|
@@ -3088,6 +3089,95 @@ class delta(Exchange, ImplicitAPI):
|
|
3088
3089
|
position = self.parse_position(self.safe_value(response, 'result', {}))
|
3089
3090
|
return [position]
|
3090
3091
|
|
3092
|
+
async def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
|
3093
|
+
"""
|
3094
|
+
fetches the margin mode of a trading pair
|
3095
|
+
:see: https://docs.delta.exchange/#get-user
|
3096
|
+
:param str symbol: unified symbol of the market to fetch the margin mode for
|
3097
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3098
|
+
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
3099
|
+
"""
|
3100
|
+
await self.load_markets()
|
3101
|
+
market = None
|
3102
|
+
if symbol is not None:
|
3103
|
+
market = self.market(symbol)
|
3104
|
+
response = await self.privateGetProfile(params)
|
3105
|
+
#
|
3106
|
+
# {
|
3107
|
+
# "result": {
|
3108
|
+
# "is_password_set": True,
|
3109
|
+
# "kyc_expiry_date": null,
|
3110
|
+
# "phishing_code": "12345",
|
3111
|
+
# "preferences": {
|
3112
|
+
# "favorites": []
|
3113
|
+
# },
|
3114
|
+
# "is_kyc_provisioned": False,
|
3115
|
+
# "country": "Canada",
|
3116
|
+
# "margin_mode": "isolated",
|
3117
|
+
# "mfa_updated_at": "2023-07-19T01:04:43Z",
|
3118
|
+
# "last_name": "",
|
3119
|
+
# "oauth_apple_active": False,
|
3120
|
+
# "pf_index_symbol": null,
|
3121
|
+
# "proof_of_identity_status": "approved",
|
3122
|
+
# "dob": null,
|
3123
|
+
# "email": "abc_123@gmail.com",
|
3124
|
+
# "force_change_password": False,
|
3125
|
+
# "nick_name": "still-breeze-123",
|
3126
|
+
# "oauth_google_active": False,
|
3127
|
+
# "phone_verification_status": "verified",
|
3128
|
+
# "id": 12345678,
|
3129
|
+
# "last_seen": null,
|
3130
|
+
# "is_withdrawal_enabled": True,
|
3131
|
+
# "force_change_mfa": False,
|
3132
|
+
# "enable_bots": False,
|
3133
|
+
# "kyc_verified_on": null,
|
3134
|
+
# "created_at": "2023-07-19T01:02:32Z",
|
3135
|
+
# "withdrawal_blocked_till": null,
|
3136
|
+
# "proof_of_address_status": "approved",
|
3137
|
+
# "is_password_change_blocked": False,
|
3138
|
+
# "is_mfa_enabled": True,
|
3139
|
+
# "is_kyc_done": True,
|
3140
|
+
# "oauth": null,
|
3141
|
+
# "account_name": "Main",
|
3142
|
+
# "sub_account_permissions": null,
|
3143
|
+
# "phone_number": null,
|
3144
|
+
# "tracking_info": {
|
3145
|
+
# "ga_cid": "1234.4321",
|
3146
|
+
# "is_kyc_gtm_tracked": True,
|
3147
|
+
# "sub_account_config": {
|
3148
|
+
# "cross": 2,
|
3149
|
+
# "isolated": 2,
|
3150
|
+
# "portfolio": 2
|
3151
|
+
# }
|
3152
|
+
# },
|
3153
|
+
# "first_name": "",
|
3154
|
+
# "phone_verified_on": null,
|
3155
|
+
# "seen_intro": False,
|
3156
|
+
# "password_updated_at": null,
|
3157
|
+
# "is_login_enabled": True,
|
3158
|
+
# "registration_date": "2023-07-19T01:02:32Z",
|
3159
|
+
# "permissions": {},
|
3160
|
+
# "max_sub_accounts_limit": 2,
|
3161
|
+
# "country_calling_code": null,
|
3162
|
+
# "is_sub_account": False,
|
3163
|
+
# "is_kyc_refresh_required": False
|
3164
|
+
# },
|
3165
|
+
# "success": True
|
3166
|
+
# }
|
3167
|
+
#
|
3168
|
+
result = self.safe_dict(response, 'result', {})
|
3169
|
+
return self.parse_margin_mode(result, market)
|
3170
|
+
|
3171
|
+
def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
|
3172
|
+
symbol = None
|
3173
|
+
if market is not None:
|
3174
|
+
symbol = market['symbol']
|
3175
|
+
return {
|
3176
|
+
'info': marginMode,
|
3177
|
+
'symbol': symbol,
|
3178
|
+
'marginMode': self.safe_string(marginMode, 'margin_mode'),
|
3179
|
+
}
|
3180
|
+
|
3091
3181
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
3092
3182
|
requestPath = '/' + self.version + '/' + self.implode_params(path, params)
|
3093
3183
|
url = self.urls['api'][api] + requestPath
|
ccxt/async_support/gate.py
CHANGED