ccxt 4.4.68__py2.py3-none-any.whl → 4.4.69__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/paradex.py +23 -0
- ccxt/abstract/tradeogre.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +5 -1
- ccxt/async_support/binance.py +16 -2
- ccxt/async_support/bitstamp.py +2 -3
- ccxt/async_support/coinbase.py +1 -5
- ccxt/async_support/cryptomus.py +122 -6
- ccxt/async_support/hyperliquid.py +1 -1
- ccxt/async_support/paradex.py +173 -5
- ccxt/async_support/phemex.py +2 -2
- ccxt/async_support/tradeogre.py +11 -7
- ccxt/async_support/whitebit.py +210 -2
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +16 -2
- ccxt/bitstamp.py +2 -3
- ccxt/coinbase.py +1 -5
- ccxt/cryptomus.py +122 -6
- ccxt/hyperliquid.py +1 -1
- ccxt/paradex.py +173 -5
- ccxt/phemex.py +2 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/test/tests_async.py +22 -0
- ccxt/test/tests_sync.py +22 -0
- ccxt/tradeogre.py +11 -7
- ccxt/whitebit.py +210 -2
- {ccxt-4.4.68.dist-info → ccxt-4.4.69.dist-info}/METADATA +4 -4
- {ccxt-4.4.68.dist-info → ccxt-4.4.69.dist-info}/RECORD +32 -32
- {ccxt-4.4.68.dist-info → ccxt-4.4.69.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.68.dist-info → ccxt-4.4.69.dist-info}/WHEEL +0 -0
- {ccxt-4.4.68.dist-info → ccxt-4.4.69.dist-info}/top_level.txt +0 -0
ccxt/async_support/phemex.py
CHANGED
@@ -3581,14 +3581,14 @@ class phemex(Exchange, ImplicitAPI):
|
|
3581
3581
|
|
3582
3582
|
:param str[] [symbols]: list of unified market symbols
|
3583
3583
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3584
|
-
:param str [params.code]: the currency code to fetch positions for, USD, BTC or USDT,
|
3584
|
+
:param str [params.code]: the currency code to fetch positions for, USD, BTC or USDT, USDT is the default
|
3585
3585
|
:param str [params.method]: *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
|
3586
3586
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
3587
3587
|
"""
|
3588
3588
|
await self.load_markets()
|
3589
3589
|
symbols = self.market_symbols(symbols)
|
3590
3590
|
subType = None
|
3591
|
-
code = self.safe_string_2(params, 'currency', 'code', '
|
3591
|
+
code = self.safe_string_2(params, 'currency', 'code', 'USDT')
|
3592
3592
|
params = self.omit(params, ['currency', 'code'])
|
3593
3593
|
settle = None
|
3594
3594
|
market = None
|
ccxt/async_support/tradeogre.py
CHANGED
@@ -134,6 +134,7 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
134
134
|
'orders/{market}': 1,
|
135
135
|
'ticker/{market}': 1,
|
136
136
|
'history/{market}': 1,
|
137
|
+
'chart/{interval}/{market}/{timestamp}': 1,
|
137
138
|
'chart/{interval}/{market}': 1,
|
138
139
|
},
|
139
140
|
},
|
@@ -422,15 +423,15 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
422
423
|
'ask': self.safe_string(ticker, 'ask'),
|
423
424
|
'askVolume': None,
|
424
425
|
'vwap': None,
|
425
|
-
'open': self.safe_string(ticker, '
|
426
|
-
'close':
|
426
|
+
'open': self.safe_string(ticker, 'initialprice'),
|
427
|
+
'close': self.safe_string(ticker, 'price'),
|
427
428
|
'last': None,
|
428
429
|
'previousClose': None,
|
429
430
|
'change': None,
|
430
431
|
'percentage': None,
|
431
432
|
'average': None,
|
432
|
-
'baseVolume':
|
433
|
-
'quoteVolume':
|
433
|
+
'baseVolume': None,
|
434
|
+
'quoteVolume': self.safe_string(ticker, 'volume'),
|
434
435
|
'info': ticker,
|
435
436
|
}, market)
|
436
437
|
|
@@ -451,11 +452,14 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
451
452
|
'market': market['id'],
|
452
453
|
'interval': self.safe_string(self.timeframes, timeframe, timeframe),
|
453
454
|
}
|
455
|
+
response = None
|
454
456
|
until = self.safe_integer(params, 'until')
|
455
457
|
if until is not None:
|
456
458
|
params = self.omit(params, 'until')
|
457
|
-
request['timestamp'] = until
|
458
|
-
|
459
|
+
request['timestamp'] = self.parse_to_int(until / 1000)
|
460
|
+
response = await self.publicGetChartIntervalMarketTimestamp(self.extend(request, params))
|
461
|
+
else:
|
462
|
+
response = await self.publicGetChartIntervalMarket(self.extend(request, params))
|
459
463
|
#
|
460
464
|
# [
|
461
465
|
# [
|
@@ -484,9 +488,9 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
484
488
|
return [
|
485
489
|
self.safe_timestamp(ohlcv, 0),
|
486
490
|
self.safe_number(ohlcv, 1),
|
491
|
+
self.safe_number(ohlcv, 2),
|
487
492
|
self.safe_number(ohlcv, 3),
|
488
493
|
self.safe_number(ohlcv, 4),
|
489
|
-
self.safe_number(ohlcv, 2),
|
490
494
|
self.safe_number(ohlcv, 5),
|
491
495
|
]
|
492
496
|
|
ccxt/async_support/whitebit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.whitebit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, BorrowInterest, Bool, Conversion, Currencies, Currency, DepositAddress, FundingHistory, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Any, Balances, BorrowInterest, Bool, Conversion, Currencies, Currency, DepositAddress, FundingHistory, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, 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
|
@@ -38,7 +38,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
38
38
|
'CORS': None,
|
39
39
|
'spot': True,
|
40
40
|
'margin': True,
|
41
|
-
'swap':
|
41
|
+
'swap': True,
|
42
42
|
'future': False,
|
43
43
|
'option': False,
|
44
44
|
'cancelAllOrders': True,
|
@@ -88,7 +88,10 @@ class whitebit(Exchange, ImplicitAPI):
|
|
88
88
|
'fetchOpenOrders': True,
|
89
89
|
'fetchOrderBook': True,
|
90
90
|
'fetchOrderTrades': True,
|
91
|
+
'fetchPosition': True,
|
92
|
+
'fetchPositionHistory': True,
|
91
93
|
'fetchPositionMode': False,
|
94
|
+
'fetchPositions': True,
|
92
95
|
'fetchPremiumIndexOHLCV': False,
|
93
96
|
'fetchStatus': True,
|
94
97
|
'fetchTicker': True,
|
@@ -2859,6 +2862,211 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2859
2862
|
'fee': None,
|
2860
2863
|
}
|
2861
2864
|
|
2865
|
+
async def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
2866
|
+
"""
|
2867
|
+
fetches historical positions
|
2868
|
+
|
2869
|
+
https://docs.whitebit.com/private/http-trade-v4/#positions-history
|
2870
|
+
|
2871
|
+
:param str symbol: unified contract symbol
|
2872
|
+
:param int [since]: the earliest time in ms to fetch positions for
|
2873
|
+
:param int [limit]: the maximum amount of records to fetch
|
2874
|
+
:param dict [params]: extra parameters specific to the exchange api endpoint
|
2875
|
+
:param int [params.positionId]: the id of the requested position
|
2876
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
2877
|
+
"""
|
2878
|
+
await self.load_markets()
|
2879
|
+
market = self.market(symbol)
|
2880
|
+
request: dict = {
|
2881
|
+
'market': market['id'],
|
2882
|
+
}
|
2883
|
+
if since is not None:
|
2884
|
+
request['startDate'] = since
|
2885
|
+
if limit is not None:
|
2886
|
+
request['limit'] = since
|
2887
|
+
request, params = self.handle_until_option('endDate', request, params)
|
2888
|
+
response = await self.v4PrivatePostCollateralAccountPositionsHistory(self.extend(request, params))
|
2889
|
+
#
|
2890
|
+
# [
|
2891
|
+
# {
|
2892
|
+
# "positionId": 479975679,
|
2893
|
+
# "market": "BTC_PERP",
|
2894
|
+
# "openDate": 1741941025.309887,
|
2895
|
+
# "modifyDate": 1741941025.309887,
|
2896
|
+
# "amount": "0.001",
|
2897
|
+
# "basePrice": "82498.7",
|
2898
|
+
# "realizedFunding": "0",
|
2899
|
+
# "liquidationPrice": "0",
|
2900
|
+
# "liquidationState": null,
|
2901
|
+
# "orderDetail": {
|
2902
|
+
# "id": 1224727949521,
|
2903
|
+
# "tradeAmount": "0.001",
|
2904
|
+
# "price": "82498.7",
|
2905
|
+
# "tradeFee": "0.028874545",
|
2906
|
+
# "fundingFee": "0",
|
2907
|
+
# "realizedPnl": "-0.028874545"
|
2908
|
+
# }
|
2909
|
+
# }
|
2910
|
+
# ]
|
2911
|
+
#
|
2912
|
+
positions = self.parse_positions(response)
|
2913
|
+
return self.filter_by_symbol_since_limit(positions, symbol, since, limit)
|
2914
|
+
|
2915
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2916
|
+
"""
|
2917
|
+
fetch all open positions
|
2918
|
+
|
2919
|
+
https://docs.whitebit.com/private/http-trade-v4/#open-positions
|
2920
|
+
|
2921
|
+
:param str[] [symbols]: list of unified market symbols
|
2922
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2923
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
2924
|
+
"""
|
2925
|
+
await self.load_markets()
|
2926
|
+
symbols = self.market_symbols(symbols)
|
2927
|
+
response = await self.v4PrivatePostCollateralAccountPositionsOpen(params)
|
2928
|
+
#
|
2929
|
+
# [
|
2930
|
+
# {
|
2931
|
+
# "positionId": 479975679,
|
2932
|
+
# "market": "BTC_PERP",
|
2933
|
+
# "openDate": 1741941025.3098869,
|
2934
|
+
# "modifyDate": 1741941025.3098869,
|
2935
|
+
# "amount": "0.001",
|
2936
|
+
# "basePrice": "82498.7",
|
2937
|
+
# "liquidationPrice": "70177.2",
|
2938
|
+
# "pnl": "0",
|
2939
|
+
# "pnlPercent": "0.00",
|
2940
|
+
# "margin": "4.2",
|
2941
|
+
# "freeMargin": "9.9",
|
2942
|
+
# "funding": "0",
|
2943
|
+
# "unrealizedFunding": "0",
|
2944
|
+
# "liquidationState": null,
|
2945
|
+
# "tpsl": null
|
2946
|
+
# }
|
2947
|
+
# ]
|
2948
|
+
#
|
2949
|
+
return self.parse_positions(response, symbols)
|
2950
|
+
|
2951
|
+
async def fetch_position(self, symbol: str, params={}) -> Position:
|
2952
|
+
"""
|
2953
|
+
fetch data on a single open contract trade position
|
2954
|
+
|
2955
|
+
https://docs.whitebit.com/private/http-trade-v4/#open-positions
|
2956
|
+
|
2957
|
+
:param str symbol: unified market symbol of the market the position is held in
|
2958
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2959
|
+
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
2960
|
+
"""
|
2961
|
+
await self.load_markets()
|
2962
|
+
market = self.market(symbol)
|
2963
|
+
request: dict = {
|
2964
|
+
'symbol': market['id'],
|
2965
|
+
}
|
2966
|
+
response = await self.v4PrivatePostCollateralAccountPositionsOpen(self.extend(request, params))
|
2967
|
+
#
|
2968
|
+
# [
|
2969
|
+
# {
|
2970
|
+
# "positionId": 479975679,
|
2971
|
+
# "market": "BTC_PERP",
|
2972
|
+
# "openDate": 1741941025.3098869,
|
2973
|
+
# "modifyDate": 1741941025.3098869,
|
2974
|
+
# "amount": "0.001",
|
2975
|
+
# "basePrice": "82498.7",
|
2976
|
+
# "liquidationPrice": "70177.2",
|
2977
|
+
# "pnl": "0",
|
2978
|
+
# "pnlPercent": "0.00",
|
2979
|
+
# "margin": "4.2",
|
2980
|
+
# "freeMargin": "9.9",
|
2981
|
+
# "funding": "0",
|
2982
|
+
# "unrealizedFunding": "0",
|
2983
|
+
# "liquidationState": null,
|
2984
|
+
# "tpsl": null
|
2985
|
+
# }
|
2986
|
+
# ]
|
2987
|
+
#
|
2988
|
+
data = self.safe_dict(response, 0, {})
|
2989
|
+
return self.parse_position(data, market)
|
2990
|
+
|
2991
|
+
def parse_position(self, position: dict, market: Market = None) -> Position:
|
2992
|
+
#
|
2993
|
+
# fetchPosition, fetchPositions
|
2994
|
+
#
|
2995
|
+
# {
|
2996
|
+
# "positionId": 479975679,
|
2997
|
+
# "market": "BTC_PERP",
|
2998
|
+
# "openDate": 1741941025.3098869,
|
2999
|
+
# "modifyDate": 1741941025.3098869,
|
3000
|
+
# "amount": "0.001",
|
3001
|
+
# "basePrice": "82498.7",
|
3002
|
+
# "liquidationPrice": "70177.2",
|
3003
|
+
# "pnl": "0",
|
3004
|
+
# "pnlPercent": "0.00",
|
3005
|
+
# "margin": "4.2",
|
3006
|
+
# "freeMargin": "9.9",
|
3007
|
+
# "funding": "0",
|
3008
|
+
# "unrealizedFunding": "0",
|
3009
|
+
# "liquidationState": null,
|
3010
|
+
# "tpsl": null
|
3011
|
+
# }
|
3012
|
+
#
|
3013
|
+
# fetchPositionHistory
|
3014
|
+
#
|
3015
|
+
# {
|
3016
|
+
# "positionId": 479975679,
|
3017
|
+
# "market": "BTC_PERP",
|
3018
|
+
# "openDate": 1741941025.309887,
|
3019
|
+
# "modifyDate": 1741941025.309887,
|
3020
|
+
# "amount": "0.001",
|
3021
|
+
# "basePrice": "82498.7",
|
3022
|
+
# "realizedFunding": "0",
|
3023
|
+
# "liquidationPrice": "0",
|
3024
|
+
# "liquidationState": null,
|
3025
|
+
# "orderDetail": {
|
3026
|
+
# "id": 1224727949521,
|
3027
|
+
# "tradeAmount": "0.001",
|
3028
|
+
# "price": "82498.7",
|
3029
|
+
# "tradeFee": "0.028874545",
|
3030
|
+
# "fundingFee": "0",
|
3031
|
+
# "realizedPnl": "-0.028874545"
|
3032
|
+
# }
|
3033
|
+
# }
|
3034
|
+
#
|
3035
|
+
marketId = self.safe_string(position, 'market')
|
3036
|
+
timestamp = self.safe_timestamp(position, 'openDate')
|
3037
|
+
tpsl = self.safe_dict(position, 'tpsl', {})
|
3038
|
+
orderDetail = self.safe_dict(position, 'orderDetail', {})
|
3039
|
+
return self.safe_position({
|
3040
|
+
'info': position,
|
3041
|
+
'id': self.safe_string(position, 'positionId'),
|
3042
|
+
'symbol': self.safe_symbol(marketId, market),
|
3043
|
+
'notional': None,
|
3044
|
+
'marginMode': None,
|
3045
|
+
'liquidationPrice': self.safe_number(position, 'liquidationPrice'),
|
3046
|
+
'entryPrice': self.safe_number(position, 'basePrice'),
|
3047
|
+
'unrealizedPnl': self.safe_number(position, 'pnl'),
|
3048
|
+
'realizedPnl': self.safe_number(orderDetail, 'realizedPnl'),
|
3049
|
+
'percentage': self.safe_number(position, 'pnlPercent'),
|
3050
|
+
'contracts': None,
|
3051
|
+
'contractSize': None,
|
3052
|
+
'markPrice': None,
|
3053
|
+
'lastPrice': None,
|
3054
|
+
'side': None,
|
3055
|
+
'hedged': None,
|
3056
|
+
'timestamp': timestamp,
|
3057
|
+
'datetime': self.iso8601(timestamp),
|
3058
|
+
'lastUpdateTimestamp': self.safe_timestamp(position, 'modifyDate'),
|
3059
|
+
'maintenanceMargin': None,
|
3060
|
+
'maintenanceMarginPercentage': None,
|
3061
|
+
'collateral': self.safe_number(position, 'margin'),
|
3062
|
+
'initialMargin': None,
|
3063
|
+
'initialMarginPercentage': None,
|
3064
|
+
'leverage': None,
|
3065
|
+
'marginRatio': None,
|
3066
|
+
'stopLossPrice': self.safe_number(tpsl, 'stopLoss'),
|
3067
|
+
'takeProfitPrice': self.safe_number(tpsl, 'takeProfit'),
|
3068
|
+
})
|
3069
|
+
|
2862
3070
|
def is_fiat(self, currency: str) -> bool:
|
2863
3071
|
fiatCurrencies = self.safe_value(self.options, 'fiatCurrencies', [])
|
2864
3072
|
return self.in_array(currency, fiatCurrencies)
|
ccxt/base/exchange.py
CHANGED
ccxt/binance.py
CHANGED
@@ -11325,8 +11325,22 @@ class binance(Exchange, ImplicitAPI):
|
|
11325
11325
|
query = None
|
11326
11326
|
# handle batchOrders
|
11327
11327
|
if (path == 'batchOrders') and ((method == 'POST') or (method == 'PUT')):
|
11328
|
-
batchOrders = self.
|
11329
|
-
|
11328
|
+
batchOrders = self.safe_list(params, 'batchOrders')
|
11329
|
+
checkedBatchOrders = batchOrders
|
11330
|
+
if method == 'POST' and api == 'fapiPrivate':
|
11331
|
+
# check broker id if batchOrders are called with fapiPrivatePostBatchOrders
|
11332
|
+
checkedBatchOrders = []
|
11333
|
+
for i in range(0, len(batchOrders)):
|
11334
|
+
batchOrder = batchOrders[i]
|
11335
|
+
newClientOrderId = self.safe_string(batchOrder, 'newClientOrderId')
|
11336
|
+
if newClientOrderId is None:
|
11337
|
+
defaultId = 'x-xcKtGhcu' # batchOrders can not be spot or margin
|
11338
|
+
broker = self.safe_dict(self.options, 'broker', {})
|
11339
|
+
brokerId = self.safe_string(broker, 'future', defaultId)
|
11340
|
+
newClientOrderId = brokerId + self.uuid22()
|
11341
|
+
batchOrder['newClientOrderId'] = newClientOrderId
|
11342
|
+
checkedBatchOrders.append(batchOrder)
|
11343
|
+
queryBatch = (self.json(checkedBatchOrders))
|
11330
11344
|
params['batchOrders'] = queryBatch
|
11331
11345
|
defaultRecvWindow = self.safe_integer(self.options, 'recvWindow')
|
11332
11346
|
extendedParams = self.extend({
|
ccxt/bitstamp.py
CHANGED
@@ -1282,10 +1282,9 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
1282
1282
|
|
1283
1283
|
def parse_trading_fees(self, fees):
|
1284
1284
|
result: dict = {'info': fees}
|
1285
|
-
|
1286
|
-
for i in range(0, len(symbols)):
|
1287
|
-
symbol = symbols[i]
|
1285
|
+
for i in range(0, len(fees)):
|
1288
1286
|
fee = self.parse_trading_fee(fees[i])
|
1287
|
+
symbol = fee['symbol']
|
1289
1288
|
result[symbol] = fee
|
1290
1289
|
return result
|
1291
1290
|
|
ccxt/coinbase.py
CHANGED
@@ -4088,6 +4088,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
4088
4088
|
'amount': self.number_to_string(amount),
|
4089
4089
|
'currency': code.upper(), # need to use code in case depositing USD etc.
|
4090
4090
|
'payment_method': id,
|
4091
|
+
'commit': True, # otheriwse the deposit does not go through
|
4091
4092
|
}
|
4092
4093
|
response = self.v2PrivatePostAccountsAccountIdDeposits(self.extend(request, params))
|
4093
4094
|
#
|
@@ -4690,11 +4691,6 @@ class coinbase(Exchange, ImplicitAPI):
|
|
4690
4691
|
return result
|
4691
4692
|
|
4692
4693
|
def parse_portfolio_details(self, portfolioData: dict):
|
4693
|
-
"""
|
4694
|
-
Parse a Coinbase portfolio JSON object and extract relevant trading information.
|
4695
|
-
:param Dict portfolioData: The JSON response containing portfolio details
|
4696
|
-
:returns any[]: List of dictionaries with parsed portfolio position data
|
4697
|
-
"""
|
4698
4694
|
breakdown = portfolioData['breakdown']
|
4699
4695
|
portfolioInfo = self.safe_dict(breakdown, 'portfolio', {})
|
4700
4696
|
portfolioName = self.safe_string(portfolioInfo, 'name', 'Unknown')
|
ccxt/cryptomus.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.cryptomus import ImplicitAPI
|
8
|
-
from ccxt.base.types import Any, Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
|
8
|
+
from ccxt.base.types import Any, Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -23,7 +23,7 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
23
23
|
'name': 'Cryptomus',
|
24
24
|
'countries': ['CA'],
|
25
25
|
'rateLimit': 100, # todo check
|
26
|
-
'version': '
|
26
|
+
'version': 'v2',
|
27
27
|
'certified': False,
|
28
28
|
'pro': False,
|
29
29
|
'has': {
|
@@ -105,7 +105,7 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
105
105
|
'fetchTime': False,
|
106
106
|
'fetchTrades': True,
|
107
107
|
'fetchTradingFee': False,
|
108
|
-
'fetchTradingFees':
|
108
|
+
'fetchTradingFees': True,
|
109
109
|
'fetchTransactions': False,
|
110
110
|
'fetchTransfers': False,
|
111
111
|
'fetchWithdrawals': False,
|
@@ -143,9 +143,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
143
143
|
'private': {
|
144
144
|
'get': {
|
145
145
|
'v2/user-api/exchange/orders': 1, # done
|
146
|
-
'v2/user-api/exchange/orders/history': 1,
|
146
|
+
'v2/user-api/exchange/orders/history': 1, # done
|
147
147
|
'v2/user-api/exchange/account/balance': 1, # done
|
148
|
-
'v2/user-api/exchange/account/tariffs': 1,
|
148
|
+
'v2/user-api/exchange/account/tariffs': 1, # done
|
149
149
|
'v2/user-api/payment/services': 1,
|
150
150
|
'v2/user-api/payout/services': 1,
|
151
151
|
'v2/user-api/transaction/list': 1,
|
@@ -231,7 +231,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
231
231
|
def fetch_markets(self, params={}) -> List[Market]:
|
232
232
|
"""
|
233
233
|
retrieves data on all markets for the exchange
|
234
|
+
|
234
235
|
https://doc.cryptomus.com/personal/market-cap/tickers
|
236
|
+
|
235
237
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
236
238
|
:returns dict[]: an array of objects representing market data
|
237
239
|
"""
|
@@ -339,7 +341,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
339
341
|
def fetch_currencies(self, params={}) -> Currencies:
|
340
342
|
"""
|
341
343
|
fetches all available currencies on an exchange
|
344
|
+
|
342
345
|
https://doc.cryptomus.com/personal/market-cap/assets
|
346
|
+
|
343
347
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
344
348
|
:returns dict: an associative dictionary of currencies
|
345
349
|
"""
|
@@ -466,7 +470,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
466
470
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
467
471
|
"""
|
468
472
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
473
|
+
|
469
474
|
https://doc.cryptomus.com/personal/market-cap/tickers
|
475
|
+
|
470
476
|
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
471
477
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
472
478
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -528,7 +534,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
528
534
|
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
529
535
|
"""
|
530
536
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
537
|
+
|
531
538
|
https://doc.cryptomus.com/personal/market-cap/orderbook
|
539
|
+
|
532
540
|
:param str symbol: unified symbol of the market to fetch the order book for
|
533
541
|
:param int [limit]: the maximum amount of order book entries to return
|
534
542
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -570,7 +578,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
570
578
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
571
579
|
"""
|
572
580
|
get the list of most recent trades for a particular symbol
|
581
|
+
|
573
582
|
https://doc.cryptomus.com/personal/market-cap/trades
|
583
|
+
|
574
584
|
:param str symbol: unified symbol of the market to fetch trades for
|
575
585
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
576
586
|
:param int [limit]: the maximum amount of trades to fetch(maximum value is 100)
|
@@ -634,7 +644,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
634
644
|
def fetch_balance(self, params={}) -> Balances:
|
635
645
|
"""
|
636
646
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
647
|
+
|
637
648
|
https://doc.cryptomus.com/personal/converts/balance
|
649
|
+
|
638
650
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
639
651
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
640
652
|
"""
|
@@ -679,8 +691,10 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
679
691
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order:
|
680
692
|
"""
|
681
693
|
create a trade order
|
694
|
+
|
682
695
|
https://doc.cryptomus.com/personal/exchange/market-order-creation
|
683
696
|
https://doc.cryptomus.com/personal/exchange/limit-order-creation
|
697
|
+
|
684
698
|
:param str symbol: unified symbol of the market to create an order in
|
685
699
|
:param str type: 'market' or 'limit' or for spot
|
686
700
|
:param str side: 'buy' or 'sell'
|
@@ -688,7 +702,6 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
688
702
|
:param float [price]: the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders(only for limit orders)
|
689
703
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
690
704
|
:param float [params.cost]: *market buy only* the quote quantity that can be used alternative for the amount
|
691
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
692
705
|
:param str [params.clientOrderId]: a unique identifier for the order(optional)
|
693
706
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
694
707
|
"""
|
@@ -742,7 +755,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
742
755
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
743
756
|
"""
|
744
757
|
cancels an open limit order
|
758
|
+
|
745
759
|
https://doc.cryptomus.com/personal/exchange/limit-order-cancellation
|
760
|
+
|
746
761
|
:param str id: order id
|
747
762
|
:param str symbol: unified symbol of the market the order was made in(not used in cryptomus)
|
748
763
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -762,7 +777,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
762
777
|
def fetch_canceled_and_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
763
778
|
"""
|
764
779
|
fetches information on multiple orders made by the user
|
780
|
+
|
765
781
|
https://doc.cryptomus.com/personal/exchange/history-of-completed-orders
|
782
|
+
|
766
783
|
:param str symbol: unified market symbol of the market orders were made in(not used in cryptomus)
|
767
784
|
:param int [since]: the earliest time in ms to fetch orders for(not used in cryptomus)
|
768
785
|
:param int [limit]: the maximum number of order structures to retrieve(not used in cryptomus)
|
@@ -832,7 +849,9 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
832
849
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
833
850
|
"""
|
834
851
|
fetch all unfilled currently open orders
|
852
|
+
|
835
853
|
https://doc.cryptomus.com/personal/exchange/list-of-active-orders
|
854
|
+
|
836
855
|
:param str symbol: unified market symbol
|
837
856
|
:param int [since]: the earliest time in ms to fetch open orders for(not used in cryptomus)
|
838
857
|
:param int [limit]: the maximum number of open orders structures to retrieve(not used in cryptomus)
|
@@ -993,6 +1012,103 @@ class cryptomus(Exchange, ImplicitAPI):
|
|
993
1012
|
}
|
994
1013
|
return self.safe_string(statuses, status, status)
|
995
1014
|
|
1015
|
+
def fetch_trading_fees(self, params={}) -> TradingFees:
|
1016
|
+
"""
|
1017
|
+
fetch the trading fees for multiple markets
|
1018
|
+
|
1019
|
+
https://trade-docs.coinlist.co/?javascript--nodejs#list-fees
|
1020
|
+
|
1021
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1022
|
+
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
1023
|
+
"""
|
1024
|
+
response = self.privateGetV2UserApiExchangeAccountTariffs(params)
|
1025
|
+
#
|
1026
|
+
# {
|
1027
|
+
# result: {
|
1028
|
+
# equivalent_currency_code: 'USD',
|
1029
|
+
# current_tariff_step: {
|
1030
|
+
# step: '0',
|
1031
|
+
# from_turnover: '0.00000000',
|
1032
|
+
# maker_percent: '0.08',
|
1033
|
+
# taker_percent: '0.1'
|
1034
|
+
# },
|
1035
|
+
# tariff_steps: [
|
1036
|
+
# {
|
1037
|
+
# step: '0',
|
1038
|
+
# from_turnover: '0.00000000',
|
1039
|
+
# maker_percent: '0.08',
|
1040
|
+
# taker_percent: '0.1'
|
1041
|
+
# },
|
1042
|
+
# {
|
1043
|
+
# step: '1',
|
1044
|
+
# from_turnover: '100001.00000000',
|
1045
|
+
# maker_percent: '0.06',
|
1046
|
+
# taker_percent: '0.095'
|
1047
|
+
# },
|
1048
|
+
# {
|
1049
|
+
# step: '2',
|
1050
|
+
# from_turnover: '250001.00000000',
|
1051
|
+
# maker_percent: '0.055',
|
1052
|
+
# taker_percent: '0.085'
|
1053
|
+
# },
|
1054
|
+
# {
|
1055
|
+
# step: '3',
|
1056
|
+
# from_turnover: '500001.00000000',
|
1057
|
+
# maker_percent: '0.05',
|
1058
|
+
# taker_percent: '0.075'
|
1059
|
+
# },
|
1060
|
+
# {
|
1061
|
+
# step: '4',
|
1062
|
+
# from_turnover: '2500001.00000000',
|
1063
|
+
# maker_percent: '0.04',
|
1064
|
+
# taker_percent: '0.07'
|
1065
|
+
# }
|
1066
|
+
# ],
|
1067
|
+
# daily_turnover: '0.00000000',
|
1068
|
+
# monthly_turnover: '77.52062617',
|
1069
|
+
# circulation_funds: '25.48900443'
|
1070
|
+
# }
|
1071
|
+
# }
|
1072
|
+
#
|
1073
|
+
data = self.safe_dict(response, 'result', {})
|
1074
|
+
currentFeeTier = self.safe_dict(data, 'current_tariff_step', {})
|
1075
|
+
makerFee = self.safe_string(currentFeeTier, 'maker_percent')
|
1076
|
+
takerFee = self.safe_string(currentFeeTier, 'taker_percent')
|
1077
|
+
makerFee = Precise.string_div(makerFee, '100')
|
1078
|
+
takerFee = Precise.string_div(takerFee, '100')
|
1079
|
+
feeTiers = self.safe_list(data, 'tariff_steps', [])
|
1080
|
+
result: dict = {}
|
1081
|
+
tiers = self.parse_fee_tiers(feeTiers)
|
1082
|
+
for i in range(0, len(self.symbols)):
|
1083
|
+
symbol = self.symbols[i]
|
1084
|
+
result[symbol] = {
|
1085
|
+
'info': response,
|
1086
|
+
'symbol': symbol,
|
1087
|
+
'maker': self.parse_number(makerFee),
|
1088
|
+
'taker': self.parse_number(takerFee),
|
1089
|
+
'percentage': True,
|
1090
|
+
'tierBased': True,
|
1091
|
+
'tiers': tiers,
|
1092
|
+
}
|
1093
|
+
return result
|
1094
|
+
|
1095
|
+
def parse_fee_tiers(self, feeTiers, market: Market = None):
|
1096
|
+
takerFees = []
|
1097
|
+
makerFees = []
|
1098
|
+
for i in range(0, len(feeTiers)):
|
1099
|
+
tier = feeTiers[i]
|
1100
|
+
turnover = self.safe_number(tier, 'from_turnover')
|
1101
|
+
taker = self.safe_string(tier, 'taker_percent')
|
1102
|
+
maker = self.safe_string(tier, 'maker_percent')
|
1103
|
+
maker = Precise.string_div(maker, '100')
|
1104
|
+
taker = Precise.string_div(taker, '100')
|
1105
|
+
makerFees.append([turnover, self.parse_number(maker)])
|
1106
|
+
takerFees.append([turnover, self.parse_number(taker)])
|
1107
|
+
return {
|
1108
|
+
'maker': makerFees,
|
1109
|
+
'taker': takerFees,
|
1110
|
+
}
|
1111
|
+
|
996
1112
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
997
1113
|
endpoint = self.implode_params(path, params)
|
998
1114
|
params = self.omit(params, self.extract_params(path))
|
ccxt/hyperliquid.py
CHANGED
@@ -837,7 +837,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
837
837
|
'info': response,
|
838
838
|
'USDC': {
|
839
839
|
'total': self.safe_number(data, 'accountValue'),
|
840
|
-
'
|
840
|
+
'used': self.safe_number(data, 'totalMarginUsed'),
|
841
841
|
},
|
842
842
|
}
|
843
843
|
timestamp = self.safe_integer(response, 'time')
|