ccxt 4.4.9__py2.py3-none-any.whl → 4.4.11__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/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/oceanex.py +5 -0
- ccxt/ascendex.py +5 -4
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ascendex.py +5 -4
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +9 -11
- ccxt/async_support/bingx.py +20 -21
- ccxt/async_support/bitfinex2.py +7 -16
- ccxt/async_support/bitget.py +9 -8
- ccxt/async_support/bitmart.py +4 -3
- ccxt/async_support/bitmex.py +7 -6
- ccxt/async_support/blofin.py +7 -16
- ccxt/async_support/bybit.py +18 -16
- ccxt/async_support/coinex.py +19 -5
- ccxt/async_support/delta.py +6 -5
- ccxt/async_support/deribit.py +4 -3
- ccxt/async_support/digifinex.py +18 -4
- ccxt/async_support/gate.py +32 -13
- ccxt/async_support/hashkey.py +6 -6
- ccxt/async_support/hitbtc.py +6 -5
- ccxt/async_support/htx.py +29 -6
- ccxt/async_support/hyperliquid.py +6 -1
- ccxt/async_support/kraken.py +35 -13
- ccxt/async_support/krakenfutures.py +6 -5
- ccxt/async_support/kucoinfutures.py +13 -2
- ccxt/async_support/mexc.py +14 -7
- ccxt/async_support/oceanex.py +80 -4
- ccxt/async_support/okx.py +19 -3
- ccxt/async_support/oxfun.py +7 -7
- ccxt/async_support/phemex.py +4 -3
- ccxt/async_support/poloniexfutures.py +13 -2
- ccxt/async_support/vertex.py +6 -5
- ccxt/async_support/whitebit.py +14 -13
- ccxt/async_support/woo.py +42 -21
- ccxt/async_support/woofipro.py +19 -6
- ccxt/async_support/xt.py +5 -3
- ccxt/base/exchange.py +1 -1
- ccxt/base/types.py +1 -0
- ccxt/binance.py +9 -11
- ccxt/bingx.py +20 -21
- ccxt/bitfinex2.py +7 -16
- ccxt/bitget.py +9 -8
- ccxt/bitmart.py +4 -3
- ccxt/bitmex.py +7 -6
- ccxt/blofin.py +7 -16
- ccxt/bybit.py +18 -16
- ccxt/coinex.py +19 -5
- ccxt/delta.py +6 -5
- ccxt/deribit.py +4 -3
- ccxt/digifinex.py +18 -4
- ccxt/gate.py +32 -13
- ccxt/hashkey.py +6 -6
- ccxt/hitbtc.py +6 -5
- ccxt/htx.py +29 -6
- ccxt/hyperliquid.py +6 -1
- ccxt/kraken.py +35 -13
- ccxt/krakenfutures.py +6 -5
- ccxt/kucoinfutures.py +13 -2
- ccxt/mexc.py +14 -7
- ccxt/oceanex.py +80 -4
- ccxt/okx.py +19 -3
- ccxt/oxfun.py +7 -7
- ccxt/phemex.py +4 -3
- ccxt/poloniexfutures.py +13 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/deribit.py +114 -2
- ccxt/pro/exmo.py +29 -2
- ccxt/pro/gate.py +1 -1
- ccxt/pro/okx.py +1 -1
- ccxt/vertex.py +6 -5
- ccxt/whitebit.py +14 -13
- ccxt/woo.py +42 -21
- ccxt/woofipro.py +19 -6
- ccxt/xt.py +5 -3
- ccxt-4.4.11.dist-info/METADATA +636 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/RECORD +84 -84
- ccxt-4.4.9.dist-info/METADATA +0 -636
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/WHEEL +0 -0
- {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/top_level.txt +0 -0
ccxt/gate.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.gate import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, FundingHistory, Greeks, Int, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, FundingHistory, Greeks, Int, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -1645,7 +1645,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1645
1645
|
result[code]['withdraw'] = withdrawAvailable
|
1646
1646
|
return result
|
1647
1647
|
|
1648
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
1648
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
1649
1649
|
"""
|
1650
1650
|
fetch the current funding rate
|
1651
1651
|
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
|
@@ -1705,13 +1705,13 @@ class gate(Exchange, ImplicitAPI):
|
|
1705
1705
|
#
|
1706
1706
|
return self.parse_funding_rate(response)
|
1707
1707
|
|
1708
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
1708
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
1709
1709
|
"""
|
1710
1710
|
fetch the funding rate for multiple markets
|
1711
1711
|
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
1712
1712
|
:param str[]|None symbols: list of unified market symbols
|
1713
1713
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1714
|
-
:returns dict: a
|
1714
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
1715
1715
|
"""
|
1716
1716
|
self.load_markets()
|
1717
1717
|
symbols = self.market_symbols(symbols)
|
@@ -1764,7 +1764,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1764
1764
|
result = self.parse_funding_rates(response)
|
1765
1765
|
return self.filter_by_array(result, 'symbol', symbols)
|
1766
1766
|
|
1767
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
1767
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
1768
1768
|
#
|
1769
1769
|
# {
|
1770
1770
|
# "name": "BTC_USDT",
|
@@ -1815,6 +1815,7 @@ class gate(Exchange, ImplicitAPI):
|
|
1815
1815
|
fundingRate = self.safe_number(contract, 'funding_rate')
|
1816
1816
|
fundingTime = self.safe_timestamp(contract, 'funding_next_apply')
|
1817
1817
|
fundingRateIndicative = self.safe_number(contract, 'funding_rate_indicative')
|
1818
|
+
fundingInterval = Precise.string_mul('1000', self.safe_string(contract, 'funding_interval'))
|
1818
1819
|
return {
|
1819
1820
|
'info': contract,
|
1820
1821
|
'symbol': symbol,
|
@@ -1833,8 +1834,19 @@ class gate(Exchange, ImplicitAPI):
|
|
1833
1834
|
'previousFundingRate': None,
|
1834
1835
|
'previousFundingTimestamp': None,
|
1835
1836
|
'previousFundingDatetime': None,
|
1837
|
+
'interval': self.parse_funding_interval(fundingInterval),
|
1836
1838
|
}
|
1837
1839
|
|
1840
|
+
def parse_funding_interval(self, interval):
|
1841
|
+
intervals: dict = {
|
1842
|
+
'3600000': '1h',
|
1843
|
+
'14400000': '4h',
|
1844
|
+
'28800000': '8h',
|
1845
|
+
'57600000': '16h',
|
1846
|
+
'86400000': '24h',
|
1847
|
+
}
|
1848
|
+
return self.safe_string(intervals, interval, interval)
|
1849
|
+
|
1838
1850
|
def fetch_network_deposit_address(self, code: str, params={}):
|
1839
1851
|
self.load_markets()
|
1840
1852
|
currency = self.currency(code)
|
@@ -4410,7 +4422,6 @@ class gate(Exchange, ImplicitAPI):
|
|
4410
4422
|
"""
|
4411
4423
|
self.load_markets()
|
4412
4424
|
until = self.safe_integer(params, 'until')
|
4413
|
-
params = self.omit(params, 'until')
|
4414
4425
|
market = None
|
4415
4426
|
if symbol is not None:
|
4416
4427
|
market = self.market(symbol)
|
@@ -4427,30 +4438,38 @@ class gate(Exchange, ImplicitAPI):
|
|
4427
4438
|
if since is not None:
|
4428
4439
|
request['from'] = self.parse_to_int(since / 1000)
|
4429
4440
|
if until is not None:
|
4441
|
+
params = self.omit(params, 'until')
|
4430
4442
|
request['to'] = self.parse_to_int(until / 1000)
|
4431
4443
|
if limit is not None:
|
4432
4444
|
request['limit'] = limit
|
4433
4445
|
response = self.privateFuturesGetSettleOrdersTimerange(self.extend(request, params))
|
4434
4446
|
return self.parse_orders(response, market, since, limit)
|
4435
4447
|
|
4436
|
-
def
|
4448
|
+
def prepare_orders_by_status_request(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4437
4449
|
market = None
|
4438
4450
|
if symbol is not None:
|
4439
4451
|
market = self.market(symbol)
|
4440
4452
|
symbol = market['symbol']
|
4441
4453
|
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
4442
4454
|
params = self.omit(params, ['stop', 'trigger'])
|
4443
|
-
type
|
4455
|
+
type: Str = None
|
4456
|
+
type, params = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
4444
4457
|
spot = (type == 'spot') or (type == 'margin')
|
4445
|
-
request
|
4458
|
+
request: dict = {}
|
4459
|
+
request, params = self.multi_order_spot_prepare_request(market, stop, params) if spot else self.prepare_request(market, type, params)
|
4446
4460
|
if status == 'closed':
|
4447
4461
|
status = 'finished'
|
4448
4462
|
request['status'] = status
|
4449
4463
|
if limit is not None:
|
4450
4464
|
request['limit'] = limit
|
4451
|
-
if
|
4452
|
-
|
4453
|
-
|
4465
|
+
if spot:
|
4466
|
+
if since is not None:
|
4467
|
+
request['from'] = self.parse_to_int(since / 1000)
|
4468
|
+
until = self.safe_integer(params, 'until')
|
4469
|
+
if until is not None:
|
4470
|
+
params = self.omit(params, 'until')
|
4471
|
+
request['to'] = self.parse_to_int(until / 1000)
|
4472
|
+
lastId, finalParams = self.handle_param_string_2(params, 'lastId', 'last_id')
|
4454
4473
|
if lastId is not None:
|
4455
4474
|
request['last_id'] = lastId
|
4456
4475
|
return [request, finalParams]
|
@@ -4466,7 +4485,7 @@ class gate(Exchange, ImplicitAPI):
|
|
4466
4485
|
res = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
4467
4486
|
type = self.safe_string(res, 0)
|
4468
4487
|
params['type'] = type
|
4469
|
-
request, requestParams = self.
|
4488
|
+
request, requestParams = self.prepare_orders_by_status_request(status, symbol, since, limit, params)
|
4470
4489
|
spot = (type == 'spot') or (type == 'margin')
|
4471
4490
|
openSpotOrders = spot and (status == 'open') and not stop
|
4472
4491
|
response = None
|
ccxt/hashkey.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hashkey import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, LastPrice, LastPrices, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, LastPrice, LastPrices, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -3491,7 +3491,7 @@ class hashkey(Exchange, ImplicitAPI):
|
|
3491
3491
|
}
|
3492
3492
|
return self.safe_string(types, type, type)
|
3493
3493
|
|
3494
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
3494
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
3495
3495
|
"""
|
3496
3496
|
fetch the current funding rate
|
3497
3497
|
:see: https://hashkeyglobal-apidoc.readme.io/reference/get-futures-funding-rate
|
@@ -3514,13 +3514,13 @@ class hashkey(Exchange, ImplicitAPI):
|
|
3514
3514
|
rate = self.safe_dict(response, 0, {})
|
3515
3515
|
return self.parse_funding_rate(rate, market)
|
3516
3516
|
|
3517
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
3517
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
3518
3518
|
"""
|
3519
3519
|
fetch the funding rate for multiple markets
|
3520
3520
|
:see: https://hashkeyglobal-apidoc.readme.io/reference/get-futures-funding-rate
|
3521
3521
|
:param str[]|None symbols: list of unified market symbols
|
3522
3522
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3523
|
-
:returns dict: a
|
3523
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
3524
3524
|
"""
|
3525
3525
|
self.load_markets()
|
3526
3526
|
symbols = self.market_symbols(symbols)
|
@@ -3537,9 +3537,8 @@ class hashkey(Exchange, ImplicitAPI):
|
|
3537
3537
|
fundingRates = self.parse_funding_rates(response)
|
3538
3538
|
return self.filter_by_array(fundingRates, 'symbol', symbols)
|
3539
3539
|
|
3540
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
3540
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
3541
3541
|
#
|
3542
|
-
# fetchFundingRates
|
3543
3542
|
# {
|
3544
3543
|
# "symbol": "ETHUSDT-PERPETUAL",
|
3545
3544
|
# "rate": "0.0001",
|
@@ -3568,6 +3567,7 @@ class hashkey(Exchange, ImplicitAPI):
|
|
3568
3567
|
'previousFundingRate': None,
|
3569
3568
|
'previousFundingTimestamp': None,
|
3570
3569
|
'previousFundingDatetime': None,
|
3570
|
+
'interval': None,
|
3571
3571
|
}
|
3572
3572
|
|
3573
3573
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
ccxt/hitbtc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hitbtc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2536,13 +2536,13 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
2536
2536
|
#
|
2537
2537
|
return self.parse_transaction(response, currency)
|
2538
2538
|
|
2539
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2539
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2540
2540
|
"""
|
2541
2541
|
fetches funding rates for multiple markets
|
2542
2542
|
:see: https://api.hitbtc.com/#futures-info
|
2543
2543
|
:param str[] symbols: unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
2544
2544
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2545
|
-
:returns dict:
|
2545
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
2546
2546
|
"""
|
2547
2547
|
self.load_markets()
|
2548
2548
|
market = None
|
@@ -2934,7 +2934,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
2934
2934
|
#
|
2935
2935
|
return self.parse_open_interest(response, market)
|
2936
2936
|
|
2937
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
2937
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
2938
2938
|
"""
|
2939
2939
|
fetch the current funding rate
|
2940
2940
|
:see: https://api.hitbtc.com/#futures-info
|
@@ -2967,7 +2967,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
2967
2967
|
#
|
2968
2968
|
return self.parse_funding_rate(response, market)
|
2969
2969
|
|
2970
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2970
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2971
2971
|
#
|
2972
2972
|
# {
|
2973
2973
|
# "contract_type": "perpetual",
|
@@ -3003,6 +3003,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
3003
3003
|
'previousFundingRate': None,
|
3004
3004
|
'previousFundingTimestamp': None,
|
3005
3005
|
'previousFundingDatetime': None,
|
3006
|
+
'interval': None,
|
3006
3007
|
}
|
3007
3008
|
|
3008
3009
|
def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
|
ccxt/htx.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.htx import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, 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
|
@@ -202,7 +202,7 @@ class htx(Exchange, ImplicitAPI):
|
|
202
202
|
},
|
203
203
|
'www': 'https://www.huobi.com',
|
204
204
|
'referral': {
|
205
|
-
'url': 'https://www.
|
205
|
+
'url': 'https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223',
|
206
206
|
'discount': 0.15,
|
207
207
|
},
|
208
208
|
'doc': [
|
@@ -1236,6 +1236,7 @@ class htx(Exchange, ImplicitAPI):
|
|
1236
1236
|
# https://github.com/ccxt/ccxt/issues/6081
|
1237
1237
|
# https://github.com/ccxt/ccxt/issues/3365
|
1238
1238
|
# https://github.com/ccxt/ccxt/issues/2873
|
1239
|
+
'NGL': 'GFNGL',
|
1239
1240
|
'GET': 'THEMIS', # conflict with GET(Guaranteed Entrance Token, GET Protocol)
|
1240
1241
|
'GTC': 'GAMECOM', # conflict with Gitcoin and Gastrocoin
|
1241
1242
|
'HIT': 'HITCHAIN',
|
@@ -1247,6 +1248,7 @@ class htx(Exchange, ImplicitAPI):
|
|
1247
1248
|
'SBTC': 'SUPERBITCOIN',
|
1248
1249
|
'SOUL': 'SOULSAVER',
|
1249
1250
|
'BIFI': 'BITCOINFILE', # conflict with Beefy.Finance https://github.com/ccxt/ccxt/issues/8706
|
1251
|
+
'FUD': 'FTX Users\' Debt',
|
1250
1252
|
},
|
1251
1253
|
})
|
1252
1254
|
|
@@ -6382,7 +6384,7 @@ class htx(Exchange, ImplicitAPI):
|
|
6382
6384
|
sorted = self.sort_by(rates, 'timestamp')
|
6383
6385
|
return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
|
6384
6386
|
|
6385
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
6387
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
6386
6388
|
#
|
6387
6389
|
# {
|
6388
6390
|
# "status": "ok",
|
@@ -6401,6 +6403,9 @@ class htx(Exchange, ImplicitAPI):
|
|
6401
6403
|
nextFundingRate = self.safe_number(contract, 'estimated_rate')
|
6402
6404
|
fundingTimestamp = self.safe_integer(contract, 'funding_time')
|
6403
6405
|
nextFundingTimestamp = self.safe_integer(contract, 'next_funding_time')
|
6406
|
+
fundingTimeString = self.safe_string(contract, 'funding_time')
|
6407
|
+
nextFundingTimeString = self.safe_string(contract, 'next_funding_time')
|
6408
|
+
millisecondsInterval = Precise.string_sub(nextFundingTimeString, fundingTimeString)
|
6404
6409
|
marketId = self.safe_string(contract, 'contract_code')
|
6405
6410
|
symbol = self.safe_symbol(marketId, market)
|
6406
6411
|
return {
|
@@ -6421,9 +6426,20 @@ class htx(Exchange, ImplicitAPI):
|
|
6421
6426
|
'previousFundingRate': None,
|
6422
6427
|
'previousFundingTimestamp': None,
|
6423
6428
|
'previousFundingDatetime': None,
|
6429
|
+
'interval': self.parse_funding_interval(millisecondsInterval),
|
6424
6430
|
}
|
6425
6431
|
|
6426
|
-
def
|
6432
|
+
def parse_funding_interval(self, interval):
|
6433
|
+
intervals: dict = {
|
6434
|
+
'3600000': '1h',
|
6435
|
+
'14400000': '4h',
|
6436
|
+
'28800000': '8h',
|
6437
|
+
'57600000': '16h',
|
6438
|
+
'86400000': '24h',
|
6439
|
+
}
|
6440
|
+
return self.safe_string(intervals, interval, interval)
|
6441
|
+
|
6442
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
6427
6443
|
"""
|
6428
6444
|
fetch the current funding rate
|
6429
6445
|
:param str symbol: unified market symbol
|
@@ -6460,12 +6476,12 @@ class htx(Exchange, ImplicitAPI):
|
|
6460
6476
|
result = self.safe_value(response, 'data', {})
|
6461
6477
|
return self.parse_funding_rate(result, market)
|
6462
6478
|
|
6463
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
6479
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
6464
6480
|
"""
|
6465
6481
|
fetch the funding rate for multiple markets
|
6466
6482
|
:param str[]|None symbols: list of unified market symbols
|
6467
6483
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
6468
|
-
:returns dict: a
|
6484
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
6469
6485
|
"""
|
6470
6486
|
self.load_markets()
|
6471
6487
|
symbols = self.market_symbols(symbols)
|
@@ -6839,6 +6855,10 @@ class htx(Exchange, ImplicitAPI):
|
|
6839
6855
|
def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
6840
6856
|
"""
|
6841
6857
|
set the level of leverage for a market
|
6858
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-switch-leverage
|
6859
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-switch-leverage
|
6860
|
+
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#switch-leverage
|
6861
|
+
:see: https://huobiapi.github.io/docs/dm/v1/en/#switch-leverage # Coin-m futures
|
6842
6862
|
:param float leverage: the rate of leverage
|
6843
6863
|
:param str symbol: unified market symbol
|
6844
6864
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -8096,6 +8116,9 @@ class htx(Exchange, ImplicitAPI):
|
|
8096
8116
|
def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
8097
8117
|
"""
|
8098
8118
|
Fetches historical settlement records
|
8119
|
+
:see: https://huobiapi.github.io/docs/dm/v1/en/#query-historical-settlement-records-of-the-platform-interface
|
8120
|
+
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-settlement-records-of-the-platform-interface
|
8121
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-settlement-records-of-the-platform-interface
|
8099
8122
|
:param str symbol: unified symbol of the market to fetch the settlement history for
|
8100
8123
|
:param int [since]: timestamp in ms, value range = current time - 90 days,default = current time - 90 days
|
8101
8124
|
:param int [limit]: page items, default 20, shall not exceed 50
|
ccxt/hyperliquid.py
CHANGED
@@ -1926,6 +1926,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1926
1926
|
# "crossed": True,
|
1927
1927
|
# "dir": "Close Long",
|
1928
1928
|
# "fee": "0.050062",
|
1929
|
+
# "feeToken": "USDC",
|
1929
1930
|
# "hash": "0x09d77c96791e98b5775a04092584ab010d009445119c71e4005c0d634ea322bc",
|
1930
1931
|
# "liquidationMarkPx": null,
|
1931
1932
|
# "oid": 3929354691,
|
@@ -1984,7 +1985,11 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1984
1985
|
'price': price,
|
1985
1986
|
'amount': amount,
|
1986
1987
|
'cost': None,
|
1987
|
-
'fee': {
|
1988
|
+
'fee': {
|
1989
|
+
'cost': fee,
|
1990
|
+
'currency': self.safe_string(trade, 'feeToken'),
|
1991
|
+
'rate': None,
|
1992
|
+
},
|
1988
1993
|
}, market)
|
1989
1994
|
|
1990
1995
|
def fetch_position(self, symbol: str, params={}):
|
ccxt/kraken.py
CHANGED
@@ -66,6 +66,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
66
66
|
'createStopMarketOrder': True,
|
67
67
|
'createStopOrder': True,
|
68
68
|
'createTrailingAmountOrder': True,
|
69
|
+
'createTrailingPercentOrder': True,
|
69
70
|
'editOrder': True,
|
70
71
|
'fetchBalance': True,
|
71
72
|
'fetchBorrowInterest': False,
|
@@ -456,7 +457,9 @@ class kraken(Exchange, ImplicitAPI):
|
|
456
457
|
'EGeneral:Internal error': ExchangeNotAvailable,
|
457
458
|
'EGeneral:Temporary lockout': DDoSProtection,
|
458
459
|
'EGeneral:Permission denied': PermissionDenied,
|
460
|
+
'EGeneral:Invalid arguments:price': InvalidOrder,
|
459
461
|
'EOrder:Unknown order': InvalidOrder,
|
462
|
+
'EOrder:Invalid price:Invalid price argument': InvalidOrder,
|
460
463
|
'EOrder:Order minimum not met': InvalidOrder,
|
461
464
|
'EGeneral:Invalid arguments': BadRequest,
|
462
465
|
'ESession:Invalid session': AuthenticationError,
|
@@ -1397,8 +1400,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
1397
1400
|
|
1398
1401
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1399
1402
|
"""
|
1400
|
-
:see: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
|
1401
1403
|
create a trade order
|
1404
|
+
:see: https://docs.kraken.com/api/docs/rest-api/add-order
|
1402
1405
|
:param str symbol: unified symbol of the market to create an order in
|
1403
1406
|
:param str type: 'market' or 'limit'
|
1404
1407
|
:param str side: 'buy' or 'sell'
|
@@ -1410,7 +1413,9 @@ class kraken(Exchange, ImplicitAPI):
|
|
1410
1413
|
:param float [params.stopLossPrice]: *margin only* the price that a stop loss order is triggered at
|
1411
1414
|
:param float [params.takeProfitPrice]: *margin only* the price that a take profit order is triggered at
|
1412
1415
|
:param str [params.trailingAmount]: *margin only* the quote amount to trail away from the current market price
|
1416
|
+
:param str [params.trailingPercent]: *margin only* the percent to trail away from the current market price
|
1413
1417
|
:param str [params.trailingLimitAmount]: *margin only* the quote amount away from the trailingAmount
|
1418
|
+
:param str [params.trailingLimitPercent]: *margin only* the percent away from the trailingAmount
|
1414
1419
|
:param str [params.offset]: *margin only* '+' or '-' whether you want the trailingLimitAmount value to be positive or negative, default is negative '-'
|
1415
1420
|
:param str [params.trigger]: *margin only* the activation price type, 'last' or 'index', default is 'last'
|
1416
1421
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1717,8 +1722,11 @@ class kraken(Exchange, ImplicitAPI):
|
|
1717
1722
|
isTakeProfitTriggerOrder = takeProfitTriggerPrice is not None
|
1718
1723
|
isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder or isTakeProfitTriggerOrder
|
1719
1724
|
trailingAmount = self.safe_string(params, 'trailingAmount')
|
1725
|
+
trailingPercent = self.safe_string(params, 'trailingPercent')
|
1720
1726
|
trailingLimitAmount = self.safe_string(params, 'trailingLimitAmount')
|
1727
|
+
trailingLimitPercent = self.safe_string(params, 'trailingLimitPercent')
|
1721
1728
|
isTrailingAmountOrder = trailingAmount is not None
|
1729
|
+
isTrailingPercentOrder = trailingPercent is not None
|
1722
1730
|
isLimitOrder = type.endswith('limit') # supporting limit, stop-loss-limit, take-profit-limit, etc
|
1723
1731
|
isMarketOrder = type == 'market'
|
1724
1732
|
cost = self.safe_string(params, 'cost')
|
@@ -1750,19 +1758,30 @@ class kraken(Exchange, ImplicitAPI):
|
|
1750
1758
|
request['ordertype'] = 'take-profit'
|
1751
1759
|
if isLimitOrder:
|
1752
1760
|
request['price2'] = self.price_to_precision(symbol, price)
|
1753
|
-
elif isTrailingAmountOrder:
|
1761
|
+
elif isTrailingAmountOrder or isTrailingPercentOrder:
|
1762
|
+
trailingPercentString = None
|
1763
|
+
if isTrailingPercentOrder:
|
1764
|
+
trailingPercentString = trailingPercent if (trailingPercent.endswith('%')) else '+' + (self.number_to_string(trailingPercent) + '%')
|
1765
|
+
trailingAmountString = '+' + trailingAmount if (trailingAmount is not None) else None # must use + for self
|
1766
|
+
offset = self.safe_string(params, 'offset', '-') # can use + or - for self
|
1767
|
+
trailingLimitAmountString = offset + self.number_to_string(trailingLimitAmount) if (trailingLimitAmount is not None) else None
|
1754
1768
|
trailingActivationPriceType = self.safe_string(params, 'trigger', 'last')
|
1755
|
-
trailingAmountString = '+' + trailingAmount
|
1756
1769
|
request['trigger'] = trailingActivationPriceType
|
1757
|
-
if isLimitOrder or (trailingLimitAmount is not None):
|
1758
|
-
offset = self.safe_string(params, 'offset', '-')
|
1759
|
-
trailingLimitAmountString = offset + self.number_to_string(trailingLimitAmount)
|
1760
|
-
request['price'] = trailingAmountString
|
1761
|
-
request['price2'] = trailingLimitAmountString
|
1770
|
+
if isLimitOrder or (trailingLimitAmount is not None) or (trailingLimitPercent is not None):
|
1762
1771
|
request['ordertype'] = 'trailing-stop-limit'
|
1772
|
+
if trailingLimitPercent is not None:
|
1773
|
+
trailingLimitPercentString = trailingLimitPercent if (trailingLimitPercent.endswith('%')) else (self.number_to_string(trailingLimitPercent) + '%')
|
1774
|
+
request['price'] = trailingPercentString
|
1775
|
+
request['price2'] = trailingLimitPercentString
|
1776
|
+
elif trailingLimitAmount is not None:
|
1777
|
+
request['price'] = trailingAmountString
|
1778
|
+
request['price2'] = trailingLimitAmountString
|
1763
1779
|
else:
|
1764
|
-
request['price'] = trailingAmountString
|
1765
1780
|
request['ordertype'] = 'trailing-stop'
|
1781
|
+
if trailingPercent is not None:
|
1782
|
+
request['price'] = trailingPercentString
|
1783
|
+
else:
|
1784
|
+
request['price'] = trailingAmountString
|
1766
1785
|
if reduceOnly:
|
1767
1786
|
if method == 'createOrderWs':
|
1768
1787
|
request['reduce_only'] = True # ws request can't have stringified bool
|
@@ -1789,7 +1808,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
1789
1808
|
request['oflags'] = extendedPostFlags
|
1790
1809
|
if (flags is not None) and not ('oflags' in request):
|
1791
1810
|
request['oflags'] = flags
|
1792
|
-
params = self.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset'])
|
1811
|
+
params = self.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingLimitAmount', 'trailingLimitPercent', 'offset'])
|
1793
1812
|
return [request, params]
|
1794
1813
|
|
1795
1814
|
def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
@@ -2916,11 +2935,15 @@ class kraken(Exchange, ImplicitAPI):
|
|
2916
2935
|
# urlencodeNested is used to address https://github.com/ccxt/ccxt/issues/12872
|
2917
2936
|
url += '?' + self.urlencode_nested(params)
|
2918
2937
|
elif api == 'private':
|
2938
|
+
price = self.safe_string(params, 'price')
|
2939
|
+
isTriggerPercent = False
|
2940
|
+
if price is not None:
|
2941
|
+
isTriggerPercent = True if (price.endswith('%')) else False
|
2919
2942
|
isCancelOrderBatch = (path == 'CancelOrderBatch')
|
2920
2943
|
self.check_required_credentials()
|
2921
2944
|
nonce = str(self.nonce())
|
2922
2945
|
# urlencodeNested is used to address https://github.com/ccxt/ccxt/issues/12872
|
2923
|
-
if isCancelOrderBatch:
|
2946
|
+
if isCancelOrderBatch or isTriggerPercent:
|
2924
2947
|
body = self.json(self.extend({'nonce': nonce}, params))
|
2925
2948
|
else:
|
2926
2949
|
body = self.urlencode_nested(self.extend({'nonce': nonce}, params))
|
@@ -2933,9 +2956,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
2933
2956
|
headers = {
|
2934
2957
|
'API-Key': self.apiKey,
|
2935
2958
|
'API-Sign': signature,
|
2936
|
-
# 'Content-Type': 'application/x-www-form-urlencoded',
|
2937
2959
|
}
|
2938
|
-
if isCancelOrderBatch:
|
2960
|
+
if isCancelOrderBatch or isTriggerPercent:
|
2939
2961
|
headers['Content-Type'] = 'application/json'
|
2940
2962
|
else:
|
2941
2963
|
headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
ccxt/krakenfutures.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.krakenfutures import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2030,10 +2030,10 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2030
2030
|
result[code] = account
|
2031
2031
|
return self.safe_balance(result)
|
2032
2032
|
|
2033
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2033
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2034
2034
|
"""
|
2035
|
+
fetch the current funding rates for multiple markets
|
2035
2036
|
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
|
2036
|
-
fetch the current funding rates
|
2037
2037
|
:param str[] symbols: unified market symbols
|
2038
2038
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2039
2039
|
:returns Order[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -2041,7 +2041,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2041
2041
|
self.load_markets()
|
2042
2042
|
marketIds = self.market_ids(symbols)
|
2043
2043
|
response = self.publicGetTickers(params)
|
2044
|
-
tickers = self.
|
2044
|
+
tickers = self.safe_list(response, 'tickers', [])
|
2045
2045
|
fundingRates = []
|
2046
2046
|
for i in range(0, len(tickers)):
|
2047
2047
|
entry = tickers[i]
|
@@ -2054,7 +2054,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2054
2054
|
fundingRates.append(parsed)
|
2055
2055
|
return self.index_by(fundingRates, 'symbol')
|
2056
2056
|
|
2057
|
-
def parse_funding_rate(self, ticker, market: Market = None):
|
2057
|
+
def parse_funding_rate(self, ticker, market: Market = None) -> FundingRate:
|
2058
2058
|
#
|
2059
2059
|
# {"ask": 26.283,
|
2060
2060
|
# "askSize": 4.6,
|
@@ -2108,6 +2108,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2108
2108
|
'previousFundingRate': None,
|
2109
2109
|
'previousFundingTimestamp': None,
|
2110
2110
|
'previousFundingDatetime': None,
|
2111
|
+
'interval': None,
|
2111
2112
|
}
|
2112
2113
|
|
2113
2114
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
ccxt/kucoinfutures.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.kucoin import kucoin
|
7
7
|
from ccxt.abstract.kucoinfutures import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, LeverageTier, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
8
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, LeverageTier, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import AuthenticationError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
@@ -2046,7 +2046,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
2046
2046
|
'trades': None,
|
2047
2047
|
}, market)
|
2048
2048
|
|
2049
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
2049
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
2050
2050
|
"""
|
2051
2051
|
fetch the current funding rate
|
2052
2052
|
:see: https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate
|
@@ -2093,8 +2093,19 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
2093
2093
|
'previousFundingRate': None,
|
2094
2094
|
'previousFundingTimestamp': None,
|
2095
2095
|
'previousFundingDatetime': None,
|
2096
|
+
'interval': self.parse_funding_interval(self.safe_string(data, 'granularity')),
|
2096
2097
|
}
|
2097
2098
|
|
2099
|
+
def parse_funding_interval(self, interval):
|
2100
|
+
intervals: dict = {
|
2101
|
+
'3600000': '1h',
|
2102
|
+
'14400000': '4h',
|
2103
|
+
'28800000': '8h',
|
2104
|
+
'57600000': '16h',
|
2105
|
+
'86400000': '24h',
|
2106
|
+
}
|
2107
|
+
return self.safe_string(intervals, interval, interval)
|
2108
|
+
|
2098
2109
|
def parse_balance(self, response) -> Balances:
|
2099
2110
|
result: dict = {
|
2100
2111
|
'info': response,
|
ccxt/mexc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.mexc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -3615,23 +3615,29 @@ class mexc(Exchange, ImplicitAPI):
|
|
3615
3615
|
:param int [since]: the earliest time in ms to fetch trades for
|
3616
3616
|
:param int [limit]: the maximum number of trades structures to retrieve
|
3617
3617
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3618
|
+
:param int [params.until]: the latest time in ms to fetch trades for
|
3618
3619
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
3619
3620
|
"""
|
3620
3621
|
if symbol is None:
|
3621
3622
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
|
3622
3623
|
self.load_markets()
|
3623
3624
|
market = self.market(symbol)
|
3624
|
-
marketType
|
3625
|
+
marketType: Str = None
|
3626
|
+
marketType, params = self.handle_market_type_and_params('fetchMyTrades', market, params)
|
3625
3627
|
request: dict = {
|
3626
3628
|
'symbol': market['id'],
|
3627
3629
|
}
|
3628
3630
|
trades = None
|
3629
3631
|
if marketType == 'spot':
|
3630
3632
|
if since is not None:
|
3631
|
-
request['
|
3633
|
+
request['startTime'] = since
|
3632
3634
|
if limit is not None:
|
3633
3635
|
request['limit'] = limit
|
3634
|
-
|
3636
|
+
until = self.safe_integer(params, 'until')
|
3637
|
+
if until is not None:
|
3638
|
+
params = self.omit(params, 'until')
|
3639
|
+
request['endTime'] = until
|
3640
|
+
trades = self.spotPrivateGetMyTrades(self.extend(request, params))
|
3635
3641
|
#
|
3636
3642
|
# spot
|
3637
3643
|
#
|
@@ -3661,7 +3667,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
3661
3667
|
request['end_time'] = self.sum(since, self.options['maxTimeTillEnd'])
|
3662
3668
|
if limit is not None:
|
3663
3669
|
request['page_size'] = limit
|
3664
|
-
response = self.contractPrivateGetOrderListOrderDeals(self.extend(request,
|
3670
|
+
response = self.contractPrivateGetOrderListOrderDeals(self.extend(request, params))
|
3665
3671
|
#
|
3666
3672
|
# {
|
3667
3673
|
# "success": True,
|
@@ -3904,7 +3910,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
3904
3910
|
})
|
3905
3911
|
return result
|
3906
3912
|
|
3907
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
3913
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
3908
3914
|
#
|
3909
3915
|
# {
|
3910
3916
|
# "symbol": "BTC_USDT",
|
@@ -3940,9 +3946,10 @@ class mexc(Exchange, ImplicitAPI):
|
|
3940
3946
|
'previousFundingRate': None,
|
3941
3947
|
'previousFundingTimestamp': None,
|
3942
3948
|
'previousFundingDatetime': None,
|
3949
|
+
'interval': None,
|
3943
3950
|
}
|
3944
3951
|
|
3945
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
3952
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
3946
3953
|
"""
|
3947
3954
|
fetch the current funding rate
|
3948
3955
|
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate
|