ccxt 4.4.24__py2.py3-none-any.whl → 4.4.26__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 (61) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/alpaca.py +1 -0
  3. ccxt/abstract/bingx.py +1 -0
  4. ccxt/abstract/okx.py +1 -0
  5. ccxt/abstract/phemex.py +1 -0
  6. ccxt/alpaca.py +245 -12
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/alpaca.py +245 -12
  9. ccxt/async_support/base/exchange.py +6 -6
  10. ccxt/async_support/binance.py +5 -6
  11. ccxt/async_support/bingx.py +6 -1
  12. ccxt/async_support/bitget.py +5 -5
  13. ccxt/async_support/bitmart.py +6 -6
  14. ccxt/async_support/bitmex.py +8 -7
  15. ccxt/async_support/bybit.py +6 -15
  16. ccxt/async_support/cex.py +36 -0
  17. ccxt/async_support/coinex.py +50 -28
  18. ccxt/async_support/digifinex.py +5 -5
  19. ccxt/async_support/exmo.py +1 -0
  20. ccxt/async_support/gate.py +6 -6
  21. ccxt/async_support/hitbtc.py +5 -9
  22. ccxt/async_support/htx.py +21 -22
  23. ccxt/async_support/hyperliquid.py +12 -4
  24. ccxt/async_support/kucoin.py +5 -5
  25. ccxt/async_support/okx.py +6 -5
  26. ccxt/async_support/phemex.py +4 -2
  27. ccxt/async_support/whitebit.py +5 -5
  28. ccxt/async_support/woo.py +1 -1
  29. ccxt/async_support/woofipro.py +1 -1
  30. ccxt/async_support/xt.py +36 -25
  31. ccxt/base/exchange.py +11 -6
  32. ccxt/base/types.py +12 -0
  33. ccxt/binance.py +5 -6
  34. ccxt/bingx.py +6 -1
  35. ccxt/bitget.py +5 -5
  36. ccxt/bitmart.py +6 -6
  37. ccxt/bitmex.py +8 -7
  38. ccxt/bybit.py +6 -15
  39. ccxt/cex.py +36 -0
  40. ccxt/coinex.py +50 -28
  41. ccxt/digifinex.py +5 -5
  42. ccxt/exmo.py +1 -0
  43. ccxt/gate.py +6 -6
  44. ccxt/hitbtc.py +5 -9
  45. ccxt/htx.py +21 -22
  46. ccxt/hyperliquid.py +12 -4
  47. ccxt/kucoin.py +5 -5
  48. ccxt/okx.py +6 -5
  49. ccxt/phemex.py +4 -2
  50. ccxt/pro/__init__.py +1 -1
  51. ccxt/pro/exmo.py +204 -4
  52. ccxt/test/tests_helpers.py +3 -1
  53. ccxt/whitebit.py +5 -5
  54. ccxt/woo.py +1 -1
  55. ccxt/woofipro.py +1 -1
  56. ccxt/xt.py +36 -25
  57. {ccxt-4.4.24.dist-info → ccxt-4.4.26.dist-info}/METADATA +7 -7
  58. {ccxt-4.4.24.dist-info → ccxt-4.4.26.dist-info}/RECORD +61 -61
  59. {ccxt-4.4.24.dist-info → ccxt-4.4.26.dist-info}/LICENSE.txt +0 -0
  60. {ccxt-4.4.24.dist-info → ccxt-4.4.26.dist-info}/WHEEL +0 -0
  61. {ccxt-4.4.24.dist-info → ccxt-4.4.26.dist-info}/top_level.txt +0 -0
ccxt/kucoin.py CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.kucoin import ImplicitAPI
8
8
  import hashlib
9
9
  import math
10
10
  import json
11
- from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
11
+ from ccxt.base.types import Account, Balances, BorrowInterest, Bool, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -4153,7 +4153,7 @@ class kucoin(Exchange, ImplicitAPI):
4153
4153
  'info': info,
4154
4154
  }
4155
4155
 
4156
- def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4156
+ def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
4157
4157
  """
4158
4158
  fetch the interest owed by the user for borrowing currency for margin trading
4159
4159
  :see: https://docs.kucoin.com/#get-repay-record
@@ -4248,7 +4248,7 @@ class kucoin(Exchange, ImplicitAPI):
4248
4248
  assets = self.safe_list(data, 'assets', []) if (marginMode == 'isolated') else self.safe_list(data, 'accounts', [])
4249
4249
  return self.parse_borrow_interests(assets, None)
4250
4250
 
4251
- def parse_borrow_interest(self, info: dict, market: Market = None):
4251
+ def parse_borrow_interest(self, info: dict, market: Market = None) -> BorrowInterest:
4252
4252
  #
4253
4253
  # Cross
4254
4254
  #
@@ -4311,15 +4311,15 @@ class kucoin(Exchange, ImplicitAPI):
4311
4311
  interest = self.safe_number(info, 'accruedInterest')
4312
4312
  currencyId = self.safe_string(info, 'currency')
4313
4313
  return {
4314
+ 'info': info,
4314
4315
  'symbol': symbol,
4315
- 'marginMode': marginMode,
4316
4316
  'currency': self.safe_currency_code(currencyId),
4317
4317
  'interest': interest,
4318
4318
  'interestRate': self.safe_number(info, 'dailyIntRate'),
4319
4319
  'amountBorrowed': amountBorrowed,
4320
+ 'marginMode': marginMode,
4320
4321
  'timestamp': timestamp, # create time
4321
4322
  'datetime': self.iso8601(timestamp),
4322
- 'info': info,
4323
4323
  }
4324
4324
 
4325
4325
  def fetch_borrow_rate_histories(self, codes=None, since: Int = None, limit: Int = None, params={}):
ccxt/okx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, LongShortRatio, Balances, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, DepositAddress, Greeks, Int, LedgerEntry, Leverage, LeverageTier, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, BorrowInterest, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, DepositAddress, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LongShortRatio, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from typing import Any
12
12
  from ccxt.base.errors import ExchangeError
@@ -421,6 +421,7 @@ class okx(Exchange, ImplicitAPI):
421
421
  # eth staking
422
422
  'finance/staking-defi/eth/balance': 5 / 3,
423
423
  'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
424
+ 'finance/staking-defi/eth/product-info': 3,
424
425
  # copytrading
425
426
  'copytrading/current-subpositions': 1,
426
427
  'copytrading/subpositions-history': 1,
@@ -6539,7 +6540,7 @@ class okx(Exchange, ImplicitAPI):
6539
6540
  })
6540
6541
  return tiers
6541
6542
 
6542
- def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
6543
+ def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
6543
6544
  """
6544
6545
  fetch the interest owed by the user for borrowing currency for margin trading
6545
6546
  :see: https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
@@ -6595,21 +6596,21 @@ class okx(Exchange, ImplicitAPI):
6595
6596
  interest = self.parse_borrow_interests(data)
6596
6597
  return self.filter_by_currency_since_limit(interest, code, since, limit)
6597
6598
 
6598
- def parse_borrow_interest(self, info: dict, market: Market = None):
6599
+ def parse_borrow_interest(self, info: dict, market: Market = None) -> BorrowInterest:
6599
6600
  instId = self.safe_string(info, 'instId')
6600
6601
  if instId is not None:
6601
6602
  market = self.safe_market(instId, market)
6602
6603
  timestamp = self.safe_integer(info, 'ts')
6603
6604
  return {
6605
+ 'info': info,
6604
6606
  'symbol': self.safe_string(market, 'symbol'),
6605
- 'marginMode': self.safe_string(info, 'mgnMode'),
6606
6607
  'currency': self.safe_currency_code(self.safe_string(info, 'ccy')),
6607
6608
  'interest': self.safe_number(info, 'interest'),
6608
6609
  'interestRate': self.safe_number(info, 'interestRate'),
6609
6610
  'amountBorrowed': self.safe_number(info, 'liab'),
6611
+ 'marginMode': self.safe_string(info, 'mgnMode'),
6610
6612
  'timestamp': timestamp, # Interest accrued time
6611
6613
  'datetime': self.iso8601(timestamp),
6612
- 'info': info,
6613
6614
  }
6614
6615
 
6615
6616
  def borrow_cross_margin(self, code: str, amount: float, params={}):
ccxt/phemex.py CHANGED
@@ -121,7 +121,7 @@ class phemex(Exchange, ImplicitAPI):
121
121
  'private': 'https://{hostname}',
122
122
  },
123
123
  'www': 'https://phemex.com',
124
- 'doc': 'https://github.com/phemex/phemex-api-docs',
124
+ 'doc': 'https://phemex-docs.github.io/#overview',
125
125
  'fees': 'https://phemex.com/fees-conditions',
126
126
  'referral': {
127
127
  'url': 'https://phemex.com/register?referralCode=EDNVJ',
@@ -179,6 +179,7 @@ class phemex(Exchange, ImplicitAPI):
179
179
  'v2': {
180
180
  'get': {
181
181
  'public/products': 5,
182
+ 'public/products-plus': 5,
182
183
  'md/v2/orderbook': 5, # ?symbol=<symbol>&id=<id>
183
184
  'md/v2/trade': 5, # ?symbol=<symbol>&id=<id>
184
185
  'md/v2/ticker/24hr': 5, # ?symbol=<symbol>&id=<id>
@@ -746,13 +747,14 @@ class phemex(Exchange, ImplicitAPI):
746
747
  'max': self.parse_safe_number(self.safe_string(market, 'maxOrderValue')),
747
748
  },
748
749
  },
749
- 'created': None,
750
+ 'created': self.safe_integer(market, 'listTime'),
750
751
  'info': market,
751
752
  })
752
753
 
753
754
  def fetch_markets(self, params={}) -> List[Market]:
754
755
  """
755
756
  retrieves data on all markets for phemex
757
+ :see: https://phemex-docs.github.io/#query-product-information-3
756
758
  :param dict [params]: extra parameters specific to the exchange API endpoint
757
759
  :returns dict[]: an array of objects representing market data
758
760
  """
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.24'
7
+ __version__ = '4.4.26'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/exmo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  import ccxt.async_support
7
7
  from ccxt.async_support.base.ws.cache import ArrayCache, ArrayCacheBySymbolById
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Int, OrderBook, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Int, Market, Order, OrderBook, Str, Strings, Ticker, Tickers, Trade
10
10
  from ccxt.async_support.base.ws.client import Client
11
11
  from typing import List
12
12
  from ccxt.base.errors import NotSupported
@@ -23,7 +23,7 @@ class exmo(ccxt.async_support.exmo):
23
23
  'watchTickers': True,
24
24
  'watchTrades': True,
25
25
  'watchMyTrades': True,
26
- 'watchOrders': False, # TODO
26
+ 'watchOrders': True,
27
27
  'watchOrderBook': True,
28
28
  'watchOHLCV': False,
29
29
  },
@@ -546,6 +546,206 @@ class exmo(ccxt.async_support.exmo):
546
546
  for i in range(0, len(deltas)):
547
547
  self.handle_delta(bookside, deltas[i])
548
548
 
