ccxt 4.3.11__py2.py3-none-any.whl → 4.3.13__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/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bigone.py +22 -22
- ccxt/async_support/binance.py +7 -7
- ccxt/async_support/bingx.py +2 -2
- ccxt/async_support/bitget.py +10 -8
- ccxt/async_support/bitmart.py +7 -11
- ccxt/async_support/bitmex.py +2 -2
- ccxt/async_support/bybit.py +76 -65
- ccxt/async_support/coinbase.py +8 -8
- ccxt/async_support/coinbaseinternational.py +2 -2
- ccxt/async_support/coinex.py +501 -445
- ccxt/async_support/coinlist.py +12 -12
- ccxt/async_support/coinmetro.py +2 -2
- ccxt/async_support/cryptocom.py +16 -16
- ccxt/async_support/digifinex.py +3 -3
- ccxt/async_support/gate.py +2 -2
- ccxt/async_support/hitbtc.py +3 -3
- ccxt/async_support/htx.py +6 -9
- ccxt/async_support/indodax.py +2 -2
- ccxt/async_support/kraken.py +3 -1
- ccxt/async_support/kucoin.py +4 -4
- ccxt/async_support/kucoinfutures.py +6 -6
- ccxt/async_support/mexc.py +5 -5
- ccxt/async_support/okx.py +9 -9
- ccxt/async_support/poloniexfutures.py +4 -4
- ccxt/async_support/probit.py +2 -2
- ccxt/async_support/whitebit.py +72 -1
- ccxt/async_support/woo.py +2 -2
- ccxt/base/exchange.py +14 -2
- ccxt/base/types.py +25 -0
- ccxt/bigone.py +22 -22
- ccxt/binance.py +7 -7
- ccxt/bingx.py +2 -2
- ccxt/bitget.py +10 -8
- ccxt/bitmart.py +7 -11
- ccxt/bitmex.py +2 -2
- ccxt/bybit.py +76 -65
- ccxt/coinbase.py +8 -8
- ccxt/coinbaseinternational.py +2 -2
- ccxt/coinex.py +501 -445
- ccxt/coinlist.py +12 -12
- ccxt/coinmetro.py +2 -2
- ccxt/cryptocom.py +16 -16
- ccxt/digifinex.py +3 -3
- ccxt/gate.py +2 -2
- ccxt/hitbtc.py +3 -3
- ccxt/htx.py +6 -9
- ccxt/indodax.py +2 -2
- ccxt/kraken.py +3 -1
- ccxt/kucoin.py +4 -4
- ccxt/kucoinfutures.py +6 -6
- ccxt/mexc.py +5 -5
- ccxt/okx.py +9 -9
- ccxt/poloniexfutures.py +4 -4
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +139 -87
- ccxt/pro/bybit.py +192 -12
- ccxt/pro/coinbase.py +90 -20
- ccxt/pro/mexc.py +21 -1
- ccxt/probit.py +2 -2
- ccxt/test/base/test_datetime.py +6 -0
- ccxt/test/base/test_ledger_entry.py +2 -2
- ccxt/whitebit.py +72 -1
- ccxt/woo.py +2 -2
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/METADATA +4 -4
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/RECORD +71 -73
- ccxt/async_support/flowbtc.py +0 -34
- ccxt/flowbtc.py +0 -34
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/WHEEL +0 -0
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/bybit.py
CHANGED
@@ -128,6 +128,7 @@ class ImplicitAPI:
|
|
128
128
|
private_get_v5_account_fee_rate = privateGetV5AccountFeeRate = Entry('v5/account/fee-rate', 'private', 'GET', {'cost': 10})
|
129
129
|
private_get_v5_account_info = privateGetV5AccountInfo = Entry('v5/account/info', 'private', 'GET', {'cost': 5})
|
130
130
|
private_get_v5_account_transaction_log = privateGetV5AccountTransactionLog = Entry('v5/account/transaction-log', 'private', 'GET', {'cost': 1})
|
131
|
+
private_get_v5_account_contract_transaction_log = privateGetV5AccountContractTransactionLog = Entry('v5/account/contract-transaction-log', 'private', 'GET', {'cost': 1})
|
131
132
|
private_get_v5_account_smp_group = privateGetV5AccountSmpGroup = Entry('v5/account/smp-group', 'private', 'GET', {'cost': 1})
|
132
133
|
private_get_v5_account_mmp_state = privateGetV5AccountMmpState = Entry('v5/account/mmp-state', 'private', 'GET', {'cost': 5})
|
133
134
|
private_get_v5_asset_exchange_order_record = privateGetV5AssetExchangeOrderRecord = Entry('v5/asset/exchange/order-record', 'private', 'GET', {'cost': 5})
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/bigone.py
CHANGED
@@ -445,16 +445,16 @@ class bigone(Exchange, ImplicitAPI):
|
|
445
445
|
# ],
|
446
446
|
# }
|
447
447
|
#
|
448
|
-
currenciesData = self.
|
448
|
+
currenciesData = self.safe_list(data, 'data', [])
|
449
449
|
result = {}
|
450
450
|
for i in range(0, len(currenciesData)):
|
451
451
|
currency = currenciesData[i]
|
452
452
|
id = self.safe_string(currency, 'symbol')
|
453
453
|
code = self.safe_currency_code(id)
|
454
454
|
name = self.safe_string(currency, 'name')
|
455
|
-
type = 'fiat' if self.
|
455
|
+
type = 'fiat' if self.safe_bool(currency, 'is_fiat') else 'crypto'
|
456
456
|
networks = {}
|
457
|
-
chains = self.
|
457
|
+
chains = self.safe_list(currency, 'binding_gateways', [])
|
458
458
|
currencyMaxPrecision = self.parse_precision(self.safe_string_2(currency, 'withdrawal_scale', 'scale'))
|
459
459
|
currencyDepositEnabled: Bool = None
|
460
460
|
currencyWithdrawEnabled: Bool = None
|
@@ -462,8 +462,8 @@ class bigone(Exchange, ImplicitAPI):
|
|
462
462
|
chain = chains[j]
|
463
463
|
networkId = self.safe_string(chain, 'gateway_name')
|
464
464
|
networkCode = self.network_id_to_code(networkId)
|
465
|
-
deposit = self.
|
466
|
-
withdraw = self.
|
465
|
+
deposit = self.safe_bool(chain, 'is_deposit_enabled')
|
466
|
+
withdraw = self.safe_bool(chain, 'is_withdrawal_enabled')
|
467
467
|
isActive = (deposit and withdraw)
|
468
468
|
minDepositAmount = self.safe_string(chain, 'min_deposit_amount')
|
469
469
|
minWithdrawalAmount = self.safe_string(chain, 'min_withdrawal_amount')
|
@@ -582,12 +582,12 @@ class bigone(Exchange, ImplicitAPI):
|
|
582
582
|
# ...
|
583
583
|
# ]
|
584
584
|
#
|
585
|
-
markets = self.
|
585
|
+
markets = self.safe_list(response, 'data', [])
|
586
586
|
result = []
|
587
587
|
for i in range(0, len(markets)):
|
588
588
|
market = markets[i]
|
589
|
-
baseAsset = self.
|
590
|
-
quoteAsset = self.
|
589
|
+
baseAsset = self.safe_dict(market, 'base_asset', {})
|
590
|
+
quoteAsset = self.safe_dict(market, 'quote_asset', {})
|
591
591
|
baseId = self.safe_string(baseAsset, 'symbol')
|
592
592
|
quoteId = self.safe_string(quoteAsset, 'symbol')
|
593
593
|
base = self.safe_currency_code(baseId)
|
@@ -651,7 +651,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
651
651
|
base = self.safe_currency_code(baseId)
|
652
652
|
quote = self.safe_currency_code(quoteId)
|
653
653
|
settle = self.safe_currency_code(settleId)
|
654
|
-
inverse = self.
|
654
|
+
inverse = self.safe_bool(market, 'isInverse')
|
655
655
|
result.append(self.safe_market_structure({
|
656
656
|
'id': marketId,
|
657
657
|
'symbol': base + '/' + quote + ':' + settle,
|
@@ -667,7 +667,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
667
667
|
'swap': True,
|
668
668
|
'future': False,
|
669
669
|
'option': False,
|
670
|
-
'active': self.
|
670
|
+
'active': self.safe_bool(market, 'enable'),
|
671
671
|
'contract': True,
|
672
672
|
'linear': not inverse,
|
673
673
|
'inverse': inverse,
|
@@ -753,8 +753,8 @@ class bigone(Exchange, ImplicitAPI):
|
|
753
753
|
marketId = self.safe_string_2(ticker, 'asset_pair_name', 'symbol')
|
754
754
|
symbol = self.safe_symbol(marketId, market, '-', marketType)
|
755
755
|
close = self.safe_string_2(ticker, 'close', 'latestPrice')
|
756
|
-
bid = self.
|
757
|
-
ask = self.
|
756
|
+
bid = self.safe_dict(ticker, 'bid', {})
|
757
|
+
ask = self.safe_dict(ticker, 'ask', {})
|
758
758
|
return self.safe_ticker({
|
759
759
|
'symbol': symbol,
|
760
760
|
'timestamp': None,
|
@@ -868,7 +868,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
868
868
|
# ]
|
869
869
|
# }
|
870
870
|
#
|
871
|
-
data = self.
|
871
|
+
data = self.safe_list(response, 'data', [])
|
872
872
|
else:
|
873
873
|
data = await self.contractPublicGetInstruments(params)
|
874
874
|
#
|
@@ -914,7 +914,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
914
914
|
# }
|
915
915
|
# }
|
916
916
|
#
|
917
|
-
data = self.
|
917
|
+
data = self.safe_dict(response, 'data', {})
|
918
918
|
timestamp = self.safe_integer(data, 'Timestamp')
|
919
919
|
return self.parse_to_int(timestamp / 1000000)
|
920
920
|
|
@@ -1255,7 +1255,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
1255
1255
|
'timestamp': None,
|
1256
1256
|
'datetime': None,
|
1257
1257
|
}
|
1258
|
-
balances = self.
|
1258
|
+
balances = self.safe_list(response, 'data', [])
|
1259
1259
|
for i in range(0, len(balances)):
|
1260
1260
|
balance = balances[i]
|
1261
1261
|
symbol = self.safe_string(balance, 'asset_symbol')
|
@@ -1335,7 +1335,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
1335
1335
|
triggerPrice = self.safe_string(order, 'stop_price')
|
1336
1336
|
if Precise.string_eq(triggerPrice, '0'):
|
1337
1337
|
triggerPrice = None
|
1338
|
-
immediateOrCancel = self.
|
1338
|
+
immediateOrCancel = self.safe_bool(order, 'immediate_or_cancel')
|
1339
1339
|
timeInForce = None
|
1340
1340
|
if immediateOrCancel:
|
1341
1341
|
timeInForce = 'IOC'
|
@@ -1359,7 +1359,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
1359
1359
|
'symbol': symbol,
|
1360
1360
|
'type': type,
|
1361
1361
|
'timeInForce': timeInForce,
|
1362
|
-
'postOnly': self.
|
1362
|
+
'postOnly': self.safe_bool(order, 'post_only'),
|
1363
1363
|
'side': side,
|
1364
1364
|
'price': price,
|
1365
1365
|
'stopPrice': triggerPrice,
|
@@ -1763,13 +1763,13 @@ class bigone(Exchange, ImplicitAPI):
|
|
1763
1763
|
# ]
|
1764
1764
|
# }
|
1765
1765
|
#
|
1766
|
-
data = self.
|
1766
|
+
data = self.safe_list(response, 'data', [])
|
1767
1767
|
dataLength = len(data)
|
1768
1768
|
if dataLength < 1:
|
1769
1769
|
raise ExchangeError(self.id + ' fetchDepositAddress() returned empty address response')
|
1770
1770
|
chainsIndexedById = self.index_by(data, 'chain')
|
1771
1771
|
selectedNetworkId = self.select_network_id_from_raw_networks(code, networkCode, chainsIndexedById)
|
1772
|
-
addressObject = self.
|
1772
|
+
addressObject = self.safe_dict(chainsIndexedById, selectedNetworkId, {})
|
1773
1773
|
address = self.safe_string(addressObject, 'value')
|
1774
1774
|
tag = self.safe_string(addressObject, 'memo')
|
1775
1775
|
self.check_address(address)
|
@@ -1855,7 +1855,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
1855
1855
|
address = self.safe_string(transaction, 'target_address')
|
1856
1856
|
tag = self.safe_string(transaction, 'memo')
|
1857
1857
|
type = 'withdrawal' if ('customer_id' in transaction) else 'deposit'
|
1858
|
-
internal = self.
|
1858
|
+
internal = self.safe_bool(transaction, 'is_internal')
|
1859
1859
|
return {
|
1860
1860
|
'info': transaction,
|
1861
1861
|
'id': id,
|
@@ -1988,7 +1988,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
1988
1988
|
"""
|
1989
1989
|
await self.load_markets()
|
1990
1990
|
currency = self.currency(code)
|
1991
|
-
accountsByType = self.
|
1991
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1992
1992
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
1993
1993
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
1994
1994
|
guid = self.safe_string(params, 'guid', self.uuid())
|
@@ -2009,7 +2009,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
2009
2009
|
# }
|
2010
2010
|
#
|
2011
2011
|
transfer = self.parse_transfer(response, currency)
|
2012
|
-
transferOptions = self.
|
2012
|
+
transferOptions = self.safe_dict(self.options, 'transfer', {})
|
2013
2013
|
fillResponseFromRequest = self.safe_bool(transferOptions, 'fillResponseFromRequest', True)
|
2014
2014
|
if fillResponseFromRequest:
|
2015
2015
|
transfer['fromAccount'] = fromAccount
|
ccxt/async_support/binance.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import json
|
11
|
-
from ccxt.base.types import Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
11
|
+
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -1122,7 +1122,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1122
1122
|
'feeSide': 'quote',
|
1123
1123
|
'tierBased': True,
|
1124
1124
|
'percentage': True,
|
1125
|
-
'taker': self.parse_number('0.
|
1125
|
+
'taker': self.parse_number('0.000500'),
|
1126
1126
|
'maker': self.parse_number('0.000200'),
|
1127
1127
|
'tiers': {
|
1128
1128
|
'taker': [
|
@@ -8412,9 +8412,9 @@ class binance(Exchange, ImplicitAPI):
|
|
8412
8412
|
params = self.omit(params, 'type')
|
8413
8413
|
if since is not None:
|
8414
8414
|
request['startTime'] = since
|
8415
|
-
until = self.
|
8415
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
8416
8416
|
endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
|
8417
|
-
params = self.omit(params, ['endTime', '
|
8417
|
+
params = self.omit(params, ['endTime', 'until'])
|
8418
8418
|
if endTime is not None:
|
8419
8419
|
request['endTime'] = endTime
|
8420
8420
|
if limit is not None:
|
@@ -10406,7 +10406,7 @@ class binance(Exchange, ImplicitAPI):
|
|
10406
10406
|
"""
|
10407
10407
|
return await self.modify_margin_helper(symbol, amount, 1, params)
|
10408
10408
|
|
10409
|
-
async def fetch_cross_borrow_rate(self, code: str, params={}):
|
10409
|
+
async def fetch_cross_borrow_rate(self, code: str, params={}) -> CrossBorrowRate:
|
10410
10410
|
"""
|
10411
10411
|
fetch the rate of interest to borrow a currency for margin trading
|
10412
10412
|
:see: https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
|
@@ -10852,9 +10852,9 @@ class binance(Exchange, ImplicitAPI):
|
|
10852
10852
|
request['contractType'] = self.safe_string(params, 'contractType', 'CURRENT_QUARTER')
|
10853
10853
|
if since is not None:
|
10854
10854
|
request['startTime'] = since
|
10855
|
-
until = self.
|
10855
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
10856
10856
|
endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
|
10857
|
-
params = self.omit(params, ['endTime', 'until'
|
10857
|
+
params = self.omit(params, ['endTime', 'until'])
|
10858
10858
|
if endTime:
|
10859
10859
|
request['endTime'] = endTime
|
10860
10860
|
elif since:
|
ccxt/async_support/bingx.py
CHANGED
@@ -2735,9 +2735,9 @@ class bingx(Exchange, ImplicitAPI):
|
|
2735
2735
|
request['limit'] = limit
|
2736
2736
|
if since is not None:
|
2737
2737
|
request['startTime'] = since
|
2738
|
-
until = self.
|
2738
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
2739
2739
|
endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
|
2740
|
-
params = self.omit(params, ['endTime', '
|
2740
|
+
params = self.omit(params, ['endTime', 'until'])
|
2741
2741
|
if endTime is not None:
|
2742
2742
|
request['endTime'] = endTime
|
2743
2743
|
response = await self.swapV1PrivateGetTradeFullOrder(self.extend(request, params))
|
ccxt/async_support/bitget.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.bitget import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import json
|
11
|
-
from ccxt.base.types import Balances, Conversion, Currencies, Currency, FundingHistory, Int,
|
11
|
+
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, FundingHistory, Int, IsolatedBorrowRate, Leverage, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -3241,11 +3241,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
3241
3241
|
'symbol': market['id'],
|
3242
3242
|
'granularity': self.safe_string(timeframes, timeframe, timeframe),
|
3243
3243
|
}
|
3244
|
-
until = self.
|
3244
|
+
until = self.safe_integer(params, 'until')
|
3245
3245
|
limitDefined = limit is not None
|
3246
3246
|
sinceDefined = since is not None
|
3247
3247
|
untilDefined = until is not None
|
3248
|
-
params = self.omit(params, ['until'
|
3248
|
+
params = self.omit(params, ['until'])
|
3249
3249
|
response = None
|
3250
3250
|
now = self.milliseconds()
|
3251
3251
|
# retrievable periods listed here:
|
@@ -4358,6 +4358,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
4358
4358
|
params = self.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId', 'trailingTriggerPrice', 'trailingPercent'])
|
4359
4359
|
response = None
|
4360
4360
|
if market['spot']:
|
4361
|
+
if triggerPrice is None:
|
4362
|
+
raise NotSupported(self.id + 'editOrder() only supports plan/trigger spot orders')
|
4361
4363
|
editMarketBuyOrderRequiresPrice = self.safe_bool(self.options, 'editMarketBuyOrderRequiresPrice', True)
|
4362
4364
|
if editMarketBuyOrderRequiresPrice and isMarketOrder and (side == 'buy'):
|
4363
4365
|
if price is None:
|
@@ -5255,8 +5257,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
5255
5257
|
if stop:
|
5256
5258
|
if symbol is None:
|
5257
5259
|
raise ArgumentsRequired(self.id + ' fetchCanceledAndClosedOrders() requires a symbol argument')
|
5258
|
-
endTime = self.safe_integer_n(params, ['endTime', 'until'
|
5259
|
-
params = self.omit(params, ['until'
|
5260
|
+
endTime = self.safe_integer_n(params, ['endTime', 'until'])
|
5261
|
+
params = self.omit(params, ['until'])
|
5260
5262
|
if since is None:
|
5261
5263
|
since = now - 7776000000
|
5262
5264
|
request['startTime'] = since
|
@@ -7380,7 +7382,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7380
7382
|
'datetime': self.iso8601(timestamp),
|
7381
7383
|
})
|
7382
7384
|
|
7383
|
-
async def fetch_isolated_borrow_rate(self, symbol: str, params={}):
|
7385
|
+
async def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
|
7384
7386
|
"""
|
7385
7387
|
fetch the rate of interest to borrow a currency for margin trading
|
7386
7388
|
:see: https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Margin-Interest-Rate-And-Max-Borrowable-Amount
|
@@ -7441,7 +7443,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7441
7443
|
first['timestamp'] = timestamp
|
7442
7444
|
return self.parse_isolated_borrow_rate(first, market)
|
7443
7445
|
|
7444
|
-
def parse_isolated_borrow_rate(self, info, market: Market = None):
|
7446
|
+
def parse_isolated_borrow_rate(self, info, market: Market = None) -> IsolatedBorrowRate:
|
7445
7447
|
#
|
7446
7448
|
# {
|
7447
7449
|
# "symbol": "BTCUSDT",
|
@@ -7493,7 +7495,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7493
7495
|
'info': info,
|
7494
7496
|
}
|
7495
7497
|
|
7496
|
-
async def fetch_cross_borrow_rate(self, code: str, params={}):
|
7498
|
+
async def fetch_cross_borrow_rate(self, code: str, params={}) -> CrossBorrowRate:
|
7497
7499
|
"""
|
7498
7500
|
fetch the rate of interest to borrow a currency for margin trading
|
7499
7501
|
:see: https://www.bitget.com/api-doc/margin/cross/account/Get-Cross-Margin-Interest-Rate-And-Borrowable
|
ccxt/async_support/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmart import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -3342,7 +3342,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3342
3342
|
'info': info,
|
3343
3343
|
}
|
3344
3344
|
|
3345
|
-
async def fetch_isolated_borrow_rate(self, symbol: str, params={}):
|
3345
|
+
async def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
|
3346
3346
|
"""
|
3347
3347
|
fetch the rate of interest to borrow a currency for margin trading
|
3348
3348
|
:see: https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
|
@@ -3393,7 +3393,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3393
3393
|
borrowRate = self.safe_value(symbols, 0)
|
3394
3394
|
return self.parse_isolated_borrow_rate(borrowRate, market)
|
3395
3395
|
|
3396
|
-
def parse_isolated_borrow_rate(self, info, market: Market = None):
|
3396
|
+
def parse_isolated_borrow_rate(self, info, market: Market = None) -> IsolatedBorrowRate:
|
3397
3397
|
#
|
3398
3398
|
# {
|
3399
3399
|
# "symbol": "BTC_USDT",
|
@@ -3435,7 +3435,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3435
3435
|
'info': info,
|
3436
3436
|
}
|
3437
3437
|
|
3438
|
-
async def fetch_isolated_borrow_rates(self, params={}):
|
3438
|
+
async def fetch_isolated_borrow_rates(self, params={}) -> IsolatedBorrowRates:
|
3439
3439
|
"""
|
3440
3440
|
fetch the borrow interest rates of all currencies, currently only works for isolated margin
|
3441
3441
|
:see: https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
|
@@ -3478,11 +3478,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3478
3478
|
#
|
3479
3479
|
data = self.safe_value(response, 'data', {})
|
3480
3480
|
symbols = self.safe_value(data, 'symbols', [])
|
3481
|
-
|
3482
|
-
for i in range(0, len(symbols)):
|
3483
|
-
symbol = self.safe_value(symbols, i)
|
3484
|
-
result.append(self.parse_isolated_borrow_rate(symbol))
|
3485
|
-
return result
|
3481
|
+
return self.parse_isolated_borrow_rates(symbols)
|
3486
3482
|
|
3487
3483
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
3488
3484
|
"""
|
@@ -3641,9 +3637,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3641
3637
|
request['time_start'] = since
|
3642
3638
|
if limit is not None:
|
3643
3639
|
request['limit'] = limit
|
3644
|
-
until = self.
|
3640
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
3645
3641
|
endTime = self.safe_integer(params, 'time_end', until) # exchange-specific in milliseconds
|
3646
|
-
params = self.omit(params, ['
|
3642
|
+
params = self.omit(params, ['until'])
|
3647
3643
|
if endTime is not None:
|
3648
3644
|
request['time_end'] = endTime
|
3649
3645
|
response = await self.privatePostAccountV1TransferContractList(self.extend(request, params))
|
ccxt/async_support/bitmex.py
CHANGED
@@ -2409,8 +2409,8 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2409
2409
|
request['startTime'] = self.iso8601(since)
|
2410
2410
|
if limit is not None:
|
2411
2411
|
request['count'] = limit
|
2412
|
-
until = self.
|
2413
|
-
params = self.omit(params, ['until'
|
2412
|
+
until = self.safe_integer(params, 'until')
|
2413
|
+
params = self.omit(params, ['until'])
|
2414
2414
|
if until is not None:
|
2415
2415
|
request['endTime'] = self.iso8601(until)
|
2416
2416
|
if (since is None) and (until is None):
|
ccxt/async_support/bybit.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bybit import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -337,6 +337,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
337
337
|
'v5/account/fee-rate': 10, # 5/s = 1000 / (20 * 10)
|
338
338
|
'v5/account/info': 5,
|
339
339
|
'v5/account/transaction-log': 1,
|
340
|
+
'v5/account/contract-transaction-log': 1,
|
340
341
|
'v5/account/smp-group': 1,
|
341
342
|
'v5/account/mmp-state': 5,
|
342
343
|
# asset
|
@@ -2418,9 +2419,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
2418
2419
|
request['category'] = type
|
2419
2420
|
if since is not None:
|
2420
2421
|
request['startTime'] = since
|
2421
|
-
until = self.
|
2422
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
2422
2423
|
endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
|
2423
|
-
params = self.omit(params, ['endTime', '
|
2424
|
+
params = self.omit(params, ['endTime', 'until'])
|
2424
2425
|
if endTime is not None:
|
2425
2426
|
request['endTime'] = endTime
|
2426
2427
|
else:
|
@@ -3811,40 +3812,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
3811
3812
|
result = self.safe_dict(response, 'result', {})
|
3812
3813
|
return self.parse_order(result, market)
|
3813
3814
|
|
3814
|
-
|
3815
|
-
"""
|
3816
|
-
edit a trade order
|
3817
|
-
:see: https://bybit-exchange.github.io/docs/v5/order/amend-order
|
3818
|
-
:see: https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
|
3819
|
-
:see: https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
|
3820
|
-
:param str id: cancel order id
|
3821
|
-
:param str symbol: unified symbol of the market to create an order in
|
3822
|
-
:param str type: 'market' or 'limit'
|
3823
|
-
:param str side: 'buy' or 'sell'
|
3824
|
-
:param float amount: how much of currency you want to trade in units of base currency
|
3825
|
-
:param float price: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
3826
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3827
|
-
:param float [params.triggerPrice]: The price that a trigger order is triggered at
|
3828
|
-
:param float [params.stopLossPrice]: The price that a stop loss order is triggered at
|
3829
|
-
:param float [params.takeProfitPrice]: The price that a take profit order is triggered at
|
3830
|
-
:param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
|
3831
|
-
:param float [params.takeProfit.triggerPrice]: take profit trigger price
|
3832
|
-
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
|
3833
|
-
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
3834
|
-
:param str [params.triggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
|
3835
|
-
:param str [params.slTriggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
|
3836
|
-
:param str [params.tpTriggerby]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
|
3837
|
-
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3838
|
-
"""
|
3839
|
-
if symbol is None:
|
3840
|
-
raise ArgumentsRequired(self.id + ' editOrder() requires a symbol argument')
|
3841
|
-
await self.load_markets()
|
3815
|
+
def edit_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3842
3816
|
market = self.market(symbol)
|
3843
|
-
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
3844
|
-
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
3845
|
-
isUsdcSettled = market['settle'] == 'USDC'
|
3846
|
-
if isUsdcSettled and not isUnifiedAccount:
|
3847
|
-
return await self.edit_usdc_order(id, symbol, type, side, amount, price, params)
|
3848
3817
|
request = {
|
3849
3818
|
'symbol': market['id'],
|
3850
3819
|
'orderId': id,
|
@@ -3905,6 +3874,43 @@ class bybit(Exchange, ImplicitAPI):
|
|
3905
3874
|
if clientOrderId is not None:
|
3906
3875
|
request['orderLinkId'] = clientOrderId
|
3907
3876
|
params = self.omit(params, ['stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'clientOrderId', 'stopLoss', 'takeProfit'])
|
3877
|
+
return request
|
3878
|
+
|
3879
|
+
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3880
|
+
"""
|
3881
|
+
edit a trade order
|
3882
|
+
:see: https://bybit-exchange.github.io/docs/v5/order/amend-order
|
3883
|
+
:see: https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
|
3884
|
+
:see: https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
|
3885
|
+
:param str id: cancel order id
|
3886
|
+
:param str symbol: unified symbol of the market to create an order in
|
3887
|
+
:param str type: 'market' or 'limit'
|
3888
|
+
:param str side: 'buy' or 'sell'
|
3889
|
+
:param float amount: how much of currency you want to trade in units of base currency
|
3890
|
+
:param float price: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
3891
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3892
|
+
:param float [params.triggerPrice]: The price that a trigger order is triggered at
|
3893
|
+
:param float [params.stopLossPrice]: The price that a stop loss order is triggered at
|
3894
|
+
:param float [params.takeProfitPrice]: The price that a take profit order is triggered at
|
3895
|
+
:param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
|
3896
|
+
:param float [params.takeProfit.triggerPrice]: take profit trigger price
|
3897
|
+
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
|
3898
|
+
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
3899
|
+
:param str [params.triggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
|
3900
|
+
:param str [params.slTriggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
|
3901
|
+
:param str [params.tpTriggerby]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
|
3902
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3903
|
+
"""
|
3904
|
+
await self.load_markets()
|
3905
|
+
if symbol is None:
|
3906
|
+
raise ArgumentsRequired(self.id + ' editOrder() requires a symbol argument')
|
3907
|
+
market = self.market(symbol)
|
3908
|
+
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
3909
|
+
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
3910
|
+
isUsdcSettled = market['settle'] == 'USDC'
|
3911
|
+
if isUsdcSettled and not isUnifiedAccount:
|
3912
|
+
return await self.edit_usdc_order(id, symbol, type, side, amount, price, params)
|
3913
|
+
request = self.edit_order_request(id, symbol, type, side, amount, price, params)
|
3908
3914
|
response = await self.privatePostV5OrderAmend(self.extend(request, params))
|
3909
3915
|
#
|
3910
3916
|
# {
|
@@ -3960,26 +3966,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
3960
3966
|
result = self.safe_dict(response, 'result', {})
|
3961
3967
|
return self.parse_order(result, market)
|
3962
3968
|
|
3963
|
-
|
3964
|
-
"""
|
3965
|
-
cancels an open order
|
3966
|
-
:see: https://bybit-exchange.github.io/docs/v5/order/cancel-order
|
3967
|
-
:param str id: order id
|
3968
|
-
:param str symbol: unified symbol of the market the order was made in
|
3969
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3970
|
-
:param boolean [params.stop]: *spot only* whether the order is a stop order
|
3971
|
-
:param str [params.orderFilter]: *spot only* 'Order' or 'StopOrder' or 'tpslOrder'
|
3972
|
-
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3973
|
-
"""
|
3974
|
-
if symbol is None:
|
3975
|
-
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
3976
|
-
await self.load_markets()
|
3969
|
+
def cancel_order_request(self, id: str, symbol: Str = None, params={}):
|
3977
3970
|
market = self.market(symbol)
|
3978
|
-
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
3979
|
-
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
3980
|
-
isUsdcSettled = market['settle'] == 'USDC'
|
3981
|
-
if isUsdcSettled and not isUnifiedAccount:
|
3982
|
-
return await self.cancel_usdc_order(id, symbol, params)
|
3983
3971
|
request = {
|
3984
3972
|
'symbol': market['id'],
|
3985
3973
|
# 'orderLinkId': 'string',
|
@@ -3989,7 +3977,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3989
3977
|
}
|
3990
3978
|
if market['spot']:
|
3991
3979
|
# only works for spot market
|
3992
|
-
isStop = self.
|
3980
|
+
isStop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
3993
3981
|
params = self.omit(params, ['stop', 'trigger'])
|
3994
3982
|
request['orderFilter'] = 'StopOrder' if isStop else 'Order'
|
3995
3983
|
if id is not None: # The user can also use argument params["orderLinkId"]
|
@@ -4002,7 +3990,30 @@ class bybit(Exchange, ImplicitAPI):
|
|
4002
3990
|
request['category'] = 'inverse'
|
4003
3991
|
elif market['option']:
|
4004
3992
|
request['category'] = 'option'
|
4005
|
-
|
3993
|
+
return self.extend(request, params)
|
3994
|
+
|
3995
|
+
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
3996
|
+
"""
|
3997
|
+
cancels an open order
|
3998
|
+
:see: https://bybit-exchange.github.io/docs/v5/order/cancel-order
|
3999
|
+
:param str id: order id
|
4000
|
+
:param str symbol: unified symbol of the market the order was made in
|
4001
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4002
|
+
:param boolean [params.stop]: *spot only* whether the order is a stop order
|
4003
|
+
:param str [params.orderFilter]: *spot only* 'Order' or 'StopOrder' or 'tpslOrder'
|
4004
|
+
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4005
|
+
"""
|
4006
|
+
if symbol is None:
|
4007
|
+
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
4008
|
+
await self.load_markets()
|
4009
|
+
market = self.market(symbol)
|
4010
|
+
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
4011
|
+
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4012
|
+
isUsdcSettled = market['settle'] == 'USDC'
|
4013
|
+
if isUsdcSettled and not isUnifiedAccount:
|
4014
|
+
return await self.cancel_usdc_order(id, symbol, params)
|
4015
|
+
requestExtended = self.cancel_order_request(id, symbol, params)
|
4016
|
+
response = await self.privatePostV5OrderCancel(requestExtended)
|
4006
4017
|
#
|
4007
4018
|
# {
|
4008
4019
|
# "retCode": 0,
|
@@ -4475,9 +4486,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
4475
4486
|
request['limit'] = limit
|
4476
4487
|
if since is not None:
|
4477
4488
|
request['startTime'] = since
|
4478
|
-
until = self.
|
4489
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
4479
4490
|
endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
|
4480
|
-
params = self.omit(params, ['endTime', '
|
4491
|
+
params = self.omit(params, ['endTime', 'until'])
|
4481
4492
|
if endTime is not None:
|
4482
4493
|
request['endTime'] = endTime
|
4483
4494
|
response = await self.privateGetV5OrderHistory(self.extend(request, params))
|
@@ -4633,9 +4644,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
4633
4644
|
request['limit'] = limit
|
4634
4645
|
if since is not None:
|
4635
4646
|
request['startTime'] = since
|
4636
|
-
until = self.
|
4647
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
4637
4648
|
endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
|
4638
|
-
params = self.omit(params, ['endTime', '
|
4649
|
+
params = self.omit(params, ['endTime', 'until'])
|
4639
4650
|
if endTime is not None:
|
4640
4651
|
request['endTime'] = endTime
|
4641
4652
|
response = await self.privateGetV5OrderHistory(self.extend(request, params))
|
@@ -5380,7 +5391,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5380
5391
|
# 'coin': currency['id'],
|
5381
5392
|
# 'currency': currency['id'], # alias
|
5382
5393
|
# 'start_date': self.iso8601(since),
|
5383
|
-
# 'end_date': self.iso8601(
|
5394
|
+
# 'end_date': self.iso8601(until),
|
5384
5395
|
# 'wallet_fund_type': 'Deposit', # Withdraw, RealisedPNL, Commission, Refund, Prize, ExchangeOrderWithdraw, ExchangeOrderDeposit
|
5385
5396
|
# 'page': 1,
|
5386
5397
|
# 'limit': 20, # max 50
|
@@ -6339,8 +6350,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
6339
6350
|
}
|
6340
6351
|
if since is not None:
|
6341
6352
|
request['startTime'] = since
|
6342
|
-
until = self.
|
6343
|
-
params = self.omit(params, ['
|
6353
|
+
until = self.safe_integer(params, 'until') # unified in milliseconds
|
6354
|
+
params = self.omit(params, ['until'])
|
6344
6355
|
if until is not None:
|
6345
6356
|
request['endTime'] = until
|
6346
6357
|
if limit is not None:
|
@@ -6478,7 +6489,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6478
6489
|
'info': interest,
|
6479
6490
|
}, market)
|
6480
6491
|
|
6481
|
-
async def fetch_cross_borrow_rate(self, code: str, params={}):
|
6492
|
+
async def fetch_cross_borrow_rate(self, code: str, params={}) -> CrossBorrowRate:
|
6482
6493
|
"""
|
6483
6494
|
fetch the rate of interest to borrow a currency for margin trading
|
6484
6495
|
:see: https://bybit-exchange.github.io/docs/zh-TW/v5/spot-margin-normal/interest-quota
|