ccxt 4.3.58__py2.py3-none-any.whl → 4.3.59__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.
Files changed (72) hide show
  1. ccxt/__init__.py +5 -5
  2. ccxt/abstract/bitmart.py +1 -0
  3. ccxt/abstract/btcbox.py +1 -0
  4. ccxt/abstract/upbit.py +3 -0
  5. ccxt/abstract/xt.py +1 -0
  6. ccxt/async_support/__init__.py +5 -5
  7. ccxt/async_support/base/exchange.py +1 -1
  8. ccxt/async_support/binance.py +1 -1
  9. ccxt/async_support/bingx.py +47 -7
  10. ccxt/async_support/bitget.py +1 -1
  11. ccxt/async_support/bitmart.py +1 -0
  12. ccxt/async_support/btcbox.py +145 -8
  13. ccxt/async_support/bybit.py +2 -2
  14. ccxt/async_support/cex.py +1 -1
  15. ccxt/async_support/coinsph.py +1 -1
  16. ccxt/async_support/deribit.py +15 -1
  17. ccxt/async_support/digifinex.py +30 -7
  18. ccxt/async_support/gate.py +16 -16
  19. ccxt/async_support/htx.py +7 -7
  20. ccxt/async_support/hyperliquid.py +106 -2
  21. ccxt/async_support/kraken.py +1 -1
  22. ccxt/async_support/mexc.py +11 -11
  23. ccxt/async_support/novadax.py +1 -1
  24. ccxt/async_support/okcoin.py +1 -1
  25. ccxt/async_support/okx.py +1 -1
  26. ccxt/async_support/phemex.py +1 -1
  27. ccxt/async_support/probit.py +1 -1
  28. ccxt/async_support/tokocrypto.py +1 -1
  29. ccxt/async_support/upbit.py +139 -45
  30. ccxt/async_support/xt.py +70 -7
  31. ccxt/base/errors.py +23 -23
  32. ccxt/base/exchange.py +9 -9
  33. ccxt/binance.py +1 -1
  34. ccxt/bingx.py +47 -7
  35. ccxt/bitget.py +1 -1
  36. ccxt/bitmart.py +1 -0
  37. ccxt/btcbox.py +145 -8
  38. ccxt/bybit.py +2 -2
  39. ccxt/cex.py +1 -1
  40. ccxt/coinsph.py +1 -1
  41. ccxt/deribit.py +15 -1
  42. ccxt/digifinex.py +30 -7
  43. ccxt/gate.py +16 -16
  44. ccxt/htx.py +7 -7
  45. ccxt/hyperliquid.py +106 -2
  46. ccxt/kraken.py +1 -1
  47. ccxt/mexc.py +11 -11
  48. ccxt/novadax.py +1 -1
  49. ccxt/okcoin.py +1 -1
  50. ccxt/okx.py +1 -1
  51. ccxt/phemex.py +1 -1
  52. ccxt/pro/__init__.py +3 -1
  53. ccxt/pro/binance.py +11 -13
  54. ccxt/pro/bingx.py +11 -8
  55. ccxt/pro/bitmart.py +2 -2
  56. ccxt/pro/bitopro.py +1 -1
  57. ccxt/pro/coincheck.py +1 -1
  58. ccxt/pro/coinone.py +1 -1
  59. ccxt/pro/hyperliquid.py +1 -1
  60. ccxt/pro/xt.py +1043 -0
  61. ccxt/probit.py +1 -1
  62. ccxt/test/tests_async.py +2 -2
  63. ccxt/test/tests_helpers.py +1 -1
  64. ccxt/test/tests_sync.py +2 -2
  65. ccxt/tokocrypto.py +1 -1
  66. ccxt/upbit.py +139 -45
  67. ccxt/xt.py +70 -7
  68. {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/METADATA +5 -5
  69. {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/RECORD +72 -71
  70. {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/LICENSE.txt +0 -0
  71. {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/WHEEL +0 -0
  72. {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/top_level.txt +0 -0
@@ -17,7 +17,6 @@ from ccxt.base.errors import AccountSuspended
17
17
  from ccxt.base.errors import ArgumentsRequired
18
18
  from ccxt.base.errors import BadRequest
19
19
  from ccxt.base.errors import BadSymbol
20
- from ccxt.base.errors import BadResponse
21
20
  from ccxt.base.errors import InsufficientFunds
22
21
  from ccxt.base.errors import InvalidOrder
23
22
  from ccxt.base.errors import OrderNotFound
@@ -25,6 +24,7 @@ from ccxt.base.errors import OrderImmediatelyFillable
25
24
  from ccxt.base.errors import NotSupported
26
25
  from ccxt.base.errors import RateLimitExceeded
27
26
  from ccxt.base.errors import ExchangeNotAvailable
27
+ from ccxt.base.errors import BadResponse
28
28
  from ccxt.base.decimal_to_precision import TICK_SIZE
29
29
  from ccxt.base.precise import Precise
30
30
 
@@ -613,21 +613,21 @@ class gate(Exchange, ImplicitAPI):
613
613
  # copied from gatev2
614
614
  'commonCurrencies': {
615
615
  '88MPH': 'MPH',
616
- 'AXIS': 'Axis DeFi',
617
- 'BIFI': 'Bitcoin File',
618
- 'BOX': 'DefiBox',
619
- 'BYN': 'BeyondFi',
620
- 'EGG': 'Goose Finance',
621
- 'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
622
- 'GTC_HT': 'Game.com HT',
623
- 'GTC_BSC': 'Game.com BSC',
624
- 'HIT': 'HitChain',
625
- 'MM': 'Million', # conflict with MilliMeter
626
- 'MPH': 'Morpher', # conflict with 88MPH
627
- 'POINT': 'GatePoint',
628
- 'RAI': 'Rai Reflex Index', # conflict with RAI Finance
629
- 'SBTC': 'Super Bitcoin',
630
- 'TNC': 'Trinity Network Credit',
616
+ 'AXIS': 'AXISDEFI',
617
+ 'BIFI': 'BITCOINFILE',
618
+ 'BOX': 'DEFIBOX',
619
+ 'BYN': 'BEYONDFI',
620
+ 'EGG': 'GOOSEFINANCE',
621
+ 'GTC': 'GAMECOM', # conflict with Gitcoin and Gastrocoin
622
+ 'GTC_HT': 'GAMECOM_HT',
623
+ 'GTC_BSC': 'GAMECOM_BSC',
624
+ 'HIT': 'HITCHAIN',
625
+ 'MM': 'MILLION', # conflict with MilliMeter
626
+ 'MPH': 'MORPHER', # conflict with 88MPH
627
+ 'POINT': 'GATEPOINT',
628
+ 'RAI': 'RAIREFLEXINDEX', # conflict with RAI Finance
629
+ 'SBTC': 'SUPERBITCOIN',
630
+ 'TNC': 'TRINITYNETWORKCREDIT',
631
631
  'VAI': 'VAIOT',
632
632
  'TRAC': 'TRACO', # conflict with OriginTrail(TRAC)
633
633
  },
ccxt/async_support/htx.py CHANGED
@@ -1237,17 +1237,17 @@ class htx(Exchange, ImplicitAPI):
1237
1237
  # https://github.com/ccxt/ccxt/issues/6081
1238
1238
  # https://github.com/ccxt/ccxt/issues/3365
1239
1239
  # https://github.com/ccxt/ccxt/issues/2873
1240
- 'GET': 'Themis', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
1241
- 'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
1242
- 'HIT': 'HitChain',
1240
+ 'GET': 'THEMIS', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
1241
+ 'GTC': 'GAMECOM', # conflict with Gitcoin and Gastrocoin
1242
+ 'HIT': 'HITCHAIN',
1243
1243
  # https://github.com/ccxt/ccxt/issues/7399
1244
1244
  # https://coinmarketcap.com/currencies/pnetwork/
1245
1245
  # https://coinmarketcap.com/currencies/penta/markets/
1246
1246
  # https://en.cryptonomist.ch/blog/eidoo/the-edo-to-pnt-upgrade-what-you-need-to-know-updated/
1247
- 'PNT': 'Penta',
1248
- 'SBTC': 'Super Bitcoin',
1249
- 'SOUL': 'Soulsaver',
1250
- 'BIFI': 'Bitcoin File', # conflict with Beefy.Finance https://github.com/ccxt/ccxt/issues/8706
1247
+ 'PNT': 'PENTA',
1248
+ 'SBTC': 'SUPERBITCOIN',
1249
+ 'SOUL': 'SOULSAVER',
1250
+ 'BIFI': 'BITCOINFILE', # conflict with Beefy.Finance https://github.com/ccxt/ccxt/issues/8706
1251
1251
  },
1252
1252
  })
1253
1253
 
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.hyperliquid import ImplicitAPI
8
8
  import asyncio
9
- from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -106,7 +106,7 @@ class hyperliquid(Exchange, ImplicitAPI):
106
106
  'fetchTickers': False,
107
107
  'fetchTime': False,
108
108
  'fetchTrades': True,
109
- 'fetchTradingFee': False,
109
+ 'fetchTradingFee': True,
110
110
  'fetchTradingFees': False,
111
111
  'fetchTransfer': False,
112
112
  'fetchTransfers': False,
@@ -2382,6 +2382,110 @@ class hyperliquid(Exchange, ImplicitAPI):
2382
2382
  'fee': None,
2383
2383
  }
2384
2384
 
2385
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2386
+ """
2387
+ fetch the trading fees for a market
2388
+ :param str symbol: unified market symbol
2389
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2390
+ :param str [params.user]: user address, will default to self.walletAddress if not provided
2391
+ :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
2392
+ """
2393
+ await self.load_markets()
2394
+ userAddress = None
2395
+ userAddress, params = self.handle_public_address('fetchTradingFee', params)
2396
+ market = self.market(symbol)
2397
+ request: dict = {
2398
+ 'type': 'userFees',
2399
+ 'user': userAddress,
2400
+ }
2401
+ response = await self.publicPostInfo(self.extend(request, params))
2402
+ #
2403
+ # {
2404
+ # "dailyUserVlm": [
2405
+ # {
2406
+ # "date": "2024-07-08",
2407
+ # "userCross": "0.0",
2408
+ # "userAdd": "0.0",
2409
+ # "exchange": "90597185.23639999"
2410
+ # }
2411
+ # ],
2412
+ # "feeSchedule": {
2413
+ # "cross": "0.00035",
2414
+ # "add": "0.0001",
2415
+ # "tiers": {
2416
+ # "vip": [
2417
+ # {
2418
+ # "ntlCutoff": "5000000.0",
2419
+ # "cross": "0.0003",
2420
+ # "add": "0.00005"
2421
+ # }
2422
+ # ],
2423
+ # "mm": [
2424
+ # {
2425
+ # "makerFractionCutoff": "0.005",
2426
+ # "add": "-0.00001"
2427
+ # }
2428
+ # ]
2429
+ # },
2430
+ # "referralDiscount": "0.04"
2431
+ # },
2432
+ # "userCrossRate": "0.00035",
2433
+ # "userAddRate": "0.0001",
2434
+ # "activeReferralDiscount": "0.0"
2435
+ # }
2436
+ #
2437
+ data: dict = {
2438
+ 'userCrossRate': self.safe_string(response, 'userCrossRate'),
2439
+ 'userAddRate': self.safe_string(response, 'userAddRate'),
2440
+ }
2441
+ return self.parse_trading_fee(data, market)
2442
+
2443
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
2444
+ #
2445
+ # {
2446
+ # "dailyUserVlm": [
2447
+ # {
2448
+ # "date": "2024-07-08",
2449
+ # "userCross": "0.0",
2450
+ # "userAdd": "0.0",
2451
+ # "exchange": "90597185.23639999"
2452
+ # }
2453
+ # ],
2454
+ # "feeSchedule": {
2455
+ # "cross": "0.00035",
2456
+ # "add": "0.0001",
2457
+ # "tiers": {
2458
+ # "vip": [
2459
+ # {
2460
+ # "ntlCutoff": "5000000.0",
2461
+ # "cross": "0.0003",
2462
+ # "add": "0.00005"
2463
+ # }
2464
+ # ],
2465
+ # "mm": [
2466
+ # {
2467
+ # "makerFractionCutoff": "0.005",
2468
+ # "add": "-0.00001"
2469
+ # }
2470
+ # ]
2471
+ # },
2472
+ # "referralDiscount": "0.04"
2473
+ # },
2474
+ # "userCrossRate": "0.00035",
2475
+ # "userAddRate": "0.0001",
2476
+ # "activeReferralDiscount": "0.0"
2477
+ # }
2478
+ #
2479
+ symbol = self.safe_symbol(None, market)
2480
+ return {
2481
+ 'info': fee,
2482
+ 'symbol': symbol,
2483
+ 'maker': self.safe_number(fee, 'userAddRate'),
2484
+ 'taker': self.safe_number(fee, 'userCrossRate'),
2485
+ 'percentage': None,
2486
+ 'tierBased': None,
2487
+ }
2488
+
2385
2489
  def format_vault_address(self, address: Str = None):
2386
2490
  if address is None:
2387
2491
  return None
@@ -19,13 +19,13 @@ from ccxt.base.errors import InsufficientFunds
19
19
  from ccxt.base.errors import InvalidAddress
20
20
  from ccxt.base.errors import InvalidOrder
21
21
  from ccxt.base.errors import OrderNotFound
22
- from ccxt.base.errors import CancelPending
23
22
  from ccxt.base.errors import NotSupported
24
23
  from ccxt.base.errors import DDoSProtection
25
24
  from ccxt.base.errors import RateLimitExceeded
26
25
  from ccxt.base.errors import ExchangeNotAvailable
27
26
  from ccxt.base.errors import OnMaintenance
28
27
  from ccxt.base.errors import InvalidNonce
28
+ from ccxt.base.errors import CancelPending
29
29
  from ccxt.base.decimal_to_precision import TRUNCATE
30
30
  from ccxt.base.decimal_to_precision import TICK_SIZE
31
31
  from ccxt.base.precise import Precise
@@ -810,24 +810,24 @@ class mexc(Exchange, ImplicitAPI):
810
810
  'commonCurrencies': {
811
811
  'BEYONDPROTOCOL': 'BEYOND',
812
812
  'BIFI': 'BIFIF',
813
- 'BYN': 'BeyondFi',
813
+ 'BYN': 'BEYONDFI',
814
814
  'COFI': 'COFIX', # conflict with CoinFi
815
- 'DFI': 'DfiStarter',
816
- 'DFT': 'dFuture',
815
+ 'DFI': 'DFISTARTER',
816
+ 'DFT': 'DFUTURE',
817
817
  'DRK': 'DRK',
818
- 'EGC': 'Egoras Credit',
818
+ 'EGC': 'EGORASCREDIT',
819
819
  'FLUX1': 'FLUX', # switched places
820
820
  'FLUX': 'FLUX1', # switched places
821
- 'FREE': 'FreeRossDAO', # conflict with FREE Coin
821
+ 'FREE': 'FREEROSSDAO', # conflict with FREE Coin
822
822
  'GAS': 'GASDAO',
823
823
  'GASNEO': 'GAS',
824
- 'GMT': 'GMT Token', # Conflict with GMT(STEPN)
824
+ 'GMT': 'GMTTOKEN', # Conflict with GMT(STEPN)
825
825
  'STEPN': 'GMT', # Conflict with GMT Token
826
- 'HERO': 'Step Hero', # conflict with Metahero
827
- 'MIMO': 'Mimosa',
828
- 'PROS': 'Pros.Finance', # conflict with Prosper
829
- 'SIN': 'Sin City Token',
830
- 'SOUL': 'Soul Swap',
826
+ 'HERO': 'STEPHERO', # conflict with Metahero
827
+ 'MIMO': 'MIMOSA',
828
+ 'PROS': 'PROSFINANCE', # conflict with Prosper
829
+ 'SIN': 'SINCITYTOKEN',
830
+ 'SOUL': 'SOULSWAP',
831
831
  },
832
832
  'exceptions': {
833
833
  'exact': {
@@ -19,9 +19,9 @@ from ccxt.base.errors import BadSymbol
19
19
  from ccxt.base.errors import InsufficientFunds
20
20
  from ccxt.base.errors import InvalidOrder
21
21
  from ccxt.base.errors import OrderNotFound
22
- from ccxt.base.errors import CancelPending
23
22
  from ccxt.base.errors import RateLimitExceeded
24
23
  from ccxt.base.errors import OnMaintenance
24
+ from ccxt.base.errors import CancelPending
25
25
  from ccxt.base.decimal_to_precision import TICK_SIZE
26
26
  from ccxt.base.precise import Precise
27
27
 
@@ -20,7 +20,6 @@ from ccxt.base.errors import InsufficientFunds
20
20
  from ccxt.base.errors import InvalidAddress
21
21
  from ccxt.base.errors import InvalidOrder
22
22
  from ccxt.base.errors import OrderNotFound
23
- from ccxt.base.errors import CancelPending
24
23
  from ccxt.base.errors import NotSupported
25
24
  from ccxt.base.errors import NetworkError
26
25
  from ccxt.base.errors import RateLimitExceeded
@@ -28,6 +27,7 @@ from ccxt.base.errors import ExchangeNotAvailable
28
27
  from ccxt.base.errors import OnMaintenance
29
28
  from ccxt.base.errors import InvalidNonce
30
29
  from ccxt.base.errors import RequestTimeout
30
+ from ccxt.base.errors import CancelPending
31
31
  from ccxt.base.decimal_to_precision import TICK_SIZE
32
32
  from ccxt.base.precise import Precise
33
33
 
ccxt/async_support/okx.py CHANGED
@@ -22,7 +22,6 @@ from ccxt.base.errors import InsufficientFunds
22
22
  from ccxt.base.errors import InvalidAddress
23
23
  from ccxt.base.errors import InvalidOrder
24
24
  from ccxt.base.errors import OrderNotFound
25
- from ccxt.base.errors import CancelPending
26
25
  from ccxt.base.errors import ContractUnavailable
27
26
  from ccxt.base.errors import NotSupported
28
27
  from ccxt.base.errors import NetworkError
@@ -32,6 +31,7 @@ from ccxt.base.errors import ExchangeNotAvailable
32
31
  from ccxt.base.errors import OnMaintenance
33
32
  from ccxt.base.errors import InvalidNonce
34
33
  from ccxt.base.errors import RequestTimeout
34
+ from ccxt.base.errors import CancelPending
35
35
  from ccxt.base.decimal_to_precision import TICK_SIZE
36
36
  from ccxt.base.precise import Precise
37
37
 
@@ -19,10 +19,10 @@ from ccxt.base.errors import BadSymbol
19
19
  from ccxt.base.errors import InsufficientFunds
20
20
  from ccxt.base.errors import InvalidOrder
21
21
  from ccxt.base.errors import OrderNotFound
22
- from ccxt.base.errors import CancelPending
23
22
  from ccxt.base.errors import DuplicateOrderId
24
23
  from ccxt.base.errors import DDoSProtection
25
24
  from ccxt.base.errors import RateLimitExceeded
25
+ from ccxt.base.errors import CancelPending
26
26
  from ccxt.base.decimal_to_precision import TICK_SIZE
27
27
  from ccxt.base.precise import Precise
28
28
 
@@ -14,13 +14,13 @@ from ccxt.base.errors import ArgumentsRequired
14
14
  from ccxt.base.errors import BadRequest
15
15
  from ccxt.base.errors import BadSymbol
16
16
  from ccxt.base.errors import MarketClosed
17
- from ccxt.base.errors import BadResponse
18
17
  from ccxt.base.errors import InsufficientFunds
19
18
  from ccxt.base.errors import InvalidAddress
20
19
  from ccxt.base.errors import InvalidOrder
21
20
  from ccxt.base.errors import DDoSProtection
22
21
  from ccxt.base.errors import RateLimitExceeded
23
22
  from ccxt.base.errors import ExchangeNotAvailable
23
+ from ccxt.base.errors import BadResponse
24
24
  from ccxt.base.decimal_to_precision import TRUNCATE
25
25
  from ccxt.base.decimal_to_precision import TICK_SIZE
26
26
  from ccxt.base.precise import Precise
@@ -17,7 +17,6 @@ from ccxt.base.errors import ArgumentsRequired
17
17
  from ccxt.base.errors import BadRequest
18
18
  from ccxt.base.errors import BadSymbol
19
19
  from ccxt.base.errors import MarginModeAlreadySet
20
- from ccxt.base.errors import BadResponse
21
20
  from ccxt.base.errors import InsufficientFunds
22
21
  from ccxt.base.errors import InvalidOrder
23
22
  from ccxt.base.errors import OrderNotFound
@@ -30,6 +29,7 @@ from ccxt.base.errors import ExchangeNotAvailable
30
29
  from ccxt.base.errors import OnMaintenance
31
30
  from ccxt.base.errors import InvalidNonce
32
31
  from ccxt.base.errors import RequestTimeout
32
+ from ccxt.base.errors import BadResponse
33
33
  from ccxt.base.decimal_to_precision import TRUNCATE
34
34
  from ccxt.base.decimal_to_precision import TICK_SIZE
35
35
  from ccxt.base.precise import Precise
@@ -134,6 +134,9 @@ class upbit(Exchange, ImplicitAPI):
134
134
  'orders/chance',
135
135
  'order',
136
136
  'orders',
137
+ 'orders/closed',
138
+ 'orders/open',
139
+ 'orders/uuids',
137
140
  'withdraws',
138
141
  'withdraw',
139
142
  'withdraws/chance',
@@ -1392,6 +1395,28 @@ class upbit(Exchange, ImplicitAPI):
1392
1395
  # ],
1393
1396
  # }
1394
1397
  #
1398
+ # fetchOpenOrders, fetchClosedOrders, fetchCanceledOrders
1399
+ #
1400
+ # {
1401
+ # "uuid": "637fd66-d019-4d77-bee6-8e0cff28edd9",
1402
+ # "side": "ask",
1403
+ # "ord_type": "limit",
1404
+ # "price": "1.5",
1405
+ # "state": "wait",
1406
+ # "market": "SGD-XRP",
1407
+ # "created_at": "2024-06-05T09:37:10Z",
1408
+ # "volume": "10",
1409
+ # "remaining_volume": "10",
1410
+ # "reserved_fee": "0",
1411
+ # "remaining_fee": "0",
1412
+ # "paid_fee": "0",
1413
+ # "locked": "10",
1414
+ # "executed_volume": "0",
1415
+ # "executed_funds": "0",
1416
+ # "trades_count": 0,
1417
+ # "time_in_force": "ioc"
1418
+ # }
1419
+ #
1395
1420
  id = self.safe_string(order, 'uuid')
1396
1421
  side = self.safe_string(order, 'side')
1397
1422
  if side == 'bid':
@@ -1453,7 +1478,7 @@ class upbit(Exchange, ImplicitAPI):
1453
1478
  'lastTradeTimestamp': lastTradeTimestamp,
1454
1479
  'symbol': market['symbol'],
1455
1480
  'type': type,
1456
- 'timeInForce': None,
1481
+ 'timeInForce': self.safe_string_upper(order, 'time_in_force'),
1457
1482
  'postOnly': None,
1458
1483
  'side': side,
1459
1484
  'price': price,
@@ -1469,77 +1494,149 @@ class upbit(Exchange, ImplicitAPI):
1469
1494
  'trades': trades,
1470
1495
  })
1471
1496
 
1472
- async def fetch_orders_by_state(self, state, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1497
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1498
+ """
1499
+ fetch all unfilled currently open orders
1500
+ :see: https://global-docs.upbit.com/reference/open-order
1501
+ :param str symbol: unified market symbol
1502
+ :param int [since]: the earliest time in ms to fetch open orders for
1503
+ :param int [limit]: the maximum number of open order structures to retrieve
1504
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1505
+ :param str [params.state]: default is 'wait', set to 'watch' for stop limit orders
1506
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1507
+ """
1473
1508
  await self.load_markets()
1474
- request: dict = {
1475
- # 'market': self.market_id(symbol),
1476
- 'state': state,
1477
- # 'page': 1,
1478
- # 'order_by': 'asc',
1479
- }
1509
+ request: dict = {}
1480
1510
  market = None
1481
1511
  if symbol is not None:
1482
1512
  market = self.market(symbol)
1483
1513
  request['market'] = market['id']
1484
- response = await self.privateGetOrders(self.extend(request, params))
1514
+ if limit is not None:
1515
+ request['limit'] = limit
1516
+ response = await self.privateGetOrdersOpen(self.extend(request, params))
1485
1517
  #
1486
1518
  # [
1487
1519
  # {
1488
- # "uuid": "a08f09b1-1718-42e2-9358-f0e5e083d3ee",
1489
- # "side": "bid",
1520
+ # "uuid": "637fd66-d019-4d77-bee6-8e0cff28edd9",
1521
+ # "side": "ask",
1490
1522
  # "ord_type": "limit",
1491
- # "price": "17417000.0",
1492
- # "state": "done",
1493
- # "market": "KRW-BTC",
1494
- # "created_at": "2018-04-05T14:09:14+09:00",
1495
- # "volume": "1.0",
1496
- # "remaining_volume": "0.0",
1497
- # "reserved_fee": "26125.5",
1498
- # "remaining_fee": "25974.0",
1499
- # "paid_fee": "151.5",
1500
- # "locked": "17341974.0",
1501
- # "executed_volume": "1.0",
1502
- # "trades_count":2
1503
- # },
1523
+ # "price": "1.5",
1524
+ # "state": "wait",
1525
+ # "market": "SGD-XRP",
1526
+ # "created_at": "2024-06-05T09:37:10Z",
1527
+ # "volume": "10",
1528
+ # "remaining_volume": "10",
1529
+ # "reserved_fee": "0",
1530
+ # "remaining_fee": "0",
1531
+ # "paid_fee": "0",
1532
+ # "locked": "10",
1533
+ # "executed_volume": "0",
1534
+ # "executed_funds": "0",
1535
+ # "trades_count": 0
1536
+ # }
1504
1537
  # ]
1505
1538
  #
1506
1539
  return self.parse_orders(response, market, since, limit)
1507
1540
 
1508
- async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1509
- """
1510
- :see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C
1511
- fetch all unfilled currently open orders
1512
- :param str symbol: unified market symbol
1513
- :param int [since]: the earliest time in ms to fetch open orders for
1514
- :param int [limit]: the maximum number of open orders structures to retrieve
1515
- :param dict [params]: extra parameters specific to the exchange API endpoint
1516
- :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1517
- """
1518
- return await self.fetch_orders_by_state('wait', symbol, since, limit, params)
1519
-
1520
1541
  async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1521
1542
  """
1522
- :see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C
1523
1543
  fetches information on multiple closed orders made by the user
1544
+ :see: https://global-docs.upbit.com/reference/closed-order
1524
1545
  :param str symbol: unified market symbol of the market orders were made in
1525
1546
  :param int [since]: the earliest time in ms to fetch orders for
1526
1547
  :param int [limit]: the maximum number of order structures to retrieve
1527
1548
  :param dict [params]: extra parameters specific to the exchange API endpoint
1549
+ :param int [params.until]: timestamp in ms of the latest order
1528
1550
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1529
1551
  """
1530
- return await self.fetch_orders_by_state('done', symbol, since, limit, params)
1552
+ await self.load_markets()
1553
+ request: dict = {
1554
+ 'state': 'done',
1555
+ }
1556
+ market = None
1557
+ if symbol is not None:
1558
+ market = self.market(symbol)
1559
+ request['market'] = market['id']
1560
+ if since is not None:
1561
+ request['start_time'] = since
1562
+ if limit is not None:
1563
+ request['limit'] = limit
1564
+ request, params = self.handle_until_option('end_time', request, params)
1565
+ response = await self.privateGetOrdersClosed(self.extend(request, params))
1566
+ #
1567
+ # [
1568
+ # {
1569
+ # "uuid": "637fd66-d019-4d77-bee6-8e0cff28edd9",
1570
+ # "side": "ask",
1571
+ # "ord_type": "limit",
1572
+ # "price": "1.5",
1573
+ # "state": "done",
1574
+ # "market": "SGD-XRP",
1575
+ # "created_at": "2024-06-05T09:37:10Z",
1576
+ # "volume": "10",
1577
+ # "remaining_volume": "10",
1578
+ # "reserved_fee": "0",
1579
+ # "remaining_fee": "0",
1580
+ # "paid_fee": "0",
1581
+ # "locked": "10",
1582
+ # "executed_volume": "0",
1583
+ # "executed_funds": "0",
1584
+ # "trades_count": 0,
1585
+ # "time_in_force": "ioc"
1586
+ # }
1587
+ # ]
1588
+ #
1589
+ return self.parse_orders(response, market, since, limit)
1531
1590
 
1532
1591
  async def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1533
1592
  """
1534
- :see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C
1535
1593
  fetches information on multiple canceled orders made by the user
1594
+ :see: https://global-docs.upbit.com/reference/closed-order
1536
1595
  :param str symbol: unified market symbol of the market orders were made in
1537
1596
  :param int [since]: timestamp in ms of the earliest order, default is None
1538
1597
  :param int [limit]: max number of orders to return, default is None
1539
1598
  :param dict [params]: extra parameters specific to the exchange API endpoint
1599
+ :param int [params.until]: timestamp in ms of the latest order
1540
1600
  :returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1541
1601
  """
1542
- return await self.fetch_orders_by_state('cancel', symbol, since, limit, params)
1602
+ await self.load_markets()
1603
+ request: dict = {
1604
+ 'state': 'cancel',
1605
+ }
1606
+ market = None
1607
+ if symbol is not None:
1608
+ market = self.market(symbol)
1609
+ request['market'] = market['id']
1610
+ if since is not None:
1611
+ request['start_time'] = since
1612
+ if limit is not None:
1613
+ request['limit'] = limit
1614
+ request, params = self.handle_until_option('end_time', request, params)
1615
+ response = await self.privateGetOrdersClosed(self.extend(request, params))
1616
+ #
1617
+ # [
1618
+ # {
1619
+ # "uuid": "637fd66-d019-4d77-bee6-8e0cff28edd9",
1620
+ # "side": "ask",
1621
+ # "ord_type": "limit",
1622
+ # "price": "1.5",
1623
+ # "state": "cancel",
1624
+ # "market": "SGD-XRP",
1625
+ # "created_at": "2024-06-05T09:37:10Z",
1626
+ # "volume": "10",
1627
+ # "remaining_volume": "10",
1628
+ # "reserved_fee": "0",
1629
+ # "remaining_fee": "0",
1630
+ # "paid_fee": "0",
1631
+ # "locked": "10",
1632
+ # "executed_volume": "0",
1633
+ # "executed_funds": "0",
1634
+ # "trades_count": 0,
1635
+ # "time_in_force": "ioc"
1636
+ # }
1637
+ # ]
1638
+ #
1639
+ return self.parse_orders(response, market, since, limit)
1543
1640
 
1544
1641
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1545
1642
  """
@@ -1793,11 +1890,8 @@ class upbit(Exchange, ImplicitAPI):
1793
1890
  if (method != 'GET') and (method != 'DELETE'):
1794
1891
  body = self.json(params)
1795
1892
  headers['Content-Type'] = 'application/json'
1796
- if hasQuery:
1797
- auth = self.urlencode(query)
1798
- else:
1799
- if hasQuery:
1800
- auth = self.urlencode(self.keysort(query))
1893
+ if hasQuery:
1894
+ auth = self.urlencode(query)
1801
1895
  if auth is not None:
1802
1896
  hash = self.hash(self.encode(auth), 'sha512')
1803
1897
  request['query_hash'] = hash