ccxt 4.4.74__py2.py3-none-any.whl → 4.4.77__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.
@@ -36,19 +36,29 @@ class bitopro(Exchange, ImplicitAPI):
36
36
  'swap': False,
37
37
  'future': False,
38
38
  'option': False,
39
+ 'addMargin': False,
40
+ 'borrowCrossMargin': False,
41
+ 'borrowIsolatedMargin': False,
42
+ 'borrowMargin': False,
39
43
  'cancelAllOrders': True,
40
44
  'cancelOrder': True,
41
45
  'cancelOrders': True,
42
46
  'closeAllPositions': False,
43
47
  'closePosition': False,
44
48
  'createOrder': True,
49
+ 'createOrderWithTakeProfitAndStopLoss': False,
50
+ 'createOrderWithTakeProfitAndStopLossWs': False,
45
51
  'createReduceOnlyOrder': False,
46
52
  'createStopOrder': True,
47
53
  'createTriggerOrder': True,
48
54
  'editOrder': False,
49
55
  'fetchBalance': True,
56
+ 'fetchBorrowInterest': False,
57
+ 'fetchBorrowRate': False,
50
58
  'fetchBorrowRateHistories': False,
51
59
  'fetchBorrowRateHistory': False,
60
+ 'fetchBorrowRates': False,
61
+ 'fetchBorrowRatesPerSymbol': False,
52
62
  'fetchClosedOrders': True,
53
63
  'fetchCrossBorrowRate': False,
54
64
  'fetchCrossBorrowRates': False,
@@ -59,19 +69,39 @@ class bitopro(Exchange, ImplicitAPI):
59
69
  'fetchDepositWithdrawFee': 'emulated',
60
70
  'fetchDepositWithdrawFees': True,
61
71
  'fetchFundingHistory': False,
72
+ 'fetchFundingInterval': False,
73
+ 'fetchFundingIntervals': False,
62
74
  'fetchFundingRate': False,
63
75
  'fetchFundingRateHistory': False,
64
76
  'fetchFundingRates': False,
77
+ 'fetchGreeks': False,
65
78
  'fetchIndexOHLCV': False,
66
79
  'fetchIsolatedBorrowRate': False,
67
80
  'fetchIsolatedBorrowRates': False,
81
+ 'fetchIsolatedPositions': False,
82
+ 'fetchLeverage': False,
83
+ 'fetchLeverages': False,
84
+ 'fetchLeverageTiers': False,
85
+ 'fetchLiquidations': False,
86
+ 'fetchLongShortRatio': False,
87
+ 'fetchLongShortRatioHistory': False,
88
+ 'fetchMarginAdjustmentHistory': False,
68
89
  'fetchMarginMode': False,
90
+ 'fetchMarginModes': False,
91
+ 'fetchMarketLeverageTiers': False,
69
92
  'fetchMarkets': True,
70
93
  'fetchMarkOHLCV': False,
94
+ 'fetchMarkPrices': False,
95
+ 'fetchMyLiquidations': False,
96
+ 'fetchMySettlementHistory': False,
71
97
  'fetchMyTrades': True,
72
98
  'fetchOHLCV': True,
99
+ 'fetchOpenInterest': False,
73
100
  'fetchOpenInterestHistory': False,
101
+ 'fetchOpenInterests': False,
74
102
  'fetchOpenOrders': True,
103
+ 'fetchOption': False,
104
+ 'fetchOptionChain': False,
75
105
  'fetchOrder': True,
76
106
  'fetchOrderBook': True,
77
107
  'fetchOrders': False,
@@ -84,6 +114,7 @@ class bitopro(Exchange, ImplicitAPI):
84
114
  'fetchPositionsHistory': False,
85
115
  'fetchPositionsRisk': False,
86
116
  'fetchPremiumIndexOHLCV': False,
117
+ 'fetchSettlementHistory': False,
87
118
  'fetchTicker': True,
88
119
  'fetchTickers': True,
89
120
  'fetchTime': False,
@@ -94,10 +125,16 @@ class bitopro(Exchange, ImplicitAPI):
94
125
  'fetchTransactions': False,
95
126
  'fetchTransfer': False,
96
127
  'fetchTransfers': False,
128
+ 'fetchVolatilityHistory': False,
97
129
  'fetchWithdrawal': True,
98
130
  'fetchWithdrawals': True,
131
+ 'reduceMargin': False,
132
+ 'repayCrossMargin': False,
133
+ 'repayIsolatedMargin': False,
99
134
  'setLeverage': False,
135
+ 'setMargin': False,
100
136
  'setMarginMode': False,
137
+ 'setPositionMode': False,
101
138
  'transfer': False,
102
139
  'withdraw': True,
103
140
  },
@@ -51,20 +51,32 @@ class bitrue(Exchange, ImplicitAPI):
51
51
  'swap': True,
52
52
  'future': False,
53
53
  'option': False,
54
+ 'addMargin': False,
55
+ 'borrowCrossMargin': False,
56
+ 'borrowIsolatedMargin': False,
57
+ 'borrowMargin': False,
54
58
  'cancelAllOrders': True,
55
59
  'cancelOrder': True,
60
+ 'closeAllPositions': False,
61
+ 'closePosition': False,
56
62
  'createMarketBuyOrderWithCost': True,
57
63
  'createMarketOrderWithCost': False,
58
64
  'createMarketSellOrderWithCost': False,
59
65
  'createOrder': True,
66
+ 'createOrderWithTakeProfitAndStopLoss': False,
67
+ 'createOrderWithTakeProfitAndStopLossWs': False,
60
68
  'createReduceOnlyOrder': True,
61
69
  'createStopLimitOrder': True,
62
70
  'createStopMarketOrder': True,
63
71
  'createStopOrder': True,
64
72
  'fetchBalance': True,
65
73
  'fetchBidsAsks': True,
74
+ 'fetchBorrowInterest': False,
75
+ 'fetchBorrowRate': False,
66
76
  'fetchBorrowRateHistories': False,
67
77
  'fetchBorrowRateHistory': False,
78
+ 'fetchBorrowRates': False,
79
+ 'fetchBorrowRatesPerSymbol': False,
68
80
  'fetchClosedOrders': True,
69
81
  'fetchCrossBorrowRate': False,
70
82
  'fetchCrossBorrowRates': False,
@@ -75,20 +87,50 @@ class bitrue(Exchange, ImplicitAPI):
75
87
  'fetchDepositWithdrawFee': 'emulated',
76
88
  'fetchDepositWithdrawFees': True,
77
89
  'fetchFundingHistory': False,
90
+ 'fetchFundingInterval': False,
91
+ 'fetchFundingIntervals': False,
78
92
  'fetchFundingRate': False,
79
93
  'fetchFundingRateHistory': False,
80
94
  'fetchFundingRates': False,
95
+ 'fetchGreeks': False,
96
+ 'fetchIndexOHLCV': False,
81
97
  'fetchIsolatedBorrowRate': False,
82
98
  'fetchIsolatedBorrowRates': False,
99
+ 'fetchIsolatedPositions': False,
100
+ 'fetchLeverage': False,
101
+ 'fetchLeverages': False,
102
+ 'fetchLeverageTiers': False,
103
+ 'fetchLiquidations': False,
104
+ 'fetchLongShortRatio': False,
105
+ 'fetchLongShortRatioHistory': False,
106
+ 'fetchMarginAdjustmentHistory': False,
83
107
  'fetchMarginMode': False,
108
+ 'fetchMarginModes': False,
109
+ 'fetchMarketLeverageTiers': False,
84
110
  'fetchMarkets': True,
111
+ 'fetchMarkOHLCV': False,
112
+ 'fetchMarkPrices': False,
113
+ 'fetchMyLiquidations': False,
114
+ 'fetchMySettlementHistory': False,
85
115
  'fetchMyTrades': True,
86
116
  'fetchOHLCV': True,
117
+ 'fetchOpenInterest': False,
118
+ 'fetchOpenInterestHistory': False,
119
+ 'fetchOpenInterests': False,
87
120
  'fetchOpenOrders': True,
121
+ 'fetchOption': False,
122
+ 'fetchOptionChain': False,
88
123
  'fetchOrder': True,
89
124
  'fetchOrderBook': True,
90
125
  'fetchOrders': False,
126
+ 'fetchPosition': False,
127
+ 'fetchPositionHistory': False,
91
128
  'fetchPositionMode': False,
129
+ 'fetchPositions': False,
130
+ 'fetchPositionsHistory': False,
131
+ 'fetchPositionsRisk': False,
132
+ 'fetchPremiumIndexOHLCV': False,
133
+ 'fetchSettlementHistory': False,
92
134
  'fetchStatus': True,
93
135
  'fetchTicker': True,
94
136
  'fetchTickers': True,
@@ -99,9 +141,15 @@ class bitrue(Exchange, ImplicitAPI):
99
141
  'fetchTransactionFees': False,
100
142
  'fetchTransactions': False,
101
143
  'fetchTransfers': True,
144
+ 'fetchVolatilityHistory': False,
102
145
  'fetchWithdrawals': True,
146
+ 'reduceMargin': False,
147
+ 'repayCrossMargin': False,
148
+ 'repayIsolatedMargin': False,
103
149
  'setLeverage': True,
104
150
  'setMargin': True,
151
+ 'setMarginMode': False,
152
+ 'setPositionMode': False,
105
153
  'transfer': True,
106
154
  'withdraw': True,
107
155
  },
@@ -763,6 +763,8 @@ class coinex(Exchange, ImplicitAPI):
763
763
  for j in range(0, len(chains)):
764
764
  chain = chains[j]
765
765
  networkId = self.safe_string(chain, 'chain')
766
+ if networkId is None:
767
+ continue
766
768
  precisionString = self.parse_precision(self.safe_string(chain, 'withdrawal_precision'))
767
769
  feeString = self.safe_string(chain, 'withdrawal_fee')
768
770
  minNetworkDepositString = self.safe_string(chain, 'min_deposit_amount')
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinlist import ImplicitAPI
8
8
  import hashlib
9
9
  import math
10
- from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -79,7 +79,7 @@ class coinlist(Exchange, ImplicitAPI):
79
79
  'fetchDepositWithdrawFee': False,
80
80
  'fetchDepositWithdrawFees': False,
81
81
  'fetchFundingHistory': False,
82
- 'fetchFundingRate': False,
82
+ 'fetchFundingRate': True,
83
83
  'fetchFundingRateHistory': False,
84
84
  'fetchFundingRates': False,
85
85
  'fetchIndexOHLCV': False,
@@ -171,6 +171,7 @@ class coinlist(Exchange, ImplicitAPI):
171
171
  'v1/leaderboard': 1,
172
172
  'v1/affiliate/{competition_code}': 1,
173
173
  'v1/competition/{competition_id}': 1,
174
+ 'v1/symbols/{symbol}/funding': 1,
174
175
  },
175
176
  },
176
177
  'private': {
@@ -194,6 +195,7 @@ class coinlist(Exchange, ImplicitAPI):
194
195
  'v1/credits': 1, # not unified
195
196
  'v1/positions': 1,
196
197
  'v1/accounts/{trader_id}/competitions': 1,
198
+ 'v1/closedPositions': 1,
197
199
  },
198
200
  'post': {
199
201
  'v1/keys': 1, # not unified
@@ -212,6 +214,9 @@ class coinlist(Exchange, ImplicitAPI):
212
214
  'v1/orders/{order_id}': 1,
213
215
  'v1/orders/bulk': 1, # not unified
214
216
  },
217
+ 'put': {
218
+ 'v1/accounts/{trader_id}/alias': 1,
219
+ },
215
220
  'delete': {
216
221
  'v1/keys/{key}': 1, # not unified
217
222
  'v1/orders': 1,
@@ -2400,6 +2405,89 @@ class coinlist(Exchange, ImplicitAPI):
2400
2405
  }
2401
2406
  return self.safe_string(types, type, type)
2402
2407
 
