ccxt 4.3.75__py2.py3-none-any.whl → 4.3.77__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

@@ -3566,7 +3566,10 @@ class bybit(Exchange, ImplicitAPI):
3566
3566
  request['qty'] = self.cost_to_precision(symbol, amount)
3567
3567
  else:
3568
3568
  if not isTrailingAmountOrder and not isAlternativeEndpoint:
3569
- request['qty'] = self.amount_to_precision(symbol, amount)
3569
+ if market['option']:
3570
+ request['qty'] = self.number_to_string(amount)
3571
+ else:
3572
+ request['qty'] = self.amount_to_precision(symbol, amount)
3570
3573
  if isTrailingAmountOrder:
3571
3574
  if trailingTriggerPrice is not None:
3572
3575
  request['activePrice'] = self.price_to_precision(symbol, trailingTriggerPrice)
@@ -278,8 +278,8 @@ class coinbase(Exchange, ImplicitAPI):
278
278
  },
279
279
  'fees': {
280
280
  'trading': {
281
- 'taker': self.parse_number('0.006'),
282
- 'maker': self.parse_number('0.004'),
281
+ 'taker': self.parse_number('0.012'),
282
+ 'maker': self.parse_number('0.006'), # {"pricing_tier":"Advanced 1","usd_from":"0","usd_to":"1000","taker_fee_rate":"0.012","maker_fee_rate":"0.006","aop_from":"","aop_to":""}
283
283
  'tierBased': True,
284
284
  'percentage': True,
285
285
  'tiers': {
@@ -1327,6 +1327,10 @@ class coinbase(Exchange, ImplicitAPI):
1327
1327
  marketType = self.safe_string_lower(market, 'product_type')
1328
1328
  tradingDisabled = self.safe_bool(market, 'trading_disabled')
1329
1329
  stablePairs = self.safe_list(self.options, 'stablePairs', [])
1330
+ defaultTakerFee = self.safe_number(self.fees['trading'], 'taker')
1331
+ defaultMakerFee = self.safe_number(self.fees['trading'], 'maker')
1332
+ takerFee = 0.00001 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'taker_fee_rate', defaultTakerFee)
1333
+ makerFee = 0.0 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'maker_fee_rate', defaultMakerFee)
1330
1334
  return self.safe_market_structure({
1331
1335
  'id': id,
1332
1336
  'symbol': base + '/' + quote,
@@ -1346,8 +1350,8 @@ class coinbase(Exchange, ImplicitAPI):
1346
1350
  'contract': False,
1347
1351
  'linear': None,
1348
1352
  'inverse': None,
1349
- 'taker': 0.00001 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'taker_fee_rate'),
1350
- 'maker': 0.0 if self.in_array(id, stablePairs) else self.safe_number(feeTier, 'maker_fee_rate'),
1353
+ 'taker': takerFee,
1354
+ 'maker': makerFee,
1351
1355
  'contractSize': None,
1352
1356
  'expiry': None,
1353
1357
  'expiryDatetime': None,
@@ -200,6 +200,7 @@ class gemini(Exchange, ImplicitAPI):
200
200
  'v1/account/create': 1,
201
201
  'v1/account/list': 1,
202
202
  'v1/heartbeat': 1,
203
+ 'v1/roles': 1,
203
204
  },
204
205
  },
205
206
  },
ccxt/async_support/htx.py CHANGED
@@ -5751,6 +5751,7 @@ class htx(Exchange, ImplicitAPI):
5751
5751
 
5752
5752
  async def fetch_deposit_addresses_by_network(self, code: str, params={}):
5753
5753
  """
5754
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
5754
5755
  fetch a dictionary of addresses for a currency, indexed by network
5755
5756
  :param str code: unified currency code of the currency for the deposit address
5756
5757
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5781,6 +5782,7 @@ class htx(Exchange, ImplicitAPI):
5781
5782
 
5782
5783
  async def fetch_deposit_address(self, code: str, params={}):
5783
5784
  """
5785
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
5784
5786
  fetch the deposit address for a currency associated with self account
5785
5787
  :param str code: unified currency code
5786
5788
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5827,6 +5829,7 @@ class htx(Exchange, ImplicitAPI):
5827
5829
 
5828
5830
  async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
5829
5831
  """
5832
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4f050-7773-11ed-9966-0242ac110003
5830
5833
  fetch all deposits made to an account
5831
5834
  :param str code: unified currency code
5832
5835
  :param int [since]: the earliest time in ms to fetch deposits for
@@ -6046,6 +6049,7 @@ class htx(Exchange, ImplicitAPI):
6046
6049
 
6047
6050
  async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
6048
6051
  """
6052
+ :see: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4cc41-7773-11ed-9966-0242ac110003
6049
6053
  make a withdrawal
6050
6054
  :param str code: unified currency code
6051
6055
  :param float amount: the amount to withdraw
@@ -1750,6 +1750,8 @@ class kraken(Exchange, ImplicitAPI):
1750
1750
  if postOnly:
1751
1751
  extendedPostFlags = flags + ',post' if (flags is not None) else 'post'
1752
1752
  request['oflags'] = extendedPostFlags
1753
+ if (flags is not None) and (request['oflags'] is None):
1754
+ request['oflags'] = flags
1753
1755
  params = self.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset'])
1754
1756
  return [request, params]
1755
1757
 
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.75'
7
+ __version__ = '4.3.77'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -110,6 +110,14 @@ from ccxt.base.types import Int
110
110
 
111
111
  # -----------------------------------------------------------------------------
112
112
 
113
+ class SafeJSONEncoder(json.JSONEncoder):
114
+ def default(self, obj):
115
+ if isinstance(obj, Exception):
116
+ return {"name": obj.__class__.__name__}
117
+ try:
118
+ return super().default(obj)
119
+ except TypeError:
120
+ return f"TypeError: Object of type {type(obj).__name__} is not JSON serializable"
113
121
 
114
122
  class Exchange(object):
115
123
  """Base exchange class"""
@@ -360,6 +368,7 @@ class Exchange(object):
360
368
  self.trades = dict() if self.trades is None else self.trades
361
369
  self.transactions = dict() if self.transactions is None else self.transactions
362
370
  self.ohlcvs = dict() if self.ohlcvs is None else self.ohlcvs
371
+ self.liquidations = dict() if self.liquidations is None else self.liquidations
363
372
  self.currencies = dict() if self.currencies is None else self.currencies
364
373
  self.options = self.get_default_options() if self.options is None else self.options # Python does not allow to define properties in run-time with setattr
365
374
  self.decimal_to_precision = decimal_to_precision
@@ -1418,7 +1427,7 @@ class Exchange(object):
1418
1427
 
1419
1428
  @staticmethod
1420
1429
  def json(data, params=None):
1421
- return json.dumps(data, separators=(',', ':'))
1430
+ return json.dumps(data, separators=(',', ':'), cls=SafeJSONEncoder)
1422
1431
 
1423
1432
  @staticmethod
1424
1433
  def is_json_encoded_object(input):
ccxt/binance.py CHANGED
@@ -2784,7 +2784,7 @@ class binance(Exchange, ImplicitAPI):
2784
2784
  'active': depositEnable and withdrawEnable,
2785
2785
  'deposit': depositEnable,
2786
2786
  'withdraw': withdrawEnable,
2787
- 'fee': self.parse_number(fee),
2787
+ 'fee': withdrawFee,
2788
2788
  'precision': self.parse_number(precisionTick),
2789
2789
  'limits': {
2790
2790
  'withdraw': {
@@ -2792,7 +2792,7 @@ class binance(Exchange, ImplicitAPI):
2792
2792
  'max': self.safe_number(networkItem, 'withdrawMax'),
2793
2793
  },
2794
2794
  'deposit': {
2795
- 'min': None,
2795
+ 'min': self.safe_number(networkItem, 'depositDust'),
2796
2796
  'max': None,
2797
2797
  },
2798
2798
  },
ccxt/bithumb.py CHANGED
@@ -207,7 +207,7 @@ class bithumb(Exchange, ImplicitAPI):
207
207
  def fetch_markets(self, params={}) -> List[Market]:
208
208
  """
209
209
  retrieves data on all markets for bithumb
210
- :see: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
210
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
211
211
  :param dict [params]: extra parameters specific to the exchange API endpoint
212
212
  :returns dict[]: an array of objects representing market data
213
213
  """
@@ -341,7 +341,7 @@ class bithumb(Exchange, ImplicitAPI):
341
341
  def fetch_balance(self, params={}) -> Balances:
342
342
  """
343
343
  query for balance and get the amount of funds available for trading or funds locked in orders
344
- :see: https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
344
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
345
345
  :param dict [params]: extra parameters specific to the exchange API endpoint
346
346
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
347
347
  """
@@ -355,7 +355,7 @@ class bithumb(Exchange, ImplicitAPI):
355
355
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
356
356
  """
357
357
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
358
- :see: https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
358
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
359
359
  :param str symbol: unified symbol of the market to fetch the order book for
360
360
  :param int [limit]: the maximum amount of order book entries to return
361
361
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -445,7 +445,7 @@ class bithumb(Exchange, ImplicitAPI):
445
445
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
446
446
  """
447
447
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
448
- :see: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
448
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
449
449
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
450
450
  :param dict [params]: extra parameters specific to the exchange API endpoint
451
451
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -502,7 +502,7 @@ class bithumb(Exchange, ImplicitAPI):
502
502
  def fetch_ticker(self, symbol: str, params={}) -> Ticker:
503
503
  """
504
504
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
505
- :see: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
505
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
506
506
  :param str symbol: unified symbol of the market to fetch the ticker for
507
507
  :param dict [params]: extra parameters specific to the exchange API endpoint
508
508
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -559,7 +559,7 @@ class bithumb(Exchange, ImplicitAPI):
559
559
  def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
560
560
  """
561
561
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
562
- :see: https://apidocs.bithumb.com/reference/candlestick-rest-api
562
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/candlestick-rest-api
563
563
  :param str symbol: unified symbol of the market to fetch OHLCV data for
564
564
  :param str timeframe: the length of time each candle represents
565
565
  :param int [since]: timestamp in ms of the earliest candle to fetch
@@ -676,7 +676,7 @@ class bithumb(Exchange, ImplicitAPI):
676
676
  def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
677
677
  """
678
678
  get the list of most recent trades for a particular symbol
679
- :see: https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
679
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
680
680
  :param str symbol: unified symbol of the market to fetch trades for
681
681
  :param int [since]: timestamp in ms of the earliest trade to fetch
682
682
  :param int [limit]: the maximum amount of trades to fetch
@@ -712,9 +712,9 @@ class bithumb(Exchange, ImplicitAPI):
712
712
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
713
713
  """
714
714
  create a trade order
715
- :see: https://apidocs.bithumb.com/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
716
- :see: https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
717
- :see: https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
715
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
716
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
717
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
718
718
  :param str symbol: unified symbol of the market to create an order in
719
719
  :param str type: 'market' or 'limit'
720
720
  :param str side: 'buy' or 'sell'
@@ -751,7 +751,7 @@ class bithumb(Exchange, ImplicitAPI):
751
751
  def fetch_order(self, id: str, symbol: Str = None, params={}):
752
752
  """
753
753
  fetches information on an order made by the user
754
- :see: https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
754
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
755
755
  :param str symbol: unified symbol of the market the order was made in
756
756
  :param dict [params]: extra parameters specific to the exchange API endpoint
757
757
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -901,7 +901,7 @@ class bithumb(Exchange, ImplicitAPI):
901
901
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
902
902
  """
903
903
  fetch all unfilled currently open orders
904
- :see: https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
904
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
905
905
  :param str symbol: unified market symbol
906
906
  :param int [since]: the earliest time in ms to fetch open orders for
907
907
  :param int [limit]: the maximum number of open order structures to retrieve
@@ -945,7 +945,7 @@ class bithumb(Exchange, ImplicitAPI):
945
945
  def cancel_order(self, id: str, symbol: Str = None, params={}):
946
946
  """
947
947
  cancels an open order
948
- :see: https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
948
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
949
949
  :param str id: order id
950
950
  :param str symbol: unified symbol of the market the order was made in
951
951
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -985,7 +985,7 @@ class bithumb(Exchange, ImplicitAPI):
985
985
  def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
986
986
  """
987
987
  make a withdrawal
988
- :see: https://apidocs.bithumb.com/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
988
+ :see: https://apidocs.bithumb.com/v1.2.0/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
989
989
  :param str code: unified currency code
990
990
  :param float amount: the amount to withdraw
991
991
  :param str address: the address to withdraw to