ccxt 4.3.46__py2.py3-none-any.whl → 4.3.48__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.3.46'
25
+ __version__ = '4.3.48'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -18,6 +18,8 @@ class ImplicitAPI:
18
18
  private_get_transfers = privateGetTransfers = Entry('transfers', 'private', 'GET', {})
19
19
  private_get_leveragepreferences = privateGetLeveragepreferences = Entry('leveragepreferences', 'private', 'GET', {})
20
20
  private_get_pnlpreferences = privateGetPnlpreferences = Entry('pnlpreferences', 'private', 'GET', {})
21
+ private_get_assignmentprogram_current = privateGetAssignmentprogramCurrent = Entry('assignmentprogram/current', 'private', 'GET', {})
22
+ private_get_assignmentprogram_history = privateGetAssignmentprogramHistory = Entry('assignmentprogram/history', 'private', 'GET', {})
21
23
  private_post_sendorder = privatePostSendorder = Entry('sendorder', 'private', 'POST', {})
22
24
  private_post_editorder = privatePostEditorder = Entry('editorder', 'private', 'POST', {})
23
25
  private_post_cancelorder = privatePostCancelorder = Entry('cancelorder', 'private', 'POST', {})
@@ -26,6 +28,8 @@ class ImplicitAPI:
26
28
  private_post_cancelallorders = privatePostCancelallorders = Entry('cancelallorders', 'private', 'POST', {})
27
29
  private_post_cancelallordersafter = privatePostCancelallordersafter = Entry('cancelallordersafter', 'private', 'POST', {})
28
30
  private_post_withdrawal = privatePostWithdrawal = Entry('withdrawal', 'private', 'POST', {})
31
+ private_post_assignmentprogram_add = privatePostAssignmentprogramAdd = Entry('assignmentprogram/add', 'private', 'POST', {})
32
+ private_post_assignmentprogram_delete = privatePostAssignmentprogramDelete = Entry('assignmentprogram/delete', 'private', 'POST', {})
29
33
  private_put_leveragepreferences = privatePutLeveragepreferences = Entry('leveragepreferences', 'private', 'PUT', {})
30
34
  private_put_pnlpreferences = privatePutPnlpreferences = Entry('pnlpreferences', 'private', 'PUT', {})
31
35
  charts_get_price_type_symbol_interval = chartsGetPriceTypeSymbolInterval = Entry('{price_type}/{symbol}/{interval}', 'charts', 'GET', {})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.46'
7
+ __version__ = '4.3.48'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.3.46'
5
+ __version__ = '4.3.48'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -5837,7 +5837,7 @@ class binance(Exchange, ImplicitAPI):
5837
5837
  market = self.market(symbol)
5838
5838
  if not market['spot']:
5839
5839
  raise NotSupported(self.id + ' createMarketOrderWithCost() supports spot orders only')
5840
- params['quoteOrderQty'] = cost
5840
+ params['cost'] = cost
5841
5841
  return await self.create_order(symbol, 'market', side, cost, None, params)
5842
5842
 
5843
5843
  async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
@@ -5853,7 +5853,7 @@ class binance(Exchange, ImplicitAPI):
5853
5853
  market = self.market(symbol)
5854
5854
  if not market['spot']:
5855
5855
  raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
5856
- params['quoteOrderQty'] = cost
5856
+ params['cost'] = cost
5857
5857
  return await self.create_order(symbol, 'market', 'buy', cost, None, params)
5858
5858
 
5859
5859
  async def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
@@ -7377,6 +7377,8 @@ class binance(Exchange, ImplicitAPI):
7377
7377
  return self.parse_transactions(response, currency, since, limit)
7378
7378
 
7379
7379
  def parse_transaction_status_by_type(self, status, type=None):