2408
+ async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
2409
+ """
2410
+ fetch the current funding rate
2411
+
2412
+ https://trade-docs.coinlist.co/#coinlist-pro-api-Funding-Rates
2413
+
2414
+ :param str symbol: unified market symbol
2415
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2416
+ :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
2417
+ """
2418
+ await self.load_markets()
2419
+ market = self.market(symbol)
2420
+ if not market['swap']:
2421
+ raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
2422
+ request: dict = {
2423
+ 'symbol': market['id'],
2424
+ }
2425
+ response = await self.publicGetV1SymbolsSymbolFunding(self.extend(request, params))
2426
+ #
2427
+ # {
2428
+ # "last": {
2429
+ # "funding_rate": "-0.00043841",
2430
+ # "funding_time": "2025-04-15T04:00:00.000Z"
2431
+ # },
2432
+ # "next": {
2433
+ # "funding_rate": "-0.00046952",
2434
+ # "funding_time": "2025-04-15T12:00:00.000Z"
2435
+ # },
2436
+ # "indicative": {
2437
+ # "funding_rate": "-0.00042517",
2438
+ # "funding_time": "2025-04-15T20:00:00.000Z"
2439
+ # },
2440
+ # "timestamp": "2025-04-15T07:01:15.219Z"
2441
+ # }
2442
+ #
2443
+ return self.parse_funding_rate(response, market)
2444
+
2445
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
2446
+ #
2447
+ # {
2448
+ # "last": {
2449
+ # "funding_rate": "-0.00043841",
2450
+ # "funding_time": "2025-04-15T04:00:00.000Z"
2451
+ # },
2452
+ # "next": {
2453
+ # "funding_rate": "-0.00046952",
2454
+ # "funding_time": "2025-04-15T12:00:00.000Z"
2455
+ # },
2456
+ # "indicative": {
2457
+ # "funding_rate": "-0.00042517",
2458
+ # "funding_time": "2025-04-15T20:00:00.000Z"
2459
+ # },
2460
+ # "timestamp": "2025-04-15T07:01:15.219Z"
2461
+ # }
2462
+ #
2463
+ previous = self.safe_dict(contract, 'last', {})
2464
+ current = self.safe_dict(contract, 'next', {})
2465
+ next = self.safe_dict(contract, 'indicative', {})
2466
+ previousDatetime = self.safe_string(previous, 'funding_time')
2467
+ currentDatetime = self.safe_string(current, 'funding_time')
2468
+ nextDatetime = self.safe_string(next, 'funding_time')
2469
+ datetime = self.safe_string(contract, 'timestamp')
2470
+ return {
2471
+ 'info': contract,
2472
+ 'symbol': self.safe_symbol(None, market),
2473
+ 'markPrice': None,
2474
+ 'indexPrice': None,
2475
+ 'interestRate': None,
2476
+ 'estimatedSettlePrice': None,
2477
+ 'timestamp': self.parse8601(datetime),
2478
+ 'datetime': datetime,
2479
+ 'fundingRate': self.safe_number(current, 'funding_rate'),
2480
+ 'fundingTimestamp': self.parse8601(currentDatetime),
2481
+ 'fundingDatetime': currentDatetime,
2482
+ 'nextFundingRate': self.safe_number(next, 'funding_rate'),
2483
+ 'nextFundingTimestamp': self.parse8601(nextDatetime),
2484
+ 'nextFundingDatetime': nextDatetime,
2485
+ 'previousFundingRate': self.safe_number(previous, 'funding_rate'),
2486
+ 'previousFundingTimestamp': self.parse8601(previousDatetime),
2487
+ 'previousFundingDatetime': previousDatetime,
2488
+ 'interval': '8h',
2489
+ }
2490
+
2403
2491
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
2404
2492
  request = self.omit(params, self.extract_params(path))
2405
2493
  endpoint = '/' + self.implode_params(path, params)
ccxt/async_support/okx.py CHANGED
@@ -398,6 +398,7 @@ class okx(Exchange, ImplicitAPI):
398
398
  'asset/subaccount/managed-subaccount-bills': 5 / 3,
399
399
  'users/entrust-subaccount-list': 10,
400
400
  'account/subaccount/interest-limits': 4,
401
+ 'users/subaccount/apikey': 10,
401
402
  # grid trading
402
403
  'tradingBot/grid/orders-algo-pending': 1,
403
404
  'tradingBot/grid/orders-algo-history': 1,
@@ -530,6 +531,9 @@ class okx(Exchange, ImplicitAPI):
530
531
  'asset/subaccount/transfer': 10,
531
532
  'users/subaccount/set-transfer-out': 10,
532
533
  'account/subaccount/set-loan-allocation': 4,
