ccxt 4.3.36__py2.py3-none-any.whl → 4.3.38__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 +1 -1
- ccxt/abstract/kraken.py +3 -3
- ccxt/abstract/okx.py +3 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +61 -31
- ccxt/async_support/bitbank.py +46 -1
- ccxt/async_support/bitmart.py +36 -37
- ccxt/async_support/bl3p.py +7 -1
- ccxt/async_support/btcalpha.py +7 -2
- ccxt/async_support/btcturk.py +11 -1
- ccxt/async_support/coinbase.py +2 -2
- ccxt/async_support/coincheck.py +8 -1
- ccxt/async_support/coinex.py +9 -6
- ccxt/async_support/htx.py +64 -3
- ccxt/async_support/kraken.py +5 -5
- ccxt/async_support/okx.py +3 -0
- ccxt/async_support/woofipro.py +3 -1
- ccxt/base/exchange.py +1 -1
- ccxt/bingx.py +61 -31
- ccxt/bitbank.py +46 -1
- ccxt/bitmart.py +36 -37
- ccxt/bl3p.py +7 -1
- ccxt/btcalpha.py +7 -2
- ccxt/btcturk.py +11 -1
- ccxt/coinbase.py +2 -2
- ccxt/coincheck.py +8 -1
- ccxt/coinex.py +9 -6
- ccxt/htx.py +64 -3
- ccxt/kraken.py +5 -5
- ccxt/okx.py +3 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/woofipro.py +3 -1
- {ccxt-4.3.36.dist-info → ccxt-4.3.38.dist-info}/METADATA +6 -4
- {ccxt-4.3.36.dist-info → ccxt-4.3.38.dist-info}/RECORD +37 -37
- {ccxt-4.3.36.dist-info → ccxt-4.3.38.dist-info}/WHEEL +0 -0
- {ccxt-4.3.36.dist-info → ccxt-4.3.38.dist-info}/top_level.txt +0 -0
ccxt/async_support/woofipro.py
CHANGED
@@ -2138,8 +2138,10 @@ class woofipro(Exchange, ImplicitAPI):
|
|
2138
2138
|
|
2139
2139
|
def sign_hash(self, hash, privateKey):
|
2140
2140
|
signature = self.ecdsa(hash[-64:], privateKey[-64:], 'secp256k1', None)
|
2141
|
+
r = signature['r']
|
2142
|
+
s = signature['s']
|
2141
2143
|
v = self.int_to_base16(self.sum(27, signature['v']))
|
2142
|
-
return '0x' +
|
2144
|
+
return '0x' + r.rjust(64, '0') + s.rjust(64, '0') + v
|
2143
2145
|
|
2144
2146
|
def sign_message(self, message, privateKey):
|
2145
2147
|
return self.sign_hash(self.hash_message(message), privateKey[-64:])
|
ccxt/base/exchange.py
CHANGED
ccxt/bingx.py
CHANGED
@@ -2569,7 +2569,9 @@ class bingx(Exchange, ImplicitAPI):
|
|
2569
2569
|
#
|
2570
2570
|
else:
|
2571
2571
|
raise BadRequest(self.id + ' cancelAllOrders is only supported for spot and swap markets.')
|
2572
|
-
|
2572
|
+
data = self.safe_dict(response, 'data', {})
|
2573
|
+
orders = self.safe_list_2(data, 'success', 'orders', [])
|
2574
|
+
return self.parse_orders(orders)
|
2573
2575
|
|
2574
2576
|
def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
2575
2577
|
"""
|
@@ -2605,42 +2607,70 @@ class bingx(Exchange, ImplicitAPI):
|
|
2605
2607
|
spotReqKey = 'clientOrderIDs' if areClientOrderIds else 'orderIds'
|
2606
2608
|
request[spotReqKey] = ','.join(parsedIds)
|
2607
2609
|
response = self.spotV1PrivatePostTradeCancelOrders(self.extend(request, params))
|
2610
|
+
#
|
2611
|
+
# {
|
2612
|
+
# "code": 0,
|
2613
|
+
# "msg": "",
|
2614
|
+
# "debugMsg": "",
|
2615
|
+
# "data": {
|
2616
|
+
# "orders": [
|
2617
|
+
# {
|
2618
|
+
# "symbol": "SOL-USDT",
|
2619
|
+
# "orderId": 1795970045910614016,
|
2620
|
+
# "transactTime": 1717027601111,
|
2621
|
+
# "price": "180.25",
|
2622
|
+
# "stopPrice": "0",
|
2623
|
+
# "origQty": "0.03",
|
2624
|
+
# "executedQty": "0",
|
2625
|
+
# "cummulativeQuoteQty": "0",
|
2626
|
+
# "status": "CANCELED",
|
2627
|
+
# "type": "LIMIT",
|
2628
|
+
# "side": "SELL",
|
2629
|
+
# "clientOrderID": ""
|
2630
|
+
# },
|
2631
|
+
# ...
|
2632
|
+
# ]
|
2633
|
+
# }
|
2634
|
+
# }
|
2635
|
+
#
|
2608
2636
|
else:
|
2609
2637
|
if areClientOrderIds:
|
2610
2638
|
request['clientOrderIDList'] = self.json(parsedIds)
|
2611
2639
|
else:
|
2612
2640
|
request['orderIdList'] = parsedIds
|
2613
2641
|
response = self.swapV2PrivateDeleteTradeBatchOrders(self.extend(request, params))
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2642
|
+
#
|
2643
|
+
# {
|
2644
|
+
# "code": 0,
|
2645
|
+
# "msg": "",
|
2646
|
+
# "data": {
|
2647
|
+
# "success": [
|
2648
|
+
# {
|
2649
|
+
# "symbol": "LINK-USDT",
|
2650
|
+
# "orderId": 1597783850786750464,
|
2651
|
+
# "side": "BUY",
|
2652
|
+
# "positionSide": "LONG",
|
2653
|
+
# "type": "TRIGGER_MARKET",
|
2654
|
+
# "origQty": "5.0",
|
2655
|
+
# "price": "5.5710",
|
2656
|
+
# "executedQty": "0.0",
|
2657
|
+
# "avgPrice": "0.0000",
|
2658
|
+
# "cumQuote": "0",
|
2659
|
+
# "stopPrice": "5.0000",
|
2660
|
+
# "profit": "0.0000",
|
2661
|
+
# "commission": "0.000000",
|
2662
|
+
# "status": "CANCELLED",
|
2663
|
+
# "time": 1669776330000,
|
2664
|
+
# "updateTime": 1672370837000
|
2665
|
+
# }
|
2666
|
+
# ],
|
2667
|
+
# "failed": null
|
2668
|
+
# }
|
2669
|
+
# }
|
2670
|
+
#
|
2671
|
+
data = self.safe_dict(response, 'data', {})
|
2672
|
+
success = self.safe_list_2(data, 'success', 'orders', [])
|
2673
|
+
return self.parse_orders(success)
|
2644
2674
|
|
2645
2675
|
def cancel_all_orders_after(self, timeout: Int, params={}):
|
2646
2676
|
"""
|
ccxt/bitbank.py
CHANGED
@@ -669,8 +669,31 @@ class bitbank(Exchange, ImplicitAPI):
|
|
669
669
|
'pair': market['id'],
|
670
670
|
}
|
671
671
|
response = self.privatePostUserSpotCancelOrder(self.extend(request, params))
|
672
|
+
#
|
673
|
+
# {
|
674
|
+
# "success": 1,
|
675
|
+
# "data": {
|
676
|
+
# "order_id": 0,
|
677
|
+
# "pair": "string",
|
678
|
+
# "side": "string",
|
679
|
+
# "type": "string",
|
680
|
+
# "start_amount": "string",
|
681
|
+
# "remaining_amount": "string",
|
682
|
+
# "executed_amount": "string",
|
683
|
+
# "price": "string",
|
684
|
+
# "post_only": False,
|
685
|
+
# "average_price": "string",
|
686
|
+
# "ordered_at": 0,
|
687
|
+
# "expire_at": 0,
|
688
|
+
# "canceled_at": 0,
|
689
|
+
# "triggered_at": 0,
|
690
|
+
# "trigger_price": "string",
|
691
|
+
# "status": "string"
|
692
|
+
# }
|
693
|
+
# }
|
694
|
+
#
|
672
695
|
data = self.safe_value(response, 'data')
|
673
|
-
return data
|
696
|
+
return self.parse_order(data)
|
674
697
|
|
675
698
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
676
699
|
"""
|
@@ -687,6 +710,28 @@ class bitbank(Exchange, ImplicitAPI):
|
|
687
710
|
'pair': market['id'],
|
688
711
|
}
|
689
712
|
response = self.privateGetUserSpotOrder(self.extend(request, params))
|
713
|
+
#
|
714
|
+
# {
|
715
|
+
# "success": 1,
|
716
|
+
# "data": {
|
717
|
+
# "order_id": 0,
|
718
|
+
# "pair": "string",
|
719
|
+
# "side": "string",
|
720
|
+
# "type": "string",
|
721
|
+
# "start_amount": "string",
|
722
|
+
# "remaining_amount": "string",
|
723
|
+
# "executed_amount": "string",
|
724
|
+
# "price": "string",
|
725
|
+
# "post_only": False,
|
726
|
+
# "average_price": "string",
|
727
|
+
# "ordered_at": 0,
|
728
|
+
# "expire_at": 0,
|
729
|
+
# "triggered_at": 0,
|
730
|
+
# "triger_price": "string",
|
731
|
+
# "status": "string"
|
732
|
+
# }
|
733
|
+
# }
|
734
|
+
#
|
690
735
|
data = self.safe_dict(response, 'data')
|
691
736
|
return self.parse_order(data, market)
|
692
737
|
|
ccxt/bitmart.py
CHANGED
@@ -1180,9 +1180,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1180
1180
|
market = self.safe_market(marketId, market)
|
1181
1181
|
symbol = market['symbol']
|
1182
1182
|
last = self.safe_string_2(ticker, 'close_24h', 'last_price')
|
1183
|
-
percentage =
|
1183
|
+
percentage = self.safe_string(ticker, 'price_change_percent_24h')
|
1184
1184
|
if percentage is None:
|
1185
|
-
percentage = Precise.
|
1185
|
+
percentage = Precise.string_mul(self.safe_string(ticker, 'fluctuation'), '100')
|
1186
1186
|
baseVolume = self.safe_string(ticker, 'base_volume_24h')
|
1187
1187
|
quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
|
1188
1188
|
if quoteVolume is None:
|
@@ -1412,13 +1412,13 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1412
1412
|
#
|
1413
1413
|
# public fetchTrades spot( amount = count * price )
|
1414
1414
|
#
|
1415
|
-
#
|
1416
|
-
#
|
1417
|
-
#
|
1418
|
-
#
|
1419
|
-
#
|
1420
|
-
#
|
1421
|
-
#
|
1415
|
+
# [
|
1416
|
+
# "BTC_USDT", # symbol
|
1417
|
+
# "1717212457302", # timestamp
|
1418
|
+
# "67643.11", # price
|
1419
|
+
# "0.00106", # size
|
1420
|
+
# "sell" # side
|
1421
|
+
# ]
|
1422
1422
|
#
|
1423
1423
|
# spot: fetchMyTrades
|
1424
1424
|
#
|
@@ -1465,22 +1465,23 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1465
1465
|
# 'lastTradeID': 6802340762
|
1466
1466
|
# }
|
1467
1467
|
#
|
1468
|
-
timestamp = self.safe_integer_n(trade, ['
|
1469
|
-
|
1468
|
+
timestamp = self.safe_integer_n(trade, ['createTime', 'create_time', 1])
|
1469
|
+
isPublic = self.safe_string(trade, 0)
|
1470
|
+
isPublicTrade = (isPublic is not None)
|
1470
1471
|
amount = None
|
1471
1472
|
cost = None
|
1472
1473
|
type = None
|
1473
1474
|
side = None
|
1474
1475
|
if isPublicTrade:
|
1475
|
-
amount = self.
|
1476
|
+
amount = self.safe_string_2(trade, 'count', 3)
|
1476
1477
|
cost = self.safe_string(trade, 'amount')
|
1477
|
-
side = self.
|
1478
|
+
side = self.safe_string_2(trade, 'type', 4)
|
1478
1479
|
else:
|
1479
1480
|
amount = self.safe_string_n(trade, ['size', 'vol', 'fillQty'])
|
1480
1481
|
cost = self.safe_string(trade, 'notional')
|
1481
1482
|
type = self.safe_string(trade, 'type')
|
1482
1483
|
side = self.parse_order_side(self.safe_string(trade, 'side'))
|
1483
|
-
marketId = self.
|
1484
|
+
marketId = self.safe_string_2(trade, 'symbol', 0)
|
1484
1485
|
market = self.safe_market(marketId, market)
|
1485
1486
|
feeCostString = self.safe_string_2(trade, 'fee', 'paid_fees')
|
1486
1487
|
fee = None
|
@@ -1502,7 +1503,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1502
1503
|
'symbol': market['symbol'],
|
1503
1504
|
'type': type,
|
1504
1505
|
'side': side,
|
1505
|
-
'price': self.
|
1506
|
+
'price': self.safe_string_n(trade, ['price', 'fillPrice', 2]),
|
1506
1507
|
'amount': amount,
|
1507
1508
|
'cost': cost,
|
1508
1509
|
'takerOrMaker': self.safe_string_lower_2(trade, 'tradeRole', 'exec_type'),
|
@@ -1511,10 +1512,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1511
1512
|
|
1512
1513
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1513
1514
|
"""
|
1514
|
-
get
|
1515
|
+
get a list of the most recent trades for a particular symbol
|
1516
|
+
:see: https://developer-pro.bitmart.com/en/spot/#get-recent-trades-v3
|
1515
1517
|
:param str symbol: unified symbol of the market to fetch trades for
|
1516
1518
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1517
|
-
:param int [limit]: the maximum
|
1519
|
+
:param int [limit]: the maximum number of trades to fetch
|
1518
1520
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1519
1521
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
1520
1522
|
"""
|
@@ -1525,30 +1527,27 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1525
1527
|
request: dict = {
|
1526
1528
|
'symbol': market['id'],
|
1527
1529
|
}
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1530
|
+
if limit is not None:
|
1531
|
+
request['limit'] = limit
|
1532
|
+
response = self.publicGetSpotQuotationV3Trades(self.extend(request, params))
|
1531
1533
|
#
|
1532
1534
|
# {
|
1533
|
-
# "
|
1534
|
-
# "
|
1535
|
-
# "
|
1536
|
-
# "data":
|
1537
|
-
#
|
1538
|
-
#
|
1539
|
-
#
|
1540
|
-
#
|
1541
|
-
#
|
1542
|
-
#
|
1543
|
-
#
|
1544
|
-
#
|
1545
|
-
# ]
|
1546
|
-
# }
|
1535
|
+
# "code": 1000,
|
1536
|
+
# "trace": "58031f9a5bd.111.17117",
|
1537
|
+
# "message": "success",
|
1538
|
+
# "data": [
|
1539
|
+
# [
|
1540
|
+
# "BTC_USDT",
|
1541
|
+
# "1717212457302",
|
1542
|
+
# "67643.11",
|
1543
|
+
# "0.00106",
|
1544
|
+
# "sell"
|
1545
|
+
# ],
|
1546
|
+
# ]
|
1547
1547
|
# }
|
1548
1548
|
#
|
1549
|
-
data = self.
|
1550
|
-
|
1551
|
-
return self.parse_trades(trades, market, since, limit)
|
1549
|
+
data = self.safe_list(response, 'data', [])
|
1550
|
+
return self.parse_trades(data, market, since, limit)
|
1552
1551
|
|
1553
1552
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
1554
1553
|
#
|
ccxt/bl3p.py
CHANGED
@@ -413,7 +413,13 @@ class bl3p(Exchange, ImplicitAPI):
|
|
413
413
|
request: dict = {
|
414
414
|
'order_id': id,
|
415
415
|
}
|
416
|
-
|
416
|
+
response = self.privatePostMarketMoneyOrderCancel(self.extend(request, params))
|
417
|
+
#
|
418
|
+
# "success"
|
419
|
+
#
|
420
|
+
return self.safe_order({
|
421
|
+
'info': response,
|
422
|
+
})
|
417
423
|
|
418
424
|
def create_deposit_address(self, code: str, params={}):
|
419
425
|
"""
|
ccxt/btcalpha.py
CHANGED
@@ -679,7 +679,7 @@ class btcalpha(Exchange, ImplicitAPI):
|
|
679
679
|
filled = self.safe_string(order, 'amount_filled')
|
680
680
|
amount = self.safe_string(order, 'amount_original')
|
681
681
|
status = self.parse_order_status(self.safe_string(order, 'status'))
|
682
|
-
id = self.
|
682
|
+
id = self.safe_string_n(order, ['oid', 'id', 'order'])
|
683
683
|
trades = self.safe_value(order, 'trades')
|
684
684
|
side = self.safe_string_2(order, 'my_side', 'type')
|
685
685
|
return self.safe_order({
|
@@ -751,7 +751,12 @@ class btcalpha(Exchange, ImplicitAPI):
|
|
751
751
|
'order': id,
|
752
752
|
}
|
753
753
|
response = self.privatePostOrderCancel(self.extend(request, params))
|
754
|
-
|
754
|
+
#
|
755
|
+
# {
|
756
|
+
# "order": 63568
|
757
|
+
# }
|
758
|
+
#
|
759
|
+
return self.parse_order(response)
|
755
760
|
|
756
761
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
757
762
|
"""
|
ccxt/btcturk.py
CHANGED
@@ -684,7 +684,17 @@ class btcturk(Exchange, ImplicitAPI):
|
|
684
684
|
request: dict = {
|
685
685
|
'id': id,
|
686
686
|
}
|
687
|
-
|
687
|
+
response = self.privateDeleteOrder(self.extend(request, params))
|
688
|
+
#
|
689
|
+
# {
|
690
|
+
# "success": True,
|
691
|
+
# "message": "SUCCESS",
|
692
|
+
# "code": 0
|
693
|
+
# }
|
694
|
+
#
|
695
|
+
return self.safe_order({
|
696
|
+
'info': response,
|
697
|
+
})
|
688
698
|
|
689
699
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
690
700
|
"""
|
ccxt/coinbase.py
CHANGED
@@ -502,9 +502,9 @@ class coinbase(Exchange, ImplicitAPI):
|
|
502
502
|
paginate = False
|
503
503
|
paginate, params = self.handle_option_and_params(params, 'fetchAccounts', 'paginate')
|
504
504
|
if paginate:
|
505
|
-
return self.fetch_paginated_call_cursor('fetchAccounts', None, None, None, params, 'cursor', 'cursor', None,
|
505
|
+
return self.fetch_paginated_call_cursor('fetchAccounts', None, None, None, params, 'cursor', 'cursor', None, 250)
|
506
506
|
request: dict = {
|
507
|
-
'limit':
|
507
|
+
'limit': 250,
|
508
508
|
}
|
509
509
|
response = self.v3PrivateGetBrokerageAccounts(self.extend(request, params))
|
510
510
|
#
|
ccxt/coincheck.py
CHANGED
@@ -595,7 +595,14 @@ class coincheck(Exchange, ImplicitAPI):
|
|
595
595
|
request: dict = {
|
596
596
|
'id': id,
|
597
597
|
}
|
598
|
-
|
598
|
+
response = self.privateDeleteExchangeOrdersId(self.extend(request, params))
|
599
|
+
#
|
600
|
+
# {
|
601
|
+
# "success": True,
|
602
|
+
# "id": 12345
|
603
|
+
# }
|
604
|
+
#
|
605
|
+
return self.parse_order(response)
|
599
606
|
|
600
607
|
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
601
608
|
"""
|
ccxt/coinex.py
CHANGED
@@ -1634,14 +1634,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
1634
1634
|
marketType, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
1635
1635
|
marginMode = None
|
1636
1636
|
marginMode, params = self.handle_margin_mode_and_params('fetchBalance', params)
|
1637
|
-
|
1638
|
-
|
1639
|
-
if marketType == 'margin':
|
1640
|
-
return self.fetch_margin_balance(params)
|
1641
|
-
elif marketType == 'swap':
|
1637
|
+
isMargin = (marginMode is not None) or (marketType == 'margin')
|
1638
|
+
if marketType == 'swap':
|
1642
1639
|
return self.fetch_swap_balance(params)
|
1643
1640
|
elif marketType == 'financial':
|
1644
1641
|
return self.fetch_financial_balance(params)
|
1642
|
+
elif isMargin:
|
1643
|
+
return self.fetch_margin_balance(params)
|
1645
1644
|
else:
|
1646
1645
|
return self.fetch_spot_balance(params)
|
1647
1646
|
|
@@ -3059,7 +3058,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
3059
3058
|
#
|
3060
3059
|
# {"code":0,"data":{},"message":"OK"}
|
3061
3060
|
#
|
3062
|
-
return
|
3061
|
+
return [
|
3062
|
+
self.safe_order({
|
3063
|
+
'info': response,
|
3064
|
+
}),
|
3065
|
+
]
|
3063
3066
|
|
3064
3067
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
3065
3068
|
"""
|
ccxt/htx.py
CHANGED
@@ -56,6 +56,8 @@ class htx(Exchange, ImplicitAPI):
|
|
56
56
|
'cancelAllOrdersAfter': True,
|
57
57
|
'cancelOrder': True,
|
58
58
|
'cancelOrders': True,
|
59
|
+
'closeAllPositions': False,
|
60
|
+
'closePosition': True,
|
59
61
|
'createDepositAddress': None,
|
60
62
|
'createMarketBuyOrderWithCost': True,
|
61
63
|
'createMarketOrderWithCost': False,
|
@@ -5003,7 +5005,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5003
5005
|
:param float [params.stopLossPrice]: *contract only* the price a stop-loss order is triggered at
|
5004
5006
|
:param float [params.takeProfitPrice]: *contract only* the price a take-profit order is triggered at
|
5005
5007
|
:param str [params.operator]: *spot and margin only* gte or lte, trigger price condition
|
5006
|
-
:param str [params.offset]: *contract only* '
|
5008
|
+
:param str [params.offset]: *contract only* 'both'(linear only), 'open', or 'close', required in hedge mode and for inverse markets
|
5007
5009
|
:param bool [params.postOnly]: *contract only* True or False
|
5008
5010
|
:param int [params.leverRate]: *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
5009
5011
|
:param str [params.timeInForce]: supports 'IOC' and 'FOK'
|
@@ -5053,6 +5055,9 @@ class htx(Exchange, ImplicitAPI):
|
|
5053
5055
|
else:
|
5054
5056
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossOrder(contractRequest)
|
5055
5057
|
elif market['inverse']:
|
5058
|
+
offset = self.safe_string(params, 'offset')
|
5059
|
+
if offset is None:
|
5060
|
+
raise ArgumentsRequired(self.id + ' createOrder() requires an extra parameter params["offset"] to be set to "open" or "close" when placing orders in inverse markets')
|
5056
5061
|
if market['swap']:
|
5057
5062
|
if isStop:
|
5058
5063
|
response = self.contractPrivatePostSwapApiV1SwapTriggerOrder(contractRequest)
|
@@ -6934,14 +6939,19 @@ class htx(Exchange, ImplicitAPI):
|
|
6934
6939
|
fetch all open positions
|
6935
6940
|
:param str[]|None symbols: list of unified market symbols
|
6936
6941
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
6942
|
+
:param str [params.subType]: 'linear' or 'inverse'
|
6943
|
+
:param str [params.type]: *inverse only* 'future', or 'swap'
|
6944
|
+
:param str [params.marginMode]: *linear only* 'cross' or 'isolated'
|
6937
6945
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
6938
6946
|
"""
|
6939
6947
|
self.load_markets()
|
6940
6948
|
symbols = self.market_symbols(symbols)
|
6941
6949
|
market = None
|
6942
6950
|
if symbols is not None:
|
6943
|
-
|
6944
|
-
|
6951
|
+
symbolsLength = len(symbols)
|
6952
|
+
if symbolsLength > 0:
|
6953
|
+
first = self.safe_string(symbols, 0)
|
6954
|
+
market = self.market(first)
|
6945
6955
|
marginMode = None
|
6946
6956
|
marginMode, params = self.handle_margin_mode_and_params('fetchPositions', params, 'cross')
|
6947
6957
|
subType = None
|
@@ -8385,6 +8395,57 @@ class htx(Exchange, ImplicitAPI):
|
|
8385
8395
|
'datetime': self.iso8601(timestamp),
|
8386
8396
|
})
|
8387
8397
|
|
8398
|
+
def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
|
8399
|
+
"""
|
8400
|
+
closes open positions for a contract market, requires 'amount' in params, unlike other exchanges
|
8401
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-lightning-close-order # USDT-M(isolated)
|
8402
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-lightning-close-position # USDT-M(cross)
|
8403
|
+
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-lightning-close-order # Coin-M swap
|
8404
|
+
:see: https://huobiapi.github.io/docs/dm/v1/en/#place-flash-close-order # Coin-M futures
|
8405
|
+
:param str symbol: unified CCXT market symbol
|
8406
|
+
:param str side: 'buy' or 'sell', the side of the closing order, opposite side side
|
8407
|
+
:param dict [params]: extra parameters specific to the okx api endpoint
|
8408
|
+
:param str [params.clientOrderId]: client needs to provide unique API and have to maintain the API themselves afterwards. [1, 9223372036854775807]
|
8409
|
+
:param dict [params.marginMode]: 'cross' or 'isolated', required for linear markets
|
8410
|
+
*
|
8411
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
8412
|
+
:param number [params.amount]: order quantity
|
8413
|
+
:param str [params.order_price_type]: 'lightning' by default, 'lightning_fok': lightning fok type, 'lightning_ioc': lightning ioc type 'market' by default, 'market': market order type, 'lightning_fok': lightning
|
8414
|
+
:returns dict: `an order structure <https://docs.ccxt.com/#/?id=position-structure>`
|
8415
|
+
"""
|
8416
|
+
self.load_markets()
|
8417
|
+
market = self.market(symbol)
|
8418
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
8419
|
+
if not market['contract']:
|
8420
|
+
raise BadRequest(self.id + ' closePosition() symbol supports contract markets only')
|
8421
|
+
self.check_required_argument('closePosition', side, 'side')
|
8422
|
+
request: dict = {
|
8423
|
+
'contract_code': market['id'],
|
8424
|
+
'direction': side,
|
8425
|
+
}
|
8426
|
+
if clientOrderId is not None:
|
8427
|
+
request['client_order_id'] = clientOrderId
|
8428
|
+
if market['inverse']:
|
8429
|
+
amount = self.safe_string_2(params, 'volume', 'amount')
|
8430
|
+
if amount is None:
|
8431
|
+
raise ArgumentsRequired(self.id + ' closePosition() requires an extra argument params["amount"] for inverse markets')
|
8432
|
+
request['volume'] = self.amount_to_precision(symbol, amount)
|
8433
|
+
params = self.omit(params, ['clientOrderId', 'volume', 'amount'])
|
8434
|
+
response = None
|
8435
|
+
if market['inverse']: # Coin-M
|
8436
|
+
if market['swap']:
|
8437
|
+
response = self.contractPrivatePostSwapApiV1SwapLightningClosePosition(self.extend(request, params))
|
8438
|
+
else: # future
|
8439
|
+
response = self.contractPrivatePostApiV1LightningClosePosition(self.extend(request, params))
|
8440
|
+
else: # USDT-M
|
8441
|
+
marginMode = None
|
8442
|
+
marginMode, params = self.handle_margin_mode_and_params('closePosition', params, 'cross')
|
8443
|
+
if marginMode == 'cross':
|
8444
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossLightningClosePosition(self.extend(request, params))
|
8445
|
+
else: # isolated
|
8446
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapLightningClosePosition(self.extend(request, params))
|
8447
|
+
return self.parse_order(response, market)
|
8448
|
+
|
8388
8449
|
def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
|
8389
8450
|
"""
|
8390
8451
|
set hedged to True or False
|
ccxt/kraken.py
CHANGED
@@ -179,13 +179,13 @@ class kraken(Exchange, ImplicitAPI):
|
|
179
179
|
# rate-limits explained in comment in the top of self file
|
180
180
|
'Assets': 1,
|
181
181
|
'AssetPairs': 1,
|
182
|
-
'Depth': 1,
|
183
|
-
'OHLC': 1,
|
182
|
+
'Depth': 1.2,
|
183
|
+
'OHLC': 1.2, # 1.2 because 1 triggers too many requests immediately
|
184
184
|
'Spread': 1,
|
185
185
|
'SystemStatus': 1,
|
186
186
|
'Ticker': 1,
|
187
187
|
'Time': 1,
|
188
|
-
'Trades': 1,
|
188
|
+
'Trades': 1.2,
|
189
189
|
},
|
190
190
|
},
|
191
191
|
'private': {
|
@@ -761,8 +761,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
761
761
|
return {
|
762
762
|
'info': response,
|
763
763
|
'symbol': market['symbol'],
|
764
|
-
'maker': self.
|
765
|
-
'taker': self.
|
764
|
+
'maker': self.parse_number(Precise.string_div(self.safe_string(symbolMakerFee, 'fee'), '100')),
|
765
|
+
'taker': self.parse_number(Precise.string_div(self.safe_string(symbolTakerFee, 'fee'), '100')),
|
766
766
|
'percentage': True,
|
767
767
|
'tierBased': True,
|
768
768
|
}
|
ccxt/okx.py
CHANGED
@@ -279,6 +279,9 @@ class okx(Exchange, ImplicitAPI):
|
|
279
279
|
'finance/staking-defi/eth/apy-history': 5 / 3,
|
280
280
|
'finance/savings/lending-rate-summary': 5 / 3,
|
281
281
|
'finance/savings/lending-rate-history': 5 / 3,
|
282
|
+
'finance/fixed-loan/lending-offers': 10 / 3,
|
283
|
+
'finance/fixed-loan/lending-apy-history': 10 / 3,
|
284
|
+
'finance/fixed-loan/pending-lending-volume': 10 / 3,
|
282
285
|
# public broker
|
283
286
|
'finance/sfp/dcd/products': 2 / 3,
|
284
287
|
# copytrading
|
ccxt/pro/__init__.py
CHANGED
ccxt/woofipro.py
CHANGED
@@ -2138,8 +2138,10 @@ class woofipro(Exchange, ImplicitAPI):
|
|
2138
2138
|
|
2139
2139
|
def sign_hash(self, hash, privateKey):
|
2140
2140
|
signature = self.ecdsa(hash[-64:], privateKey[-64:], 'secp256k1', None)
|
2141
|
+
r = signature['r']
|
2142
|
+
s = signature['s']
|
2141
2143
|
v = self.int_to_base16(self.sum(27, signature['v']))
|
2142
|
-
return '0x' +
|
2144
|
+
return '0x' + r.rjust(64, '0') + s.rjust(64, '0') + v
|
2143
2145
|
|
2144
2146
|
def sign_message(self, message, privateKey):
|
2145
2147
|
return self.sign_hash(self.hash_message(message), privateKey[-64:])
|