7380
+ if type is None:
7381
+ return status
7380
7382
  statusesByType: dict = {
7381
7383
  'deposit': {
7382
7384
  '0': 'pending',
@@ -8201,7 +8203,7 @@ class binance(Exchange, ImplicitAPI):
8201
8203
  request: dict = {
8202
8204
  'coin': currency['id'],
8203
8205
  'address': address,
8204
- 'amount': amount,
8206
+ 'amount': self.currency_to_precision(code, amount),
8205
8207
  # https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
8206
8208
  # issue sapiGetCapitalConfigGetall() to get networks for withdrawing USDT ERC20 vs USDT Omni
8207
8209
  # 'network': 'ETH', # 'BTC', 'TRX', etc, optional
@@ -4190,7 +4190,7 @@ class bitget(Exchange, ImplicitAPI):
4190
4190
  request['clientOid'] = clientOrderId
4191
4191
  if marginMode is not None:
4192
4192
  request['loanType'] = 'normal'
4193
- if createMarketBuyOrderRequiresPrice and isMarketOrder and (side == 'buy'):
4193
+ if isMarketOrder and (side == 'buy'):
4194
4194
  request['quoteSize'] = quantity
4195
4195
  else:
4196
4196
  request['baseSize'] = quantity
@@ -2238,7 +2238,7 @@ class bitmart(Exchange, ImplicitAPI):
2238
2238
  trailingActivationPrice = self.safe_number(order, 'activation_price')
2239
2239
  return self.safe_order({
2240
2240
  'id': id,
2241
- 'clientOrderId': self.safe_string(order, 'client_order_id'),
2241
+ 'clientOrderId': self.safe_string_2(order, 'client_order_id', 'clientOrderId'),
2242
2242
  'info': order,
2243
2243
  'timestamp': timestamp,
2244
2244
  'datetime': self.iso8601(timestamp),
@@ -798,6 +798,7 @@ class gate(Exchange, ImplicitAPI):
798
798
  'NOT_ACCEPTABLE': BadRequest,
799
799
  'METHOD_NOT_ALLOWED': BadRequest,
800
800
  'NOT_FOUND': ExchangeError,
801
+ 'AUTHENTICATION_FAILED': AuthenticationError,
801
802
  'INVALID_CREDENTIALS': AuthenticationError,
802
803
  'INVALID_KEY': AuthenticationError,
803
804
  'IP_FORBIDDEN': AuthenticationError,
@@ -3669,17 +3670,14 @@ class gate(Exchange, ImplicitAPI):
3669
3670
  #
3670
3671
  return self.parse_order(response, market)
3671
3672
 
3672
- async def create_orders(self, orders: List[OrderRequest], params={}):
3673
- """
3674
- create a list of trade orders
3675
- :see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
3676
- :see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
3677
- :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
3678
- :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3679
- """
3680
- await self.load_markets()
3673
+ def create_orders_request(self, orders: List[OrderRequest], params={}):
3681
3674
  ordersRequests = []
3682
3675
  orderSymbols = []
3676
+ ordersLength = len(orders)
3677
+ if ordersLength == 0:
3678
+ raise BadRequest(self.id + ' createOrders() requires at least one order')
3679
+ if ordersLength > 10:
3680
+ raise BadRequest(self.id + ' createOrders() accepts a maximum of 10 orders at a time')
3683
3681
  for i in range(0, len(orders)):
3684
3682
  rawOrder = orders[i]
3685
3683
  marketId = self.safe_string(rawOrder, 'symbol')
@@ -3700,6 +3698,21 @@ class gate(Exchange, ImplicitAPI):
3700
3698
  market = self.market(symbols[0])
3701
3699
  if market['future'] or market['option']:
3702
3700
  raise NotSupported(self.id + ' createOrders() does not support futures or options markets')
3701
+ return ordersRequests
3702
+
3703
+ async def create_orders(self, orders: List[OrderRequest], params={}):
3704
+ """
3705
+ create a list of trade orders
3706
+ :see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
3707
+ :see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
3708
+ :see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
3709
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
3710
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3711
+ """
3712
+ await self.load_markets()
3713
+ ordersRequests = self.create_orders_request(orders, params)
3714
+ firstOrder = orders[0]
3715
+ market = self.market(firstOrder['symbol'])
3703
3716
  response = None
3704
3717
  if market['spot']:
3705
3718
  response = await self.privateSpotPostBatchOrders(ordersRequests)
@@ -3930,21 +3943,7 @@ class gate(Exchange, ImplicitAPI):
3930
3943
  params['createMarketBuyOrderRequiresPrice'] = False
3931
3944
  return await self.create_order(symbol, 'market', 'buy', cost, None, params)
3932
3945
 
3933
- async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3934
- """
3935
- edit a trade order, gate currently only supports the modification of the price or amount fields
3936
- :see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
3937
- :see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
3938
- :param str id: order id
3939
- :param str symbol: unified symbol of the market to create an order in
3940
- :param str type: 'market' or 'limit'
3941
- :param str side: 'buy' or 'sell'
3942
- :param float amount: how much of the currency you want to trade in units of the base currency
3943
- :param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
3944
- :param dict [params]: extra parameters specific to the exchange API endpoint
3945
- :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3946
- """
3947
- await self.load_markets()
3946
+ def edit_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3948
3947
  market = self.market(symbol)
3949
3948
  marketType, query = self.handle_market_type_and_params('editOrder', market, params)
3950
3949
  account = self.convert_type_to_account(marketType)
@@ -3954,7 +3953,7 @@ class gate(Exchange, ImplicitAPI):
3954
3953
  # exchange doesn't have market orders for spot
3955
3954
  raise InvalidOrder(self.id + ' editOrder() does not support ' + type + ' orders for ' + marketType + ' markets')
3956
3955
  request: dict = {
3957
- 'order_id': id,
3956
+ 'order_id': str(id),
3958
3957
  'currency_pair': market['id'],
3959
3958
  'account': account,
3960
3959
  }
@@ -3968,12 +3967,32 @@ class gate(Exchange, ImplicitAPI):
3968
3967
  request['size'] = self.amount_to_precision(symbol, amount)
3969
3968
  if price is not None:
3970
3969
  request['price'] = self.price_to_precision(symbol, price)
3970
+ if not market['spot']:
3971
+ request['settle'] = market['settleId']
3972
+ return self.extend(request, query)
3973
+
3974
+ async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3975
+ """
3976
+ edit a trade order, gate currently only supports the modification of the price or amount fields
3977
+ :see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
3978
+ :see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
3979
+ :param str id: order id
3980
+ :param str symbol: unified symbol of the market to create an order in
3981
+ :param str type: 'market' or 'limit'
3982
+ :param str side: 'buy' or 'sell'
3983
+ :param float amount: how much of the currency you want to trade in units of the base currency
3984
+ :param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
3985
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3986
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3987
+ """
3988
+ await self.load_markets()
3989
+ market = self.market(symbol)
3990
+ extendedRequest = self.edit_order_request(id, symbol, type, side, amount, price, params)
3971
3991
  response = None
3972
3992
  if market['spot']:
3973
- response = await self.privateSpotPatchOrdersOrderId(self.extend(request, query))
3993
+ response = await self.privateSpotPatchOrdersOrderId(extendedRequest)
3974
3994
  else:
3975
- request['settle'] = market['settleId']
3976
- response = await self.privateFuturesPutSettleOrdersOrderId(self.extend(request, query))
3995
+ response = await self.privateFuturesPutSettleOrdersOrderId(extendedRequest)
3977
3996
  #
3978
3997
  # {
3979
3998
  # "id": "243233276443",
@@ -4274,6 +4293,23 @@ class gate(Exchange, ImplicitAPI):
4274
4293
  'info': order,
4275
4294
  }, market)
4276
4295
 
4296
+ def fetch_order_request(self, id: str, symbol: Str = None, params={}):
4297
+ market = None if (symbol is None) else self.market(symbol)
4298
+ stop = self.safe_bool_n(params, ['trigger', 'is_stop_order', 'stop'], False)
4299
+ params = self.omit(params, ['is_stop_order', 'stop', 'trigger'])
4300
+ clientOrderId = self.safe_string_2(params, 'text', 'clientOrderId')
4301
+ orderId = id
4302
+ if clientOrderId is not None:
4303
+ params = self.omit(params, ['text', 'clientOrderId'])
4304
+ if clientOrderId[0] != 't':
4305
+ clientOrderId = 't-' + clientOrderId
4306
+ orderId = clientOrderId
4307
+ type, query = self.handle_market_type_and_params('fetchOrder', market, params)
4308
+ contract = (type == 'swap') or (type == 'future') or (type == 'option')
4309
+ request, requestParams = self.prepare_request(market, type, query) if contract else self.spot_order_prepare_request(market, stop, query)
4310
+ request['order_id'] = str(orderId)
4311
+ return [request, requestParams]
4312
+
4277
4313
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
4278
4314
  """
4279
4315
  Retrieves information on an order
@@ -4284,27 +4320,18 @@ class gate(Exchange, ImplicitAPI):
4284
4320
  :param str id: Order id
4285
4321
  :param str symbol: Unified market symbol, *required for spot and margin*
4286
4322
  :param dict [params]: Parameters specified by the exchange api
4287
- :param bool [params.stop]: True if the order being fetched is a trigger order
4323
+ :param bool [params.trigger]: True if the order being fetched is a trigger order
4288
4324
  :param str [params.marginMode]: 'cross' or 'isolated' - marginMode for margin trading if not provided self.options['defaultMarginMode'] is used
4289
4325
  :param str [params.type]: 'spot', 'swap', or 'future', if not provided self.options['defaultMarginMode'] is used
4290
4326
  :param str [params.settle]: 'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol is not None, default="usdt" for swap and "btc" for future
4291
4327
  :returns: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4292
4328
  """
4293
4329
  await self.load_markets()
4294
- stop = self.safe_value_2(params, 'is_stop_order', 'stop', False)
4295
- params = self.omit(params, ['is_stop_order', 'stop'])
4296
- clientOrderId = self.safe_string_2(params, 'text', 'clientOrderId')
4297
- orderId = id
4298
- if clientOrderId is not None:
4299
- params = self.omit(params, ['text', 'clientOrderId'])
4300
- if clientOrderId[0] != 't':
4301
- clientOrderId = 't-' + clientOrderId
4302
- orderId = clientOrderId
4303
4330
  market = None if (symbol is None) else self.market(symbol)
4304
- type, query = self.handle_market_type_and_params('fetchOrder', market, params)
4305
- contract = (type == 'swap') or (type == 'future') or (type == 'option')
4306
- request, requestParams = self.prepare_request(market, type, query) if contract else self.spot_order_prepare_request(market, stop, query)
4307
- request['order_id'] = orderId
4331
+ result = self.handle_market_type_and_params('fetchOrder', market, params)
4332
+ type = self.safe_string(result, 0)
4333
+ stop = self.safe_bool_n(params, ['trigger', 'is_stop_order', 'stop'], False)
4334
+ request, requestParams = self.fetch_order_request(id, symbol, params)
4308
4335
  response = None
4309
4336
  if type == 'spot' or type == 'margin':
4310
4337
  if stop:
@@ -4363,14 +4390,13 @@ class gate(Exchange, ImplicitAPI):
4363
4390
  """
4364
4391
  return await self.fetch_orders_by_status('finished', symbol, since, limit, params)
4365
4392
 
4366
- async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4367
- await self.load_markets()
4393
+ def fetch_orders_by_status_request(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4368
4394
  market = None
4369
4395
  if symbol is not None:
4370
4396
  market = self.market(symbol)
4371
4397
  symbol = market['symbol']
4372
- stop = self.safe_value(params, 'stop')
4373
- params = self.omit(params, 'stop')
4398
+ stop = self.safe_bool_2(params, 'stop', 'trigger')
4399
+ params = self.omit(params, ['stop', 'trigger'])
4374
4400
  type, query = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
4375
4401
  spot = (type == 'spot') or (type == 'margin')
4376
4402
  request, requestParams = self.multi_order_spot_prepare_request(market, stop, query) if spot else self.prepare_request(market, type, query)
@@ -4381,6 +4407,24 @@ class gate(Exchange, ImplicitAPI):
4381
4407
  request['limit'] = limit
4382
4408
  if since is not None and spot:
4383
4409
  request['from'] = self.parse_to_int(since / 1000)
4410
+ lastId, finalParams = self.handle_param_string_2(requestParams, 'lastId', 'last_id')
4411
+ if lastId is not None:
4412
+ request['last_id'] = lastId
4413
+ return [request, finalParams]
4414
+
4415
+ async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4416
+ await self.load_markets()
4417
+ market = None
4418
+ if symbol is not None:
4419
+ market = self.market(symbol)
4420
+ symbol = market['symbol']
4421
+ stop = self.safe_bool_2(params, 'stop', 'trigger')
4422
+ params = self.omit(params, ['trigger', 'stop'])
4423
+ res = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
4424
+ type = self.safe_string(res, 0)
4425
+ params['type'] = type
4426
+ request, requestParams = self.fetch_orders_by_status_request(status, symbol, since, limit, params)
4427
+ spot = (type == 'spot') or (type == 'margin')
4384
4428
  openSpotOrders = spot and (status == 'open') and not stop
4385
4429
  response = None
4386
4430
  if type == 'spot' or type == 'margin':
@@ -4574,8 +4618,8 @@ class gate(Exchange, ImplicitAPI):
4574
4618
  """
4575
4619
  await self.load_markets()
4576
4620
  market = None if (symbol is None) else self.market(symbol)
4577
- stop = self.safe_value_2(params, 'is_stop_order', 'stop', False)
4578
- params = self.omit(params, ['is_stop_order', 'stop'])
4621
+ stop = self.safe_bool_n(params, ['is_stop_order', 'stop', 'trigger'], False)
4622
+ params = self.omit(params, ['is_stop_order', 'stop', 'trigger'])
4579
4623
  type, query = self.handle_market_type_and_params('cancelOrder', market, params)
4580
4624
  request, requestParams = self.spot_order_prepare_request(market, stop, query) if (type == 'spot' or type == 'margin') else self.prepare_request(market, type, query)
4581
4625
  request['order_id'] = id
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.hyperliquid import ImplicitAPI
8
8
  import asyncio
9
- from ccxt.base.types import Balances, Currencies, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -2342,6 +2342,33 @@ class hyperliquid(Exchange, ImplicitAPI):
2342
2342
  response = await self.privatePostExchange(self.extend(request, params))
2343
2343
  return self.parse_transaction(response)
2344
2344
 
2345
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2346
+ #
2347
+ # {status: 'ok', response: {type: 'default'}}
2348
+ #
2349
+ return {
2350
+ 'info': transaction,
2351
+ 'id': None,
2352
+ 'txid': None,
2353
+ 'timestamp': None,
2354
+ 'datetime': None,
2355
+ 'network': None,
2356
+ 'address': None,
2357
+ 'addressTo': None,
2358
+ 'addressFrom': None,
2359
+ 'tag': None,
2360
+ 'tagTo': None,
2361
+ 'tagFrom': None,
2362
+ 'type': None,
2363
+ 'amount': None,
2364
+ 'currency': None,
2365
+ 'status': self.safe_string(transaction, 'status'),
2366
+ 'updated': None,
2367
+ 'comment': None,
2368
+ 'internal': None,
2369
+ 'fee': None,
2370
+ }
2371
+
2345
2372
  def format_vault_address(self, address: Str = None):
2346
2373
  if address is None:
2347
2374
  return None
@@ -136,6 +136,8 @@ class krakenfutures(Exchange, ImplicitAPI):
136
136
  'transfers',
137
137
  'leveragepreferences',
138
138
  'pnlpreferences',
139
+ 'assignmentprogram/current',
140
+ 'assignmentprogram/history',
139
141
  ],
140
142
  'post': [
141
143
  'sendorder',
@@ -146,6 +148,8 @@ class krakenfutures(Exchange, ImplicitAPI):
146
148
  'cancelallorders',
147
149
  'cancelallordersafter',
148
150
  'withdrawal', # for futures wallet -> kraken spot wallet
151
+ 'assignmentprogram/add',
152
+ 'assignmentprogram/delete',
149
153
  ],
150
154
  'put': [
151
155
  'leveragepreferences',
ccxt/async_support/woo.py CHANGED
@@ -2361,6 +2361,10 @@ class woo(Exchange, ImplicitAPI):
2361
2361
  url += access + '/' + pathWithParams
2362
2362
  if params:
2363
2363
  url += '?' + self.urlencode(params)
2364
+ elif access == 'pub':
2365
+ url += pathWithParams
2366
+ if params:
2367
+ url += '?' + self.urlencode(params)
2364
2368
  else:
2365
2369
  self.check_required_credentials()
2366
2370
  if method == 'POST' and (path == 'algo/order' or path == 'order'):
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.46'
7
+ __version__ = '4.3.48'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1518,8 +1518,8 @@ class Exchange(object):
1518
1518
 
1519
1519
  def precision_from_string(self, str):
1520
1520
  # support string formats like '1e-4'
1521
- if 'e' in str:
1522
- numStr = re.sub(r'\de', '', str)
1521
+ if 'e' in str or 'E' in str:
1522
+ numStr = re.sub(r'\d\.?\d*[eE]', '', str)
1523
1523
  return int(numStr) * -1
1524
1524
  # support integer formats (without dot) like '1', '10' etc [Note: bug in decimalToPrecision, so this should not be used atm]
1525
1525
  # if not ('.' in str):
ccxt/binance.py CHANGED
@@ -5836,7 +5836,7 @@ class binance(Exchange, ImplicitAPI):
5836
5836
  market = self.market(symbol)
5837
5837
  if not market['spot']:
5838
5838
  raise NotSupported(self.id + ' createMarketOrderWithCost() supports spot orders only')
5839
- params['quoteOrderQty'] = cost
5839
+ params['cost'] = cost
5840
5840
  return self.create_order(symbol, 'market', side, cost, None, params)
5841
5841
 
5842
5842
  def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
@@ -5852,7 +5852,7 @@ class binance(Exchange, ImplicitAPI):
5852
5852
  market = self.market(symbol)
5853
5853
  if not market['spot']:
5854
5854
  raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
5855
- params['quoteOrderQty'] = cost
5855
+ params['cost'] = cost
5856
5856
  return self.create_order(symbol, 'market', 'buy', cost, None, params)
5857
5857
 
5858
5858
  def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
@@ -7376,6 +7376,8 @@ class binance(Exchange, ImplicitAPI):
7376
7376
  return self.parse_transactions(response, currency, since, limit)
7377
7377
 
7378
7378
  def parse_transaction_status_by_type(self, status, type=None):
7379
+ if type is None:
7380
+ return status
7379
7381
  statusesByType: dict = {
7380
7382
  'deposit': {
7381
7383
  '0': 'pending',
@@ -8200,7 +8202,7 @@ class binance(Exchange, ImplicitAPI):
8200
8202
  request: dict = {
8201
8203
  'coin': currency['id'],
8202
8204
  'address': address,
8203
- 'amount': amount,
8205
+ 'amount': self.currency_to_precision(code, amount),
8204
8206
  # https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
8205
8207
  # issue sapiGetCapitalConfigGetall() to get networks for withdrawing USDT ERC20 vs USDT Omni
8206
8208
  # 'network': 'ETH', # 'BTC', 'TRX', etc, optional
ccxt/bitget.py CHANGED
@@ -4189,7 +4189,7 @@ class bitget(Exchange, ImplicitAPI):
4189
4189
  request['clientOid'] = clientOrderId
4190
4190
  if marginMode is not None:
4191
4191
  request['loanType'] = 'normal'
4192
- if createMarketBuyOrderRequiresPrice and isMarketOrder and (side == 'buy'):
4192
+ if isMarketOrder and (side == 'buy'):
4193
4193
  request['quoteSize'] = quantity
4194
4194
  else:
4195
4195
  request['baseSize'] = quantity
ccxt/bitmart.py CHANGED
@@ -2238,7 +2238,7 @@ class bitmart(Exchange, ImplicitAPI):
2238
2238
  trailingActivationPrice = self.safe_number(order, 'activation_price')
2239
2239
  return self.safe_order({
2240
2240
  'id': id,
2241
- 'clientOrderId': self.safe_string(order, 'client_order_id'),
2241
+ 'clientOrderId': self.safe_string_2(order, 'client_order_id', 'clientOrderId'),
2242
2242
  'info': order,
2243
2243
  'timestamp': timestamp,
2244
2244
  'datetime': self.iso8601(timestamp),