ccxt 4.4.25__py2.py3-none-any.whl → 4.4.27__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 (123) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/alpaca.py +3 -0
  3. ccxt/abstract/bingx.py +1 -0
  4. ccxt/abstract/hyperliquid.py +1 -1
  5. ccxt/abstract/okx.py +1 -0
  6. ccxt/abstract/phemex.py +1 -0
  7. ccxt/ace.py +1 -1
  8. ccxt/alpaca.py +426 -17
  9. ccxt/ascendex.py +1 -1
  10. ccxt/async_support/__init__.py +1 -1
  11. ccxt/async_support/ace.py +1 -1
  12. ccxt/async_support/alpaca.py +426 -17
  13. ccxt/async_support/ascendex.py +1 -1
  14. ccxt/async_support/base/exchange.py +24 -6
  15. ccxt/async_support/bequant.py +1 -1
  16. ccxt/async_support/bigone.py +1 -1
  17. ccxt/async_support/binance.py +6 -7
  18. ccxt/async_support/binancecoinm.py +1 -1
  19. ccxt/async_support/binanceus.py +1 -1
  20. ccxt/async_support/binanceusdm.py +1 -1
  21. ccxt/async_support/bingx.py +29 -29
  22. ccxt/async_support/bit2c.py +1 -1
  23. ccxt/async_support/bitbank.py +1 -1
  24. ccxt/async_support/bitbns.py +1 -1
  25. ccxt/async_support/bitfinex.py +1 -1
  26. ccxt/async_support/bitfinex2.py +1 -1
  27. ccxt/async_support/bitflyer.py +1 -1
  28. ccxt/async_support/bitget.py +6 -6
  29. ccxt/async_support/bithumb.py +1 -1
  30. ccxt/async_support/bitmart.py +7 -7
  31. ccxt/async_support/bitmex.py +1 -1
  32. ccxt/async_support/bitopro.py +1 -1
  33. ccxt/async_support/bitrue.py +1 -1
  34. ccxt/async_support/bitso.py +1 -1
  35. ccxt/async_support/bitstamp.py +1 -1
  36. ccxt/async_support/bitteam.py +1 -1
  37. ccxt/async_support/bitvavo.py +1 -1
  38. ccxt/async_support/bl3p.py +1 -1
  39. ccxt/async_support/blockchaincom.py +1 -1
  40. ccxt/async_support/blofin.py +1 -1
  41. ccxt/async_support/btcalpha.py +1 -1
  42. ccxt/async_support/btcbox.py +1 -1
  43. ccxt/async_support/btcmarkets.py +1 -1
  44. ccxt/async_support/btcturk.py +1 -1
  45. ccxt/async_support/bybit.py +10 -16
  46. ccxt/async_support/cex.py +36 -0
  47. ccxt/async_support/coinbase.py +89 -11
  48. ccxt/async_support/coinex.py +6 -8
  49. ccxt/async_support/digifinex.py +5 -5
  50. ccxt/async_support/exmo.py +1 -0
  51. ccxt/async_support/gate.py +26 -22
  52. ccxt/async_support/htx.py +5 -6
  53. ccxt/async_support/hyperliquid.py +31 -5
  54. ccxt/async_support/kucoin.py +5 -5
  55. ccxt/async_support/lbank.py +97 -2
  56. ccxt/async_support/okx.py +6 -5
  57. ccxt/async_support/phemex.py +4 -2
  58. ccxt/async_support/wavesexchange.py +13 -2
  59. ccxt/async_support/whitebit.py +5 -5
  60. ccxt/async_support/woo.py +1 -1
  61. ccxt/async_support/xt.py +32 -24
  62. ccxt/base/exchange.py +29 -6
  63. ccxt/base/types.py +12 -0
  64. ccxt/bequant.py +1 -1
  65. ccxt/bigone.py +1 -1
  66. ccxt/binance.py +6 -7
  67. ccxt/binancecoinm.py +1 -1
  68. ccxt/binanceus.py +1 -1
  69. ccxt/binanceusdm.py +1 -1
  70. ccxt/bingx.py +29 -29
  71. ccxt/bit2c.py +1 -1
  72. ccxt/bitbank.py +1 -1
  73. ccxt/bitbns.py +1 -1
  74. ccxt/bitfinex.py +1 -1
  75. ccxt/bitfinex2.py +1 -1
  76. ccxt/bitflyer.py +1 -1
  77. ccxt/bitget.py +6 -6
  78. ccxt/bithumb.py +1 -1
  79. ccxt/bitmart.py +7 -7
  80. ccxt/bitmex.py +1 -1
  81. ccxt/bitopro.py +1 -1
  82. ccxt/bitrue.py +1 -1
  83. ccxt/bitso.py +1 -1
  84. ccxt/bitstamp.py +1 -1
  85. ccxt/bitteam.py +1 -1
  86. ccxt/bitvavo.py +1 -1
  87. ccxt/bl3p.py +1 -1
  88. ccxt/blockchaincom.py +1 -1
  89. ccxt/blofin.py +1 -1
  90. ccxt/btcalpha.py +1 -1
  91. ccxt/btcbox.py +1 -1
  92. ccxt/btcmarkets.py +1 -1
  93. ccxt/btcturk.py +1 -1
  94. ccxt/bybit.py +10 -16
  95. ccxt/cex.py +36 -0
  96. ccxt/coinbase.py +89 -11
  97. ccxt/coinex.py +6 -8
  98. ccxt/digifinex.py +5 -5
  99. ccxt/exmo.py +1 -0
  100. ccxt/gate.py +26 -22
  101. ccxt/htx.py +5 -6
  102. ccxt/hyperliquid.py +31 -5
  103. ccxt/kucoin.py +5 -5
  104. ccxt/lbank.py +97 -2
  105. ccxt/okx.py +6 -5
  106. ccxt/phemex.py +4 -2
  107. ccxt/pro/__init__.py +1 -1
  108. ccxt/pro/binance.py +2 -2
  109. ccxt/pro/bybit.py +1 -1
  110. ccxt/pro/exmo.py +204 -4
  111. ccxt/pro/lbank.py +7 -4
  112. ccxt/pro/okx.py +1 -1
  113. ccxt/test/tests_helpers.py +3 -1
  114. ccxt/wavesexchange.py +13 -2
  115. ccxt/whitebit.py +5 -5
  116. ccxt/woo.py +1 -1
  117. ccxt/xt.py +32 -24
  118. ccxt-4.4.27.dist-info/METADATA +637 -0
  119. {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/RECORD +122 -122
  120. ccxt-4.4.25.dist-info/METADATA +0 -636
  121. {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/LICENSE.txt +0 -0
  122. {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/WHEEL +0 -0
  123. {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@ import asyncio
9
9
  import hashlib
10
10
  import math
11
11
  import json
12
- 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
12
+ 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
13
13
  from typing import List
14
14
  from ccxt.base.errors import ExchangeError
15
15
  from ccxt.base.errors import AuthenticationError
@@ -4154,7 +4154,7 @@ class kucoin(Exchange, ImplicitAPI):
4154
4154
  'info': info,
4155
4155
  }
4156
4156
 
4157
- async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4157
+ async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
4158
4158
  """
4159
4159
  fetch the interest owed by the user for borrowing currency for margin trading
4160
4160
  :see: https://docs.kucoin.com/#get-repay-record
@@ -4249,7 +4249,7 @@ class kucoin(Exchange, ImplicitAPI):
4249
4249
  assets = self.safe_list(data, 'assets', []) if (marginMode == 'isolated') else self.safe_list(data, 'accounts', [])
4250
4250
  return self.parse_borrow_interests(assets, None)
4251
4251
 
4252
- def parse_borrow_interest(self, info: dict, market: Market = None):
4252
+ def parse_borrow_interest(self, info: dict, market: Market = None) -> BorrowInterest:
4253
4253
  #
4254
4254
  # Cross
4255
4255
  #
@@ -4312,15 +4312,15 @@ class kucoin(Exchange, ImplicitAPI):
4312
4312
  interest = self.safe_number(info, 'accruedInterest')
4313
4313
  currencyId = self.safe_string(info, 'currency')
4314
4314
  return {
4315
+ 'info': info,
4315
4316
  'symbol': symbol,
4316
- 'marginMode': marginMode,
4317
4317
  'currency': self.safe_currency_code(currencyId),
4318
4318
  'interest': interest,
4319
4319
  'interestRate': self.safe_number(info, 'dailyIntRate'),
4320
4320
  'amountBorrowed': amountBorrowed,
4321
+ 'marginMode': marginMode,
4321
4322
  'timestamp': timestamp, # create time
4322
4323
  'datetime': self.iso8601(timestamp),
4323
- 'info': info,
4324
4324
  }
4325
4325
 
4326
4326
  async def fetch_borrow_rate_histories(self, codes=None, since: Int = None, limit: Int = None, params={}):
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.lbank import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
10
+ from ccxt.base.types import Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -70,7 +70,7 @@ class lbank(Exchange, ImplicitAPI):
70
70
  'fetchFundingHistory': False,
71
71
  'fetchFundingRate': False,
72
72
  'fetchFundingRateHistory': False,
73
- 'fetchFundingRates': False,
73
+ 'fetchFundingRates': True,
74
74
  'fetchIndexOHLCV': False,
75
75
  'fetchIsolatedBorrowRate': False,
76
76
  'fetchIsolatedBorrowRates': False,
@@ -1133,6 +1133,101 @@ class lbank(Exchange, ImplicitAPI):
1133
1133
  return self.safe_balance(result)
1134
1134
  return None
1135
1135
 
1136
+ def parse_funding_rate(self, ticker, market: Market = None) -> FundingRate:
1137
+ # {
1138
+ # "symbol": "BTCUSDT",
1139
+ # "highestPrice": "69495.5",
1140
+ # "underlyingPrice": "68455.904",
1141
+ # "lowestPrice": "68182.1",
1142
+ # "openPrice": "68762.4",
1143
+ # "positionFeeRate": "0.0001",
1144
+ # "volume": "33534.2858",
1145
+ # "markedPrice": "68434.1",
1146
+ # "turnover": "1200636218.210558",
1147
+ # "positionFeeTime": "28800",
1148
+ # "lastPrice": "68427.3",
1149
+ # "nextFeeTime": "1730736000000",
1150
+ # "fundingRate": "0.0001",
1151
+ # }
1152
+ marketId = self.safe_string(ticker, 'symbol')
1153
+ symbol = self.safe_symbol(marketId, market)
1154
+ markPrice = self.safe_number(ticker, 'markedPrice')
1155
+ indexPrice = self.safe_number(ticker, 'underlyingPrice')
1156
+ fundingRate = self.safe_number(ticker, 'fundingRate')
1157
+ fundingTime = self.safe_integer(ticker, 'nextFeeTime')
1158
+ return {
1159
+ 'info': ticker,
1160
+ 'symbol': symbol,
1161
+ 'markPrice': markPrice,
1162
+ 'indexPrice': indexPrice,
1163
+ 'fundingRate': fundingRate,
1164
+ 'fundingTimestamp': fundingTime,
1165
+ 'fundingDatetime': self.iso8601(fundingTime),
1166
+ 'timestamp': None,
1167
+ 'datetime': None,
1168
+ 'nextFundingRate': None,
1169
+ 'nextFundingTimestamp': None,
1170
+ 'nextFundingDatetime': None,
1171
+ 'previousFundingRate': None,
1172
+ 'previousFundingTimestamp': None,
1173
+ 'previousFundingDatetime': None,
1174
+ 'interval': None,
1175
+ }
1176
+
1177
+ async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
1178
+ """
1179
+ fetch the current funding rate
1180
+ :see: https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
1181
+ :param str symbol: unified market symbol
1182
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1183
+ :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
1184
+ """
1185
+ await self.load_markets()
1186
+ market = self.market(symbol)
1187
+ responseForSwap = await self.fetch_funding_rates([market['symbol']], params)
1188
+ return self.safe_value(responseForSwap, market['symbol'])
1189
+
1190
+ async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
1191
+ """
1192
+ fetch the funding rate for multiple markets
1193
+ :see: https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
1194
+ :param str[]|None symbols: list of unified market symbols
1195
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1196
+ :returns dict: a dictionary of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
1197
+ """
1198
+ await self.load_markets()
1199
+ symbols = self.market_symbols(symbols)
1200
+ request: dict = {
1201
+ 'productGroup': 'SwapU',
1202
+ }
1203
+ response = await self.contractPublicGetCfdOpenApiV1PubMarketData(self.extend(request, params))
1204
+ # {
1205
+ # "data": [
1206
+ # {
1207
+ # "symbol": "BTCUSDT",
1208
+ # "highestPrice": "69495.5",
1209
+ # "underlyingPrice": "68455.904",
1210
+ # "lowestPrice": "68182.1",
1211
+ # "openPrice": "68762.4",
1212
+ # "positionFeeRate": "0.0001",
1213
+ # "volume": "33534.2858",
1214
+ # "markedPrice": "68434.1",
1215
+ # "turnover": "1200636218.210558",
1216
+ # "positionFeeTime": "28800",
1217
+ # "lastPrice": "68427.3",
1218
+ # "nextFeeTime": "1730736000000",
1219
+ # "fundingRate": "0.0001",
1220
+ # }
1221
+ # ],
1222
+ # "error_code": "0",
1223
+ # "msg": "Success",
1224
+ # "result": "true",
1225
+ # "success": True,
1226
+ # }
1227
+ data = self.safe_list(response, 'data', [])
1228
+ result = self.parse_funding_rates(data)
1229
+ return self.filter_by_array(result, 'symbol', symbols)
1230
+
1136
1231
  async def fetch_balance(self, params={}) -> Balances:
1137
1232
  """
1138
1233
  query for balance and get the amount of funds available for trading or funds locked in orders
ccxt/async_support/okx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- 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
10
+ 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
11
11
  from typing import List
12
12
  from typing import Any
13
13
  from ccxt.base.errors import ExchangeError
@@ -422,6 +422,7 @@ class okx(Exchange, ImplicitAPI):
422
422
  # eth staking
423
423
  'finance/staking-defi/eth/balance': 5 / 3,
424
424
  'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
425
+ 'finance/staking-defi/eth/product-info': 3,
425
426
  # copytrading
426
427
  'copytrading/current-subpositions': 1,
427
428
  'copytrading/subpositions-history': 1,
@@ -6540,7 +6541,7 @@ class okx(Exchange, ImplicitAPI):
6540
6541
  })
6541
6542
  return tiers
6542
6543
 
6543
- async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
6544
+ async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
6544
6545
  """
6545
6546
  fetch the interest owed by the user for borrowing currency for margin trading
6546
6547
  :see: https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
@@ -6596,21 +6597,21 @@ class okx(Exchange, ImplicitAPI):
6596
6597
  interest = self.parse_borrow_interests(data)
6597
6598
  return self.filter_by_currency_since_limit(interest, code, since, limit)
6598
6599
 
6599
- def parse_borrow_interest(self, info: dict, market: Market = None):
6600
+ def parse_borrow_interest(self, info: dict, market: Market = None) -> BorrowInterest:
6600
6601
  instId = self.safe_string(info, 'instId')
6601
6602
  if instId is not None:
6602
6603
  market = self.safe_market(instId, market)
6603
6604
  timestamp = self.safe_integer(info, 'ts')
6604
6605
  return {
6606
+ 'info': info,
6605
6607
  'symbol': self.safe_string(market, 'symbol'),
6606
- 'marginMode': self.safe_string(info, 'mgnMode'),
6607
6608
  'currency': self.safe_currency_code(self.safe_string(info, 'ccy')),
6608
6609
  'interest': self.safe_number(info, 'interest'),
6609
6610
  'interestRate': self.safe_number(info, 'interestRate'),
6610
6611
  'amountBorrowed': self.safe_number(info, 'liab'),
6612
+ 'marginMode': self.safe_string(info, 'mgnMode'),
6611
6613
  'timestamp': timestamp, # Interest accrued time
6612
6614
  'datetime': self.iso8601(timestamp),
6613
- 'info': info,
6614
6615
  }
6615
6616
 
6616
6617
  async def borrow_cross_margin(self, code: str, amount: float, params={}):
@@ -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
  async 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
  """
@@ -138,7 +138,13 @@ class wavesexchange(Exchange, ImplicitAPI):
138
138
  'forward': 'https://wx.network/api/v1/forward/matcher',
139
139
  'market': 'https://wx.network/api/v1/forward/marketdata/api/v1',
140
140
  },
