ccxt 4.1.28__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/abstract/bybit.py +1 -0
- ccxt/abstract/okex.py +1 -0
- ccxt/abstract/okex5.py +1 -0
- ccxt/abstract/okx.py +1 -0
- 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 +265 -16
- ccxt/async_support/bitopro.py +4 -4
- ccxt/async_support/bitrue.py +33 -16
- ccxt/async_support/bybit.py +4 -0
- ccxt/async_support/cryptocom.py +29 -0
- 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 +48 -4
- ccxt/async_support/mexc.py +86 -4
- ccxt/async_support/okx.py +1 -0
- ccxt/async_support/phemex.py +2 -0
- ccxt/base/exchange.py +1 -1
- ccxt/bitget.py +265 -16
- ccxt/bitopro.py +4 -4
- ccxt/bitrue.py +33 -16
- ccxt/bybit.py +4 -0
- ccxt/cryptocom.py +29 -0
- ccxt/gate.py +58 -10
- ccxt/huobi.py +0 -1
- ccxt/huobijp.py +0 -1
- ccxt/krakenfutures.py +48 -4
- ccxt/mexc.py +86 -4
- ccxt/okx.py +1 -0
- ccxt/phemex.py +2 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/huobi.py +4 -0
- {ccxt-4.1.28.dist-info → ccxt-4.1.30.dist-info}/METADATA +4 -4
- {ccxt-4.1.28.dist-info → ccxt-4.1.30.dist-info}/RECORD +39 -39
- {ccxt-4.1.28.dist-info → ccxt-4.1.30.dist-info}/WHEEL +0 -0
- {ccxt-4.1.28.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,
|
@@ -64,6 +64,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
64
64
|
'editOrder': True,
|
65
65
|
'fetchAccounts': False,
|
66
66
|
'fetchBalance': True,
|
67
|
+
'fetchBorrowInterest': True,
|
67
68
|
'fetchBorrowRate': True,
|
68
69
|
'fetchBorrowRateHistories': False,
|
69
70
|
'fetchBorrowRateHistory': False,
|
@@ -1487,19 +1488,43 @@ class bitget(Exchange, ImplicitAPI):
|
|
1487
1488
|
"""
|
1488
1489
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
1489
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
|
1490
1493
|
:param str symbol: unified market symbol
|
1491
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
|
1492
1497
|
:returns dict: a `leverage tiers structure <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`
|
1493
1498
|
"""
|
1494
1499
|
self.load_markets()
|
1495
1500
|
request = {}
|
1496
|
-
market = None
|
1497
1501
|
market = self.market(symbol)
|
1498
|
-
|
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:
|
1499
1525
|
raise BadRequest(self.id + ' fetchMarketLeverageTiers() symbol does not support market ' + symbol)
|
1500
|
-
|
1501
|
-
|
1502
|
-
response = self.publicMixGetMarketQueryPositionLever(self.extend(request, params))
|
1526
|
+
#
|
1527
|
+
# swap and future
|
1503
1528
|
#
|
1504
1529
|
# {
|
1505
1530
|
# "code":"00000",
|
@@ -1516,10 +1541,50 @@ class bitget(Exchange, ImplicitAPI):
|
|
1516
1541
|
# "requestTime":1627292076687
|
1517
1542
|
# }
|
1518
1543
|
#
|
1519
|
-
|
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', [])
|
1520
1583
|
return self.parse_market_leverage_tiers(result, market)
|
1521
1584
|
|
1522
1585
|
def parse_market_leverage_tiers(self, info, market=None):
|
1586
|
+
#
|
1587
|
+
# swap and future
|
1523
1588
|
#
|
1524
1589
|
# [
|
1525
1590
|
# {
|
@@ -1529,22 +1594,56 @@ class bitget(Exchange, ImplicitAPI):
|
|
1529
1594
|
# "leverage": 125,
|
1530
1595
|
# "keepMarginRate": "0.004"
|
1531
1596
|
# }
|
1532
|
-
# ]
|
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
|
+
# ]
|
1533
1626
|
#
|
1534
1627
|
tiers = []
|
1628
|
+
minNotional = 0
|
1535
1629
|
for i in range(0, len(info)):
|
1536
1630
|
item = info[i]
|
1537
|
-
|
1538
|
-
|
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']
|
1539
1637
|
tiers.append({
|
1540
|
-
'tier': self.
|
1541
|
-
'currency':
|
1638
|
+
'tier': self.safe_integer_2(item, 'level', 'tier'),
|
1639
|
+
'currency': self.safe_currency_code(currencyId),
|
1542
1640
|
'minNotional': minNotional,
|
1543
1641
|
'maxNotional': maxNotional,
|
1544
|
-
'maintenanceMarginRate': self.
|
1642
|
+
'maintenanceMarginRate': self.safe_number_2(item, 'keepMarginRate', 'maintainMarginRate'),
|
1545
1643
|
'maxLeverage': self.safe_number(item, 'leverage'),
|
1546
1644
|
'info': item,
|
1547
1645
|
})
|
1646
|
+
minNotional = maxNotional
|
1548
1647
|
return tiers
|
1549
1648
|
|
1550
1649
|
def fetch_deposits(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
@@ -3167,12 +3266,16 @@ class bitget(Exchange, ImplicitAPI):
|
|
3167
3266
|
create a list of trade orders(all orders should be of the same symbol)
|
3168
3267
|
:see: https://bitgetlimited.github.io/apidoc/en/spot/#batch-order
|
3169
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
|
3170
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
|
3171
3273
|
:returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
3172
3274
|
"""
|
3173
3275
|
self.load_markets()
|
3174
3276
|
ordersRequests = []
|
3175
3277
|
symbol = None
|
3278
|
+
marginMode = None
|
3176
3279
|
for i in range(0, len(orders)):
|
3177
3280
|
rawOrder = orders[i]
|
3178
3281
|
marketId = self.safe_string(rawOrder, 'symbol')
|
@@ -3186,20 +3289,34 @@ class bitget(Exchange, ImplicitAPI):
|
|
3186
3289
|
amount = self.safe_value(rawOrder, 'amount')
|
3187
3290
|
price = self.safe_value(rawOrder, 'price')
|
3188
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)')
|
3189
3300
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
3190
3301
|
ordersRequests.append(orderRequest)
|
3191
3302
|
market = self.market(symbol)
|
3303
|
+
symbolRequest = (market['info']['symbolName']) if (marginMode is not None) else (market['id'])
|
3192
3304
|
request = {
|
3193
|
-
'symbol':
|
3305
|
+
'symbol': symbolRequest,
|
3194
3306
|
}
|
3195
3307
|
response = None
|
3196
3308
|
if market['spot']:
|
3197
3309
|
request['orderList'] = ordersRequests
|
3198
|
-
|
3199
|
-
else:
|
3310
|
+
if (market['swap']) or (market['future']):
|
3200
3311
|
request['orderDataList'] = ordersRequests
|
3201
3312
|
request['marginCoin'] = market['settleId']
|
3202
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)
|
3203
3320
|
#
|
3204
3321
|
# {
|
3205
3322
|
# "code": "00000",
|
@@ -5954,6 +6071,138 @@ class bitget(Exchange, ImplicitAPI):
|
|
5954
6071
|
'info': info,
|
5955
6072
|
}
|
5956
6073
|
|
6074
|
+
def fetch_borrow_interest(self, code: Optional[str] = None, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
6075
|
+
"""
|
6076
|
+
fetch the interest owed by the user for borrowing currency for margin trading
|
6077
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-interest-records
|
6078
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-interest-records
|
6079
|
+
:param str [code]: unified currency code
|
6080
|
+
:param str [symbol]: unified market symbol when fetching interest in isolated markets
|
6081
|
+
:param int [since]: the earliest time in ms to fetch borrow interest for
|
6082
|
+
:param int [limit]: the maximum number of structures to retrieve
|
6083
|
+
:param dict [params]: extra parameters specific to the bitget api endpoint
|
6084
|
+
:returns dict[]: a list of `borrow interest structures <https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure>`
|
6085
|
+
"""
|
6086
|
+
self.load_markets()
|
6087
|
+
market = None
|
6088
|
+
if symbol is not None:
|
6089
|
+
market = self.market(symbol)
|
6090
|
+
request = {}
|
6091
|
+
currency = None
|
6092
|
+
if code is not None:
|
6093
|
+
currency = self.currency(code)
|
6094
|
+
request['coin'] = currency['id']
|
6095
|
+
if since is not None:
|
6096
|
+
request['startTime'] = since
|
6097
|
+
else:
|
6098
|
+
request['startTime'] = self.milliseconds() - 7776000000
|
6099
|
+
if limit is not None:
|
6100
|
+
request['pageSize'] = limit
|
6101
|
+
response = None
|
6102
|
+
marginMode = None
|
6103
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchBorrowInterest', params, 'cross')
|
6104
|
+
if marginMode == 'isolated':
|
6105
|
+
self.check_required_symbol('fetchBorrowInterest', symbol)
|
6106
|
+
request['symbol'] = market['info']['symbolName']
|
6107
|
+
response = self.privateMarginGetIsolatedInterestList(self.extend(request, params))
|
6108
|
+
elif marginMode == 'cross':
|
6109
|
+
response = self.privateMarginGetCrossInterestList(self.extend(request, params))
|
6110
|
+
#
|
6111
|
+
# isolated
|
6112
|
+
#
|
6113
|
+
# {
|
6114
|
+
# "code": "00000",
|
6115
|
+
# "msg": "success",
|
6116
|
+
# "requestTime": 1698282523888,
|
6117
|
+
# "data": {
|
6118
|
+
# "resultList": [
|
6119
|
+
# {
|
6120
|
+
# "interestId": "1100560904468705284",
|
6121
|
+
# "interestCoin": "USDT",
|
6122
|
+
# "interestRate": "0.000126279",
|
6123
|
+
# "loanCoin": "USDT",
|
6124
|
+
# "amount": "0.00000298",
|
6125
|
+
# "type": "scheduled",
|
6126
|
+
# "symbol": "BTCUSDT",
|
6127
|
+
# "ctime": "1698120000000"
|
6128
|
+
# },
|
6129
|
+
# ],
|
6130
|
+
# "maxId": "1100560904468705284",
|
6131
|
+
# "minId": "1096915487398965249"
|
6132
|
+
# }
|
6133
|
+
# }
|
6134
|
+
#
|
6135
|
+
# cross
|
6136
|
+
#
|
6137
|
+
# {
|
6138
|
+
# "code": "00000",
|
6139
|
+
# "msg": "success",
|
6140
|
+
# "requestTime": 1698282552126,
|
6141
|
+
# "data": {
|
6142
|
+
# "resultList": [
|
6143
|
+
# {
|
6144
|
+
# "interestId": "1099126154352799744",
|
6145
|
+
# "interestCoin": "USDT",
|
6146
|
+
# "interestRate": "0.000126279",
|
6147
|
+
# "loanCoin": "USDT",
|
6148
|
+
# "amount": "0.00002631",
|
6149
|
+
# "type": "scheduled",
|
6150
|
+
# "ctime": "1697778000000"
|
6151
|
+
# },
|
6152
|
+
# ],
|
6153
|
+
# "maxId": "1099126154352799744",
|
6154
|
+
# "minId": "1096917004629716993"
|
6155
|
+
# }
|
6156
|
+
# }
|
6157
|
+
#
|
6158
|
+
data = self.safe_value(response, 'data', {})
|
6159
|
+
rows = self.safe_value(data, 'resultList', [])
|
6160
|
+
interest = self.parse_borrow_interests(rows, market)
|
6161
|
+
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
6162
|
+
|
6163
|
+
def parse_borrow_interest(self, info, market=None):
|
6164
|
+
#
|
6165
|
+
# isolated
|
6166
|
+
#
|
6167
|
+
# {
|
6168
|
+
# "interestId": "1100560904468705284",
|
6169
|
+
# "interestCoin": "USDT",
|
6170
|
+
# "interestRate": "0.000126279",
|
6171
|
+
# "loanCoin": "USDT",
|
6172
|
+
# "amount": "0.00000298",
|
6173
|
+
# "type": "scheduled",
|
6174
|
+
# "symbol": "BTCUSDT",
|
6175
|
+
# "ctime": "1698120000000"
|
6176
|
+
# }
|
6177
|
+
#
|
6178
|
+
# cross
|
6179
|
+
#
|
6180
|
+
# {
|
6181
|
+
# "interestId": "1099126154352799744",
|
6182
|
+
# "interestCoin": "USDT",
|
6183
|
+
# "interestRate": "0.000126279",
|
6184
|
+
# "loanCoin": "USDT",
|
6185
|
+
# "amount": "0.00002631",
|
6186
|
+
# "type": "scheduled",
|
6187
|
+
# "ctime": "1697778000000"
|
6188
|
+
# }
|
6189
|
+
#
|
6190
|
+
marketId = self.safe_string(info, 'symbol')
|
6191
|
+
market = self.safe_market(marketId, market)
|
6192
|
+
marginMode = 'isolated' if (marketId is not None) else 'cross'
|
6193
|
+
timestamp = self.safe_integer(info, 'ctime')
|
6194
|
+
return {
|
6195
|
+
'symbol': self.safe_string(market, 'symbol'),
|
6196
|
+
'marginMode': marginMode,
|
6197
|
+
'currency': self.safe_currency_code(self.safe_string(info, 'interestCoin')),
|
6198
|
+
'interest': self.safe_number(info, 'amount'),
|
6199
|
+
'interestRate': self.safe_number(info, 'interestRate'),
|
6200
|
+
'amountBorrowed': None,
|
6201
|
+
'timestamp': timestamp,
|
6202
|
+
'datetime': self.iso8601(timestamp),
|
6203
|
+
'info': info,
|
6204
|
+
}
|
6205
|
+
|
5957
6206
|
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
5958
6207
|
if not response:
|
5959
6208
|
return None # fallback to default error handler
|
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/bybit.py
CHANGED
@@ -634,6 +634,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
634
634
|
'v5/position/trading-stop': 5, # 10/s => cost = 50 / 10 = 5
|
635
635
|
'v5/position/set-auto-add-margin': 2.5,
|
636
636
|
'v5/position/add-margin': 2.5,
|
637
|
+
'v5/position/confirm-pending-mmr': 2.5,
|
637
638
|
# account
|
638
639
|
'v5/account/upgrade-to-uta': 2.5,
|
639
640
|
'v5/account/set-margin-mode': 2.5,
|
@@ -3071,8 +3072,11 @@ class bybit(Exchange, ImplicitAPI):
|
|
3071
3072
|
# "time": 1672125441042
|
3072
3073
|
# }
|
3073
3074
|
#
|
3075
|
+
timestamp = self.safe_integer(response, 'time')
|
3074
3076
|
result = {
|
3075
3077
|
'info': response,
|
3078
|
+
'timestamp': timestamp,
|
3079
|
+
'datetime': self.iso8601(timestamp),
|
3076
3080
|
}
|
3077
3081
|
responseResult = self.safe_value(response, 'result', {})
|
3078
3082
|
currencyList = self.safe_value_n(responseResult, ['loanAccountList', 'list', 'balance'])
|
ccxt/cryptocom.py
CHANGED
@@ -50,6 +50,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
50
50
|
'borrowMargin': True,
|
51
51
|
'cancelAllOrders': True,
|
52
52
|
'cancelOrder': True,
|
53
|
+
'cancelOrders': True,
|
53
54
|
'createOrder': True,
|
54
55
|
'createOrders': True,
|
55
56
|
'fetchAccounts': True,
|
@@ -1323,6 +1324,34 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
1323
1324
|
result = self.safe_value(response, 'result', {})
|
1324
1325
|
return self.parse_order(result, market)
|
1325
1326
|
|
1327
|
+
def cancel_orders(self, ids, symbol: Optional[str] = None, params={}):
|
1328
|
+
"""
|
1329
|
+
cancel multiple orders
|
1330
|
+
:see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
|
1331
|
+
:param str[] ids: order ids
|
1332
|
+
:param str symbol: unified market symbol
|
1333
|
+
:param dict [params]: extra parameters specific to the okx api endpoint
|
1334
|
+
:returns dict: an list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
1335
|
+
"""
|
1336
|
+
self.check_required_symbol('cancelOrders', symbol)
|
1337
|
+
self.load_markets()
|
1338
|
+
market = self.market(symbol)
|
1339
|
+
orderRequests = []
|
1340
|
+
for i in range(0, len(ids)):
|
1341
|
+
id = ids[i]
|
1342
|
+
order = {
|
1343
|
+
'instrument_name': market['id'],
|
1344
|
+
'order_id': str(id),
|
1345
|
+
}
|
1346
|
+
orderRequests.append(order)
|
1347
|
+
request = {
|
1348
|
+
'contingency_type': 'LIST',
|
1349
|
+
'order_list': orderRequests,
|
1350
|
+
}
|
1351
|
+
response = self.v1PrivatePostPrivateCancelOrderList(self.extend(request, params))
|
1352
|
+
result = self.safe_value(response, 'result', [])
|
1353
|
+
return self.parse_orders(result, market, None, None, params)
|
1354
|
+
|
1326
1355
|
def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
1327
1356
|
"""
|
1328
1357
|
fetch all unfilled currently open orders
|