549
+ async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
550
+ """
551
+ :see: https://documenter.getpostman.com/view/10287440/SzYXWKPi#85f7bc03-b1c9-4cd2-bd22-8fd422272825
552
+ :see: https://documenter.getpostman.com/view/10287440/SzYXWKPi#95e4ed18-1791-4e6d-83ad-cbfe9be1051c
553
+ watches information on multiple orders made by the user
554
+ :param str symbol: unified market symbol of the market orders were made in
555
+ :param int [since]: the earliest time in ms to fetch orders for
556
+ :param int [limit]: the maximum number of order structures to retrieve
557
+ :param dict [params]: extra parameters specific to the exchange API endpoint
558
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
559
+ """
560
+ await self.load_markets()
561
+ await self.authenticate(params)
562
+ type, query = self.handle_market_type_and_params('watchOrders', None, params)
563
+ url = self.urls['api']['ws'][type]
564
+ messageHash = None
565
+ if symbol is None:
566
+ messageHash = 'orders:' + type
567
+ else:
568
+ market = self.market(symbol)
569
+ symbol = market['symbol']
570
+ messageHash = 'orders:' + market['symbol']
571
+ message: dict = {
572
+ 'method': 'subscribe',
573
+ 'topics': [
574
+ type + '/orders',
575
+ ],
576
+ 'id': self.request_id(),
577
+ }
578
+ request = self.deep_extend(message, query)
579
+ orders = await self.watch(url, messageHash, request, messageHash, request)
580
+ return self.filter_by_symbol_since_limit(orders, symbol, since, limit, True)
581
+
582
+ def handle_orders(self, client: Client, message):
583
+ #
584
+ # spot
585
+ # {
586
+ # "ts": 1574427585174,
587
+ # "event": "snapshot",
588
+ # "topic": "spot/orders",
589
+ # "data": [
590
+ # {
591
+ # "order_id": "14",
592
+ # "client_id":"100500",
593
+ # "created": "1574427585",
594
+ # "pair": "BTC_USD",
595
+ # "price": "7750",
596
+ # "quantity": "0.1",
597
+ # "amount": "775",
598
+ # "original_quantity": "0.1",
599
+ # "original_amount": "775",
600
+ # "type": "sell",
601
+ # "status": "open"
602
+ # }
603
+ # ]
604
+ # }
605
+ #
606
+ # margin
607
+ # {
608
+ # "ts":1624371281773,
609
+ # "event":"snapshot",
610
+ # "topic":"margin/orders",
611
+ # "data":[
612
+ # {
613
+ # "order_id":"692844278081168665",
614
+ # "created":"1624371250919761600",
615
+ # "type":"limit_buy",
616
+ # "previous_type":"limit_buy",
617
+ # "pair":"BTC_USD",
618
+ # "leverage":"2",
619
+ # "price":"10000",
620
+ # "stop_price":"0",
621
+ # "distance":"0",
622
+ # "trigger_price":"10000",
623
+ # "init_quantity":"0.1",
624
+ # "quantity":"0.1",
625
+ # "funding_currency":"USD",
626
+ # "funding_quantity":"1000",
627
+ # "funding_rate":"0",
628
+ # "client_id":"111111",
629
+ # "expire":0,
630
+ # "src":1,
631
+ # "comment":"comment1",
632
+ # "updated":1624371250938136600,
633
+ # "status":"active"
634
+ # }
635
+ # ]
636
+ # }
637
+ #
638
+ topic = self.safe_string(message, 'topic')
639
+ parts = topic.split('/')
640
+ type = self.safe_string(parts, 0)
641
+ messageHash = 'orders:' + type
642
+ event = self.safe_string(message, 'event')
643
+ if self.orders is None:
644
+ limit = self.safe_integer(self.options, 'ordersLimit', 1000)
645
+ self.orders = ArrayCacheBySymbolById(limit)
646
+ cachedOrders = self.orders
647
+ rawOrders = []
648
+ if event == 'snapshot':
649
+ rawOrders = self.safe_value(message, 'data', [])
650
+ elif event == 'update':
651
+ rawOrder = self.safe_dict(message, 'data', {})
652
+ rawOrders.append(rawOrder)
653
+ symbols: dict = {}
654
+ for j in range(0, len(rawOrders)):
655
+ order = self.parse_ws_order(rawOrders[j])
656
+ cachedOrders.append(order)
657
+ symbols[order['symbol']] = True
658
+ symbolKeys = list(symbols.keys())
659
+ for i in range(0, len(symbolKeys)):
660
+ symbol = symbolKeys[i]
661
+ symbolSpecificMessageHash = 'orders:' + symbol
662
+ client.resolve(cachedOrders, symbolSpecificMessageHash)
663
+ client.resolve(cachedOrders, messageHash)
664
+
665
+ def parse_ws_order(self, order: dict, market: Market = None) -> Order:
666
+ #
667
+ # {
668
+ # order_id: '43226756791',
669
+ # client_id: 0,
670
+ # created: '1730371416',
671
+ # type: 'market_buy',
672
+ # pair: 'TRX_USD',
673
+ # quantity: '0',
674
+ # original_quantity: '30',
675
+ # status: 'cancelled',
676
+ # last_trade_id: '726480870',
677
+ # last_trade_price: '0.17',
678
+ # last_trade_quantity: '30'
679
+ # }
680
+ #
681
+ id = self.safe_string(order, 'order_id')
682
+ timestamp = self.safe_timestamp(order, 'created')
683
+ orderType = self.safe_string(order, 'type')
684
+ side = self.parseSide(orderType)
685
+ marketId = self.safe_string(order, 'pair')
686
+ market = self.safe_market(marketId, market)
687
+ symbol = market['symbol']
688
+ amount = self.safe_string(order, 'quantity')
689
+ if amount is None:
690
+ amountField = 'in_amount' if (side == 'buy') else 'out_amount'
691
+ amount = self.safe_string(order, amountField)
692
+ price = self.safe_string(order, 'price')
693
+ clientOrderId = self.omit_zero(self.safe_string(order, 'client_id'))
694
+ triggerPrice = self.omit_zero(self.safe_string(order, 'stop_price'))
695
+ type = None
696
+ if (orderType != 'buy') and (orderType != 'sell'):
697
+ type = orderType
698
+ trades = None
699
+ if 'last_trade_id' in order:
700
+ trade = self.parse_ws_trade(order, market)
701
+ trades = [trade]
702
+ return self.safe_order({
703
+ 'id': id,
704
+ 'clientOrderId': clientOrderId,
705
+ 'datetime': self.iso8601(timestamp),
706
+ 'timestamp': timestamp,
707
+ 'lastTradeTimestamp': None,
708
+ 'status': self.parseStatus(self.safe_string(order, 'status')),
709
+ 'symbol': symbol,
710
+ 'type': type,
711
+ 'timeInForce': None,
712
+ 'postOnly': None,
713
+ 'side': side,
714
+ 'price': price,
715
+ 'stopPrice': triggerPrice,
716
+ 'triggerPrice': triggerPrice,
717
+ 'cost': None,
718
+ 'amount': self.safe_string(order, 'original_quantity'),
719
+ 'filled': None,
720
+ 'remaining': self.safe_string(order, 'quantity'),
721
+ 'average': None,
722
+ 'trades': trades,
723
+ 'fee': None,
724
+ 'info': order,
725
+ }, market)
726
+
727
+ def parse_ws_trade(self, trade: dict, market: Market = None) -> Trade:
728
+ id = self.safe_string(trade, 'order_id')
729
+ orderType = self.safe_string(trade, 'type')
730
+ side = self.parseSide(orderType)
731
+ marketId = self.safe_string(trade, 'pair')
732
+ market = self.safe_market(marketId, market)
733
+ symbol = market['symbol']
734
+ type = None
735
+ if (orderType != 'buy') and (orderType != 'sell'):
736
+ type = orderType
737
+ return self.safe_trade({
738
+ 'id': self.safe_string(trade, 'last_trade_id'),
739
+ 'symbol': symbol,
740
+ 'order': id,
741
+ 'type': type,
742
+ 'side': side,
743
+ 'price': self.safe_string(trade, 'last_trade_price'),
744
+ 'amount': self.safe_string(trade, 'last_trade_quantity'),
745
+ 'cost': None,
746
+ 'fee': None,
747
+ }, market)
748
+
549
749
  def handle_message(self, client: Client, message):
550
750
  #
551
751
  # {
@@ -585,8 +785,8 @@ class exmo(ccxt.async_support.exmo):
585
785
  'spot/trades': self.handle_trades,
586
786
  'margin/trades': self.handle_trades,
587
787
  'spot/order_book_updates': self.handle_order_book,
588
- # 'spot/orders': self.handleOrders,
589
- # 'margin/orders': self.handleOrders,
788
+ 'spot/orders': self.handle_orders,
789
+ 'margin/orders': self.handle_orders,
590
790
  'spot/user_trades': self.handle_my_trades,
591
791
  'margin/user_trades': self.handle_my_trades,
592
792
  }
@@ -69,7 +69,9 @@ parser.add_argument('--static', action='store_true', help='run static tests')
69
69
  parser.add_argument('--useProxy', action='store_true', help='run static tests')
70
70
  parser.add_argument('--idTests', action='store_true', help='run brokerId tests')
71
71
  parser.add_argument('--responseTests', action='store_true', help='run response tests')
72
- parser.add_argument('--requestTests', action='store_true', help='run response tests')
72
+ parser.add_argument('--response', action='store_true', help='run response tests')
73
+ parser.add_argument('--requestTests', action='store_true', help='run request tests')
74
+ parser.add_argument('--request', action='store_true', help='run request tests')
73
75
  parser.add_argument('--sync', action='store_true', help='is sync')
74
76
  parser.add_argument('--baseTests', action='store_true', help='is base tests')
75
77
  parser.add_argument('--exchangeTests', action='store_true', help='is exchange tests')
ccxt/whitebit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.whitebit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Bool, Currencies, Currency, DepositAddress, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, BorrowInterest, Bool, Currencies, Currency, DepositAddress, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2144,7 +2144,7 @@ class whitebit(Exchange, ImplicitAPI):
2144
2144
  records = self.safe_list(response, 'records', [])
2145
2145
  return self.parse_transactions(records, currency, since, limit)
2146
2146
 
