ccxt 4.1.29__py2.py3-none-any.whl → 4.1.30__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/__init__.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/functions.py +1 -1
- ccxt/async_support/bitget.py +132 -16
- ccxt/async_support/bitopro.py +4 -4
- ccxt/async_support/bitrue.py +33 -16
- ccxt/async_support/gate.py +58 -10
- ccxt/async_support/huobi.py +0 -1
- ccxt/async_support/huobijp.py +0 -1
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/phemex.py +2 -0
- ccxt/base/exchange.py +1 -1
- ccxt/bitget.py +132 -16
- ccxt/bitopro.py +4 -4
- ccxt/bitrue.py +33 -16
- ccxt/gate.py +58 -10
- ccxt/huobi.py +0 -1
- ccxt/huobijp.py +0 -1
- ccxt/krakenfutures.py +1 -1
- ccxt/phemex.py +2 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/huobi.py +4 -0
- {ccxt-4.1.29.dist-info → ccxt-4.1.30.dist-info}/METADATA +4 -4
- {ccxt-4.1.29.dist-info → ccxt-4.1.30.dist-info}/RECORD +27 -27
- {ccxt-4.1.29.dist-info → ccxt-4.1.30.dist-info}/WHEEL +0 -0
- {ccxt-4.1.29.dist-info → ccxt-4.1.30.dist-info}/top_level.txt +0 -0
ccxt/bitget.py
CHANGED
@@ -49,7 +49,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
49
49
|
'has': {
|
50
50
|
'CORS': None,
|
51
51
|
'spot': True,
|
52
|
-
'margin':
|
52
|
+
'margin': True,
|
53
53
|
'swap': True,
|
54
54
|
'future': True,
|
55
55
|
'option': False,
|
@@ -1488,19 +1488,43 @@ class bitget(Exchange, ImplicitAPI):
|
|
1488
1488
|
"""
|
1489
1489
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
1490
1490
|
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-position-tier
|
1491
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-tier-data
|
1492
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-tier-data
|
1491
1493
|
:param str symbol: unified market symbol
|
1492
1494
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
1495
|
+
:param str [params.marginMode]: for spot margin 'cross' or 'isolated', default is 'isolated'
|
1496
|
+
:param str [params.code]: required for cross spot margin
|
1493
1497
|
:returns dict: a `leverage tiers structure <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`
|
1494
1498
|
"""
|
1495
1499
|
self.load_markets()
|
1496
1500
|
request = {}
|
1497
|
-
market = None
|
1498
1501
|
market = self.market(symbol)
|
1499
|
-
|
1502
|
+
type = None
|
1503
|
+
type, params = self.handle_market_type_and_params('fetchMarketLeverageTiers', market, params)
|
1504
|
+
response = None
|
1505
|
+
marginMode = None
|
1506
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchMarketLeverageTiers', params, 'isolated')
|
1507
|
+
if (type == 'swap') or (type == 'future'):
|
1508
|
+
marketId = market['id']
|
1509
|
+
parts = marketId.split('_')
|
1510
|
+
productType = self.safe_string_upper(parts, 1)
|
1511
|
+
request['symbol'] = marketId
|
1512
|
+
request['productType'] = productType
|
1513
|
+
response = self.publicMixGetMarketQueryPositionLever(self.extend(request, params))
|
1514
|
+
elif marginMode == 'isolated':
|
1515
|
+
request['symbol'] = market['info']['symbolName']
|
1516
|
+
response = self.publicMarginGetIsolatedPublicTierData(self.extend(request, params))
|
1517
|
+
elif marginMode == 'cross':
|
1518
|
+
code = self.safe_string(params, 'code')
|
1519
|
+
self.check_required_argument('fetchMarketLeverageTiers', code, 'code')
|
1520
|
+
params = self.omit(params, 'code')
|
1521
|
+
currency = self.currency(code)
|
1522
|
+
request['coin'] = currency['code']
|
1523
|
+
response = self.publicMarginGetCrossPublicTierData(self.extend(request, params))
|
1524
|
+
else:
|
1500
1525
|
raise BadRequest(self.id + ' fetchMarketLeverageTiers() symbol does not support market ' + symbol)
|
1501
|
-
|
1502
|
-
|
1503
|
-
response = self.publicMixGetMarketQueryPositionLever(self.extend(request, params))
|
1526
|
+
#
|
1527
|
+
# swap and future
|
1504
1528
|
#
|
1505
1529
|
# {
|
1506
1530
|
# "code":"00000",
|
@@ -1517,10 +1541,50 @@ class bitget(Exchange, ImplicitAPI):
|
|
1517
1541
|
# "requestTime":1627292076687
|
1518
1542
|
# }
|
1519
1543
|
#
|
1520
|
-
|
1544
|
+
# isolated
|
1545
|
+
#
|
1546
|
+
# {
|
1547
|
+
# "code": "00000",
|
1548
|
+
# "msg": "success",
|
1549
|
+
# "requestTime": 1698352496622,
|
1550
|
+
# "data": [
|
1551
|
+
# {
|
1552
|
+
# "tier": "1",
|
1553
|
+
# "symbol": "BTCUSDT",
|
1554
|
+
# "leverage": "10",
|
1555
|
+
# "baseCoin": "BTC",
|
1556
|
+
# "quoteCoin": "USDT",
|
1557
|
+
# "baseMaxBorrowableAmount": "3",
|
1558
|
+
# "quoteMaxBorrowableAmount": "30000",
|
1559
|
+
# "maintainMarginRate": "0.05",
|
1560
|
+
# "initRate": "0.1111"
|
1561
|
+
# },
|
1562
|
+
# ]
|
1563
|
+
# }
|
1564
|
+
#
|
1565
|
+
# cross
|
1566
|
+
#
|
1567
|
+
# {
|
1568
|
+
# "code": "00000",
|
1569
|
+
# "msg": "success",
|
1570
|
+
# "requestTime": 1698352997077,
|
1571
|
+
# "data": [
|
1572
|
+
# {
|
1573
|
+
# "tier": "1",
|
1574
|
+
# "leverage": "3",
|
1575
|
+
# "coin": "BTC",
|
1576
|
+
# "maxBorrowableAmount": "26",
|
1577
|
+
# "maintainMarginRate": "0.1"
|
1578
|
+
# }
|
1579
|
+
# ]
|
1580
|
+
# }
|
1581
|
+
#
|
1582
|
+
result = self.safe_value(response, 'data', [])
|
1521
1583
|
return self.parse_market_leverage_tiers(result, market)
|
1522
1584
|
|
1523
1585
|
def parse_market_leverage_tiers(self, info, market=None):
|
1586
|
+
#
|
1587
|
+
# swap and future
|
1524
1588
|
#
|
1525
1589
|
# [
|
1526
1590
|
# {
|
@@ -1530,22 +1594,56 @@ class bitget(Exchange, ImplicitAPI):
|
|
1530
1594
|
# "leverage": 125,
|
1531
1595
|
# "keepMarginRate": "0.004"
|
1532
1596
|
# }
|
1533
|
-
# ]
|
1597
|
+
# ]
|
1598
|
+
#
|
1599
|
+
# isolated
|
1600
|
+
#
|
1601
|
+
# [
|
1602
|
+
# {
|
1603
|
+
# "tier": "1",
|
1604
|
+
# "symbol": "BTCUSDT",
|
1605
|
+
# "leverage": "10",
|
1606
|
+
# "baseCoin": "BTC",
|
1607
|
+
# "quoteCoin": "USDT",
|
1608
|
+
# "baseMaxBorrowableAmount": "3",
|
1609
|
+
# "quoteMaxBorrowableAmount": "30000",
|
1610
|
+
# "maintainMarginRate": "0.05",
|
1611
|
+
# "initRate": "0.1111"
|
1612
|
+
# }
|
1613
|
+
# ]
|
1614
|
+
#
|
1615
|
+
# cross
|
1616
|
+
#
|
1617
|
+
# [
|
1618
|
+
# {
|
1619
|
+
# "tier": "1",
|
1620
|
+
# "leverage": "3",
|
1621
|
+
# "coin": "BTC",
|
1622
|
+
# "maxBorrowableAmount": "26",
|
1623
|
+
# "maintainMarginRate": "0.1"
|
1624
|
+
# }
|
1625
|
+
# ]
|
1534
1626
|
#
|
1535
1627
|
tiers = []
|
1628
|
+
minNotional = 0
|
1536
1629
|
for i in range(0, len(info)):
|
1537
1630
|
item = info[i]
|
1538
|
-
|
1539
|
-
|
1631
|
+
minimumNotional = self.safe_number(item, 'startUnit')
|
1632
|
+
if minimumNotional is not None:
|
1633
|
+
minNotional = minimumNotional
|
1634
|
+
maxNotional = self.safe_number_n(item, ['endUnit', 'maxBorrowableAmount', 'baseMaxBorrowableAmount'])
|
1635
|
+
marginCurrency = self.safe_string_2(item, 'coin', 'baseCoin')
|
1636
|
+
currencyId = marginCurrency if (marginCurrency is not None) else market['base']
|
1540
1637
|
tiers.append({
|
1541
|
-
'tier': self.
|
1542
|
-
'currency':
|
1638
|
+
'tier': self.safe_integer_2(item, 'level', 'tier'),
|
1639
|
+
'currency': self.safe_currency_code(currencyId),
|
1543
1640
|
'minNotional': minNotional,
|
1544
1641
|
'maxNotional': maxNotional,
|
1545
|
-
'maintenanceMarginRate': self.
|
1642
|
+
'maintenanceMarginRate': self.safe_number_2(item, 'keepMarginRate', 'maintainMarginRate'),
|
1546
1643
|
'maxLeverage': self.safe_number(item, 'leverage'),
|
1547
1644
|
'info': item,
|
1548
1645
|
})
|
1646
|
+
minNotional = maxNotional
|
1549
1647
|
return tiers
|
1550
1648
|
|
1551
1649
|
def fetch_deposits(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
@@ -3168,12 +3266,16 @@ class bitget(Exchange, ImplicitAPI):
|
|
3168
3266
|
create a list of trade orders(all orders should be of the same symbol)
|
3169
3267
|
:see: https://bitgetlimited.github.io/apidoc/en/spot/#batch-order
|
3170
3268
|
:see: https://bitgetlimited.github.io/apidoc/en/mix/#batch-order
|
3269
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-order
|
3270
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-order
|
3171
3271
|
: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
|
3272
|
+
:param dict [params]: extra parameters specific to the api endpoint
|
3172
3273
|
:returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
3173
3274
|
"""
|
3174
3275
|
self.load_markets()
|
3175
3276
|
ordersRequests = []
|
3176
3277
|
symbol = None
|
3278
|
+
marginMode = None
|
3177
3279
|
for i in range(0, len(orders)):
|
3178
3280
|
rawOrder = orders[i]
|
3179
3281
|
marketId = self.safe_string(rawOrder, 'symbol')
|
@@ -3187,20 +3289,34 @@ class bitget(Exchange, ImplicitAPI):
|
|
3187
3289
|
amount = self.safe_value(rawOrder, 'amount')
|
3188
3290
|
price = self.safe_value(rawOrder, 'price')
|
3189
3291
|
orderParams = self.safe_value(rawOrder, 'params', {})
|
3292
|
+
marginResult = self.handle_margin_mode_and_params('createOrders', params)
|
3293
|
+
currentMarginMode = marginResult[0]
|
3294
|
+
if currentMarginMode is not None:
|
3295
|
+
if marginMode is None:
|
3296
|
+
marginMode = currentMarginMode
|
3297
|
+
else:
|
3298
|
+
if marginMode != currentMarginMode:
|
3299
|
+
raise BadRequest(self.id + ' createOrders() requires all orders to have the same margin mode(isolated or cross)')
|
3190
3300
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
3191
3301
|
ordersRequests.append(orderRequest)
|
3192
3302
|
market = self.market(symbol)
|
3303
|
+
symbolRequest = (market['info']['symbolName']) if (marginMode is not None) else (market['id'])
|
3193
3304
|
request = {
|
3194
|
-
'symbol':
|
3305
|
+
'symbol': symbolRequest,
|
3195
3306
|
}
|
3196
3307
|
response = None
|
3197
3308
|
if market['spot']:
|
3198
3309
|
request['orderList'] = ordersRequests
|
3199
|
-
|
3200
|
-
else:
|
3310
|
+
if (market['swap']) or (market['future']):
|
3201
3311
|
request['orderDataList'] = ordersRequests
|
3202
3312
|
request['marginCoin'] = market['settleId']
|
3203
3313
|
response = self.privateMixPostOrderBatchOrders(request)
|
3314
|
+
elif marginMode == 'isolated':
|
3315
|
+
response = self.privateMarginPostIsolatedOrderBatchPlaceOrder(request)
|
3316
|
+
elif marginMode == 'cross':
|
3317
|
+
response = self.privateMarginPostCrossOrderBatchPlaceOrder(request)
|
3318
|
+
else:
|
3319
|
+
response = self.privateSpotPostTradeBatchOrders(request)
|
3204
3320
|
#
|
3205
3321
|
# {
|
3206
3322
|
# "code": "00000",
|
ccxt/bitopro.py
CHANGED
@@ -1071,13 +1071,13 @@ class bitopro(Exchange, ImplicitAPI):
|
|
1071
1071
|
request = {
|
1072
1072
|
# 'pair': market['id'], # optional
|
1073
1073
|
}
|
1074
|
-
|
1075
|
-
method = self.safe_string(self.options, 'privateDeleteOrdersPair', 'privateDeleteOrdersAll')
|
1074
|
+
response = None
|
1076
1075
|
if symbol is not None:
|
1077
1076
|
market = self.market(symbol)
|
1078
1077
|
request['pair'] = market['id']
|
1079
|
-
|
1080
|
-
|
1078
|
+
response = self.privateDeleteOrdersPair(self.extend(request, params))
|
1079
|
+
else:
|
1080
|
+
response = self.privateDeleteOrdersAll(self.extend(request, params))
|
1081
1081
|
result = self.safe_value(response, 'data', {})
|
1082
1082
|
#
|
1083
1083
|
# {
|
ccxt/bitrue.py
CHANGED
@@ -794,6 +794,16 @@ class bitrue(Exchange, ImplicitAPI):
|
|
794
794
|
return orderbook
|
795
795
|
|
796
796
|
def parse_ticker(self, ticker, market=None):
|
797
|
+
#
|
798
|
+
# fetchBidsAsks
|
799
|
+
#
|
800
|
+
# {
|
801
|
+
# "symbol": "LTCBTC",
|
802
|
+
# "bidPrice": "4.00000000",
|
803
|
+
# "bidQty": "431.00000000",
|
804
|
+
# "askPrice": "4.00000200",
|
805
|
+
# "askQty": "9.00000000"
|
806
|
+
# }
|
797
807
|
#
|
798
808
|
# fetchTicker
|
799
809
|
#
|
@@ -818,10 +828,10 @@ class bitrue(Exchange, ImplicitAPI):
|
|
818
828
|
'datetime': None,
|
819
829
|
'high': self.safe_string(ticker, 'high24hr'),
|
820
830
|
'low': self.safe_string(ticker, 'low24hr'),
|
821
|
-
'bid': self.
|
822
|
-
'bidVolume':
|
823
|
-
'ask': self.
|
824
|
-
'askVolume':
|
831
|
+
'bid': self.safe_string_2(ticker, 'highestBid', 'bidPrice'),
|
832
|
+
'bidVolume': self.safe_string(ticker, 'bidQty'),
|
833
|
+
'ask': self.safe_string_2(ticker, 'lowestAsk', 'askPrice'),
|
834
|
+
'askVolume': self.safe_string(ticker, 'askQty'),
|
825
835
|
'vwap': None,
|
826
836
|
'open': None,
|
827
837
|
'close': last,
|
@@ -941,23 +951,30 @@ class bitrue(Exchange, ImplicitAPI):
|
|
941
951
|
def fetch_bids_asks(self, symbols: Optional[List[str]] = None, params={}):
|
942
952
|
"""
|
943
953
|
fetches the bid and ask price and volume for multiple markets
|
954
|
+
:see: https://github.com/Bitrue-exchange/Spot-official-api-docs#symbol-order-book-ticker
|
944
955
|
:param str[]|None symbols: unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
945
956
|
:param dict [params]: extra parameters specific to the bitrue api endpoint
|
946
957
|
:returns dict: a dictionary of `ticker structures <https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure>`
|
947
958
|
"""
|
948
959
|
self.load_markets()
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
960
|
+
symbols = self.market_symbols(symbols)
|
961
|
+
market = None
|
962
|
+
request = {}
|
963
|
+
if symbols is not None:
|
964
|
+
first = self.safe_string(symbols, 0)
|
965
|
+
market = self.market(first)
|
966
|
+
request['symbol'] = market['id']
|
967
|
+
response = self.v1PublicGetTickerBookTicker(self.extend(request, params))
|
968
|
+
# {
|
969
|
+
# "symbol": "LTCBTC",
|
970
|
+
# "bidPrice": "4.00000000",
|
971
|
+
# "bidQty": "431.00000000",
|
972
|
+
# "askPrice": "4.00000200",
|
973
|
+
# "askQty": "9.00000000"
|
974
|
+
# }
|
975
|
+
data = {}
|
976
|
+
data[market['id']] = response
|
977
|
+
return self.parse_tickers(data, symbols)
|
961
978
|
|
962
979
|
def fetch_tickers(self, symbols: Optional[List[str]] = None, params={}):
|
963
980
|
"""
|
ccxt/gate.py
CHANGED
@@ -1536,6 +1536,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1536
1536
|
def fetch_currencies(self, params={}):
|
1537
1537
|
"""
|
1538
1538
|
fetches all available currencies on an exchange
|
1539
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details
|
1539
1540
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1540
1541
|
:returns dict: an associative dictionary of currencies
|
1541
1542
|
"""
|
@@ -1641,6 +1642,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1641
1642
|
def fetch_funding_rate(self, symbol: str, params={}):
|
1642
1643
|
"""
|
1643
1644
|
fetch the current funding rate
|
1645
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
|
1644
1646
|
:param str symbol: unified market symbol
|
1645
1647
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1646
1648
|
:returns dict: a `funding rate structure <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure>`
|
@@ -1700,6 +1702,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1700
1702
|
def fetch_funding_rates(self, symbols: Optional[List[str]] = None, params={}):
|
1701
1703
|
"""
|
1702
1704
|
fetch the funding rate for multiple markets
|
1705
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
1703
1706
|
:param str[]|None symbols: list of unified market symbols
|
1704
1707
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
1705
1708
|
:returns dict: a dictionary of `funding rates structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure>`, indexe by market symbols
|
@@ -2140,6 +2143,8 @@ class gate(Exchange, ImplicitAPI):
|
|
2140
2143
|
def fetch_funding_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2141
2144
|
"""
|
2142
2145
|
fetch the history of funding payments paid and received on self account
|
2146
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
|
2147
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
|
2143
2148
|
:param str symbol: unified market symbol
|
2144
2149
|
:param int [since]: the earliest time in ms to fetch funding history for
|
2145
2150
|
:param int [limit]: the maximum number of funding history structures to retrieve
|
@@ -2795,6 +2800,7 @@ class gate(Exchange, ImplicitAPI):
|
|
2795
2800
|
def fetch_funding_rate_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2796
2801
|
"""
|
2797
2802
|
fetches historical funding rate prices
|
2803
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history
|
2798
2804
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
2799
2805
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
2800
2806
|
:param int [limit]: the maximum amount of `funding rate structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure>` to fetch
|
@@ -2880,6 +2886,10 @@ class gate(Exchange, ImplicitAPI):
|
|
2880
2886
|
def fetch_trades(self, symbol: str, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2881
2887
|
"""
|
2882
2888
|
get the list of most recent trades for a particular symbol
|
2889
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades
|
2890
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history
|
2891
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2
|
2892
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#options-trade-history
|
2883
2893
|
:param str symbol: unified symbol of the market to fetch trades for
|
2884
2894
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
2885
2895
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -2977,6 +2987,10 @@ class gate(Exchange, ImplicitAPI):
|
|
2977
2987
|
def fetch_order_trades(self, id: str, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2978
2988
|
"""
|
2979
2989
|
fetch all the trades made from a single order
|
2990
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
|
2991
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
|
2992
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
|
2993
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
|
2980
2994
|
:param str id: order id
|
2981
2995
|
:param str symbol: unified market symbol
|
2982
2996
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -3278,6 +3292,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3278
3292
|
def fetch_deposits(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3279
3293
|
"""
|
3280
3294
|
fetch all deposits made to an account
|
3295
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records
|
3281
3296
|
:param str code: unified currency code
|
3282
3297
|
:param int [since]: the earliest time in ms to fetch deposits for
|
3283
3298
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
@@ -3309,6 +3324,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3309
3324
|
def fetch_withdrawals(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3310
3325
|
"""
|
3311
3326
|
fetch all withdrawals made from an account
|
3327
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records
|
3312
3328
|
:param str code: unified currency code
|
3313
3329
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
3314
3330
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
@@ -3340,6 +3356,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3340
3356
|
def withdraw(self, code: str, amount, address, tag=None, params={}):
|
3341
3357
|
"""
|
3342
3358
|
make a withdrawal
|
3359
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#withdraw
|
3343
3360
|
:param str code: unified currency code
|
3344
3361
|
:param float amount: the amount to withdraw
|
3345
3362
|
:param str address: the address to withdraw to
|
@@ -3477,6 +3494,13 @@ class gate(Exchange, ImplicitAPI):
|
|
3477
3494
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
|
3478
3495
|
"""
|
3479
3496
|
Create an order on the exchange
|
3497
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-an-order
|
3498
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order
|
3499
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
|
3500
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2
|
3501
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
|
3502
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3
|
3503
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
|
3480
3504
|
:param str symbol: Unified CCXT market symbol
|
3481
3505
|
:param str type: 'limit' or 'market' *"market" is contract only*
|
3482
3506
|
:param str side: 'buy' or 'sell'
|
@@ -4204,6 +4228,7 @@ class gate(Exchange, ImplicitAPI):
|
|
4204
4228
|
def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4205
4229
|
"""
|
4206
4230
|
fetch all unfilled currently open orders
|
4231
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
|
4207
4232
|
:param str symbol: unified market symbol
|
4208
4233
|
:param int [since]: the earliest time in ms to fetch open orders for
|
4209
4234
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -4218,6 +4243,13 @@ class gate(Exchange, ImplicitAPI):
|
|
4218
4243
|
def fetch_closed_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4219
4244
|
"""
|
4220
4245
|
fetches information on multiple closed orders made by the user
|
4246
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-orders
|
4247
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
4248
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders
|
4249
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders
|
4250
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
|
4251
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
|
4252
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
|
4221
4253
|
:param str symbol: unified market symbol of the market orders were made in
|
4222
4254
|
:param int [since]: the earliest time in ms to fetch orders for
|
4223
4255
|
:param int [limit]: the maximum number of orde structures to retrieve
|
@@ -4417,6 +4449,10 @@ class gate(Exchange, ImplicitAPI):
|
|
4417
4449
|
def cancel_order(self, id: str, symbol: Optional[str] = None, params={}):
|
4418
4450
|
"""
|
4419
4451
|
Cancels an open order
|
4452
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order
|
4453
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2
|
4454
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3
|
4455
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4
|
4420
4456
|
:param str id: Order id
|
4421
4457
|
:param str symbol: Unified market symbol
|
4422
4458
|
:param dict [params]: Parameters specified by the exchange api
|
@@ -4525,6 +4561,10 @@ class gate(Exchange, ImplicitAPI):
|
|
4525
4561
|
def cancel_all_orders(self, symbol: Optional[str] = None, params={}):
|
4526
4562
|
"""
|
4527
4563
|
cancel all open orders
|
4564
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
|
4565
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched
|
4566
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
|
4567
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
|
4528
4568
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
4529
4569
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
4530
4570
|
:returns dict[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
@@ -4645,6 +4685,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4645
4685
|
def set_leverage(self, leverage, symbol: Optional[str] = None, params={}):
|
4646
4686
|
"""
|
4647
4687
|
set the level of leverage for a market
|
4688
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage
|
4689
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2
|
4648
4690
|
:param float leverage: the rate of leverage
|
4649
4691
|
:param str symbol: unified market symbol
|
4650
4692
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
@@ -4983,6 +5025,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4983
5025
|
def fetch_leverage_tiers(self, symbols: Optional[List[str]] = None, params={}):
|
4984
5026
|
"""
|
4985
5027
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
5028
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
5029
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
4986
5030
|
:param str[]|None symbols: list of unified market symbols
|
4987
5031
|
:param dict [params]: extra parameters specific to the gate api endpoint
|
4988
5032
|
:returns dict: a dictionary of `leverage tiers structures <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`, indexed by market symbols
|
@@ -5233,11 +5277,11 @@ class gate(Exchange, ImplicitAPI):
|
|
5233
5277
|
'currency': currency['id'],
|
5234
5278
|
'amount': self.currency_to_precision(code, amount),
|
5235
5279
|
}
|
5236
|
-
|
5280
|
+
response = None
|
5281
|
+
params = self.omit(params, ['marginMode'])
|
5237
5282
|
if symbol is None:
|
5238
|
-
|
5283
|
+
response = self.privateMarginPostCrossRepayments(self.extend(request, params))
|
5239
5284
|
else:
|
5240
|
-
method = 'privateMarginPostLoansLoanIdRepayment'
|
5241
5285
|
market = self.market(symbol)
|
5242
5286
|
request['currency_pair'] = market['id']
|
5243
5287
|
request['mode'] = 'partial'
|
@@ -5245,8 +5289,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5245
5289
|
if loanId is None:
|
5246
5290
|
raise ArgumentsRequired(self.id + ' repayMargin() requires loan_id param for isolated margin')
|
5247
5291
|
request['loan_id'] = loanId
|
5248
|
-
|
5249
|
-
|
5292
|
+
params = self.omit(params, ['loan_id', 'id'])
|
5293
|
+
response = self.privateMarginPostLoansLoanIdRepayment(self.extend(request, params))
|
5250
5294
|
#
|
5251
5295
|
# Cross
|
5252
5296
|
#
|
@@ -5310,9 +5354,9 @@ class gate(Exchange, ImplicitAPI):
|
|
5310
5354
|
'currency': currency['id'],
|
5311
5355
|
'amount': self.currency_to_precision(code, amount),
|
5312
5356
|
}
|
5313
|
-
|
5357
|
+
response = None
|
5314
5358
|
if symbol is None:
|
5315
|
-
|
5359
|
+
response = self.privateMarginPostCrossLoans(self.extend(request, params))
|
5316
5360
|
else:
|
5317
5361
|
market = self.market(symbol)
|
5318
5362
|
request['currency_pair'] = market['id']
|
@@ -5321,9 +5365,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5321
5365
|
# is the smallest tick size currently offered by gateio
|
5322
5366
|
request['rate'] = self.safe_string(params, 'rate', '0.0001')
|
5323
5367
|
request['auto_renew'] = True
|
5324
|
-
|
5325
|
-
|
5326
|
-
response = getattr(self, method)(self.extend(request, params))
|
5368
|
+
params = self.omit(params, ['rate'])
|
5369
|
+
response = self.privateMarginPostLoans(self.extend(request, params))
|
5327
5370
|
#
|
5328
5371
|
# Cross
|
5329
5372
|
#
|
@@ -5531,6 +5574,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5531
5574
|
def reduce_margin(self, symbol: str, amount, params={}):
|
5532
5575
|
"""
|
5533
5576
|
remove margin from a position
|
5577
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
5578
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
5534
5579
|
:param str symbol: unified market symbol
|
5535
5580
|
:param float amount: the amount of margin to remove
|
5536
5581
|
:param dict [params]: extra parameters specific to the exmo api endpoint
|
@@ -5541,6 +5586,8 @@ class gate(Exchange, ImplicitAPI):
|
|
5541
5586
|
def add_margin(self, symbol: str, amount, params={}):
|
5542
5587
|
"""
|
5543
5588
|
add margin
|
5589
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
5590
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
5544
5591
|
:param str symbol: unified market symbol
|
5545
5592
|
:param float amount: amount of margin to add
|
5546
5593
|
:param dict [params]: extra parameters specific to the exmo api endpoint
|
@@ -6040,6 +6087,7 @@ class gate(Exchange, ImplicitAPI):
|
|
6040
6087
|
def fetch_underlying_assets(self, params={}):
|
6041
6088
|
"""
|
6042
6089
|
fetches the market ids of underlying assets for a specific contract market type
|
6090
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings
|
6043
6091
|
:param dict [params]: exchange specific params
|
6044
6092
|
:param str [params.type]: the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
6045
6093
|
:returns dict[]: a list of `underlying assets <https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure>`
|
ccxt/huobi.py
CHANGED
@@ -1068,7 +1068,6 @@ class huobi(Exchange, ImplicitAPI):
|
|
1068
1068
|
'GET': 'Themis', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
|
1069
1069
|
'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
|
1070
1070
|
'HIT': 'HitChain',
|
1071
|
-
'HOT': 'Hydro Protocol', # conflict with HOT(Holo) https://github.com/ccxt/ccxt/issues/4929
|
1072
1071
|
# https://github.com/ccxt/ccxt/issues/7399
|
1073
1072
|
# https://coinmarketcap.com/currencies/pnetwork/
|
1074
1073
|
# https://coinmarketcap.com/currencies/penta/markets/
|
ccxt/huobijp.py
CHANGED
@@ -333,7 +333,6 @@ class huobijp(Exchange, ImplicitAPI):
|
|
333
333
|
'GET': 'Themis', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
|
334
334
|
'GTC': 'Game.com', # conflict with Gitcoin and Gastrocoin
|
335
335
|
'HIT': 'HitChain',
|
336
|
-
'HOT': 'Hydro Protocol', # conflict with HOT(Holo) https://github.com/ccxt/ccxt/issues/4929
|
337
336
|
# https://github.com/ccxt/ccxt/issues/7399
|
338
337
|
# https://coinmarketcap.com/currencies/pnetwork/
|
339
338
|
# https://coinmarketcap.com/currencies/penta/markets/
|
ccxt/krakenfutures.py
CHANGED
@@ -1811,7 +1811,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1811
1811
|
result.append({
|
1812
1812
|
'info': item,
|
1813
1813
|
'symbol': symbol,
|
1814
|
-
'fundingRate': self.safe_number(item, '
|
1814
|
+
'fundingRate': self.safe_number(item, 'relativeFundingRate'),
|
1815
1815
|
'timestamp': self.parse8601(datetime),
|
1816
1816
|
'datetime': datetime,
|
1817
1817
|
})
|
ccxt/phemex.py
CHANGED
@@ -1756,6 +1756,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
1756
1756
|
type, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
1757
1757
|
method = 'privateGetSpotWallets'
|
1758
1758
|
request = {}
|
1759
|
+
if (type != 'spot') and (type != 'swap'):
|
1760
|
+
raise BadRequest(self.id + ' does not support ' + type + ' markets, only spot and swap')
|
1759
1761
|
if type == 'swap':
|
1760
1762
|
code = self.safe_string(params, 'code')
|
1761
1763
|
settle = None
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/huobi.py
CHANGED
@@ -344,6 +344,7 @@ class huobi(ccxt.async_support.huobi):
|
|
344
344
|
# id: 1583473663565,
|
345
345
|
# rep: 'market.btcusdt.mbp.150',
|
346
346
|
# status: 'ok',
|
347
|
+
# ts: 1698359289261,
|
347
348
|
# data: {
|
348
349
|
# seqNum: 104999417756,
|
349
350
|
# bids: [
|
@@ -372,6 +373,9 @@ class huobi(ccxt.async_support.huobi):
|
|
372
373
|
sequence = self.safe_integer(tick, 'seqNum')
|
373
374
|
nonce = self.safe_integer(data, 'seqNum')
|
374
375
|
snapshot['nonce'] = nonce
|
376
|
+
timestamp = self.safe_integer(message, 'ts')
|
377
|
+
snapshot['timestamp'] = timestamp
|
378
|
+
snapshot['datetime'] = self.iso8601(timestamp)
|
375
379
|
snapshotLimit = self.safe_integer(subscription, 'limit')
|
376
380
|
snapshotOrderBook = self.order_book(snapshot, snapshotLimit)
|
377
381
|
client.resolve(snapshotOrderBook, id)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 4.1.
|
3
|
+
Version: 4.1.30
|
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
|
@@ -254,13 +254,13 @@ console.log(version, Object.keys(exchanges));
|
|
254
254
|
|
255
255
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
256
256
|
|
257
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
258
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
257
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.30/dist/ccxt.browser.js
|
258
|
+
* unpkg: https://unpkg.com/ccxt@4.1.30/dist/ccxt.browser.js
|
259
259
|
|
260
260
|
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.
|
261
261
|
|
262
262
|
```HTML
|
263
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
263
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.30/dist/ccxt.browser.js"></script>
|
264
264
|
```
|
265
265
|
|
266
266
|
Creates a global `ccxt` object:
|