ccxt 4.2.54__py2.py3-none-any.whl → 4.2.56__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 CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.2.54'
25
+ __version__ = '4.2.56'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/gate.py CHANGED
@@ -67,9 +67,12 @@ class ImplicitAPI:
67
67
  private_wallet_get_saved_address = privateWalletGetSavedAddress = Entry('saved_address', ['private', 'wallet'], 'GET', {'cost': 1})
68
68
  private_wallet_get_fee = privateWalletGetFee = Entry('fee', ['private', 'wallet'], 'GET', {'cost': 1})
69
69
  private_wallet_get_total_balance = privateWalletGetTotalBalance = Entry('total_balance', ['private', 'wallet'], 'GET', {'cost': 2.5})
70
+ private_wallet_get_small_balance = privateWalletGetSmallBalance = Entry('small_balance', ['private', 'wallet'], 'GET', {'cost': 1})
71
+ private_wallet_get_small_balance_history = privateWalletGetSmallBalanceHistory = Entry('small_balance_history', ['private', 'wallet'], 'GET', {'cost': 1})
70
72
  private_wallet_post_transfers = privateWalletPostTransfers = Entry('transfers', ['private', 'wallet'], 'POST', {'cost': 2.5})
71
73
  private_wallet_post_sub_account_transfers = privateWalletPostSubAccountTransfers = Entry('sub_account_transfers', ['private', 'wallet'], 'POST', {'cost': 2.5})
72
74
  private_wallet_post_sub_account_to_sub_account = privateWalletPostSubAccountToSubAccount = Entry('sub_account_to_sub_account', ['private', 'wallet'], 'POST', {'cost': 2.5})
75
+ private_wallet_post_small_balance = privateWalletPostSmallBalance = Entry('small_balance', ['private', 'wallet'], 'POST', {'cost': 1})
73
76
  private_subaccounts_get_sub_accounts = privateSubAccountsGetSubAccounts = Entry('sub_accounts', ['private', 'subAccounts'], 'GET', {'cost': 2.5})
74
77
  private_subaccounts_get_sub_accounts_user_id = privateSubAccountsGetSubAccountsUserId = Entry('sub_accounts/{user_id}', ['private', 'subAccounts'], 'GET', {'cost': 2.5})
75
78
  private_subaccounts_get_sub_accounts_user_id_keys = privateSubAccountsGetSubAccountsUserIdKeys = Entry('sub_accounts/{user_id}/keys', ['private', 'subAccounts'], 'GET', {'cost': 2.5})
@@ -80,15 +83,16 @@ class ImplicitAPI:
80
83
  private_subaccounts_post_sub_accounts_user_id_unlock = privateSubAccountsPostSubAccountsUserIdUnlock = Entry('sub_accounts/{user_id}/unlock', ['private', 'subAccounts'], 'POST', {'cost': 2.5})
81
84
  private_subaccounts_put_sub_accounts_user_id_keys_key = privateSubAccountsPutSubAccountsUserIdKeysKey = Entry('sub_accounts/{user_id}/keys/{key}', ['private', 'subAccounts'], 'PUT', {'cost': 2.5})
82
85
  private_subaccounts_delete_sub_accounts_user_id_keys_key = privateSubAccountsDeleteSubAccountsUserIdKeysKey = Entry('sub_accounts/{user_id}/keys/{key}', ['private', 'subAccounts'], 'DELETE', {'cost': 2.5})
83
- private_portfolio_get_accounts = privatePortfolioGetAccounts = Entry('accounts', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
84
- private_portfolio_get_account_mode = privatePortfolioGetAccountMode = Entry('account_mode', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
85
- private_portfolio_get_borrowable = privatePortfolioGetBorrowable = Entry('borrowable', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
86
- private_portfolio_get_transferable = privatePortfolioGetTransferable = Entry('transferable', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
87
- private_portfolio_get_loans = privatePortfolioGetLoans = Entry('loans', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
88
- private_portfolio_get_loan_records = privatePortfolioGetLoanRecords = Entry('loan_records', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
89
- private_portfolio_get_interest_records = privatePortfolioGetInterestRecords = Entry('interest_records', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
90
- private_portfolio_post_account_mode = privatePortfolioPostAccountMode = Entry('account_mode', ['private', 'portfolio'], 'POST', {'cost': 1.3333333333333333})
91
- private_portfolio_post_loans = privatePortfolioPostLoans = Entry('loans', ['private', 'portfolio'], 'POST', {'cost': 13.333333333333334})
86
+ private_unified_get_accounts = privateUnifiedGetAccounts = Entry('accounts', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
87
+ private_unified_get_account_mode = privateUnifiedGetAccountMode = Entry('account_mode', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
88
+ private_unified_get_borrowable = privateUnifiedGetBorrowable = Entry('borrowable', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
89
+ private_unified_get_transferable = privateUnifiedGetTransferable = Entry('transferable', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
90
+ private_unified_get_loans = privateUnifiedGetLoans = Entry('loans', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
91
+ private_unified_get_loan_records = privateUnifiedGetLoanRecords = Entry('loan_records', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
92
+ private_unified_get_interest_records = privateUnifiedGetInterestRecords = Entry('interest_records', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
93
+ private_unified_get_estimate_rate = privateUnifiedGetEstimateRate = Entry('estimate_rate', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
94
+ private_unified_post_account_mode = privateUnifiedPostAccountMode = Entry('account_mode', ['private', 'unified'], 'POST', {'cost': 1.3333333333333333})
95
+ private_unified_post_loans = privateUnifiedPostLoans = Entry('loans', ['private', 'unified'], 'POST', {'cost': 13.333333333333334})
92
96
  private_spot_get_fee = privateSpotGetFee = Entry('fee', ['private', 'spot'], 'GET', {'cost': 1})
93
97
  private_spot_get_batch_fee = privateSpotGetBatchFee = Entry('batch_fee', ['private', 'spot'], 'GET', {'cost': 1})
94
98
  private_spot_get_accounts = privateSpotGetAccounts = Entry('accounts', ['private', 'spot'], 'GET', {'cost': 1})
ccxt/abstract/gateio.py CHANGED
@@ -67,9 +67,12 @@ class ImplicitAPI:
67
67
  private_wallet_get_saved_address = privateWalletGetSavedAddress = Entry('saved_address', ['private', 'wallet'], 'GET', {'cost': 1})
68
68
  private_wallet_get_fee = privateWalletGetFee = Entry('fee', ['private', 'wallet'], 'GET', {'cost': 1})
69
69
  private_wallet_get_total_balance = privateWalletGetTotalBalance = Entry('total_balance', ['private', 'wallet'], 'GET', {'cost': 2.5})
70
+ private_wallet_get_small_balance = privateWalletGetSmallBalance = Entry('small_balance', ['private', 'wallet'], 'GET', {'cost': 1})
71
+ private_wallet_get_small_balance_history = privateWalletGetSmallBalanceHistory = Entry('small_balance_history', ['private', 'wallet'], 'GET', {'cost': 1})
70
72
  private_wallet_post_transfers = privateWalletPostTransfers = Entry('transfers', ['private', 'wallet'], 'POST', {'cost': 2.5})
71
73
  private_wallet_post_sub_account_transfers = privateWalletPostSubAccountTransfers = Entry('sub_account_transfers', ['private', 'wallet'], 'POST', {'cost': 2.5})
72
74
  private_wallet_post_sub_account_to_sub_account = privateWalletPostSubAccountToSubAccount = Entry('sub_account_to_sub_account', ['private', 'wallet'], 'POST', {'cost': 2.5})
75
+ private_wallet_post_small_balance = privateWalletPostSmallBalance = Entry('small_balance', ['private', 'wallet'], 'POST', {'cost': 1})
73
76
  private_subaccounts_get_sub_accounts = privateSubAccountsGetSubAccounts = Entry('sub_accounts', ['private', 'subAccounts'], 'GET', {'cost': 2.5})
74
77
  private_subaccounts_get_sub_accounts_user_id = privateSubAccountsGetSubAccountsUserId = Entry('sub_accounts/{user_id}', ['private', 'subAccounts'], 'GET', {'cost': 2.5})
75
78
  private_subaccounts_get_sub_accounts_user_id_keys = privateSubAccountsGetSubAccountsUserIdKeys = Entry('sub_accounts/{user_id}/keys', ['private', 'subAccounts'], 'GET', {'cost': 2.5})
@@ -80,15 +83,16 @@ class ImplicitAPI:
80
83
  private_subaccounts_post_sub_accounts_user_id_unlock = privateSubAccountsPostSubAccountsUserIdUnlock = Entry('sub_accounts/{user_id}/unlock', ['private', 'subAccounts'], 'POST', {'cost': 2.5})
81
84
  private_subaccounts_put_sub_accounts_user_id_keys_key = privateSubAccountsPutSubAccountsUserIdKeysKey = Entry('sub_accounts/{user_id}/keys/{key}', ['private', 'subAccounts'], 'PUT', {'cost': 2.5})
82
85
  private_subaccounts_delete_sub_accounts_user_id_keys_key = privateSubAccountsDeleteSubAccountsUserIdKeysKey = Entry('sub_accounts/{user_id}/keys/{key}', ['private', 'subAccounts'], 'DELETE', {'cost': 2.5})
83
- private_portfolio_get_accounts = privatePortfolioGetAccounts = Entry('accounts', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
84
- private_portfolio_get_account_mode = privatePortfolioGetAccountMode = Entry('account_mode', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
85
- private_portfolio_get_borrowable = privatePortfolioGetBorrowable = Entry('borrowable', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
86
- private_portfolio_get_transferable = privatePortfolioGetTransferable = Entry('transferable', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
87
- private_portfolio_get_loans = privatePortfolioGetLoans = Entry('loans', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
88
- private_portfolio_get_loan_records = privatePortfolioGetLoanRecords = Entry('loan_records', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
89
- private_portfolio_get_interest_records = privatePortfolioGetInterestRecords = Entry('interest_records', ['private', 'portfolio'], 'GET', {'cost': 1.3333333333333333})
90
- private_portfolio_post_account_mode = privatePortfolioPostAccountMode = Entry('account_mode', ['private', 'portfolio'], 'POST', {'cost': 1.3333333333333333})
91
- private_portfolio_post_loans = privatePortfolioPostLoans = Entry('loans', ['private', 'portfolio'], 'POST', {'cost': 13.333333333333334})
86
+ private_unified_get_accounts = privateUnifiedGetAccounts = Entry('accounts', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
87
+ private_unified_get_account_mode = privateUnifiedGetAccountMode = Entry('account_mode', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
88
+ private_unified_get_borrowable = privateUnifiedGetBorrowable = Entry('borrowable', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
89
+ private_unified_get_transferable = privateUnifiedGetTransferable = Entry('transferable', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
90
+ private_unified_get_loans = privateUnifiedGetLoans = Entry('loans', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
91
+ private_unified_get_loan_records = privateUnifiedGetLoanRecords = Entry('loan_records', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
92
+ private_unified_get_interest_records = privateUnifiedGetInterestRecords = Entry('interest_records', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
93
+ private_unified_get_estimate_rate = privateUnifiedGetEstimateRate = Entry('estimate_rate', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
94
+ private_unified_post_account_mode = privateUnifiedPostAccountMode = Entry('account_mode', ['private', 'unified'], 'POST', {'cost': 1.3333333333333333})
95
+ private_unified_post_loans = privateUnifiedPostLoans = Entry('loans', ['private', 'unified'], 'POST', {'cost': 13.333333333333334})
92
96
  private_spot_get_fee = privateSpotGetFee = Entry('fee', ['private', 'spot'], 'GET', {'cost': 1})
93
97
  private_spot_get_batch_fee = privateSpotGetBatchFee = Entry('batch_fee', ['private', 'spot'], 'GET', {'cost': 1})
94
98
  private_spot_get_accounts = privateSpotGetAccounts = Entry('accounts', ['private', 'spot'], 'GET', {'cost': 1})
ccxt/abstract/woo.py CHANGED
@@ -24,10 +24,16 @@ class ImplicitAPI:
24
24
  v1_private_get_client_trade_tid = v1PrivateGetClientTradeTid = Entry('client/trade/{tid}', ['v1', 'private'], 'GET', {'cost': 1})
25
25
  v1_private_get_order_oid_trades = v1PrivateGetOrderOidTrades = Entry('order/{oid}/trades', ['v1', 'private'], 'GET', {'cost': 1})
26
26
  v1_private_get_client_trades = v1PrivateGetClientTrades = Entry('client/trades', ['v1', 'private'], 'GET', {'cost': 1})
27
+ v1_private_get_client_hist_trades = v1PrivateGetClientHistTrades = Entry('client/hist_trades', ['v1', 'private'], 'GET', {'cost': 1})
28
+ v1_private_get_staking_yield_history = v1PrivateGetStakingYieldHistory = Entry('staking/yield_history', ['v1', 'private'], 'GET', {'cost': 1})
29
+ v1_private_get_client_holding = v1PrivateGetClientHolding = Entry('client/holding', ['v1', 'private'], 'GET', {'cost': 1})
27
30
  v1_private_get_asset_deposit = v1PrivateGetAssetDeposit = Entry('asset/deposit', ['v1', 'private'], 'GET', {'cost': 10})
28
31
  v1_private_get_asset_history = v1PrivateGetAssetHistory = Entry('asset/history', ['v1', 'private'], 'GET', {'cost': 60})
29
32
  v1_private_get_sub_account_all = v1PrivateGetSubAccountAll = Entry('sub_account/all', ['v1', 'private'], 'GET', {'cost': 60})
30
33
  v1_private_get_sub_account_assets = v1PrivateGetSubAccountAssets = Entry('sub_account/assets', ['v1', 'private'], 'GET', {'cost': 60})
34
+ v1_private_get_sub_account_asset_detail = v1PrivateGetSubAccountAssetDetail = Entry('sub_account/asset_detail', ['v1', 'private'], 'GET', {'cost': 60})
35
+ v1_private_get_sub_account_ip_restriction = v1PrivateGetSubAccountIpRestriction = Entry('sub_account/ip_restriction', ['v1', 'private'], 'GET', {'cost': 10})
36
+ v1_private_get_asset_main_sub_transfer_history = v1PrivateGetAssetMainSubTransferHistory = Entry('asset/main_sub_transfer_history', ['v1', 'private'], 'GET', {'cost': 30})
31
37
  v1_private_get_token_interest = v1PrivateGetTokenInterest = Entry('token_interest', ['v1', 'private'], 'GET', {'cost': 60})
32
38
  v1_private_get_token_interest_token = v1PrivateGetTokenInterestToken = Entry('token_interest/{token}', ['v1', 'private'], 'GET', {'cost': 60})
33
39
  v1_private_get_interest_history = v1PrivateGetInterestHistory = Entry('interest/history', ['v1', 'private'], 'GET', {'cost': 60})
@@ -38,9 +44,12 @@ class ImplicitAPI:
38
44
  v1_private_get_client_transaction_history = v1PrivateGetClientTransactionHistory = Entry('client/transaction_history', ['v1', 'private'], 'GET', {'cost': 60})
39
45
  v1_private_post_order = v1PrivatePostOrder = Entry('order', ['v1', 'private'], 'POST', {'cost': 5})
40
46
  v1_private_post_asset_main_sub_transfer = v1PrivatePostAssetMainSubTransfer = Entry('asset/main_sub_transfer', ['v1', 'private'], 'POST', {'cost': 30})
47
+ v1_private_post_asset_ltv = v1PrivatePostAssetLtv = Entry('asset/ltv', ['v1', 'private'], 'POST', {'cost': 30})
41
48
  v1_private_post_asset_withdraw = v1PrivatePostAssetWithdraw = Entry('asset/withdraw', ['v1', 'private'], 'POST', {'cost': 30})
49
+ v1_private_post_asset_internal_withdraw = v1PrivatePostAssetInternalWithdraw = Entry('asset/internal_withdraw', ['v1', 'private'], 'POST', {'cost': 30})
42
50
  v1_private_post_interest_repay = v1PrivatePostInterestRepay = Entry('interest/repay', ['v1', 'private'], 'POST', {'cost': 60})
43
51
  v1_private_post_client_account_mode = v1PrivatePostClientAccountMode = Entry('client/account_mode', ['v1', 'private'], 'POST', {'cost': 120})
52
+ v1_private_post_client_position_mode = v1PrivatePostClientPositionMode = Entry('client/position_mode', ['v1', 'private'], 'POST', {'cost': 5})
44
53
  v1_private_post_client_leverage = v1PrivatePostClientLeverage = Entry('client/leverage', ['v1', 'private'], 'POST', {'cost': 120})
45
54
  v1_private_delete_order = v1PrivateDeleteOrder = Entry('order', ['v1', 'private'], 'DELETE', {'cost': 1})
46
55
  v1_private_delete_client_order = v1PrivateDeleteClientOrder = Entry('client/order', ['v1', 'private'], 'DELETE', {'cost': 1})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.54'
7
+ __version__ = '4.2.56'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.2.54'
5
+ __version__ = '4.2.56'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -723,7 +723,7 @@ class bingx(Exchange, ImplicitAPI):
723
723
  if paginate:
724
724
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440)
725
725
  market = self.market(symbol)
726
- request = {
726
+ request: dict = {
727
727
  'symbol': market['id'],
728
728
  }
729
729
  request['interval'] = self.safe_string(self.timeframes, timeframe, timeframe)
@@ -850,7 +850,7 @@ class bingx(Exchange, ImplicitAPI):
850
850
  """
851
851
  await self.load_markets()
852
852
  market = self.market(symbol)
853
- request = {
853
+ request: dict = {
854
854
  'symbol': market['id'],
855
855
  }
856
856
  if limit is not None:
@@ -1038,7 +1038,7 @@ class bingx(Exchange, ImplicitAPI):
1038
1038
  """
1039
1039
  await self.load_markets()
1040
1040
  market = self.market(symbol)
1041
- request = {
1041
+ request: dict = {
1042
1042
  'symbol': market['id'],
1043
1043
  }
1044
1044
  if limit is not None:
@@ -1121,7 +1121,7 @@ class bingx(Exchange, ImplicitAPI):
1121
1121
  """
1122
1122
  await self.load_markets()
1123
1123
  market = self.market(symbol)
1124
- request = {
1124
+ request: dict = {
1125
1125
  'symbol': market['id'],
1126
1126
  }
1127
1127
  response = await self.swapV2PublicGetQuotePremiumIndex(self.extend(request, params))
@@ -1217,7 +1217,7 @@ class bingx(Exchange, ImplicitAPI):
1217
1217
  if paginate:
1218
1218
  return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params)
1219
1219
  market = self.market(symbol)
1220
- request = {
1220
+ request: dict = {
1221
1221
  'symbol': market['id'],
1222
1222
  }
1223
1223
  if since is not None:
@@ -1270,7 +1270,7 @@ class bingx(Exchange, ImplicitAPI):
1270
1270
  """
1271
1271
  await self.load_markets()
1272
1272
  market = self.market(symbol)
1273
- request = {
1273
+ request: dict = {
1274
1274
  'symbol': market['id'],
1275
1275
  }
1276
1276
  response = await self.swapV2PublicGetQuoteOpenInterest(self.extend(request, params))
@@ -1322,7 +1322,7 @@ class bingx(Exchange, ImplicitAPI):
1322
1322
  """
1323
1323
  await self.load_markets()
1324
1324
  market = self.market(symbol)
1325
- request = {
1325
+ request: dict = {
1326
1326
  'symbol': market['id'],
1327
1327
  }
1328
1328
  response = None
@@ -1347,7 +1347,8 @@ class bingx(Exchange, ImplicitAPI):
1347
1347
  if symbols is not None:
1348
1348
  symbols = self.market_symbols(symbols)
1349
1349
  firstSymbol = self.safe_string(symbols, 0)
1350
- market = self.market(firstSymbol)
1350
+ if firstSymbol is not None:
1351
+ market = self.market(firstSymbol)
1351
1352
  type = None
1352
1353
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
1353
1354
  response = None
@@ -1358,7 +1359,7 @@ class bingx(Exchange, ImplicitAPI):
1358
1359
  tickers = self.safe_value(response, 'data')
1359
1360
  return self.parse_tickers(tickers, symbols)
1360
1361
 
1361
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1362
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1362
1363
  #
1363
1364
  # spot
1364
1365
  # {
@@ -1716,7 +1717,7 @@ class bingx(Exchange, ImplicitAPI):
1716
1717
  marketType = None
1717
1718
  marketType, params = self.handle_market_type_and_params('createOrder', market, params)
1718
1719
  type = type.upper()
1719
- request = {
1720
+ request: dict = {
1720
1721
  'symbol': market['id'],
1721
1722
  'type': type,
1722
1723
  'side': side.upper(),
@@ -1815,7 +1816,7 @@ class bingx(Exchange, ImplicitAPI):
1815
1816
  slTriggerPrice = self.safe_string_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
1816
1817
  slWorkingType = self.safe_string(stopLoss, 'workingType', 'MARK_PRICE')
1817
1818
  slType = self.safe_string(stopLoss, 'type', 'STOP_MARKET')
1818
- slRequest = {
1819
+ slRequest: dict = {
1819
1820
  'stopPrice': self.parse_to_numeric(self.price_to_precision(symbol, slTriggerPrice)),
1820
1821
  'workingType': slWorkingType,
1821
1822
  'type': slType,
@@ -1830,7 +1831,7 @@ class bingx(Exchange, ImplicitAPI):
1830
1831
  tkTriggerPrice = self.safe_string_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
1831
1832
  tkWorkingType = self.safe_string(takeProfit, 'workingType', 'MARK_PRICE')
1832
1833
  tpType = self.safe_string(takeProfit, 'type', 'TAKE_PROFIT_MARKET')
1833
- tpRequest = {
1834
+ tpRequest: dict = {
1834
1835
  'stopPrice': self.parse_to_numeric(self.price_to_precision(symbol, tkTriggerPrice)),
1835
1836
  'workingType': tkWorkingType,
1836
1837
  'type': tpType,
@@ -1961,7 +1962,7 @@ class bingx(Exchange, ImplicitAPI):
1961
1962
  orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
1962
1963
  ordersRequests.append(orderRequest)
1963
1964
  market = self.market(symbol)
1964
- request = {}
1965
+ request: dict = {}
1965
1966
  response = None
1966
1967
  if market['swap']:
1967
1968
  request['batchOrders'] = self.json(ordersRequests)
@@ -2335,7 +2336,7 @@ class bingx(Exchange, ImplicitAPI):
2335
2336
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
2336
2337
  await self.load_markets()
2337
2338
  market = self.market(symbol)
2338
- request = {
2339
+ request: dict = {
2339
2340
  'symbol': market['id'],
2340
2341
  }
2341
2342
  clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clientOrderID')
@@ -2413,7 +2414,7 @@ class bingx(Exchange, ImplicitAPI):
2413
2414
  raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
2414
2415
  await self.load_markets()
2415
2416
  market = self.market(symbol)
2416
- request = {
2417
+ request: dict = {
2417
2418
  'symbol': market['id'],
2418
2419
  }
2419
2420
  response = None
@@ -2491,7 +2492,7 @@ class bingx(Exchange, ImplicitAPI):
2491
2492
  raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
2492
2493
  await self.load_markets()
2493
2494
  market = self.market(symbol)
2494
- request = {
2495
+ request: dict = {
2495
2496
  'symbol': market['id'],
2496
2497
  }
2497
2498
  clientOrderIds = self.safe_value(params, 'clientOrderIds')
@@ -2560,7 +2561,7 @@ class bingx(Exchange, ImplicitAPI):
2560
2561
  raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
2561
2562
  await self.load_markets()
2562
2563
  market = self.market(symbol)
2563
- request = {
2564
+ request: dict = {
2564
2565
  'symbol': market['id'],
2565
2566
  'orderId': id,
2566
2567
  }
@@ -2638,7 +2639,7 @@ class bingx(Exchange, ImplicitAPI):
2638
2639
  """
2639
2640
  await self.load_markets()
2640
2641
  market = None
2641
- request = {}
2642
+ request: dict = {}
2642
2643
  if symbol is not None:
2643
2644
  market = self.market(symbol)
2644
2645
  request['symbol'] = market['id']
@@ -2725,7 +2726,7 @@ class bingx(Exchange, ImplicitAPI):
2725
2726
  raise ArgumentsRequired(self.id + ' fetchClosedOrders() requires a symbol argument')
2726
2727
  await self.load_markets()
2727
2728
  market = self.market(symbol)
2728
- request = {
2729
+ request: dict = {
2729
2730
  'symbol': market['id'],
2730
2731
  }
2731
2732
  response = None
@@ -2813,7 +2814,7 @@ class bingx(Exchange, ImplicitAPI):
2813
2814
  accountsByType = self.safe_value(self.options, 'accountsByType', {})
2814
2815
  fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
2815
2816
  toId = self.safe_string(accountsByType, toAccount, toAccount)
2816
- request = {
2817
+ request: dict = {
2817
2818
  'asset': currency['id'],
2818
2819
  'amount': self.currency_to_precision(code, amount),
2819
2820
  'type': fromId + '_' + toId,
@@ -2857,7 +2858,7 @@ class bingx(Exchange, ImplicitAPI):
2857
2858
  toId = self.safe_string(accountsByType, toAccount, toAccount)
2858
2859
  if fromId is None or toId is None:
2859
2860
  raise ExchangeError(self.id + ' fromAccount & toAccount parameter are required')
2860
- request = {
2861
+ request: dict = {
2861
2862
  'type': fromId + '_' + toId,
2862
2863
  }
2863
2864
  if since is not None:
@@ -2919,7 +2920,7 @@ class bingx(Exchange, ImplicitAPI):
2919
2920
  currency = self.currency(code)
2920
2921
  defaultRecvWindow = self.safe_integer(self.options, 'recvWindow')
2921
2922
  recvWindow = self.safe_integer(self.parse_params, 'recvWindow', defaultRecvWindow)
2922
- request = {
2923
+ request: dict = {
2923
2924
  'coin': currency['id'],
2924
2925
  'offset': 0,
2925
2926
  'limit': 1000,
@@ -3008,7 +3009,7 @@ class bingx(Exchange, ImplicitAPI):
3008
3009
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
3009
3010
  """
3010
3011
  await self.load_markets()
3011
- request = {
3012
+ request: dict = {
3012
3013
  }
3013
3014
  currency = None
3014
3015
  if code is not None:
@@ -3049,7 +3050,7 @@ class bingx(Exchange, ImplicitAPI):
3049
3050
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
3050
3051
  """
3051
3052
  await self.load_markets()
3052
- request = {
3053
+ request: dict = {
3053
3054
  }
3054
3055
  currency = None
3055
3056
  if code is not None:
@@ -3174,7 +3175,7 @@ class bingx(Exchange, ImplicitAPI):
3174
3175
  'internal': None,
3175
3176
  }
3176
3177
 
3177
- def parse_transaction_status(self, status):
3178
+ def parse_transaction_status(self, status: str):
3178
3179
  statuses = {
3179
3180
  '0': 'pending',
3180
3181
  '1': 'ok',
@@ -3213,7 +3214,7 @@ class bingx(Exchange, ImplicitAPI):
3213
3214
  marginMode = 'CROSSED'
3214
3215
  if marginMode != 'ISOLATED' and marginMode != 'CROSSED':
3215
3216
  raise BadRequest(self.id + ' setMarginMode() marginMode argument should be isolated or cross')
3216
- request = {
3217
+ request: dict = {
3217
3218
  'symbol': market['id'],
3218
3219
  'marginType': marginMode,
3219
3220
  }
@@ -3235,7 +3236,7 @@ class bingx(Exchange, ImplicitAPI):
3235
3236
  raise ArgumentsRequired(self.id + ' setMargin() requires a type parameter either 1(increase margin) or 2(decrease margin)')
3236
3237
  await self.load_markets()
3237
3238
  market = self.market(symbol)
3238
- request = {
3239
+ request: dict = {
3239
3240
  'symbol': market['id'],
3240
3241
  'amount': self.amount_to_precision(market['symbol'], amount),
3241
3242
  'type': type,
@@ -3261,7 +3262,7 @@ class bingx(Exchange, ImplicitAPI):
3261
3262
  """
3262
3263
  await self.load_markets()
3263
3264
  market = self.market(symbol)
3264
- request = {
3265
+ request: dict = {
3265
3266
  'symbol': market['id'],
3266
3267
  }
3267
3268
  response = await self.swapV2PrivateGetTradeLeverage(self.extend(request, params))
@@ -3293,7 +3294,7 @@ class bingx(Exchange, ImplicitAPI):
3293
3294
  self.check_required_argument('setLeverage', side, 'side', ['LONG', 'SHORT', 'BOTH'])
3294
3295
  await self.load_markets()
3295
3296
  market = self.market(symbol)
3296
- request = {
3297
+ request: dict = {
3297
3298
  'symbol': market['id'],
3298
3299
  'side': side,
3299
3300
  'leverage': leverage,
@@ -3329,7 +3330,7 @@ class bingx(Exchange, ImplicitAPI):
3329
3330
  market = self.market(symbol)
3330
3331
  now = self.milliseconds()
3331
3332
  response = None
3332
- request = {
3333
+ request: dict = {
3333
3334
  'symbol': market['id'],
3334
3335
  }
3335
3336
  if since is not None:
@@ -3493,7 +3494,7 @@ class bingx(Exchange, ImplicitAPI):
3493
3494
  walletType = 1
3494
3495
  if not self.in_array(walletType, [1, 2, 3]):
3495
3496
  raise BadRequest(self.id + ' withdraw() requires either 1 fund account, 2 standard futures account, 3 perpetual account for walletType')
3496
- request = {
3497
+ request: dict = {
3497
3498
  'coin': currency['id'],
3498
3499
  'address': address,
3499
3500
  'amount': self.number_to_string(amount),
@@ -3641,7 +3642,7 @@ class bingx(Exchange, ImplicitAPI):
3641
3642
  """
3642
3643
  await self.load_markets()
3643
3644
  market = self.market(symbol)
3644
- request = {
3645
+ request: dict = {
3645
3646
  'symbol': market['id'],
3646
3647
  }
3647
3648
  response = await self.swapV2PrivatePostTradeCloseAllPositions(self.extend(request, params))
@@ -3675,7 +3676,7 @@ class bingx(Exchange, ImplicitAPI):
3675
3676
  marketType, params = self.handle_market_type_and_params('closeAllPositions', None, params)
3676
3677
  if marketType == 'margin':
3677
3678
  raise BadRequest(self.id + ' closePositions() cannot be used for ' + marketType + ' markets')
3678
- request = {
3679
+ request: dict = {
3679
3680
  'recvWindow': recvWindow,
3680
3681
  }
3681
3682
  response = await self.swapV2PrivatePostTradeCloseAllPositions(self.extend(request, params))
@@ -3740,7 +3741,7 @@ class bingx(Exchange, ImplicitAPI):
3740
3741
  dualSidePosition = 'true'
3741
3742
  else:
3742
3743
  dualSidePosition = 'false'
3743
- request = {
3744
+ request: dict = {
3744
3745
  'dualSidePosition': dualSidePosition,
3745
3746
  }
3746
3747
  #
@@ -3929,7 +3930,7 @@ class bingx(Exchange, ImplicitAPI):
3929
3930
  def nonce(self):
3930
3931
  return self.milliseconds()
3931
3932
 
3932
- def set_sandbox_mode(self, enable):
3933
+ def set_sandbox_mode(self, enable: bool):
3933
3934
  super(bingx, self).set_sandbox_mode(enable)
3934
3935
  self.options['sandboxMode'] = enable
3935
3936
 
@@ -64,7 +64,7 @@ class gate(Exchange, ImplicitAPI):
64
64
  'spot': 'https://api.gateio.ws/api/v4',
65
65
  'options': 'https://api.gateio.ws/api/v4',
66
66
  'subAccounts': 'https://api.gateio.ws/api/v4',
67
- 'portfolio': 'https://api.gateio.ws/api/v4',
67
+ 'unified': 'https://api.gateio.ws/api/v4',
68
68
  'rebate': 'https://api.gateio.ws/api/v4',
69
69
  'earn': 'https://api.gateio.ws/api/v4',
70
70
  'account': 'https://api.gateio.ws/api/v4',
@@ -287,11 +287,14 @@ class gate(Exchange, ImplicitAPI):
287
287
  'saved_address': 1,
288
288
  'fee': 1,
289
289
  'total_balance': 2.5,
290
+ 'small_balance': 1,
291
+ 'small_balance_history': 1,
290
292
  },
291
293
  'post': {
292
294
  'transfers': 2.5, # 8r/s cost = 20 / 8 = 2.5
293
295
  'sub_account_transfers': 2.5,
294
296
  'sub_account_to_sub_account': 2.5,
297
+ 'small_balance': 1,
295
298
  },
296
299
  },
297
300
  'subAccounts': {
@@ -314,7 +317,7 @@ class gate(Exchange, ImplicitAPI):
314
317
  'sub_accounts/{user_id}/keys/{key}': 2.5,
315
318
  },
316
319
  },
317
- 'portfolio': {
320
+ 'unified': {
318
321
  'get': {
319
322
  'accounts': 20 / 15,
320
323
  'account_mode': 20 / 15,
@@ -323,6 +326,7 @@ class gate(Exchange, ImplicitAPI):
323
326
  'loans': 20 / 15,
324
327
  'loan_records': 20 / 15,
325
328
  'interest_records': 20 / 15,
329
+ 'estimate_rate': 20 / 15,
326
330
  },
327
331
  'post': {
328
332
  'account_mode': 20 / 15,
ccxt/async_support/okx.py CHANGED
@@ -596,6 +596,7 @@ class okx(Exchange, ImplicitAPI):
596
596
  '50027': PermissionDenied, # The account is restricted from trading
597
597
  '50028': ExchangeError, # Unable to take the order, please reach out to support center for details
598
598
  '50044': BadRequest, # Must select one broker type
599
+ '50062': ExchangeError, # This feature is currently unavailable.
599
600
  # API Class
600
601
  '50100': ExchangeError, # API frozen, please contact customer service
601
602
  '50101': AuthenticationError, # Broker id of APIKey does not match current environment
@@ -650,6 +651,15 @@ class okx(Exchange, ImplicitAPI):
650
651
  '51072': InvalidOrder, # As a spot lead trader, you need to set tdMode to 'spot_isolated' when configured buying lead trade pairs
651
652
  '51073': InvalidOrder, # As a spot lead trader, you need to use '/copytrading/close-subposition' for selling assets through lead trades
652
653
  '51074': InvalidOrder, # Only the tdMode for lead trade pairs configured by spot lead traders can be set to 'spot_isolated'
654
+ '51090': InvalidOrder, # You can't modify the amount of an SL order placed with a TP limit order.
655
+ '51091': InvalidOrder, # All TP orders in one order must be of the same type.
656
+ '51092': InvalidOrder, # TP order prices(tpOrdPx) in one order must be different.
657
+ '51093': InvalidOrder, # TP limit order prices(tpOrdPx) in one order can't be –1(market price).
658
+ '51094': InvalidOrder, # You can't place TP limit orders in spot, margin, or options trading.
659
+ '51095': InvalidOrder, # To place TP limit orders at self endpoint, you must place an SL order at the same time.
660
+ '51096': InvalidOrder, # cxlOnClosePos needs to be True to place a TP limit order
661
+ '51098': InvalidOrder, # You can't add a new TP order to an SL order placed with a TP limit order.
662
+ '51099': InvalidOrder, # You can't place TP limit orders lead trader.
653
663
  '51100': InvalidOrder, # Trading amount does not meet the min tradable amount
654
664
  '51101': InvalidOrder, # Entered amount exceeds the max pending order amount(Cont) per transaction
655
665
  '51102': InvalidOrder, # Entered amount exceeds the max pending count
@@ -2635,7 +2645,7 @@ class okx(Exchange, ImplicitAPI):
2635
2645
  raise InvalidOrder(self.id + ' createOrder() requires a trigger price in params["takeProfit"]["triggerPrice"], or params["takeProfit"]["stopPrice"], or params["takeProfit"]["tpTriggerPx"] for a take profit order')
2636
2646
  request['tpTriggerPx'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
2637
2647
  takeProfitLimitPrice = self.safe_value_n(takeProfit, ['price', 'takeProfitPrice', 'tpOrdPx'])
2638
- takeProfitOrderType = self.safe_string(takeProfit, 'type')
2648
+ takeProfitOrderType = self.safe_string_2(takeProfit, 'type', 'tpOrdKind')
2639
2649
  if takeProfitOrderType is not None:
2640
2650
  takeProfitLimitOrderType = (takeProfitOrderType == 'limit')
2641
2651
  takeProfitMarketOrderType = (takeProfitOrderType == 'market')
@@ -2645,10 +2655,12 @@ class okx(Exchange, ImplicitAPI):
2645
2655
  if takeProfitLimitPrice is None:
2646
2656
  raise InvalidOrder(self.id + ' createOrder() requires a limit price in params["takeProfit"]["price"] or params["takeProfit"]["tpOrdPx"] for a take profit limit order')
2647
2657
  else:
2658
+ request['tpOrdKind'] = takeProfitOrderType
2648
2659
  request['tpOrdPx'] = self.price_to_precision(symbol, takeProfitLimitPrice)
2649
2660
  elif takeProfitOrderType == 'market':
2650
2661
  request['tpOrdPx'] = '-1'
2651
2662
  elif takeProfitLimitPrice is not None:
2663
+ request['tpOrdKind'] = 'limit'
2652
2664
  request['tpOrdPx'] = self.price_to_precision(symbol, takeProfitLimitPrice) # limit tp order
2653
2665
  else:
2654
2666
  request['tpOrdPx'] = '-1' # market tp order
@@ -2666,6 +2678,7 @@ class okx(Exchange, ImplicitAPI):
2666
2678
  twoWayCondition = ((takeProfitPrice is not None) and (stopLossPrice is not None))
2667
2679
  # if TP and SL are sent together
2668
2680
  # 'conditional' only stop-loss order will be applied
2681
+ # tpOrdKind is 'condition' which is the default
2669
2682
  if twoWayCondition:
2670
2683
  request['ordType'] = 'oco'
2671
2684
  if takeProfitPrice is not None:
@@ -2710,6 +2723,7 @@ class okx(Exchange, ImplicitAPI):
2710
2723
  :param str [params.stopLoss.type]: 'market' or 'limit' used to specify the stop loss price type
2711
2724
  :param str [params.positionSide]: if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
2712
2725
  :param str [params.trailingPercent]: the percent to trail away from the current market price
2726
+ :param str [params.tpOrdKind]: 'condition' or 'limit', the default is 'condition'
2713
2727
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2714
2728
  """
2715
2729
  await self.load_markets()
@@ -2850,6 +2864,7 @@ class okx(Exchange, ImplicitAPI):
2850
2864
  takeProfitTriggerPrice = self.safe_value(takeProfit, 'triggerPrice')
2851
2865
  takeProfitPrice = self.safe_value(takeProfit, 'price')
2852
2866
  takeProfitType = self.safe_string(takeProfit, 'type')
2867
+ request['newTpOrdKind'] = takeProfitType if (takeProfitType == 'limit') else 'condition'
2853
2868
  request['newTpTriggerPx'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
2854
2869
  request['newTpOrdPx'] = '-1' if (takeProfitType == 'market') else self.price_to_precision(symbol, takeProfitPrice)
2855
2870
  request['newTpTriggerPxType'] = takeProfitTriggerPriceType
@@ -2888,6 +2903,7 @@ class okx(Exchange, ImplicitAPI):
2888
2903
  :param float [params.takeProfit.triggerPrice]: take profit trigger price
2889
2904
  :param float [params.takeProfit.price]: used for take profit limit orders, not used for take profit market price orders
2890
2905
  :param str [params.takeProfit.type]: 'market' or 'limit' used to specify the take profit price type
2906
+ :param str [params.newTpOrdKind]: 'condition' or 'limit', the default is 'condition'
2891
2907
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2892
2908
  """
2893
2909
  await self.load_markets()
@@ -604,7 +604,7 @@ class upbit(Exchange, ImplicitAPI):
604
604
  # "trade_time": "104543",
605
605
  # "trade_date_kst": "20181122",
606
606
  # "trade_time_kst": "194543",
607
- # "trade_timestamp": 1542883543097,
607
+ # "trade_timestamp": 1542883543096,
608
608
  # "opening_price": 0.02976455,
609
609
  # "high_price": 0.02992577,
610
610
  # "low_price": 0.02934283,