2147
- def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2147
+ def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
2148
2148
  """
2149
2149
  fetch the interest owed by the user for borrowing currency for margin trading
2150
2150
  :see: https://docs.whitebit.com/private/http-trade-v4/#open-positions
@@ -2186,7 +2186,7 @@ class whitebit(Exchange, ImplicitAPI):
2186
2186
  interest = self.parse_borrow_interests(response, market)
2187
2187
  return self.filter_by_currency_since_limit(interest, code, since, limit)
2188
2188
 
2189
- def parse_borrow_interest(self, info: dict, market: Market = None):
2189
+ def parse_borrow_interest(self, info: dict, market: Market = None) -> BorrowInterest:
2190
2190
  #
2191
2191
  # {
2192
2192
  # "positionId": 191823,
@@ -2210,15 +2210,15 @@ class whitebit(Exchange, ImplicitAPI):
2210
2210
  symbol = self.safe_symbol(marketId, market, '_')
2211
2211
  timestamp = self.safe_timestamp(info, 'modifyDate')
2212
2212
  return {
2213
+ 'info': info,
2213
2214
  'symbol': symbol,
2214
- 'marginMode': 'cross',
2215
2215
  'currency': 'USDT',
2216
2216
  'interest': self.safe_number(info, 'unrealizedFunding'),
2217
2217
  'interestRate': 0.00098, # https://whitebit.com/fees
2218
2218
  'amountBorrowed': self.safe_number(info, 'amount'),
2219
+ 'marginMode': 'cross',
2219
2220
  'timestamp': timestamp,
2220
2221
  'datetime': self.iso8601(timestamp),
2221
- 'info': info,
2222
2222
  }
2223
2223
 
2224
2224
  def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
ccxt/woo.py CHANGED
@@ -2332,7 +2332,7 @@ class woo(Exchange, ImplicitAPI):
2332
2332
  #
2333
2333
  return self.parse_transaction(response, currency)
2334
2334
 
2335
- def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
2335
+ def repay_margin(self, code: str, amount: float, symbol: Str = None, params={}):
2336
2336
  """
2337
2337
  repay borrowed margin and interest
2338
2338
  :see: https://docs.woo.org/#repay-interest
ccxt/woofipro.py CHANGED
@@ -133,7 +133,7 @@ class woofipro(Exchange, ImplicitAPI):
133
133
  '1y': '1y',
134
134
  },
135
135
  'urls': {
136
- 'logo': 'https://github.com/ccxt/ccxt/assets/43336371/b1e7b348-a0fc-4605-8b7f-91176958fd69',
136
+ 'logo': 'https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1',
137
137
  'api': {
138
138
  'public': 'https://api-evm.orderly.org',
139
139
  'private': 'https://api-evm.orderly.org',
ccxt/xt.py CHANGED
@@ -1698,6 +1698,9 @@ class xt(Exchange, ImplicitAPI):
1698
1698
  market = self.safe_market(marketId, market, '_', marketType)
1699
1699
  symbol = market['symbol']
1700
1700
  timestamp = self.safe_integer(ticker, 't')
1701
+ percentage = self.safe_string_2(ticker, 'cr', 'r')
1702
+ if percentage is not None:
1703
+ percentage = Precise.string_mul(percentage, '100')
1701
1704
  return self.safe_ticker({
1702
1705
  'symbol': symbol,
1703
1706
  'timestamp': timestamp,
@@ -1714,7 +1717,7 @@ class xt(Exchange, ImplicitAPI):
1714
1717
  'last': self.safe_string(ticker, 'c'),
1715
1718
  'previousClose': None,
1716
1719
  'change': self.safe_number(ticker, 'cv'),
1717
- 'percentage': self.safe_number_2(ticker, 'cr', 'r'),
1720
+ 'percentage': self.parse_number(percentage),
1718
1721
  'average': None,
1719
1722
  'baseVolume': None,
1720
1723
  'quoteVolume': self.safe_number_2(ticker, 'a', 'v'),
@@ -1902,6 +1905,17 @@ class xt(Exchange, ImplicitAPI):
1902
1905
  # "b": True
1903
1906
  # }
1904
1907
  #
1908
+ # spot: watchTrades
1909
+ #
1910
+ # {
1911
+ # s: 'btc_usdt',
1912
+ # i: '228825383103928709',
1913
+ # t: 1684258222702,
1914
+ # p: '27003.65',
1915
+ # q: '0.000796',
1916
+ # b: True
1917
+ # }
1918
+ #
1905
1919
  # spot: watchMyTrades
1906
1920
  #
1907
1921
  # {
@@ -1914,17 +1928,6 @@ class xt(Exchange, ImplicitAPI):
1914
1928
  # "v": "90000" # volume trade amount
1915
1929
  # }
1916
1930
  #
1917
- # spot: watchTrades
1918
- #
1919
- # {
1920
- # s: 'btc_usdt',
1921
- # i: '228825383103928709',
1922
- # t: 1684258222702,
1923
- # p: '27003.65',
1924
- # q: '0.000796',
1925
- # b: True
1926
- # }
1927
- #
1928
1931
  # swap and future: fetchTrades
1929
1932
  #
1930
1933
  # {
@@ -2003,19 +2006,27 @@ class xt(Exchange, ImplicitAPI):
2003
2006
  if marketType is None:
2004
2007
  marketType = 'spot' if hasSpotKeys else 'contract'
2005
2008
  market = self.safe_market(marketId, market, '_', marketType)
2006
- bidOrAsk = self.safe_string(trade, 'm')
2007
- side = self.safe_string_lower(trade, 'orderSide')
2008
- if bidOrAsk is not None:
2009
- side = 'buy' if (bidOrAsk == 'BID') else 'sell'
2010
- buyerMaker = self.safe_value(trade, 'b')
2011
- if buyerMaker is not None:
2012
- side = 'buy'
2013
- takerOrMaker = self.safe_string_lower(trade, 'takerMaker')
2014
- if buyerMaker is not None:
2015
- takerOrMaker = 'maker' if buyerMaker else 'taker'
2016
- isMaker = self.safe_bool(trade, 'isMaker')
2017
- if isMaker is not None:
2018
- takerOrMaker = 'maker' if isMaker else 'taker'
2009
+ side = None
2010
+ takerOrMaker = None
2011
+ isBuyerMaker = self.safe_bool(trade, 'b')
2012
+ if isBuyerMaker is not None:
2013
+ side = 'sell' if isBuyerMaker else 'buy'
2014
+ takerOrMaker = 'taker' # public trades always taker
2015
+ else:
2016
+ takerMaker = self.safe_string_lower(trade, 'takerMaker')
2017
+ if takerMaker is not None:
2018
+ takerOrMaker = takerMaker
2019
+ else:
2020
+ isMaker = self.safe_bool(trade, 'isMaker')
2021
+ if isMaker is not None:
2022
+ takerOrMaker = 'maker' if isMaker else 'taker'
2023
+ orderSide = self.safe_string_lower(trade, 'orderSide')
2024
+ if orderSide is not None:
2025
+ side = orderSide
2026
+ else:
2027
+ bidOrAsk = self.safe_string(trade, 'm')
2028
+ if bidOrAsk is not None:
2029
+ side = 'buy' if (bidOrAsk == 'BID') else 'sell'
2019
2030
  timestamp = self.safe_integer_n(trade, ['t', 'time', 'timestamp'])
2020
2031
  quantity = self.safe_string_2(trade, 'q', 'quantity')
2021
2032
  amount = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.4.24
3
+ Version: 4.4.26
4
4
  Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
5
5
  Home-page: https://ccxt.com
6
6
  Author: Igor Kroitor
@@ -103,7 +103,7 @@ Current feature list:
103
103
  | [![mexc](https://user-images.githubusercontent.com/1294454/137283979-8b2a818d-8633-461b-bfca-de89e8c446b2.jpg)](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | mexc | [MEXC Global](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://mexcdevelop.github.io/apidocs/) | cex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
104
104
  | [![okx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.okx.com/join/CCXT2023) | okx | [OKX](https://www.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okx.com/docs-v5/en/) | cex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with OKX using CCXT's referral link for a 20% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d20%25&color=orange)](https://www.okx.com/join/CCXT2023) |
105
105
  | [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://x.woo.org/register?ref=DIJT0CNL) | woo | [WOO X](https://x.woo.org/register?ref=DIJT0CNL) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woo.org/) | cex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with WOO X using CCXT's referral link for a 35% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d35%25&color=orange)](https://x.woo.org/register?ref=DIJT0CNL) |
106
- | [![woofipro](https://github.com/ccxt/ccxt/assets/43336371/b1e7b348-a0fc-4605-8b7f-91176958fd69)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | dex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with WOOFI PRO using CCXT's referral link for a 5% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d5%25&color=orange)](https://dex.woo.org/en/trade?ref=CCXT) |
106
+ | [![woofipro](https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | dex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with WOOFI PRO using CCXT's referral link for a 5% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d5%25&color=orange)](https://dex.woo.org/en/trade?ref=CCXT) |
107
107
 
108
108
  ## Supported Cryptocurrency Exchanges
109
109
 
@@ -197,7 +197,7 @@ The CCXT library currently supports the following 104 cryptocurrency exchange ma
197
197
  | [![p2b](https://github.com/ccxt/ccxt/assets/43336371/8da13a80-1f0a-49be-bb90-ff8b25164755)](https://p2pb2b.com?referral=ee784c53) | p2b | [p2b](https://p2pb2b.com?referral=ee784c53) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
198
198
  | [![paradex](https://github.com/user-attachments/assets/84628770-784e-4ec4-a759-ec2fbb2244ea)](https://app.paradex.trade/r/ccxt24) | paradex | [Paradex](https://app.paradex.trade/r/ccxt24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.api.testnet.paradex.trade/) | dex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
199
199
  | [![paymium](https://user-images.githubusercontent.com/51840849/87153930-f0f02200-c2c0-11ea-9c0a-40337375ae89.jpg)](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | paymium | [Paymium](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Paymium/api-documentation) | cex | | |
200
- | [![phemex](https://user-images.githubusercontent.com/1294454/85225056-221eb600-b3d7-11ea-930d-564d2690e3f6.jpg)](https://phemex.com/register?referralCode=EDNVJ) | phemex | [Phemex](https://phemex.com/register?referralCode=EDNVJ) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/phemex/phemex-api-docs) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
200
+ | [![phemex](https://user-images.githubusercontent.com/1294454/85225056-221eb600-b3d7-11ea-930d-564d2690e3f6.jpg)](https://phemex.com/register?referralCode=EDNVJ) | phemex | [Phemex](https://phemex.com/register?referralCode=EDNVJ) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://phemex-docs.github.io/#overview) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
201
201
  | [![poloniex](https://user-images.githubusercontent.com/1294454/27766817-e9456312-5ee6-11e7-9b3c-b628ca5626a5.jpg)](https://poloniex.com/signup?c=UBFZJRPJ) | poloniex | [Poloniex](https://poloniex.com/signup?c=UBFZJRPJ) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://api-docs.poloniex.com/spot/) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
202
202
  | [![poloniexfutures](https://user-images.githubusercontent.com/1294454/27766817-e9456312-5ee6-11e7-9b3c-b628ca5626a5.jpg)](https://poloniex.com/signup?c=UBFZJRPJ) | poloniexfutures | [Poloniex Futures](https://poloniex.com/signup?c=UBFZJRPJ) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api-docs.poloniex.com/futures/) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
203
203
  | [![probit](https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg)](https://www.probit.com/r/34608773) | probit | [ProBit](https://www.probit.com/r/34608773) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs-en.probit.com) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
@@ -210,7 +210,7 @@ The CCXT library currently supports the following 104 cryptocurrency exchange ma
210
210
  | [![wazirx](https://user-images.githubusercontent.com/1294454/148647666-c109c20b-f8ac-472f-91c3-5f658cb90f49.jpeg)](https://wazirx.com/invite/k7rrnks5) | wazirx | [WazirX](https://wazirx.com/invite/k7rrnks5) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.wazirx.com/#public-rest-api-for-wazirx) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
211
211
  | [![whitebit](https://user-images.githubusercontent.com/1294454/66732963-8eb7dd00-ee66-11e9-849b-10d9282bb9e0.jpg)](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | whitebit | [WhiteBit](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://github.com/whitebit-exchange/api-docs) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
212
212
  | [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://x.woo.org/register?ref=DIJT0CNL) | woo | [WOO X](https://x.woo.org/register?ref=DIJT0CNL) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woo.org/) | cex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
213
- | [![woofipro](https://github.com/ccxt/ccxt/assets/43336371/b1e7b348-a0fc-4605-8b7f-91176958fd69)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | dex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
213
+ | [![woofipro](https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | dex | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
214
214
  | [![xt](https://user-images.githubusercontent.com/14319357/232636712-466df2fc-560a-4ca4-aab2-b1d954a58e24.jpg)](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | xt | [XT](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://doc.xt.com/) | cex | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
215
215
  | [![yobit](https://user-images.githubusercontent.com/1294454/27766910-cdcbfdae-5eea-11e7-9859-03fea873272d.jpg)](https://www.yobit.net) | yobit | [YoBit](https://www.yobit.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.yobit.net/en/api/) | cex | | |
216
216
  | [![zaif](https://user-images.githubusercontent.com/1294454/27766927-39ca2ada-5eeb-11e7-972f-1b4199518ca6.jpg)](https://zaif.jp) | zaif | [Zaif](https://zaif.jp) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://techbureau-api-document.readthedocs.io/ja/latest/index.html) | cex | | |
@@ -272,13 +272,13 @@ console.log(version, Object.keys(exchanges));
272
272
 
273
273
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
274
274
 
275
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.24/dist/ccxt.browser.min.js
276
- * unpkg: https://unpkg.com/ccxt@4.4.24/dist/ccxt.browser.min.js
275
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.26/dist/ccxt.browser.min.js
276
+ * unpkg: https://unpkg.com/ccxt@4.4.26/dist/ccxt.browser.min.js
277
277
 
278
278
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
279
279
 
280
280
  ```HTML
281
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.24/dist/ccxt.browser.min.js"></script>
281
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.26/dist/ccxt.browser.min.js"></script>
282
282
  ```
283
283
 
284
284
  Creates a global `ccxt` object: