ccxt 4.4.65__py2.py3-none-any.whl → 4.4.67__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.
ccxt/binance.py CHANGED
@@ -6167,7 +6167,8 @@ class binance(Exchange, ImplicitAPI):
6167
6167
  # don't handle/omit params here, omitting happens inside createOrderRequest
6168
6168
  marketType = self.safe_string(params, 'type', market['type'])
6169
6169
  marginMode = self.safe_string(params, 'marginMode')
6170
- isPortfolioMargin = self.safe_bool_2(params, 'papi', 'portfolioMargin', False)
6170
+ porfolioOptionsValue = self.safe_bool_2(self.options, 'papi', 'portfolioMargin', False)
6171
+ isPortfolioMargin = self.safe_bool_2(params, 'papi', 'portfolioMargin', porfolioOptionsValue)
6171
6172
  triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
6172
6173
  stopLossPrice = self.safe_string(params, 'stopLossPrice')
6173
6174
  takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
@@ -6179,8 +6180,9 @@ class binance(Exchange, ImplicitAPI):
6179
6180
  sor = self.safe_bool_2(params, 'sor', 'SOR', False)
6180
6181
  test = self.safe_bool(params, 'test', False)
6181
6182
  params = self.omit(params, ['sor', 'SOR', 'test'])
6182
- if isPortfolioMargin:
6183
- params['portfolioMargin'] = isPortfolioMargin
6183
+ # if isPortfolioMargin:
6184
+ # params['portfolioMargin'] = isPortfolioMargin
6185
+ # }
6184
6186
  request = self.create_order_request(symbol, type, side, amount, price, params)
6185
6187
  response = None
6186
6188
  if market['option']:
ccxt/bitget.py CHANGED
@@ -2338,16 +2338,16 @@ class bitget(Exchange, ImplicitAPI):
2338
2338
  paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
2339
2339
  if paginate:
2340
2340
  return self.fetch_paginated_call_cursor('fetchDeposits', None, since, limit, params, 'idLessThan', 'idLessThan', None, 100)
2341
- if code is None:
2342
- raise ArgumentsRequired(self.id + ' fetchDeposits() requires a `code` argument')
2343
- currency = self.currency(code)
2344
2341
  if since is None:
2345
2342
  since = self.milliseconds() - 7776000000 # 90 days
2346
2343
  request: dict = {
2347
- 'coin': currency['id'],
2348
2344
  'startTime': since,
2349
2345
  'endTime': self.milliseconds(),
2350
2346
  }
2347
+ currency = None
2348
+ if code is not None:
2349
+ currency = self.currency(code)
2350
+ request['coin'] = currency['id']
2351
2351
  if limit is not None:
2352
2352
  request['limit'] = limit
2353
2353
  request, params = self.handle_until_option('endTime', request, params)
@@ -2376,7 +2376,7 @@ class bitget(Exchange, ImplicitAPI):
2376
2376
  # }
2377
2377
  #
2378
2378
  rawTransactions = self.safe_list(response, 'data', [])
2379
- return self.parse_transactions(rawTransactions, currency, since, limit)
2379
+ return self.parse_transactions(rawTransactions, None, since, limit)
2380
2380
 
2381
2381
  def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2382
2382
  """
@@ -4669,7 +4669,8 @@ class bitget(Exchange, ImplicitAPI):
4669
4669
  elif isTakeProfitOrder or isStopLossOrder:
4670
4670
  request['marginCoin'] = market['settleId']
4671
4671
  request['size'] = self.amount_to_precision(symbol, amount)
4672
- request['executePrice'] = self.price_to_precision(symbol, price)
4672
+ if price is not None:
4673
+ request['executePrice'] = self.price_to_precision(symbol, price)
4673
4674
  if isStopLossOrder:
4674
4675
  request['triggerPrice'] = self.price_to_precision(symbol, stopLossPrice)
4675
4676
  elif isTakeProfitOrder:
@@ -5450,10 +5451,11 @@ class bitget(Exchange, ImplicitAPI):
5450
5451
  :param int [since]: timestamp in ms of the earliest order
5451
5452
  :param int [limit]: the max number of closed orders to return
5452
5453
  :param dict [params]: extra parameters specific to the exchange API endpoint
5453
- :param int [params.until]: the latest time in ms to fetch entries for
5454
+ :param int [params.until]: the latest time in ms to fetch orders for
5455
+ :param str [params.planType]: *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
5456
+ :param boolean [params.trigger]: set to True for fetching trigger orders
5454
5457
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
5455
5458
  :param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5456
- :param str [params.productType]: *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
5457
5459
  :param boolean [params.trailing]: set to True if you want to fetch trailing orders
5458
5460
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
5459
5461
  """