534
+ 'users/subaccount/create-subaccount': 10,
535
+ 'users/subaccount/subaccount-apikey': 10,
536
+ 'users/subaccount/delete-apikey': 10,
533
537
  # grid trading
534
538
  'tradingBot/grid/order-algo': 1,
535
539
  'tradingBot/grid/amend-order-algo': 1,
@@ -940,6 +944,11 @@ class okx(Exchange, ImplicitAPI):
940
944
  '59506': ExchangeError, # APIKey does not exist
941
945
  '59507': ExchangeError, # The two accounts involved in a transfer must be two different sub accounts under the same parent account
942
946
  '59508': AccountSuspended, # The sub account of {0} is suspended
947
+ '59515': ExchangeError, # You are currently not on the custody whitelist. Please contact customer service for assistance.
948
+ '59516': ExchangeError, # Please create the Copper custody funding account first.
949
+ '59517': ExchangeError, # Please create the Komainu custody funding account first.
950
+ '59518': ExchangeError, # You can’t create a sub-account using the API; please use the app or web.
951
+ '59519': ExchangeError, # You can’t use self function/feature while it's frozen, due to: {freezereason}
943
952
  '59642': BadRequest, # Lead and copy traders can only use margin-free or single-currency margin account modes
944
953
  '59643': ExchangeError, # Couldn’t switch account modes’re currently copying spot trades
945
954
  # WebSocket error Codes from 60000-63999
@@ -1608,8 +1617,8 @@ class okx(Exchange, ImplicitAPI):
1608
1617
  swap = (type == 'swap')
1609
1618
  option = (type == 'option')
1610
1619
  contract = swap or future or option
1611
- baseId = self.safe_string(market, 'baseCcy')
1612
- quoteId = self.safe_string(market, 'quoteCcy')
1620
+ baseId = self.safe_string(market, 'baseCcy', '') # defaulting to '' because some weird preopen markets have empty baseId
1621
+ quoteId = self.safe_string(market, 'quoteCcy', '')
1613
1622
  settleId = self.safe_string(market, 'settleCcy')
1614
1623
  settle = self.safe_currency_code(settleId)
1615
1624
  underlying = self.safe_string(market, 'uly')
@@ -1624,18 +1633,21 @@ class okx(Exchange, ImplicitAPI):
1624
1633
  strikePrice = None
1625
1634
  optionType = None
1626
1635
  if contract:
1627
- symbol = symbol + ':' + settle
1636
+ if settle is not None:
1637
+ symbol = symbol + ':' + settle
1628
1638
  if future:
1629
1639
  expiry = self.safe_integer(market, 'expTime')
1630
- ymd = self.yymmdd(expiry)
1631
- symbol = symbol + '-' + ymd
1640
+ if expiry is not None:
1641
+ ymd = self.yymmdd(expiry)
1642
+ symbol = symbol + '-' + ymd
1632
1643
  elif option:
1633
1644
  expiry = self.safe_integer(market, 'expTime')
1634
1645
  strikePrice = self.safe_string(market, 'stk')
1635
1646
  optionType = self.safe_string(market, 'optType')
1636
- ymd = self.yymmdd(expiry)
1637
- symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType
1638
- optionType = 'put' if (optionType == 'P') else 'call'
1647
+ if expiry is not None:
1648
+ ymd = self.yymmdd(expiry)
1649
+ symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType
1650
+ optionType = 'put' if (optionType == 'P') else 'call'
1639
1651
  tickSize = self.safe_string(market, 'tickSz')
1640
1652
  fees = self.safe_dict_2(self.fees, type, 'trading', {})
1641
1653
  maxLeverage = self.safe_string(market, 'lever', '1')
@@ -1825,31 +1837,31 @@ class okx(Exchange, ImplicitAPI):
1825
1837
  chainsLength = len(chains)
1826
1838
  for j in range(0, chainsLength):
1827
1839
  chain = chains[j]
1828
- networkId = self.safe_string(chain, 'chain') # USDT-BEP20, USDT-Avalance-C, etc
1829
- if networkId is not None:
1830
- idParts = networkId.split('-')
1831
- parts = self.array_slice(idParts, 1)
1832
- chainPart = '-'.join(parts)
1833
- networkCode = self.network_id_to_code(chainPart, currency['code'])
1834
- networks[networkCode] = {
1835
- 'id': networkId,
1836
- 'network': networkCode,
1837
- 'active': None,
1838
- 'deposit': self.safe_bool(chain, 'canDep'),
1839
- 'withdraw': self.safe_bool(chain, 'canWd'),
1840
- 'fee': self.safe_number(chain, 'fee'),
1841
- 'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'wdTickSz'))),
1842
- 'limits': {
1843
- 'withdraw': {
1844
- 'min': self.safe_number(chain, 'minWd'),
1845
- 'max': self.safe_number(chain, 'maxWd'),
1846
- },
1847
- },
1848
- 'info': chain,
1849
- }
1850
- else:
1851
- # only happens for FIAT currency
1840
+ # allow empty string for rare fiat-currencies, e.g. TRY
1841
+ networkId = self.safe_string(chain, 'chain', '') # USDT-BEP20, USDT-Avalance-C, etc
1842
+ if networkId == '':
1843
+ # only happens for fiat 'TRY' currency
1852
1844
  type = 'fiat'
1845
+ idParts = networkId.split('-')
1846
+ parts = self.array_slice(idParts, 1)
1847
+ chainPart = '-'.join(parts)
1848
+ networkCode = self.network_id_to_code(chainPart, currency['code'])
1849
+ networks[networkCode] = {
1850
+ 'id': networkId,
1851
+ 'network': networkCode,
1852
+ 'active': None,
1853
+ 'deposit': self.safe_bool(chain, 'canDep'),
1854
+ 'withdraw': self.safe_bool(chain, 'canWd'),
1855
+ 'fee': self.safe_number(chain, 'fee'),
1856
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'wdTickSz'))),
1857
+ 'limits': {
1858
+ 'withdraw': {
1859
+ 'min': self.safe_number(chain, 'minWd'),
1860
+ 'max': self.safe_number(chain, 'maxWd'),
1861
+ },
1862
+ },
1863
+ 'info': chain,
1864
+ }
1853
1865
  firstChain = self.safe_dict(chains, 0, {})
1854
1866
  result[code] = self.safe_currency_structure({
1855
1867
  'info': chains,
@@ -703,14 +703,9 @@ class paradex(Exchange, ImplicitAPI):
703
703
  """
704
704
  await self.load_markets()
705
705
  symbols = self.market_symbols(symbols)
706
- request: dict = {}
707
- if symbols is not None:
708
- if isinstance(symbols, list):
709
- request['market'] = self.market_id(symbols[0])
710
- else:
711
- request['market'] = self.market_id(symbols)
712
- else:
713
- request['market'] = 'ALL'
706
+ request: dict = {
707
+ 'market': 'ALL',
708
+ }
714
709
  response = await self.publicGetMarketsSummary(self.extend(request, params))
715
710
  #
716
711
  # {
@@ -28,7 +28,7 @@ class upbit(Exchange, ImplicitAPI):
28
28
  'name': 'Upbit',
29
29
  'countries': ['KR'],
30
30
  'version': 'v1',
31
- 'rateLimit': 1000,
31
+ 'rateLimit': 50,
32
32
  'pro': True,
33
33
  # new metainfo interface
34
34
  'has': {
@@ -83,6 +83,7 @@ class upbit(Exchange, ImplicitAPI):
83
83
  'withdraw': True,
84
84
  },
85
85
  'timeframes': {
86
+ '1s': 'seconds',
86
87
  '1m': 'minutes',
87
88
  '3m': 'minutes',
88
89
  '5m': 'minutes',
@@ -94,6 +95,7 @@ class upbit(Exchange, ImplicitAPI):
94
95
  '1d': 'days',
95
96
  '1w': 'weeks',
96
97
  '1M': 'months',
98
+ '1y': 'years',
97
99
  },
98
100
  'hostname': 'api.upbit.com',
99
101
  'urls': {
@@ -107,54 +109,70 @@ class upbit(Exchange, ImplicitAPI):
107
109
  'fees': 'https://upbit.com/service_center/guide',
108
110
  },
109
111
  'api': {
112
+ # 'endpoint','API Cost'
113
+ # cost = 1000 / (rateLimit * RPS)
110
114
  'public': {
111
- 'get': [
112
- 'market/all',
113
- 'candles/{timeframe}',
114
- 'candles/{timeframe}/{unit}',
115
- 'candles/minutes/{unit}',
116
- 'candles/minutes/1',
117
- 'candles/minutes/3',
118
- 'candles/minutes/5',
119
- 'candles/minutes/10',
120
- 'candles/minutes/15',
121
- 'candles/minutes/30',
122
- 'candles/minutes/60',
123
- 'candles/minutes/240',
124
- 'candles/days',
125
- 'candles/weeks',
126
- 'candles/months',
127
- 'trades/ticks',
128
- 'ticker',
129
- 'orderbook',
130
- ],
115
+ 'get': {
116
+ 'market/all': 2, # RPS: 10
117
+ 'candles/{timeframe}': 2,
118
+ 'candles/{timeframe}/{unit}': 2,
119
+ 'candles/seconds': 2,
120
+ 'candles/minutes/{unit}': 2,
121
+ 'candles/minutes/1': 2,
122
+ 'candles/minutes/3': 2,
123
+ 'candles/minutes/5': 2,
124
+ 'candles/minutes/10': 2,
125
+ 'candles/minutes/15': 2,
126
+ 'candles/minutes/30': 2,
127
+ 'candles/minutes/60': 2,
128
+ 'candles/minutes/240': 2,
129
+ 'candles/days': 2,
130
+ 'candles/weeks': 2,
131
+ 'candles/months': 2,
132
+ 'candles/years': 2,
133
+ 'trades/ticks': 2,
134
+ 'ticker': 2,
135
+ 'ticker/all': 2,
136
+ 'orderbook': 2,
137
+ 'orderbook/supported_levels': 2, # Upbit KR only
138
+ },
131
139
  },
132
140
  'private': {
133
- 'get': [
134
- 'accounts',
135
- 'orders/chance',
136
- 'order',
137
- 'orders',
138
- 'orders/closed',
139
- 'orders/open',
140
- 'orders/uuids',
141
- 'withdraws',
142
- 'withdraw',
143
- 'withdraws/chance',
144
- 'deposits',
145
- 'deposit',
146
- 'deposits/coin_addresses',
147
- 'deposits/coin_address',
148
- ],
149
- 'post': [
150
- 'orders',
151
- 'withdraws/coin',
152
- 'withdraws/krw',
153
- 'deposits/generate_coin_address',
154
- ],
155
- 'delete': [
156
- 'order',
157
- ],
141
+ 'get': {
142
+ 'accounts': 0.67, # RPS: 30
143
+ 'orders/chance': 0.67,
144
+ 'order': 0.67,
145
+ 'orders/closed': 0.67,
146
+ 'orders/open': 0.67,
147
+ 'orders/uuids': 0.67,
148
+ 'withdraws': 0.67,
149
+ 'withdraw': 0.67,
150
+ 'withdraws/chance': 0.67,
151
+ 'withdraws/coin_addresses': 0.67,
152
+ 'deposits': 0.67,
153
+ 'deposits/chance/coin': 0.67,
154
+ 'deposit': 0.67,
155
+ 'deposits/coin_addresses': 0.67,
156
+ 'deposits/coin_address': 0.67,
157
+ 'travel_rule/vasps': 0.67,
158
+ 'status/wallet': 0.67, # Upbit KR only
159
+ 'api_keys': 0.67, # Upbit KR only
160
+ },
161
+ 'post': {
162
+ 'orders': 2.5, # RPS: 8
163
+ 'orders/cancel_and_new': 2.5, # RPS: 8
164
+ 'withdraws/coin': 0.67,
165
+ 'withdraws/krw': 0.67, # Upbit KR only.
166
+ 'deposits/krw': 0.67, # Upbit KR only.
167
+ 'deposits/generate_coin_address': 0.67,
168
+ 'travel_rule/deposit/uuid': 0.67, # RPS: 30, but each deposit can only be queried once every 10 minutes
169
+ 'travel_rule/deposit/txid': 0.67, # RPS: 30, but each deposit can only be queried once every 10 minutes
170
+ },
171
+ 'delete': {
172
+ 'order': 0.67,
173
+ 'orders/open': 40, # RPS: 0.5
174
+ 'orders/uuids': 0.67,
175
+ },
158
176
  },
159
177
  },
160
178
  'fees': {