141
- 'doc': 'https://docs.wx.network',
141
+ 'doc': [
142
+ 'https://docs.wx.network',
143
+ 'https://docs.waves.tech',
144
+ 'https://api.wavesplatform.com/v0/docs/',
145
+ 'https://nodes.wavesnodes.com/api-docs/index.html',
146
+ 'https://matcher.waves.exchange/api-docs/index.html',
147
+ ],
142
148
  'www': 'https://wx.network',
143
149
  },
144
150
  'api': {
@@ -602,6 +608,7 @@ class wavesexchange(Exchange, ImplicitAPI):
602
608
  async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
603
609
  """
604
610
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
611
+ :see: https://matcher.waves.exchange/api-docs/index.html#/markets/getOrderBook
605
612
  :param str symbol: unified symbol of the market to fetch the order book for
606
613
  :param int [limit]: the maximum amount of order book entries to return
607
614
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -722,6 +729,7 @@ class wavesexchange(Exchange, ImplicitAPI):
722
729
  async def sign_in(self, params={}):
723
730
  """
724
731
  sign in, must be called prior to using other authenticated methods
732
+ :see: https://docs.wx.network/en/api/auth/oauth2-token
725
733
  :param dict [params]: extra parameters specific to the exchange API endpoint
726
734
  :returns: response from exchange
727
735
  """
@@ -832,6 +840,7 @@ class wavesexchange(Exchange, ImplicitAPI):
832
840
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
833
841
  """
834
842
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
843
+ :see: https://api.wavesplatform.com/v0/docs/#/pairs/getPairsListAll
835
844
  :param str symbol: unified symbol of the market to fetch the ticker for
836
845
  :param dict [params]: extra parameters specific to the exchange API endpoint
837
846
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -873,7 +882,7 @@ class wavesexchange(Exchange, ImplicitAPI):
873
882
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
874
883
  """
875
884
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
876
- :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
885
+ :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
877
886
  :param dict [params]: extra parameters specific to the exchange API endpoint
878
887
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
879
888
  """
@@ -912,6 +921,7 @@ class wavesexchange(Exchange, ImplicitAPI):
912
921
  async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
913
922
  """
914
923
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
924
+ :see: https://api.wavesplatform.com/v0/docs/#/candles/getCandles
915
925
  :param str symbol: unified symbol of the market to fetch OHLCV data for
916
926
  :param str timeframe: the length of time each candle represents
917
927
  :param int [since]: timestamp in ms of the earliest candle to fetch
@@ -1217,6 +1227,7 @@ class wavesexchange(Exchange, ImplicitAPI):
1217
1227
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1218
1228
  """
1219
1229
  create a trade order
1230
+ :see: https://matcher.waves.exchange/api-docs/index.html#/serialize/serializeOrder
1220
1231
  :param str symbol: unified symbol of the market to create an order in
1221
1232
  :param str type: 'market' or 'limit'
1222
1233
  :param str side: 'buy' or 'sell'
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.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
- async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2147
+ async 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
  async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
ccxt/async_support/woo.py CHANGED
@@ -2332,7 +2332,7 @@ class woo(Exchange, ImplicitAPI):
2332
2332
  #
2333
2333
  return self.parse_transaction(response, currency)
2334
2334
 
2335
- async def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
2335
+ async 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/async_support/xt.py CHANGED
@@ -1906,6 +1906,17 @@ class xt(Exchange, ImplicitAPI):
1906
1906
  # "b": True
1907
1907
  # }
1908
1908
  #
1909
+ # spot: watchTrades
1910
+ #
1911
+ # {
1912
+ # s: 'btc_usdt',
1913
+ # i: '228825383103928709',
1914
+ # t: 1684258222702,
1915
+ # p: '27003.65',
1916
+ # q: '0.000796',
1917
+ # b: True
1918
+ # }
1919
+ #
1909
1920
  # spot: watchMyTrades
1910
1921
  #
1911
1922
  # {
@@ -1918,17 +1929,6 @@ class xt(Exchange, ImplicitAPI):
1918
1929
  # "v": "90000" # volume trade amount
1919
1930
  # }
1920
1931
  #
1921
- # spot: watchTrades
1922
- #
1923
- # {
1924
- # s: 'btc_usdt',
1925
- # i: '228825383103928709',
1926
- # t: 1684258222702,
1927
- # p: '27003.65',
1928
- # q: '0.000796',
1929
- # b: True
1930
- # }
1931
- #
1932
1932
  # swap and future: fetchTrades
1933
1933
  #
1934
1934
  # {
@@ -2007,19 +2007,27 @@ class xt(Exchange, ImplicitAPI):
2007
2007
  if marketType is None:
2008
2008
  marketType = 'spot' if hasSpotKeys else 'contract'
2009
2009
  market = self.safe_market(marketId, market, '_', marketType)
2010
- bidOrAsk = self.safe_string(trade, 'm')
2011
- side = self.safe_string_lower(trade, 'orderSide')
2012
- if bidOrAsk is not None:
2013
- side = 'buy' if (bidOrAsk == 'BID') else 'sell'
2014
- buyerMaker = self.safe_value(trade, 'b')
2015
- if buyerMaker is not None:
2016
- side = 'buy'
2017
- takerOrMaker = self.safe_string_lower(trade, 'takerMaker')
2018
- if buyerMaker is not None:
2019
- takerOrMaker = 'maker' if buyerMaker else 'taker'
2020
- isMaker = self.safe_bool(trade, 'isMaker')
2021
- if isMaker is not None:
2022
- takerOrMaker = 'maker' if isMaker else 'taker'
2010
+ side = None
2011
+ takerOrMaker = None
2012
+ isBuyerMaker = self.safe_bool(trade, 'b')
2013
+ if isBuyerMaker is not None:
2014
+ side = 'sell' if isBuyerMaker else 'buy'
2015
+ takerOrMaker = 'taker' # public trades always taker
2016
+ else:
2017
+ takerMaker = self.safe_string_lower(trade, 'takerMaker')
2018
+ if takerMaker is not None:
2019
+ takerOrMaker = takerMaker
2020
+ else:
2021
+ isMaker = self.safe_bool(trade, 'isMaker')
2022
+ if isMaker is not None:
2023
+ takerOrMaker = 'maker' if isMaker else 'taker'
2024
+ orderSide = self.safe_string_lower(trade, 'orderSide')
2025
+ if orderSide is not None:
2026
+ side = orderSide
2027
+ else:
2028
+ bidOrAsk = self.safe_string(trade, 'm')
2029
+ if bidOrAsk is not None:
2030
+ side = 'buy' if (bidOrAsk == 'BID') else 'sell'
2023
2031
  timestamp = self.safe_integer_n(trade, ['t', 'time', 'timestamp'])
2024
2032
  quantity = self.safe_string_2(trade, 'q', 'quantity')
2025
2033
  amount = None
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.25'
7
+ __version__ = '4.4.27'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -296,6 +296,7 @@ class Exchange(object):
296
296
  quote_currencies = None
297
297
  currencies = None
298
298
  options = None # Python does not allow to define properties in run-time with setattr
299
+ isSandboxModeEnabled = False
299
300
  accounts = None
300
301
  positions = None
301
302
 
@@ -2403,6 +2404,8 @@ class Exchange(object):
2403
2404
  self.urls['api'] = self.clone(self.urls['test'])
2404
2405
  else:
2405
2406
  raise NotSupported(self.id + ' does not have a sandbox URL')
2407
+ # set flag
2408
+ self.isSandboxModeEnabled = True
2406
2409
  elif 'apiBackup' in self.urls:
2407
2410
  if isinstance(self.urls['api'], str):
2408
2411
  self.urls['api'] = self.urls['apiBackup']
@@ -2410,6 +2413,8 @@ class Exchange(object):
2410
2413
  self.urls['api'] = self.clone(self.urls['apiBackup'])
2411
2414
  newUrls = self.omit(self.urls, 'apiBackup')
2412
2415
  self.urls = newUrls
2416
+ # set flag
2417
+ self.isSandboxModeEnabled = False
2413
2418
 
2414
2419
  def sign(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None):
2415
2420
  return {}
@@ -2442,9 +2447,15 @@ class Exchange(object):
2442
2447
  def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}):
2443
2448
  raise NotSupported(self.id + ' watchTrades() is not supported yet')
2444
2449
 
2450
+ def un_watch_trades(self, symbol: str, params={}):
2451
+ raise NotSupported(self.id + ' unWatchTrades() is not supported yet')
2452
+
2445
2453
  def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
2446
2454
  raise NotSupported(self.id + ' watchTradesForSymbols() is not supported yet')
2447
2455
 
2456
+ def un_watch_trades_for_symbols(self, symbols: List[str], params={}):
2457
+ raise NotSupported(self.id + ' unWatchTradesForSymbols() is not supported yet')
2458
+
2448
2459
  def watch_my_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
2449
2460
  raise NotSupported(self.id + ' watchMyTradesForSymbols() is not supported yet')
2450
2461
 
@@ -2454,9 +2465,15 @@ class Exchange(object):
2454
2465
  def watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], since: Int = None, limit: Int = None, params={}):
2455
2466
  raise NotSupported(self.id + ' watchOHLCVForSymbols() is not supported yet')
2456
2467
 
2468
+ def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}):
2469
+ raise NotSupported(self.id + ' unWatchOHLCVForSymbols() is not supported yet')
2470
+
2457
2471
  def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}):
2458
2472
  raise NotSupported(self.id + ' watchOrderBookForSymbols() is not supported yet')
2459
2473
 
2474
+ def un_watch_order_book_for_symbols(self, symbols: List[str], params={}):
2475
+ raise NotSupported(self.id + ' unWatchOrderBookForSymbols() is not supported yet')
2476
+
2460
2477
  def fetch_deposit_addresses(self, codes: Strings = None, params={}):
2461
2478
  raise NotSupported(self.id + ' fetchDepositAddresses() is not supported yet')
2462
2479
 
@@ -2487,6 +2504,9 @@ class Exchange(object):
2487
2504
  def watch_order_book(self, symbol: str, limit: Int = None, params={}):
2488
2505
  raise NotSupported(self.id + ' watchOrderBook() is not supported yet')
2489
2506
 
2507
+ def un_watch_order_book(self, symbol: str, params={}):
2508
+ raise NotSupported(self.id + ' unWatchOrderBook() is not supported yet')
2509
+
2490
2510
  def fetch_time(self, params={}):
2491
2511
  raise NotSupported(self.id + ' fetchTime() is not supported yet')
2492
2512
 
@@ -3509,13 +3529,13 @@ class Exchange(object):
3509
3529
  'markPrice': self.safe_number(ticker, 'markPrice'),
3510
3530
  })
3511
3531
 
3512
- def fetch_borrow_rate(self, code: str, amount, params={}):
3532
+ def fetch_borrow_rate(self, code: str, amount: float, params={}):
3513
3533
  raise NotSupported(self.id + ' fetchBorrowRate is deprecated, please use fetchCrossBorrowRate or fetchIsolatedBorrowRate instead')
3514
3534
 
3515
- def repay_cross_margin(self, code: str, amount, params={}):
3535
+ def repay_cross_margin(self, code: str, amount: float, params={}):
3516
3536
  raise NotSupported(self.id + ' repayCrossMargin is not support yet')
3517
3537
 
3518
- def repay_isolated_margin(self, symbol: str, code: str, amount, params={}):
3538
+ def repay_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
3519
3539
  raise NotSupported(self.id + ' repayIsolatedMargin is not support yet')
3520
3540
 
3521
3541
  def borrow_cross_margin(self, code: str, amount: float, params={}):
@@ -3524,10 +3544,10 @@ class Exchange(object):
3524
3544
  def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
3525
3545
  raise NotSupported(self.id + ' borrowIsolatedMargin is not support yet')
3526
3546
 
3527
- def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
3547
+ def borrow_margin(self, code: str, amount: float, symbol: Str = None, params={}):
3528
3548
  raise NotSupported(self.id + ' borrowMargin is deprecated, please use borrowCrossMargin or borrowIsolatedMargin instead')
3529
3549
 
3530
- def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
3550
+ def repay_margin(self, code: str, amount: float, symbol: Str = None, params={}):
3531
3551
  raise NotSupported(self.id + ' repayMargin is deprecated, please use repayCrossMargin or repayIsolatedMargin instead')
3532
3552
 
3533
3553
  def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}):
@@ -4566,6 +4586,9 @@ class Exchange(object):
4566
4586
  def watch_tickers(self, symbols: Strings = None, params={}):
4567
4587
  raise NotSupported(self.id + ' watchTickers() is not supported yet')
4568
4588
 
4589
+ def un_watch_tickers(self, symbols: Strings = None, params={}):
4590
+ raise NotSupported(self.id + ' unWatchTickers() is not supported yet')
4591
+
4569
4592
  def fetch_order(self, id: str, symbol: Str = None, params={}):
4570
4593
  raise NotSupported(self.id + ' fetchOrder() is not supported yet')
4571
4594
 
ccxt/base/types.py CHANGED
@@ -542,6 +542,18 @@ class LongShortRatio:
542
542
  longShortRatio: float
543
543
 
544
544
 
545
+ class BorrowInterest:
546
+ info: Any
547
+ symbol: Optional[Str]
548
+ currency: Optional[Str]
549
+ interest: Optional[Num]
550
+ interestRate: Optional[Num]
551
+ amountBorrowed: Optional[Num]
552
+ marginMode: Optional[Str]
553
+ timestamp: Optional[Int]
554
+ datetime: Optional[Str]
555
+
556
+
545
557
  FundingRates = Dict[Str, FundingRate]
546
558
  LastPrices = Dict[Str, LastPrice]
547
559
  Currencies = Dict[Str, CurrencyInterface]
ccxt/bequant.py CHANGED
@@ -16,7 +16,7 @@ class bequant(hitbtc, ImplicitAPI):
16
16
  'countries': ['MT'], # Malta
17
17
  'pro': True,
18
18
  'urls': {
19
- 'logo': 'https://user-images.githubusercontent.com/1294454/55248342-a75dfe00-525a-11e9-8aa2-05e9dca943c6.jpg',
19
+ 'logo': 'https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867',
20
20
  'api': {
21
21
  'public': 'https://api.bequant.io/api/3',
22
22
  'private': 'https://api.bequant.io/api/3',
ccxt/bigone.py CHANGED
@@ -92,7 +92,7 @@ class bigone(Exchange, ImplicitAPI):
92
92
  },
93
93
  'hostname': 'big.one', # or 'bigone.com'
94
94
  'urls': {
95
- 'logo': 'https://user-images.githubusercontent.com/1294454/69354403-1d532180-0c91-11ea-88ed-44c06cefdf87.jpg',
95
+ 'logo': 'https://github.com/user-attachments/assets/4e5cfd53-98cc-4b90-92cd-0d7b512653d1',
96
96
  'api': {
97
97
  'public': 'https://{hostname}/api/v3',
98
98
  'private': 'https://{hostname}/api/v3/viewer',