@@ -5476,10 +5478,11 @@ class bitget(Exchange, ImplicitAPI):
5476
5478
  :param int [since]: timestamp in ms of the earliest order
5477
5479
  :param int [limit]: the max number of canceled orders to return
5478
5480
  :param dict [params]: extra parameters specific to the exchange API endpoint
5479
- :param int [params.until]: the latest time in ms to fetch entries for
5481
+ :param int [params.until]: the latest time in ms to fetch orders for
5482
+ :param str [params.planType]: *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
5483
+ :param boolean [params.trigger]: set to True for fetching trigger orders
5480
5484
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
5481
5485
  :param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5482
- :param str [params.productType]: *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
5483
5486
  :param boolean [params.trailing]: set to True if you want to fetch trailing orders
5484
5487
  :returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
5485
5488
  """
@@ -5502,6 +5505,12 @@ class bitget(Exchange, ImplicitAPI):
5502
5505
  :param int [since]: the earliest time in ms to fetch orders for
5503
5506
  :param int [limit]: the maximum number of order structures to retrieve
5504
5507
  :param dict [params]: extra parameters specific to the exchange API endpoint
5508
+ :param int [params.until]: the latest time in ms to fetch orders for
5509
+ :param str [params.planType]: *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
5510
+ :param boolean [params.trigger]: set to True for fetching trigger orders
5511
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
5512
+ :param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5513
+ :param boolean [params.trailing]: set to True if you want to fetch trailing orders
5505
5514
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
5506
5515
  """
5507
5516
  self.load_markets()
@@ -5530,7 +5539,7 @@ class bitget(Exchange, ImplicitAPI):
5530
5539
  cursorReceived = 'endId'
5531
5540
  return self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan')
5532
5541
  response = None
5533
- trailing = self.safe_value(params, 'trailing')
5542
+ trailing = self.safe_bool(params, 'trailing')
5534
5543
  trigger = self.safe_bool_2(params, 'stop', 'trigger')
5535
5544
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
5536
5545
  request, params = self.handle_until_option('endTime', request, params)
@@ -5570,11 +5579,12 @@ class bitget(Exchange, ImplicitAPI):
5570
5579
  productType = None
5571
5580
  productType, params = self.handle_product_type_and_params(market, params)
5572
5581
  request['productType'] = productType
5582
+ planTypeDefined = self.safe_string(params, 'planType') is not None
5573
5583
  if trailing:
5574
5584
  planType = self.safe_string(params, 'planType', 'track_plan')
5575
5585
  request['planType'] = planType
5576
5586
  response = self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
5577
- elif trigger:
5587
+ elif trigger or planTypeDefined:
5578
5588
  planType = self.safe_string(params, 'planType', 'normal_plan')
5579
5589
  request['planType'] = planType
5580
5590
  response = self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
ccxt/bitrue.py CHANGED
@@ -1385,6 +1385,7 @@ class bitrue(Exchange, ImplicitAPI):
1385
1385
  :param int [since]: timestamp in ms of the earliest candle to fetch
1386
1386
  :param int [limit]: the maximum amount of candles to fetch
1387
1387
  :param dict [params]: extra parameters specific to the exchange API endpoint
1388
+ :param int [params.until]: the latest time in ms to fetch transfers for
1388
1389
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
1389
1390
  """
1390
1391
  self.load_markets()
@@ -1415,8 +1416,10 @@ class bitrue(Exchange, ImplicitAPI):
1415
1416
  }
1416
1417
  if limit is not None:
1417
1418
  request['limit'] = limit
1418
- if since is not None:
1419
- request['fromIdx'] = since
1419
+ until = self.safe_integer(params, 'until')
1420
+ if until is not None:
1421
+ params = self.omit(params, 'until')
1422
+ request['fromIdx'] = until
1420
1423
  response = self.spotV1PublicGetMarketKline(self.extend(request, params))
1421
1424
  data = self.safe_list(response, 'data', [])
1422
1425
  else: