ccxt 4.1.67__py2.py3-none-any.whl → 4.1.68__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.

ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.1.67'
25
+ __version__ = '4.1.68'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.67'
7
+ __version__ = '4.1.68'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.1.67'
5
+ __version__ = '4.1.68'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -746,7 +746,7 @@ class Exchange(BaseExchange):
746
746
  raise NotSupported(self.id + ' watchPositions() is not supported yet')
747
747
 
748
748
  async def watch_position_for_symbols(self, symbols: List[str] = None, since: Int = None, limit: Int = None, params={}):
749
- return self.watchPositions(symbols, since, limit, params)
749
+ return await self.watchPositions(symbols, since, limit, params)
750
750
 
751
751
  async def fetch_positions_for_symbol(self, symbol: str, params={}):
752
752
  """
@@ -2057,8 +2057,8 @@ class bybit(Exchange, ImplicitAPI):
2057
2057
  parsedSymbols.append(market['symbol'])
2058
2058
  request = {
2059
2059
  # 'symbol': market['id'],
2060
- # 'baseCoin': '', Base coin. For option only
2061
- # 'expDate': '', Expiry date. e.g., 25DEC22. For option only
2060
+ # 'baseCoin': '', # Base coin. For option only
2061
+ # 'expDate': '', # Expiry date. e.g., 25DEC22. For option only
2062
2062
  }
2063
2063
  type = None
2064
2064
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
@@ -572,8 +572,6 @@ class gate(Exchange, ImplicitAPI):
572
572
  'AXIS': 'Axis DeFi',
573
573
  'BIFI': 'Bitcoin File',
574
574
  'BOX': 'DefiBox',
575
- 'BTCBEAR': 'BEAR',
576
- 'BTCBULL': 'BULL',
577
575
  'BYN': 'BeyondFi',
578
576
  'EGG': 'Goose Finance',
579
577
  'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
@@ -869,6 +867,7 @@ class gate(Exchange, ImplicitAPI):
869
867
  'AUTO_TRIGGER_PRICE_LESS_LAST': InvalidOrder, # {"label":"AUTO_TRIGGER_PRICE_LESS_LAST","message":"invalid argument: Trigger.Price must < last_price"}
870
868
  'AUTO_TRIGGER_PRICE_GREATE_LAST': InvalidOrder, # {"label":"AUTO_TRIGGER_PRICE_GREATE_LAST","message":"invalid argument: Trigger.Price must > last_price"}
871
869
  'POSITION_HOLDING': BadRequest,
870
+ 'USER_LOAN_EXCEEDED': BadRequest, # {"label":"USER_LOAN_EXCEEDED","message":"Max loan amount per user would be exceeded"}
872
871
  },
873
872
  'broad': {},
874
873
  },
@@ -5265,6 +5264,204 @@ class gate(Exchange, ImplicitAPI):
5265
5264
  floor = cap
5266
5265
  return tiers
5267
5266
 
5267
+ async def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
5268
+ """
5269
+ repay borrowed margin and interest
5270
+ :see: https://www.gate.io/docs/apiv4/en/#repay-cross-margin-loan
5271
+ :see: https://www.gate.io/docs/apiv4/en/#repay-a-loan
5272
+ :param str code: unified currency code of the currency to repay
5273
+ :param float amount: the amount to repay
5274
+ :param str symbol: unified market symbol, required for isolated margin
5275
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5276
+ :param str [params.mode]: 'all' or 'partial' payment mode, extra parameter required for isolated margin
5277
+ :param str [params.id]: '34267567' loan id, extra parameter required for isolated margin
5278
+ :returns dict: a `margin loan structure <https://docs.ccxt.com/#/?id=margin-loan-structure>`
5279
+ """
5280
+ marginMode = None
5281
+ marginMode, params = self.handle_option_and_params(params, 'repayMargin', 'marginMode')
5282
+ self.check_required_argument('repayMargin', marginMode, 'marginMode', ['cross', 'isolated'])
5283
+ self.check_required_margin_argument('repayMargin', symbol, marginMode)
5284
+ await self.load_markets()
5285
+ currency = self.currency(code)
5286
+ request = {
5287
+ 'currency': currency['id'].upper(),
5288
+ 'amount': self.currency_to_precision(code, amount),
5289
+ }
5290
+ response = None
5291
+ if (marginMode == 'cross') and (symbol is None):
5292
+ response = await self.privateMarginPostCrossRepayments(self.extend(request, params))
5293
+ elif (marginMode == 'isolated') or (symbol is not None):
5294
+ if symbol is None:
5295
+ raise BadRequest(self.id + ' repayMargin() requires a symbol argument for isolated margin')
5296
+ market = self.market(symbol)
5297
+ request['currency_pair'] = market['id']
5298
+ request['type'] = 'repay'
5299
+ response = await self.privateMarginPostUniLoans(self.extend(request, params))
5300
+ #
5301
+ # Cross
5302
+ #
5303
+ # [
5304
+ # {
5305
+ # "id": "17",
5306
+ # "create_time": 1620381696159,
5307
+ # "update_time": 1620381696159,
5308
+ # "currency": "EOS",
5309
+ # "amount": "110.553635",
5310
+ # "text": "web",
5311
+ # "status": 2,
5312
+ # "repaid": "110.506649705159",
5313
+ # "repaid_interest": "0.046985294841",
5314
+ # "unpaid_interest": "0.0000074393366667"
5315
+ # }
5316
+ # ]
5317
+ #
5318
+ # Isolated
5319
+ #
5320
+ # {
5321
+ # "id": "34267567",
5322
+ # "create_time": "1656394778",
5323
+ # "expire_time": "1657258778",
5324
+ # "status": "finished",
5325
+ # "side": "borrow",
5326
+ # "currency": "USDT",
5327
+ # "rate": "0.0002",
5328
+ # "amount": "100",
5329
+ # "days": 10,
5330
+ # "auto_renew": False,
5331
+ # "currency_pair": "LTC_USDT",
5332
+ # "left": "0",
5333
+ # "repaid": "100",
5334
+ # "paid_interest": "0.003333333333",
5335
+ # "unpaid_interest": "0"
5336
+ # }
5337
+ #
5338
+ if marginMode == 'cross':
5339
+ response = response[0]
5340
+ return self.parse_margin_loan(response, currency)
5341
+
5342
+ async def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
5343
+ """
5344
+ create a loan to borrow margin
5345
+ :see: https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan
5346
+ :see: https://www.gate.io/docs/developers/apiv4/en/#marginuni
5347
+ :param str code: unified currency code of the currency to borrow
5348
+ :param float amount: the amount to borrow
5349
+ :param str symbol: unified market symbol, required for isolated margin
5350
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5351
+ :param str [params.rate]: '0.0002' or '0.002' extra parameter required for isolated margin
5352
+ :returns dict: a `margin loan structure <https://docs.ccxt.com/#/?id=margin-loan-structure>`
5353
+ """
5354
+ marginMode = None
5355
+ marginMode, params = self.handle_option_and_params(params, 'borrowMargin', 'marginMode')
5356
+ self.check_required_argument('borrowMargin', marginMode, 'marginMode', ['cross', 'isolated'])
5357
+ self.check_required_margin_argument('borrowMargin', symbol, marginMode)
5358
+ await self.load_markets()
5359
+ currency = self.currency(code)
5360
+ request = {
5361
+ 'currency': currency['id'].upper(),
5362
+ 'amount': self.currency_to_precision(code, amount),
5363
+ }
5364
+ response = None
5365
+ if (marginMode == 'cross') and (symbol is None):
5366
+ response = await self.privateMarginPostCrossLoans(self.extend(request, params))
5367
+ elif (marginMode == 'isolated') or (symbol is not None):
5368
+ if symbol is None:
5369
+ raise BadRequest(self.id + ' borrowMargin() requires a symbol argument for isolated margin')
5370
+ market = self.market(symbol)
5371
+ request['currency_pair'] = market['id']
5372
+ request['type'] = 'borrow'
5373
+ response = await self.privateMarginPostUniLoans(self.extend(request, params))
5374
+ #
5375
+ # Cross
5376
+ #
5377
+ # {
5378
+ # "id": "17",
5379
+ # "create_time": 1620381696159,
5380
+ # "update_time": 1620381696159,
5381
+ # "currency": "EOS",
5382
+ # "amount": "110.553635",
5383
+ # "text": "web",
5384
+ # "status": 2,
5385
+ # "repaid": "110.506649705159",
5386
+ # "repaid_interest": "0.046985294841",
5387
+ # "unpaid_interest": "0.0000074393366667"
5388
+ # }
5389
+ #
5390
+ # Isolated
5391
+ #
5392
+ # {
5393
+ # "id": "34267567",
5394
+ # "create_time": "1656394778",
5395
+ # "expire_time": "1657258778",
5396
+ # "status": "loaned",
5397
+ # "side": "borrow",
5398
+ # "currency": "USDT",
5399
+ # "rate": "0.0002",
5400
+ # "amount": "100",
5401
+ # "days": 10,
5402
+ # "auto_renew": False,
5403
+ # "currency_pair": "LTC_USDT",
5404
+ # "left": "0",
5405
+ # "repaid": "0",
5406
+ # "paid_interest": "0",
5407
+ # "unpaid_interest": "0.003333333333"
5408
+ # }
5409
+ #
5410
+ return self.parse_margin_loan(response, currency)
5411
+
5412
+ def parse_margin_loan(self, info, currency: Currency = None):
5413
+ #
5414
+ # Cross
5415
+ #
5416
+ # {
5417
+ # "id": "17",
5418
+ # "create_time": 1620381696159,
5419
+ # "update_time": 1620381696159,
5420
+ # "currency": "EOS",
5421
+ # "amount": "110.553635",
5422
+ # "text": "web",
5423
+ # "status": 2,
5424
+ # "repaid": "110.506649705159",
5425
+ # "repaid_interest": "0.046985294841",
5426
+ # "unpaid_interest": "0.0000074393366667"
5427
+ # }
5428
+ #
5429
+ # Isolated
5430
+ #
5431
+ # {
5432
+ # "id": "34267567",
5433
+ # "create_time": "1656394778",
5434
+ # "expire_time": "1657258778",
5435
+ # "status": "loaned",
5436
+ # "side": "borrow",
5437
+ # "currency": "USDT",
5438
+ # "rate": "0.0002",
5439
+ # "amount": "100",
5440
+ # "days": 10,
5441
+ # "auto_renew": False,
5442
+ # "currency_pair": "LTC_USDT",
5443
+ # "left": "0",
5444
+ # "repaid": "0",
5445
+ # "paid_interest": "0",
5446
+ # "unpaid_interest": "0.003333333333"
5447
+ # }
5448
+ #
5449
+ marginMode = self.safe_string_2(self.options, 'defaultMarginMode', 'marginMode', 'cross')
5450
+ timestamp = self.safe_integer(info, 'create_time')
5451
+ if marginMode == 'isolated':
5452
+ timestamp = self.safe_timestamp(info, 'create_time')
5453
+ currencyId = self.safe_string(info, 'currency')
5454
+ marketId = self.safe_string(info, 'currency_pair')
5455
+ return {
5456
+ 'id': self.safe_integer(info, 'id'),
5457
+ 'currency': self.safe_currency_code(currencyId, currency),
5458
+ 'amount': self.safe_number(info, 'amount'),
5459
+ 'symbol': self.safe_symbol(marketId, None, '_', 'margin'),
5460
+ 'timestamp': timestamp,
5461
+ 'datetime': self.iso8601(timestamp),
5462
+ 'info': info,
5463
+ }
5464
+
5268
5465
  def sign(self, path, api=[], method='GET', params={}, headers=None, body=None):
5269
5466
  authentication = api[0] # public, private
5270
5467
  type = api[1] # spot, margin, future, delivery
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.67'
7
+ __version__ = '4.1.68'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -564,7 +564,7 @@ class Exchange(object):
564
564
  proxies['http'] = socksProxy
565
565
  proxies['https'] = socksProxy
566
566
  proxyAgentSet = proxies is not None
567
- self.checkConflictingProxies(proxyAgentSet, proxyUrl)
567
+ self.check_conflicting_proxies(proxyAgentSet, proxyUrl)
568
568
  # specifically for async-python, there is ".proxies" property maintained
569
569
  if (self.proxies is not None):
570
570
  if (proxyAgentSet or proxyUrl):
@@ -1989,7 +1989,7 @@ class Exchange(object):
1989
1989
  def parse_markets(self, markets):
1990
1990
  result = []
1991
1991
  for i in range(0, len(markets)):
1992
- result.append(self.parseMarket(markets[i]))
1992
+ result.append(self.parse_market(markets[i]))
1993
1993
  return result
1994
1994
 
1995
1995
  def parse_ticker(self, ticker: object, market: Market = None):
@@ -2832,7 +2832,7 @@ class Exchange(object):
2832
2832
  'bidVolume': self.safe_number(ticker, 'bidVolume'),
2833
2833
  'ask': self.parse_number(self.omit_zero(self.safe_number(ticker, 'ask'))),
2834
2834
  'askVolume': self.safe_number(ticker, 'askVolume'),
2835
- 'high': self.parse_number(self.omit_zero(self.safe_string(ticker, 'high"'))),
2835
+ 'high': self.parse_number(self.omit_zero(self.safe_string(ticker, 'high'))),
2836
2836
  'low': self.parse_number(self.omit_zero(self.safe_number(ticker, 'low'))),
2837
2837
  'open': self.parse_number(self.omit_zero(self.parse_number(open))),
2838
2838
  'close': self.parse_number(self.omit_zero(self.parse_number(close))),
@@ -4338,7 +4338,7 @@ class Exchange(object):
4338
4338
  message += ', one of ' + '(' + messageOptions + ')'
4339
4339
  raise ArgumentsRequired(message)
4340
4340
 
4341
- def check_required_margin_argument(self, methodName: str, symbol: str, marginMode: str):
4341
+ def check_required_margin_argument(self, methodName: str, symbol: Str, marginMode: str):
4342
4342
  """
4343
4343
  * @ignore
4344
4344
  :param str symbol: unified symbol of the market
ccxt/bybit.py CHANGED
@@ -2056,8 +2056,8 @@ class bybit(Exchange, ImplicitAPI):
2056
2056
  parsedSymbols.append(market['symbol'])
2057
2057
  request = {
2058
2058
  # 'symbol': market['id'],
2059
- # 'baseCoin': '', Base coin. For option only
2060
- # 'expDate': '', Expiry date. e.g., 25DEC22. For option only
2059
+ # 'baseCoin': '', # Base coin. For option only
2060
+ # 'expDate': '', # Expiry date. e.g., 25DEC22. For option only
2061
2061
  }
2062
2062
  type = None
2063
2063
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
ccxt/gate.py CHANGED
@@ -571,8 +571,6 @@ class gate(Exchange, ImplicitAPI):
571
571
  'AXIS': 'Axis DeFi',
572
572
  'BIFI': 'Bitcoin File',
573
573
  'BOX': 'DefiBox',
574
- 'BTCBEAR': 'BEAR',
575
- 'BTCBULL': 'BULL',
576
574
  'BYN': 'BeyondFi',
577
575
  'EGG': 'Goose Finance',
578
576
  'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
@@ -868,6 +866,7 @@ class gate(Exchange, ImplicitAPI):
868
866
  'AUTO_TRIGGER_PRICE_LESS_LAST': InvalidOrder, # {"label":"AUTO_TRIGGER_PRICE_LESS_LAST","message":"invalid argument: Trigger.Price must < last_price"}
869
867
  'AUTO_TRIGGER_PRICE_GREATE_LAST': InvalidOrder, # {"label":"AUTO_TRIGGER_PRICE_GREATE_LAST","message":"invalid argument: Trigger.Price must > last_price"}
870
868
  'POSITION_HOLDING': BadRequest,
869
+ 'USER_LOAN_EXCEEDED': BadRequest, # {"label":"USER_LOAN_EXCEEDED","message":"Max loan amount per user would be exceeded"}
871
870
  },
872
871
  'broad': {},
873
872
  },
@@ -5264,6 +5263,204 @@ class gate(Exchange, ImplicitAPI):
5264
5263
  floor = cap
5265
5264
  return tiers
5266
5265
 
5266
+ def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
5267
+ """
5268
+ repay borrowed margin and interest
5269
+ :see: https://www.gate.io/docs/apiv4/en/#repay-cross-margin-loan
5270
+ :see: https://www.gate.io/docs/apiv4/en/#repay-a-loan
5271
+ :param str code: unified currency code of the currency to repay
5272
+ :param float amount: the amount to repay
5273
+ :param str symbol: unified market symbol, required for isolated margin
5274
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5275
+ :param str [params.mode]: 'all' or 'partial' payment mode, extra parameter required for isolated margin
5276
+ :param str [params.id]: '34267567' loan id, extra parameter required for isolated margin
5277
+ :returns dict: a `margin loan structure <https://docs.ccxt.com/#/?id=margin-loan-structure>`
5278
+ """
5279
+ marginMode = None
5280
+ marginMode, params = self.handle_option_and_params(params, 'repayMargin', 'marginMode')
5281
+ self.check_required_argument('repayMargin', marginMode, 'marginMode', ['cross', 'isolated'])
5282
+ self.check_required_margin_argument('repayMargin', symbol, marginMode)
5283
+ self.load_markets()
5284
+ currency = self.currency(code)
5285
+ request = {
5286
+ 'currency': currency['id'].upper(),
5287
+ 'amount': self.currency_to_precision(code, amount),
5288
+ }
5289
+ response = None
5290
+ if (marginMode == 'cross') and (symbol is None):
5291
+ response = self.privateMarginPostCrossRepayments(self.extend(request, params))
5292
+ elif (marginMode == 'isolated') or (symbol is not None):
5293
+ if symbol is None:
5294
+ raise BadRequest(self.id + ' repayMargin() requires a symbol argument for isolated margin')
5295
+ market = self.market(symbol)
5296
+ request['currency_pair'] = market['id']
5297
+ request['type'] = 'repay'
5298
+ response = self.privateMarginPostUniLoans(self.extend(request, params))
5299
+ #
5300
+ # Cross
5301
+ #
5302
+ # [
5303
+ # {
5304
+ # "id": "17",
5305
+ # "create_time": 1620381696159,
5306
+ # "update_time": 1620381696159,
5307
+ # "currency": "EOS",
5308
+ # "amount": "110.553635",
5309
+ # "text": "web",
5310
+ # "status": 2,
5311
+ # "repaid": "110.506649705159",
5312
+ # "repaid_interest": "0.046985294841",
5313
+ # "unpaid_interest": "0.0000074393366667"
5314
+ # }
5315
+ # ]
5316
+ #
5317
+ # Isolated
5318
+ #
5319
+ # {
5320
+ # "id": "34267567",
5321
+ # "create_time": "1656394778",
5322
+ # "expire_time": "1657258778",
5323
+ # "status": "finished",
5324
+ # "side": "borrow",
5325
+ # "currency": "USDT",
5326
+ # "rate": "0.0002",
5327
+ # "amount": "100",
5328
+ # "days": 10,
5329
+ # "auto_renew": False,
5330
+ # "currency_pair": "LTC_USDT",
5331
+ # "left": "0",
5332
+ # "repaid": "100",
5333
+ # "paid_interest": "0.003333333333",
5334
+ # "unpaid_interest": "0"
5335
+ # }
5336
+ #
5337
+ if marginMode == 'cross':
5338
+ response = response[0]
5339
+ return self.parse_margin_loan(response, currency)
5340
+
5341
+ def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
5342
+ """
5343
+ create a loan to borrow margin
5344
+ :see: https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan
5345
+ :see: https://www.gate.io/docs/developers/apiv4/en/#marginuni
5346
+ :param str code: unified currency code of the currency to borrow
5347
+ :param float amount: the amount to borrow
5348
+ :param str symbol: unified market symbol, required for isolated margin
5349
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5350
+ :param str [params.rate]: '0.0002' or '0.002' extra parameter required for isolated margin
5351
+ :returns dict: a `margin loan structure <https://docs.ccxt.com/#/?id=margin-loan-structure>`
5352
+ """
5353
+ marginMode = None
5354
+ marginMode, params = self.handle_option_and_params(params, 'borrowMargin', 'marginMode')
5355
+ self.check_required_argument('borrowMargin', marginMode, 'marginMode', ['cross', 'isolated'])
5356
+ self.check_required_margin_argument('borrowMargin', symbol, marginMode)
5357
+ self.load_markets()
5358
+ currency = self.currency(code)
5359
+ request = {
5360
+ 'currency': currency['id'].upper(),
5361
+ 'amount': self.currency_to_precision(code, amount),
5362
+ }
5363
+ response = None
5364
+ if (marginMode == 'cross') and (symbol is None):
5365
+ response = self.privateMarginPostCrossLoans(self.extend(request, params))
5366
+ elif (marginMode == 'isolated') or (symbol is not None):
5367
+ if symbol is None:
5368
+ raise BadRequest(self.id + ' borrowMargin() requires a symbol argument for isolated margin')
5369
+ market = self.market(symbol)
5370
+ request['currency_pair'] = market['id']
5371
+ request['type'] = 'borrow'
5372
+ response = self.privateMarginPostUniLoans(self.extend(request, params))
5373
+ #
5374
+ # Cross
5375
+ #
5376
+ # {
5377
+ # "id": "17",
5378
+ # "create_time": 1620381696159,
5379
+ # "update_time": 1620381696159,
5380
+ # "currency": "EOS",
5381
+ # "amount": "110.553635",
5382
+ # "text": "web",
5383
+ # "status": 2,
5384
+ # "repaid": "110.506649705159",
5385
+ # "repaid_interest": "0.046985294841",
5386
+ # "unpaid_interest": "0.0000074393366667"
5387
+ # }
5388
+ #
5389
+ # Isolated
5390
+ #
5391
+ # {
5392
+ # "id": "34267567",
5393
+ # "create_time": "1656394778",
5394
+ # "expire_time": "1657258778",
5395
+ # "status": "loaned",
5396
+ # "side": "borrow",
5397
+ # "currency": "USDT",
5398
+ # "rate": "0.0002",
5399
+ # "amount": "100",
5400
+ # "days": 10,
5401
+ # "auto_renew": False,
5402
+ # "currency_pair": "LTC_USDT",
5403
+ # "left": "0",
5404
+ # "repaid": "0",
5405
+ # "paid_interest": "0",
5406
+ # "unpaid_interest": "0.003333333333"
5407
+ # }
5408
+ #
5409
+ return self.parse_margin_loan(response, currency)
5410
+
5411
+ def parse_margin_loan(self, info, currency: Currency = None):
5412
+ #
5413
+ # Cross
5414
+ #
5415
+ # {
5416
+ # "id": "17",
5417
+ # "create_time": 1620381696159,
5418
+ # "update_time": 1620381696159,
5419
+ # "currency": "EOS",
5420
+ # "amount": "110.553635",
5421
+ # "text": "web",
5422
+ # "status": 2,
5423
+ # "repaid": "110.506649705159",
5424
+ # "repaid_interest": "0.046985294841",
5425
+ # "unpaid_interest": "0.0000074393366667"
5426
+ # }
5427
+ #
5428
+ # Isolated
5429
+ #
5430
+ # {
5431
+ # "id": "34267567",
5432
+ # "create_time": "1656394778",
5433
+ # "expire_time": "1657258778",
5434
+ # "status": "loaned",
5435
+ # "side": "borrow",
5436
+ # "currency": "USDT",
5437
+ # "rate": "0.0002",
5438
+ # "amount": "100",
5439
+ # "days": 10,
5440
+ # "auto_renew": False,
5441
+ # "currency_pair": "LTC_USDT",
5442
+ # "left": "0",
5443
+ # "repaid": "0",
5444
+ # "paid_interest": "0",
5445
+ # "unpaid_interest": "0.003333333333"
5446
+ # }
5447
+ #
5448
+ marginMode = self.safe_string_2(self.options, 'defaultMarginMode', 'marginMode', 'cross')
5449
+ timestamp = self.safe_integer(info, 'create_time')
5450
+ if marginMode == 'isolated':
5451
+ timestamp = self.safe_timestamp(info, 'create_time')
5452
+ currencyId = self.safe_string(info, 'currency')
5453
+ marketId = self.safe_string(info, 'currency_pair')
5454
+ return {
5455
+ 'id': self.safe_integer(info, 'id'),
5456
+ 'currency': self.safe_currency_code(currencyId, currency),
5457
+ 'amount': self.safe_number(info, 'amount'),
5458
+ 'symbol': self.safe_symbol(marketId, None, '_', 'margin'),
5459
+ 'timestamp': timestamp,
5460
+ 'datetime': self.iso8601(timestamp),
5461
+ 'info': info,
5462
+ }
5463
+
5267
5464
  def sign(self, path, api=[], method='GET', params={}, headers=None, body=None):
5268
5465
  authentication = api[0] # public, private
5269
5466
  type = api[1] # spot, margin, future, delivery
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.67'
7
+ __version__ = '4.1.68'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/binance.py CHANGED
@@ -682,7 +682,7 @@ class binance(ccxt.async_support.binance):
682
682
  def handle_trade(self, client: Client, message):
683
683
  # the trade streams push raw trade information in real-time
684
684
  # each trade has a unique buyer and seller
685
- isSpot = ((client.url.find('/stream') > -1) or (client.url.find('/testnet.binance') > -1))
685
+ isSpot = ((client.url.find('wss://stream.binance.com') > -1) or (client.url.find('/testnet.binance') > -1))
686
686
  marketType = 'spot' if (isSpot) else 'contract'
687
687
  marketId = self.safe_string(message, 's')
688
688
  market = self.safe_market(marketId, None, None, marketType)
ccxt/pro/phemex.py CHANGED
@@ -1213,7 +1213,7 @@ class phemex(ccxt.async_support.phemex):
1213
1213
  lastTradeTimestamp = self.safe_integer_product(order, 'transactTimeNs', 0.000001)
1214
1214
  if lastTradeTimestamp == 0:
1215
1215
  lastTradeTimestamp = None
1216
- timeInForce = self.parseTimeInForce(self.safe_string(order, 'timeInForce'))
1216
+ timeInForce = self.parse_time_in_force(self.safe_string(order, 'timeInForce'))
1217
1217
  stopPrice = self.safe_string(order, 'stopPx')
1218
1218
  postOnly = (timeInForce == 'PO')
1219
1219
  return self.safe_order({
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.1.67
3
+ Version: 4.1.68
4
4
  Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges
5
5
  Home-page: https://ccxt.com
6
6
  Author: Igor Kroitor
@@ -260,13 +260,13 @@ console.log(version, Object.keys(exchanges));
260
260
 
261
261
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
262
262
 
263
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.67/dist/ccxt.browser.js
264
- * unpkg: https://unpkg.com/ccxt@4.1.67/dist/ccxt.browser.js
263
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.68/dist/ccxt.browser.js
264
+ * unpkg: https://unpkg.com/ccxt@4.1.68/dist/ccxt.browser.js
265
265
 
266
266
  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.
267
267
 
268
268
  ```HTML
269
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.67/dist/ccxt.browser.js"></script>
269
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.68/dist/ccxt.browser.js"></script>
270
270
  ```
271
271
 
272
272
  Creates a global `ccxt` object:
@@ -1,4 +1,4 @@
1
- ccxt/__init__.py,sha256=euAERP2oOSSEhgs9kehkC5kFLyUCifp2UGbVfT1HLTY,15177
1
+ ccxt/__init__.py,sha256=7t2YN4CW07IyX13vZoIJ_HZUmOvPOiEsCXfgfs89kVI,15177
2
2
  ccxt/ace.py,sha256=BWWFoSfDar1k8SuqIuupgs8BLfZyu8w6BEdGZxWVR7M,41264
3
3
  ccxt/alpaca.py,sha256=4MSi6SDyes3lNvGKmWgXWEIB2CacwfbVdhLxchv3m7k,45944
4
4
  ccxt/ascendex.py,sha256=F6sRaTfCGzYMEm8Xq2jhsGLnmn8YLopoSc2_mq4fn44,142413
@@ -35,7 +35,7 @@ ccxt/btcalpha.py,sha256=4mNS_yMwcDAz1kFQyCVfSSBITjEkv2UJp9iL_A9nAiM,35544
35
35
  ccxt/btcbox.py,sha256=vAexHxCRX7yJvugkxhXsrIoZZUYNYZVwg22CuN_bNdM,22765
36
36
  ccxt/btcmarkets.py,sha256=ltQTbUZ1VdeIDlmCgOEzqxKx69DK5cTxIAlGOLSOXNM,48498
37
37
  ccxt/btcturk.py,sha256=p9bwzFNEOvWdA6eNS8Be8MUE2tooj41qYr9WV0zcNig,35374
38
- ccxt/bybit.py,sha256=K9z5CNmETif8In7muOA-goLrkXu0C6YyylTsLVxh828,353285
38
+ ccxt/bybit.py,sha256=lrVax6vqhDCCIN5QZvepyqlDS49DMfbI4YJRQC4Zr6w,353291
39
39
  ccxt/cex.py,sha256=mZGWOJAYS6o7bnxUFkykFSNMp0WBWu_ov8W9xgeBT8A,66222
40
40
  ccxt/coinbase.py,sha256=yAJr50ql9Jg84dubNvHxdjRRXbTwFYIzwCvezeeDJzE,143324
41
41
  ccxt/coinbaseprime.py,sha256=Ygvljulxb2uKdei5yimCj1LMjLlUJNvP-G7ns1HpUFk,1219
@@ -55,7 +55,7 @@ ccxt/digifinex.py,sha256=5OeiNfFIM-w3AAPvMXE7SIWIrtfV4bUvyxiaeCSCEo4,165923
55
55
  ccxt/exmo.py,sha256=SrZt0OVTAkzn7XhNUdhI87Pe8fsa1cjvOfZGyISThWQ,111560
56
56
  ccxt/flowbtc.py,sha256=YPvm6tbsHJJUQBspFcHuVPQfVmiWzwnVvfzRqBdQX6U,1169
57
57
  ccxt/fmfwio.py,sha256=RbVLvzPwnqfDsE7Ea-N13ISCC82eJVPsXYjrleASmew,1236
58
- ccxt/gate.py,sha256=CvJNb1W9TTSeYr-dyhYD9MHIKFvOK2LcpoUipcbo4CA,280818
58
+ ccxt/gate.py,sha256=6FQiRGktApiRCdqEkas2_E5Z0zEaA2M2PKsW72ZVhu0,289347
59
59
  ccxt/gateio.py,sha256=86AETJWODl_vA5VNeQRHZprmpNIY1HAxCddKZcnKSi8,445
60
60
  ccxt/gemini.py,sha256=JSzf7E3kX7EYkKvMidQeu2oqroY0GJID_EFpVuDRBlg,74433
61
61
  ccxt/hitbtc.py,sha256=4L--cDzLMh2ckUFJzm-lll1Jzg7lOrGUAfO1DHD6Kuc,140528
@@ -205,7 +205,7 @@ ccxt/abstract/woo.py,sha256=Z3ua45hKE0Tf9rtfSEYYgGEztaTO1Ri3mKl_hIo3OHs,8768
205
205
  ccxt/abstract/yobit.py,sha256=8ycfCO8ORFly9hc0Aa47sZyX4_ZKPXS9h9yJzI-uQ7Q,1339
206
206
  ccxt/abstract/zaif.py,sha256=m15WHdl3gYy0GOXNZ8NEH8eE7sVh8c0T_ITNuU8vXeU,3935
207
207
  ccxt/abstract/zonda.py,sha256=aSfewvRojzmuymX6QbOnDR8v9VFqWTULMHX9Y7kKD1M,5820
208
- ccxt/async_support/__init__.py,sha256=yI1AjqhPeceGDHN4UsHy7ajuG7srQ7DlTqL3zlpzIYA,14900
208
+ ccxt/async_support/__init__.py,sha256=ca37P2gGCFm3xLOgJF4TnF9-pgfVVDb_BQVOicCH-Bs,14900
209
209
  ccxt/async_support/ace.py,sha256=H3BMrCEUPt86k1nFZnuTbcGPtgzzTii5V0OQeRK8x4U,41488
210
210
  ccxt/async_support/alpaca.py,sha256=q8s3omyklOv0grJ6kDJxmPkt9kqKHwes_fuYkP_Nhf8,46156
211
211
  ccxt/async_support/ascendex.py,sha256=t-OchFpnIgDF_Zu2Usg776cYjCwjIMGICighU7lwfFE,143111
@@ -242,7 +242,7 @@ ccxt/async_support/btcalpha.py,sha256=Ey4I6vEpIQfpqsfpRfyD_yQ_sGnJBDOcQfaSHZaT2O
242
242
  ccxt/async_support/btcbox.py,sha256=nkyHZsopW7ysB467teuV3yjO1WINpOW1qeo-4mfvZBk,22959
243
243
  ccxt/async_support/btcmarkets.py,sha256=1uO9fzK0GkHZ7CkjZaMHpbzh_MrHfdFFWIzTGpouOW8,48848
244
244
  ccxt/async_support/btcturk.py,sha256=5hV7fywDOCXW0rHYB3YYxRkTYPk8K02-opfLnm7I3cg,35592
245
- ccxt/async_support/bybit.py,sha256=MOPSQQdAwu2uSC6DsxS1UKWotdZuAbHfHnEPmQsVHQw,354729
245
+ ccxt/async_support/bybit.py,sha256=KvmTGSSC1DsPFTgA8yu-F7qqic6yEp62t8G8EffY--4,354735
246
246
  ccxt/async_support/cex.py,sha256=nroVKpc2_U09DYWqOhE3b1PtXr1tUPdifchIyu4f-w0,66548
247
247
  ccxt/async_support/coinbase.py,sha256=-GQCGYqy2YX36VTpIcBJZZEajnHBtSfnsTxp4EzysZ8,144088
248
248
  ccxt/async_support/coinbaseprime.py,sha256=M5Ez1DsFcW3-vJ-4QoZzwYBAKjAAtJnJpkfnV4sWAIc,1233
@@ -262,7 +262,7 @@ ccxt/async_support/digifinex.py,sha256=tza4_wKbBQpDKyNXHUYtjA1aSVQC86yo41oV8NQ0W
262
262
  ccxt/async_support/exmo.py,sha256=gEI0BHmx5angmzZYO_anGCCVFSLU7buHApfWZVXMvTA,112168
263
263
  ccxt/async_support/flowbtc.py,sha256=bCnvtcNnPxxaxqVjI1GGXKhIpz_1r4GIFWqqPokvCR0,1183
264
264
  ccxt/async_support/fmfwio.py,sha256=lzfSnPrB2ARcC3EIqAuBM4vyg6LJ6n8RE71Zvt3ez1s,1250
265
- ccxt/async_support/gate.py,sha256=IFMT2fmFr0iUCQPWDKlAKDSFlHZjZR2dD2fmy0Fts7E,281950
265
+ ccxt/async_support/gate.py,sha256=1aT-px9o_M70hH-Y3bvA5TGPyQTVqC3V6le2xK8c3X4,290527
266
266
  ccxt/async_support/gateio.py,sha256=6_t032F9p9x5KGTjtSuqGXITzFOx-XAQBYLpsuQjzxw,459
267
267
  ccxt/async_support/gemini.py,sha256=Wtgi4hdYQGtCmukUuFuWnFy2FrP2DXcTVsMdMqEUwW4,74935
268
268
  ccxt/async_support/hitbtc.py,sha256=03XsnK7JR4mQQZ9G7DhX2Zk7xvE4lb6rpm2jvzLWwqQ,141334
@@ -312,7 +312,7 @@ ccxt/async_support/yobit.py,sha256=Sr_o0G6zpBB2YHRClnD6FUzPBW74cukKl-cvjILW7YQ,5
312
312
  ccxt/async_support/zaif.py,sha256=-YCjZLw87m9m-JXxUCr6AEC8KfnNX8b7IVSv5caW3QQ,28158
313
313
  ccxt/async_support/zonda.py,sha256=DSrmvHZ4_uAwRzQQl_C6KGy3UK2kaTjJVohNg0SNbPQ,80592
314
314
  ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
315
- ccxt/async_support/base/exchange.py,sha256=klr61UK1xqTe3iBeX8pRc5lDzD0WVbosbKLwsTYdhw8,67406
315
+ ccxt/async_support/base/exchange.py,sha256=iL95YqyTtLXApU_MpvjK-ACEVQfA62iKOnaVpVi6u3o,67412
316
316
  ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
317
317
  ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
318
318
  ccxt/async_support/base/ws/aiohttp_client.py,sha256=_qjsl_x-rd88QmzQeGVWovMDK0XoD3f4m5GHqxZRajs,5203
@@ -326,14 +326,14 @@ ccxt/async_support/base/ws/order_book_side.py,sha256=Pxrq22nCODckJ6G1OXkYEmUunIu
326
326
  ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
327
327
  ccxt/base/decimal_to_precision.py,sha256=fgWRBzRTtsf3r2INyS4f7WHlzgjB5YM1ekiwqD21aac,6634
328
328
  ccxt/base/errors.py,sha256=1C38u76jlNGq06N_uwfw8b8FZHK8_3_90wM1rKfU_Rg,3878
329
- ccxt/base/exchange.py,sha256=Ydy9DytGfIeq194JK-Awy8CnTktjn-VK0vFOW9DTGmI,213804
329
+ ccxt/base/exchange.py,sha256=ITjQLlEEEuVGMc8pmTrmzUF_hUaYKKnu4fFAX-Txsfw,213806
330
330
  ccxt/base/precise.py,sha256=_xfu54sV0vWNnOfGTKRFykeuWP8mn4K1m9lk1tcllX4,8565
331
331
  ccxt/base/types.py,sha256=LN8MOE5oGr8ATL6VNuMAnE9f6o2fZ9zbeLLyXLndlEk,5528
332
- ccxt/pro/__init__.py,sha256=dWEW7xAdpo2Coyd4ZhEMCMPlTeQU8KWrVf-JHL8ConM,6376
332
+ ccxt/pro/__init__.py,sha256=FYjyGIvGfr4RJ4yWV6-1qs8CWL8HRfreVMAMdiGgEkk,6376
333
333
  ccxt/pro/alpaca.py,sha256=fy1mLmw4yac7DKvGPpaqEBuA8briQqaRwPbvKsKUJwY,26974
334
334
  ccxt/pro/ascendex.py,sha256=GqH6QOPZfQtbAYhdB65zJ9iIMQDGsXugSyAPUsKXk40,34730
335
335
  ccxt/pro/bequant.py,sha256=3IeQ0vPg-eVqPiGMfX7yqH9qtXKm1ZqocQDeLwpA8EE,1093
336
- ccxt/pro/binance.py,sha256=UUUtWoLqysw8g7Fwvb0Zr1GmJciVC-meY4vk2LNNQw4,125628
336
+ ccxt/pro/binance.py,sha256=A4ct4PIxsy7brzg55XRekdGAwQgrMx8QYTLSXoPj2jY,125645
337
337
  ccxt/pro/binancecoinm.py,sha256=vu5SUgP70T1Dax-Am3rch7ZldGrmUwxr_rI51Y38xjw,724
338
338
  ccxt/pro/binanceus.py,sha256=xKL-1cOHyqlLTwLGg-DPf6g3JMM1oU2Kv708FiGJwrY,2016
339
339
  ccxt/pro/binanceusdm.py,sha256=S0eT662O2ReplsihWk42nhJWqw1XsODpeDQa9eFVVt8,1357
@@ -383,7 +383,7 @@ ccxt/pro/ndax.py,sha256=kN4RT3g1KSV5R-jwxQEuSZPkm90ZBQxvnpb6rZXIEdA,22661
383
383
  ccxt/pro/okcoin.py,sha256=Og8uFEb7aHBqNseP4JNX64380EFXkfjlB17pSvQCjWo,30339
384
384
  ccxt/pro/okex.py,sha256=mKJJEfmOzmt31KyDIPVRuAqV_mL280pc2mbRz5h2oOg,382
385
385
  ccxt/pro/okx.py,sha256=p9EwmR61fCh_P-jJrq_b_VVACPmIRbG2lAq8bPCFidc,65115
386
- ccxt/pro/phemex.py,sha256=eskkPlDFNbgmjjAL7ErBwHbQaz7RtDCHXvyMNfdzubk,60398
386
+ ccxt/pro/phemex.py,sha256=fI5I9rQ1Ale5GMeo18Kumk7ygrCUdfseAC7rVuHv5Z0,60401
387
387
  ccxt/pro/poloniex.py,sha256=EwLkLdCRTQ5_oZG6Z1v9LxWhwKPG4NZ95l2fyeHhC_k,50823
388
388
  ccxt/pro/poloniexfutures.py,sha256=hdRIBPriTQ7r7Gdvks0F5yynlNWgC019vJYawFtkijA,40897
389
389
  ccxt/pro/probit.py,sha256=tfzrftQAi_NLWm4lXIF7XhLeXlzN3rE7Ymw_ck9oY9c,22672
@@ -439,7 +439,7 @@ ccxt/test/base/test_ticker.py,sha256=5J8KHgFhJLgcWyFwt3bhJ-tldMho3K7LD5yJnnUyrT4
439
439
  ccxt/test/base/test_trade.py,sha256=AN3emAdEPhdFyunap43cKqZTS1cbaShZKTjYue67jEU,2297
440
440
  ccxt/test/base/test_trading_fee.py,sha256=2_WCp3qJ2UpraQQoGFlGJYwHD-T0Bm5W7KIw4zpFvSM,1068
441
441
  ccxt/test/base/test_transaction.py,sha256=BTbB4UHHXkrvYgwbrhh867nVRlevmIkIrz1W_odlQJI,1434
442
- ccxt-4.1.67.dist-info/METADATA,sha256=D1_1d1uTV6sBnqWjB88b_xnJdmxc6qLZQpDHH8EC60A,106785
443
- ccxt-4.1.67.dist-info/WHEEL,sha256=P2T-6epvtXQ2cBOE_U1K4_noqlJFN3tj15djMgEu4NM,110
444
- ccxt-4.1.67.dist-info/top_level.txt,sha256=CkQDuCTDKNcImPV60t36G6MdYfxsAPNiSaEwifVoVMo,5
445
- ccxt-4.1.67.dist-info/RECORD,,
442
+ ccxt-4.1.68.dist-info/METADATA,sha256=Z6qBBQf6MCb847KW9ZF5_g6YC-n1l8Tyek3Zab31eNA,106785
443
+ ccxt-4.1.68.dist-info/WHEEL,sha256=P2T-6epvtXQ2cBOE_U1K4_noqlJFN3tj15djMgEu4NM,110
444
+ ccxt-4.1.68.dist-info/top_level.txt,sha256=CkQDuCTDKNcImPV60t36G6MdYfxsAPNiSaEwifVoVMo,5
445
+ ccxt-4.1.68.dist-info/RECORD,,
File without changes