ccxt 4.4.68__py2.py3-none-any.whl → 4.4.70__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 (43) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bybit.py +4 -0
  3. ccxt/abstract/myokx.py +3 -0
  4. ccxt/abstract/okx.py +3 -0
  5. ccxt/abstract/paradex.py +23 -0
  6. ccxt/abstract/tradeogre.py +2 -1
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/base/exchange.py +5 -1
  9. ccxt/async_support/binance.py +17 -3
  10. ccxt/async_support/bitget.py +47 -262
  11. ccxt/async_support/bitstamp.py +2 -3
  12. ccxt/async_support/bybit.py +7 -0
  13. ccxt/async_support/coinbase.py +24 -9
  14. ccxt/async_support/cryptomus.py +122 -6
  15. ccxt/async_support/hyperliquid.py +17 -8
  16. ccxt/async_support/okx.py +4 -0
  17. ccxt/async_support/paradex.py +173 -5
  18. ccxt/async_support/phemex.py +2 -2
  19. ccxt/async_support/tradeogre.py +31 -11
  20. ccxt/async_support/whitebit.py +210 -2
  21. ccxt/base/exchange.py +1 -2
  22. ccxt/binance.py +17 -3
  23. ccxt/bitget.py +47 -262
  24. ccxt/bitstamp.py +2 -3
  25. ccxt/bybit.py +7 -0
  26. ccxt/coinbase.py +24 -9
  27. ccxt/cryptomus.py +122 -6
  28. ccxt/hyperliquid.py +17 -8
  29. ccxt/okx.py +4 -0
  30. ccxt/paradex.py +173 -5
  31. ccxt/phemex.py +2 -2
  32. ccxt/pro/__init__.py +1 -1
  33. ccxt/pro/bitget.py +28 -3
  34. ccxt/pro/bybit.py +81 -37
  35. ccxt/test/tests_async.py +25 -3
  36. ccxt/test/tests_sync.py +25 -3
  37. ccxt/tradeogre.py +31 -11
  38. ccxt/whitebit.py +210 -2
  39. {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/METADATA +4 -4
  40. {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/RECORD +43 -43
  41. {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/LICENSE.txt +0 -0
  42. {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/WHEEL +0 -0
  43. {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/top_level.txt +0 -0
ccxt/phemex.py CHANGED
@@ -3580,14 +3580,14 @@ class phemex(Exchange, ImplicitAPI):
3580
3580
 
3581
3581
  :param str[] [symbols]: list of unified market symbols
3582
3582
  :param dict [params]: extra parameters specific to the exchange API endpoint
3583
- :param str [params.code]: the currency code to fetch positions for, USD, BTC or USDT, USD is the default
3583
+ :param str [params.code]: the currency code to fetch positions for, USD, BTC or USDT, USDT is the default
3584
3584
  :param str [params.method]: *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3585
3585
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
3586
3586
  """
3587
3587
  self.load_markets()
3588
3588
  symbols = self.market_symbols(symbols)
3589
3589
  subType = None
3590
- code = self.safe_string_2(params, 'currency', 'code', 'USD')
3590
+ code = self.safe_string_2(params, 'currency', 'code', 'USDT')
3591
3591
  params = self.omit(params, ['currency', 'code'])
3592
3592
  settle = None
3593
3593
  market = None
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.68'
7
+ __version__ = '4.4.70'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/bitget.py CHANGED
@@ -52,6 +52,10 @@ class bitget(ccxt.async_support.bitget):
52
52
  'public': 'wss://ws.bitget.com/v2/ws/public',
53
53
  'private': 'wss://ws.bitget.com/v2/ws/private',
54
54
  },
55
+ 'demo': {
56
+ 'public': 'wss://wspap.bitget.com/v2/ws/public',
57
+ 'private': 'wss://wspap.bitget.com/v2/ws/private',
58
+ },
55
59
  },
56
60
  },
57
61
  'options': {
@@ -1125,7 +1129,7 @@ class bitget(ccxt.async_support.bitget):
1125
1129
  instType = 'SPOT'
1126
1130
  else:
1127
1131
  instType, params = self.get_inst_type(market, params)
1128
- if type == 'spot':
1132
+ if type == 'spot' and (symbol is not None):
1129
1133
  subscriptionHash = subscriptionHash + ':' + symbol
1130
1134
  if isTrigger:
1131
1135
  subscriptionHash = subscriptionHash + ':stop' # we don't want to re-use the same subscription hash for stop orders
@@ -1697,6 +1701,11 @@ class bitget(ccxt.async_support.bitget):
1697
1701
 
1698
1702
  async def watch_public(self, messageHash, args, params={}):
1699
1703
  url = self.urls['api']['ws']['public']
1704
+ sandboxMode = self.safe_bool_2(self.options, 'sandboxMode', 'sandbox', False)
1705
+ if sandboxMode:
1706
+ instType = self.safe_string(args, 'instType')
1707
+ if (instType != 'SCOIN-FUTURES') and (instType != 'SUSDT-FUTURES') and (instType != 'SUSDC-FUTURES'):
1708
+ url = self.urls['api']['demo']['public']
1700
1709
  request: dict = {
1701
1710
  'op': 'subscribe',
1702
1711
  'args': [args],
@@ -1706,6 +1715,11 @@ class bitget(ccxt.async_support.bitget):
1706
1715
 
1707
1716
  async def un_watch_public(self, messageHash, args, params={}):
1708
1717
  url = self.urls['api']['ws']['public']
1718
+ sandboxMode = self.safe_bool_2(self.options, 'sandboxMode', 'sandbox', False)
1719
+ if sandboxMode:
1720
+ instType = self.safe_string(args, 'instType')
1721
+ if (instType != 'SCOIN-FUTURES') and (instType != 'SUSDT-FUTURES') and (instType != 'SUSDC-FUTURES'):
1722
+ url = self.urls['api']['demo']['public']
1709
1723
  request: dict = {
1710
1724
  'op': 'unsubscribe',
1711
1725
  'args': [args],
@@ -1715,6 +1729,12 @@ class bitget(ccxt.async_support.bitget):
1715
1729
 
1716
1730
  async def watch_public_multiple(self, messageHashes, argsArray, params={}):
1717
1731
  url = self.urls['api']['ws']['public']
1732
+ sandboxMode = self.safe_bool_2(self.options, 'sandboxMode', 'sandbox', False)
1733
+ if sandboxMode:
1734
+ argsArrayFirst = self.safe_dict(argsArray, 0, {})
1735
+ instType = self.safe_string(argsArrayFirst, 'instType')
1736
+ if (instType != 'SCOIN-FUTURES') and (instType != 'SUSDT-FUTURES') and (instType != 'SUSDC-FUTURES'):
1737
+ url = self.urls['api']['demo']['public']
1718
1738
  request: dict = {
1719
1739
  'op': 'subscribe',
1720
1740
  'args': argsArray,
@@ -1724,7 +1744,7 @@ class bitget(ccxt.async_support.bitget):
1724
1744
 
1725
1745
  async def authenticate(self, params={}):
1726
1746
  self.check_required_credentials()
1727
- url = self.urls['api']['ws']['private']
1747
+ url = self.safe_string(params, 'url')
1728
1748
  client = self.client(url)
1729
1749
  messageHash = 'authenticated'
1730
1750
  future = client.future(messageHash)
@@ -1750,8 +1770,13 @@ class bitget(ccxt.async_support.bitget):
1750
1770
  return await future
1751
1771
 
1752
1772
  async def watch_private(self, messageHash, subscriptionHash, args, params={}):
1753
- await self.authenticate()
1754
1773
  url = self.urls['api']['ws']['private']
1774
+ sandboxMode = self.safe_bool_2(self.options, 'sandboxMode', 'sandbox', False)
1775
+ if sandboxMode:
1776
+ instType = self.safe_string(args, 'instType')
1777
+ if (instType != 'SCOIN-FUTURES') and (instType != 'SUSDT-FUTURES') and (instType != 'SUSDC-FUTURES'):
1778
+ url = self.urls['api']['demo']['private']
1779
+ await self.authenticate({'url': url})
1755
1780
  request: dict = {
1756
1781
  'op': 'subscribe',
1757
1782
  'args': [args],
ccxt/pro/bybit.py CHANGED
@@ -1494,6 +1494,7 @@ class bybit(ccxt.async_support.bybit):
1494
1494
  :param int [since]: the earliest time in ms to fetch liquidations for
1495
1495
  :param int [limit]: the maximum number of liquidation structures to retrieve
1496
1496
  :param dict [params]: exchange specific parameters for the bitmex api endpoint
1497
+ :param str [params.method]: exchange specific method, supported: liquidation, allLiquidation
1497
1498
  :returns dict: an array of `liquidation structures <https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure>`
1498
1499
  """
1499
1500
  await self.load_markets()
@@ -1501,8 +1502,10 @@ class bybit(ccxt.async_support.bybit):
1501
1502
  symbol = market['symbol']
1502
1503
  url = await self.get_url_by_market_type(symbol, False, 'watchLiquidations', params)
1503
1504
  params = self.clean_params(params)
1505
+ method = None
1506
+ method, params = self.handle_option_and_params(params, 'watchLiquidations', 'method', 'liquidation')
1504
1507
  messageHash = 'liquidations::' + symbol
1505
- topic = 'liquidation.' + market['id']
1508
+ topic = method + '.' + market['id']
1506
1509
  newLiquidation = await self.watch_topics(url, [messageHash], [topic], params)
1507
1510
  if self.newUpdates:
1508
1511
  return newLiquidation
@@ -1510,52 +1513,92 @@ class bybit(ccxt.async_support.bybit):
1510
1513
 
1511
1514
  def handle_liquidation(self, client: Client, message):
1512
1515
  #
1513
- # {
1514
- # "data": {
1515
- # "price": "0.03803",
1516
- # "side": "Buy",
1517
- # "size": "1637",
1518
- # "symbol": "GALAUSDT",
1519
- # "updatedTime": 1673251091822
1520
- # },
1521
- # "topic": "liquidation.GALAUSDT",
1522
- # "ts": 1673251091822,
1523
- # "type": "snapshot"
1524
- # }
1516
+ # {
1517
+ # "data": {
1518
+ # "price": "0.03803",
1519
+ # "side": "Buy",
1520
+ # "size": "1637",
1521
+ # "symbol": "GALAUSDT",
1522
+ # "updatedTime": 1673251091822
1523
+ # },
1524
+ # "topic": "liquidation.GALAUSDT",
1525
+ # "ts": 1673251091822,
1526
+ # "type": "snapshot"
1527
+ # }
1525
1528
  #
1526
- rawLiquidation = self.safe_dict(message, 'data', {})
1527
- marketId = self.safe_string(rawLiquidation, 'symbol')
1528
- market = self.safe_market(marketId, None, '', 'contract')
1529
- symbol = market['symbol']
1530
- liquidation = self.parse_ws_liquidation(rawLiquidation, market)
1531
- liquidations = self.safe_value(self.liquidations, symbol)
1532
- if liquidations is None:
1533
- limit = self.safe_integer(self.options, 'liquidationsLimit', 1000)
1534
- liquidations = ArrayCache(limit)
1535
- liquidations.append(liquidation)
1536
- self.liquidations[symbol] = liquidations
1537
- client.resolve([liquidation], 'liquidations')
1538
- client.resolve([liquidation], 'liquidations::' + symbol)
1529
+ # {
1530
+ # "topic": "allLiquidation.ROSEUSDT",
1531
+ # "type": "snapshot",
1532
+ # "ts": 1739502303204,
1533
+ # "data": [
1534
+ # {
1535
+ # "T": 1739502302929,
1536
+ # "s": "ROSEUSDT",
1537
+ # "S": "Sell",
1538
+ # "v": "20000",
1539
+ # "p": "0.04499"
1540
+ # }
1541
+ # ]
1542
+ # }
1543
+ #
1544
+ if isinstance(message['data'], list):
1545
+ rawLiquidations = self.safe_list(message, 'data', [])
1546
+ for i in range(0, len(rawLiquidations)):
1547
+ rawLiquidation = rawLiquidations[i]
1548
+ marketId = self.safe_string(rawLiquidation, 's')
1549
+ market = self.safe_market(marketId, None, '', 'contract')
1550
+ symbol = market['symbol']
1551
+ liquidation = self.parse_ws_liquidation(rawLiquidation, market)
1552
+ liquidations = self.safe_value(self.liquidations, symbol)
1553
+ if liquidations is None:
1554
+ limit = self.safe_integer(self.options, 'liquidationsLimit', 1000)
1555
+ liquidations = ArrayCache(limit)
1556
+ liquidations.append(liquidation)
1557
+ self.liquidations[symbol] = liquidations
1558
+ client.resolve([liquidation], 'liquidations')
1559
+ client.resolve([liquidation], 'liquidations::' + symbol)
1560
+ else:
1561
+ rawLiquidation = self.safe_dict(message, 'data', {})
1562
+ marketId = self.safe_string(rawLiquidation, 'symbol')
1563
+ market = self.safe_market(marketId, None, '', 'contract')
1564
+ symbol = market['symbol']
1565
+ liquidation = self.parse_ws_liquidation(rawLiquidation, market)
1566
+ liquidations = self.safe_value(self.liquidations, symbol)
1567
+ if liquidations is None:
1568
+ limit = self.safe_integer(self.options, 'liquidationsLimit', 1000)
1569
+ liquidations = ArrayCache(limit)
1570
+ liquidations.append(liquidation)
1571
+ self.liquidations[symbol] = liquidations
1572
+ client.resolve([liquidation], 'liquidations')
1573
+ client.resolve([liquidation], 'liquidations::' + symbol)
1539
1574
 
1540
1575
  def parse_ws_liquidation(self, liquidation, market=None):
1541
1576
  #
1542
- # {
1543
- # "price": "0.03803",
1544
- # "side": "Buy",
1545
- # "size": "1637",
1546
- # "symbol": "GALAUSDT",
1547
- # "updatedTime": 1673251091822
1548
- # }
1577
+ # {
1578
+ # "price": "0.03803",
1579
+ # "side": "Buy",
1580
+ # "size": "1637",
1581
+ # "symbol": "GALAUSDT",
1582
+ # "updatedTime": 1673251091822
1583
+ # }
1584
+ #
1585
+ # {
1586
+ # "T": 1739502302929,
1587
+ # "s": "ROSEUSDT",
1588
+ # "S": "Sell",
1589
+ # "v": "20000",
1590
+ # "p": "0.04499"
1591
+ # }
1549
1592
  #
1550
- marketId = self.safe_string(liquidation, 'symbol')
1593
+ marketId = self.safe_string_2(liquidation, 'symbol', 's')
1551
1594
  market = self.safe_market(marketId, market, '', 'contract')
1552
- timestamp = self.safe_integer(liquidation, 'updatedTime')
1595
+ timestamp = self.safe_integer_2(liquidation, 'updatedTime', 'T')
1553
1596
  return self.safe_liquidation({
1554
1597
  'info': liquidation,
1555
1598
  'symbol': market['symbol'],
1556
- 'contracts': self.safe_number(liquidation, 'size'),
1599
+ 'contracts': self.safe_number_2(liquidation, 'size', 'v'),
1557
1600
  'contractSize': self.safe_number(market, 'contractSize'),
1558
- 'price': self.safe_number(liquidation, 'price'),
1601
+ 'price': self.safe_number_2(liquidation, 'price', 'p'),
1559
1602
  'baseValue': None,
1560
1603
  'quoteValue': None,
1561
1604
  'timestamp': timestamp,
@@ -2318,6 +2361,7 @@ class bybit(ccxt.async_support.bybit):
2318
2361
  'user.openapi.perp.trade': self.handle_my_trades,
2319
2362
  'position': self.handle_positions,
2320
2363
  'liquidation': self.handle_liquidation,
2364
+ 'allLiquidation': self.handle_liquidation,
2321
2365
  'pong': self.handle_pong,
2322
2366
  'order.create': self.handle_order_ws,
2323
2367
  'order.amend': self.handle_order_ws,
ccxt/test/tests_async.py CHANGED
@@ -765,8 +765,8 @@ class testMainClass:
765
765
  self.assert_new_and_stored_output(exchange, skip_keys, new_item, stored_item, strict_type_check)
766
766
  else:
767
767
  # built-in types like strings, numbers, booleans
768
- sanitized_new_output = None if (not new_output) else new_output # we store undefined as nulls in the json file so we need to convert it back
769
- sanitized_stored_output = None if (not stored_output) else stored_output
768
+ sanitized_new_output = None if (is_null_value(new_output)) else new_output # we store undefined as nulls in the json file so we need to convert it back
769
+ sanitized_stored_output = None if (is_null_value(stored_output)) else stored_output
770
770
  new_output_string = str(sanitized_new_output) if sanitized_new_output else 'undefined'
771
771
  stored_output_string = str(sanitized_stored_output) if sanitized_stored_output else 'undefined'
772
772
  message_error = 'output value mismatch:' + new_output_string + ' != ' + stored_output_string
@@ -787,7 +787,7 @@ class testMainClass:
787
787
  is_string = is_computed_string or is_stored_string
788
788
  is_undefined = is_computed_undefined or is_stored_undefined # undefined is a perfetly valid value
789
789
  if is_boolean or is_string or is_undefined:
790
- if self.lang == 'C#':
790
+ if (self.lang == 'C#') or (self.lang == 'GO'):
791
791
  # tmp c# number comparsion
792
792
  is_number = False
793
793
  try:
@@ -1180,6 +1180,28 @@ class testMainClass:
1180
1180
  assert client_order_id_swap.startswith(swap_id_string), 'binance - swap clientOrderId: ' + client_order_id_swap + ' does not start with swapId' + swap_id_string
1181
1181
  client_order_id_inverse = swap_inverse_order_request['newClientOrderId']
1182
1182
  assert client_order_id_inverse.startswith(swap_id_string), 'binance - swap clientOrderIdInverse: ' + client_order_id_inverse + ' does not start with swapId' + swap_id_string
1183
+ create_orders_request = None
1184
+ try:
1185
+ orders = [{
1186
+ 'symbol': 'BTC/USDT:USDT',
1187
+ 'type': 'limit',
1188
+ 'side': 'sell',
1189
+ 'amount': 1,
1190
+ 'price': 100000,
1191
+ }, {
1192
+ 'symbol': 'BTC/USDT:USDT',
1193
+ 'type': 'market',
1194
+ 'side': 'buy',
1195
+ 'amount': 1,
1196
+ }]
1197
+ await exchange.create_orders(orders)
1198
+ except Exception as e:
1199
+ create_orders_request = self.urlencoded_to_dict(exchange.last_request_body)
1200
+ batch_orders = create_orders_request['batchOrders']
1201
+ for i in range(0, len(batch_orders)):
1202
+ current = batch_orders[i]
1203
+ current_client_order_id = current['newClientOrderId']
1204
+ assert current_client_order_id.startswith(swap_id_string), 'binance createOrders - clientOrderId: ' + current_client_order_id + ' does not start with swapId' + swap_id_string
1183
1205
  if not is_sync():
1184
1206
  await close(exchange)
1185
1207
  return True
ccxt/test/tests_sync.py CHANGED
@@ -762,8 +762,8 @@ class testMainClass:
762
762
  self.assert_new_and_stored_output(exchange, skip_keys, new_item, stored_item, strict_type_check)
763
763
  else:
764
764
  # built-in types like strings, numbers, booleans
765
- sanitized_new_output = None if (not new_output) else new_output # we store undefined as nulls in the json file so we need to convert it back
766
- sanitized_stored_output = None if (not stored_output) else stored_output
765
+ sanitized_new_output = None if (is_null_value(new_output)) else new_output # we store undefined as nulls in the json file so we need to convert it back
766
+ sanitized_stored_output = None if (is_null_value(stored_output)) else stored_output
767
767
  new_output_string = str(sanitized_new_output) if sanitized_new_output else 'undefined'
768
768
  stored_output_string = str(sanitized_stored_output) if sanitized_stored_output else 'undefined'
769
769
  message_error = 'output value mismatch:' + new_output_string + ' != ' + stored_output_string
@@ -784,7 +784,7 @@ class testMainClass:
784
784
  is_string = is_computed_string or is_stored_string
785
785
  is_undefined = is_computed_undefined or is_stored_undefined # undefined is a perfetly valid value
786
786
  if is_boolean or is_string or is_undefined:
787
- if self.lang == 'C#':
787
+ if (self.lang == 'C#') or (self.lang == 'GO'):
788
788
  # tmp c# number comparsion
789
789
  is_number = False
790
790
  try:
@@ -1177,6 +1177,28 @@ class testMainClass:
1177
1177
  assert client_order_id_swap.startswith(swap_id_string), 'binance - swap clientOrderId: ' + client_order_id_swap + ' does not start with swapId' + swap_id_string
1178
1178
  client_order_id_inverse = swap_inverse_order_request['newClientOrderId']
1179
1179
  assert client_order_id_inverse.startswith(swap_id_string), 'binance - swap clientOrderIdInverse: ' + client_order_id_inverse + ' does not start with swapId' + swap_id_string
1180
+ create_orders_request = None
1181
+ try:
1182
+ orders = [{
1183
+ 'symbol': 'BTC/USDT:USDT',
1184
+ 'type': 'limit',
1185
+ 'side': 'sell',
1186
+ 'amount': 1,
1187
+ 'price': 100000,
1188
+ }, {
1189
+ 'symbol': 'BTC/USDT:USDT',
1190
+ 'type': 'market',
1191
+ 'side': 'buy',
1192
+ 'amount': 1,
1193
+ }]
1194
+ exchange.create_orders(orders)
1195
+ except Exception as e:
1196
+ create_orders_request = self.urlencoded_to_dict(exchange.last_request_body)
1197
+ batch_orders = create_orders_request['batchOrders']
1198
+ for i in range(0, len(batch_orders)):
1199
+ current = batch_orders[i]
1200
+ current_client_order_id = current['newClientOrderId']
1201
+ assert current_client_order_id.startswith(swap_id_string), 'binance createOrders - clientOrderId: ' + current_client_order_id + ' does not start with swapId' + swap_id_string
1180
1202
  if not is_sync():
1181
1203
  close(exchange)
1182
1204
  return True
ccxt/tradeogre.py CHANGED
@@ -134,12 +134,12 @@ class tradeogre(Exchange, ImplicitAPI):
134
134
  'orders/{market}': 1,
135
135
  'ticker/{market}': 1,
136
136
  'history/{market}': 1,
137
+ 'chart/{interval}/{market}/{timestamp}': 1,
137
138
  'chart/{interval}/{market}': 1,
138
139
  },
139
140
  },
140
141
  'private': {
141
142
  'get': {
142
- 'account/balance': 1,
143
143
  'account/balances': 1,
144
144
  'account/order/{uuid}': 1,
145
145
  },
@@ -149,6 +149,7 @@ class tradeogre(Exchange, ImplicitAPI):
149
149
  'order/cancel': 1,
150
150
  'orders': 1,
151
151
  'account/orders': 1,
152
+ 'account/balance': 1,
152
153
  },
153
154
  },
154
155
  },
@@ -422,15 +423,15 @@ class tradeogre(Exchange, ImplicitAPI):
422
423
  'ask': self.safe_string(ticker, 'ask'),
423
424
  'askVolume': None,
424
425
  'vwap': None,
425
- 'open': self.safe_string(ticker, 'open'),
426
- 'close': None,
426
+ 'open': self.safe_string(ticker, 'initialprice'),
427
+ 'close': self.safe_string(ticker, 'price'),
427
428
  'last': None,
428
429
  'previousClose': None,
429
430
  'change': None,
430
431
  'percentage': None,
431
432
  'average': None,
432
- 'baseVolume': self.safe_string(ticker, 'volume'),
433
- 'quoteVolume': None,
433
+ 'baseVolume': None,
434
+ 'quoteVolume': self.safe_string(ticker, 'volume'),
434
435
  'info': ticker,
435
436
  }, market)
436
437
 
@@ -451,11 +452,14 @@ class tradeogre(Exchange, ImplicitAPI):
451
452
  'market': market['id'],
452
453
  'interval': self.safe_string(self.timeframes, timeframe, timeframe),
453
454
  }
455
+ response = None
454
456
  until = self.safe_integer(params, 'until')
455
457
  if until is not None:
456
458
  params = self.omit(params, 'until')
457
- request['timestamp'] = until
458
- response = self.publicGetChartIntervalMarket(self.extend(request, params))
459
+ request['timestamp'] = self.parse_to_int(until / 1000)
460
+ response = self.publicGetChartIntervalMarketTimestamp(self.extend(request, params))
461
+ else:
462
+ response = self.publicGetChartIntervalMarket(self.extend(request, params))
459
463
  #
460
464
  # [
461
465
  # [
@@ -484,9 +488,9 @@ class tradeogre(Exchange, ImplicitAPI):
484
488
  return [
485
489
  self.safe_timestamp(ohlcv, 0),
486
490
  self.safe_number(ohlcv, 1),
491
+ self.safe_number(ohlcv, 2),
487
492
  self.safe_number(ohlcv, 3),
488
493
  self.safe_number(ohlcv, 4),
489
- self.safe_number(ohlcv, 2),
490
494
  self.safe_number(ohlcv, 5),
491
495
  ]
492
496
 
@@ -584,10 +588,26 @@ class tradeogre(Exchange, ImplicitAPI):
584
588
  """
585
589
  query for balance and get the amount of funds available for trading or funds locked in orders
586
590
  :param dict [params]: extra parameters specific to the exchange API endpoint
591
+ :param str [params.currency]: currency to fetch the balance for
587
592
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
588
593
  """
589
594
  self.load_markets()
590
- response = self.privateGetAccountBalances(params)
595
+ response = None
596
+ currency = self.safe_string(params, 'currency')
597
+ if currency is not None:
598
+ response = self.privatePostAccountBalance(params)
599
+ singleCurrencyresult: dict = {
600
+ 'info': response,
601
+ }
602
+ code = self.safe_currency_code(currency)
603
+ account = {
604
+ 'total': self.safe_number(response, 'balance'),
605
+ 'free': self.safe_number(response, 'available'),
606
+ }
607
+ singleCurrencyresult[code] = account
608
+ return self.safe_balance(singleCurrencyresult)
609
+ else:
610
+ response = self.privateGetAccountBalances(params)
591
611
  result = self.safe_dict(response, 'balances', {})
592
612
  return self.parse_balance(result)
593
613
 
@@ -740,11 +760,11 @@ class tradeogre(Exchange, ImplicitAPI):
740
760
  'side': self.safe_string(order, 'type'),
741
761
  'price': self.safe_string(order, 'price'),
742
762
  'triggerPrice': None,
743
- 'amount': self.safe_string(order, 'quantity'),
763
+ 'amount': None,
744
764
  'cost': None,
745
765
  'average': None,
746
766
  'filled': self.safe_string(order, 'fulfilled'),
747
- 'remaining': None,
767
+ 'remaining': self.safe_string(order, 'quantity'),
748
768
  'status': None,
749
769
  'fee': {
750
770
  'currency': None,