ccxt 4.4.64__py2.py3-none-any.whl → 4.4.67__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 +5 -3
- ccxt/abstract/cryptomus.py +20 -0
- ccxt/abstract/derive.py +117 -0
- ccxt/abstract/tradeogre.py +1 -0
- ccxt/abstract/whitebit.py +16 -0
- ccxt/async_support/__init__.py +5 -3
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +5 -3
- ccxt/async_support/bitget.py +22 -12
- ccxt/async_support/bitrue.py +5 -2
- ccxt/async_support/cryptocom.py +2 -0
- ccxt/async_support/cryptomus.py +1041 -0
- ccxt/async_support/derive.py +2530 -0
- ccxt/async_support/gate.py +5 -1
- ccxt/async_support/htx.py +19 -5
- ccxt/async_support/hyperliquid.py +108 -68
- ccxt/async_support/paradex.py +51 -12
- ccxt/async_support/tradeogre.py +131 -13
- ccxt/async_support/whitebit.py +276 -2
- ccxt/base/errors.py +0 -6
- ccxt/base/exchange.py +8 -1
- ccxt/binance.py +5 -3
- ccxt/bitget.py +22 -12
- ccxt/bitrue.py +5 -2
- ccxt/cryptocom.py +2 -0
- ccxt/cryptomus.py +1041 -0
- ccxt/derive.py +2529 -0
- ccxt/gate.py +5 -1
- ccxt/htx.py +19 -5
- ccxt/hyperliquid.py +108 -68
- ccxt/paradex.py +51 -12
- ccxt/pro/__init__.py +3 -3
- ccxt/pro/bybit.py +3 -2
- ccxt/pro/derive.py +704 -0
- ccxt/pro/gate.py +5 -2
- ccxt/pro/hyperliquid.py +3 -3
- ccxt/test/tests_async.py +36 -3
- ccxt/test/tests_sync.py +36 -3
- ccxt/tradeogre.py +131 -13
- ccxt/whitebit.py +276 -2
- {ccxt-4.4.64.dist-info → ccxt-4.4.67.dist-info}/METADATA +14 -10
- {ccxt-4.4.64.dist-info → ccxt-4.4.67.dist-info}/RECORD +45 -42
- ccxt/abstract/currencycom.py +0 -68
- ccxt/async_support/currencycom.py +0 -2070
- ccxt/currencycom.py +0 -2070
- ccxt/pro/currencycom.py +0 -536
- {ccxt-4.4.64.dist-info → ccxt-4.4.67.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.64.dist-info → ccxt-4.4.67.dist-info}/WHEEL +0 -0
- {ccxt-4.4.64.dist-info → ccxt-4.4.67.dist-info}/top_level.txt +0 -0
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, Currencies, Currency, DepositAddress, 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, 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
|
@@ -45,6 +45,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
45
45
|
'cancelAllOrdersAfter': True,
|
46
46
|
'cancelOrder': True,
|
47
47
|
'cancelOrders': False,
|
48
|
+
'createConvertTrade': True,
|
48
49
|
'createMarketBuyOrderWithCost': True,
|
49
50
|
'createMarketOrderWithCost': False,
|
50
51
|
'createMarketSellOrderWithCost': False,
|
@@ -57,6 +58,9 @@ class whitebit(Exchange, ImplicitAPI):
|
|
57
58
|
'fetchBorrowRateHistories': False,
|
58
59
|
'fetchBorrowRateHistory': False,
|
59
60
|
'fetchClosedOrders': True,
|
61
|
+
'fetchConvertQuote': True,
|
62
|
+
'fetchConvertTrade': False,
|
63
|
+
'fetchConvertTradeHistory': True,
|
60
64
|
'fetchCrossBorrowRate': False,
|
61
65
|
'fetchCrossBorrowRates': False,
|
62
66
|
'fetchCurrencies': True,
|
@@ -68,7 +72,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
68
72
|
'fetchDepositsWithdrawals': True,
|
69
73
|
'fetchDepositWithdrawFee': 'emulated',
|
70
74
|
'fetchDepositWithdrawFees': True,
|
71
|
-
'fetchFundingHistory':
|
75
|
+
'fetchFundingHistory': True,
|
72
76
|
'fetchFundingRate': True,
|
73
77
|
'fetchFundingRateHistory': False,
|
74
78
|
'fetchFundingRates': True,
|
@@ -186,6 +190,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
186
190
|
'assets',
|
187
191
|
'collateral/markets',
|
188
192
|
'fee',
|
193
|
+
'orderbook/depth/{market}',
|
189
194
|
'orderbook/{market}',
|
190
195
|
'ticker',
|
191
196
|
'trades/{market}',
|
@@ -194,6 +199,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
194
199
|
'markets',
|
195
200
|
'futures',
|
196
201
|
'platform/status',
|
202
|
+
'mining-pool',
|
197
203
|
],
|
198
204
|
},
|
199
205
|
'private': {
|
@@ -204,6 +210,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
204
210
|
'collateral-account/leverage',
|
205
211
|
'collateral-account/positions/open',
|
206
212
|
'collateral-account/summary',
|
213
|
+
'collateral-account/funding-history',
|
207
214
|
'main-account/address',
|
208
215
|
'main-account/balance',
|
209
216
|
'main-account/create-new-address',
|
@@ -230,6 +237,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
230
237
|
'order/collateral/market',
|
231
238
|
'order/collateral/stop-limit',
|
232
239
|
'order/collateral/trigger-market',
|
240
|
+
'order/collateral/bulk',
|
233
241
|
'order/new',
|
234
242
|
'order/market',
|
235
243
|
'order/stock_market',
|
@@ -241,6 +249,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
241
249
|
'order/kill-switch/status',
|
242
250
|
'order/bulk',
|
243
251
|
'order/modify',
|
252
|
+
'order/conditional-cancel',
|
244
253
|
'orders',
|
245
254
|
'oco-orders',
|
246
255
|
'order/collateral/oco',
|
@@ -259,6 +268,17 @@ class whitebit(Exchange, ImplicitAPI):
|
|
259
268
|
'sub-account/unblock',
|
260
269
|
'sub-account/balances',
|
261
270
|
'sub-account/transfer/history',
|
271
|
+
'sub-account/api-key/create',
|
272
|
+
'sub-account/api-key/edit',
|
273
|
+
'sub-account/api-key/delete',
|
274
|
+
'sub-account/api-key/list',
|
275
|
+
'sub-account/api-key/reset',
|
276
|
+
'sub-account/api-key/ip-address/list',
|
277
|
+
'sub-account/api-key/ip-address/create',
|
278
|
+
'sub-account/api-key/ip-address/delete',
|
279
|
+
'mining/rewards',
|
280
|
+
'market/fee',
|
281
|
+
'conditional-orders',
|
262
282
|
],
|
263
283
|
},
|
264
284
|
},
|
@@ -2515,6 +2535,84 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2515
2535
|
'interval': None,
|
2516
2536
|
}
|
2517
2537
|
|
2538
|
+
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[FundingHistory]:
|
2539
|
+
"""
|
2540
|
+
fetch the history of funding payments paid and received on self account
|
2541
|
+
|
2542
|
+
https://docs.whitebit.com/private/http-trade-v4/#funding-history
|
2543
|
+
|
2544
|
+
:param str [symbol]: unified market symbol
|
2545
|
+
:param int [since]: the starting timestamp in milliseconds
|
2546
|
+
:param int [limit]: the number of entries to return
|
2547
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2548
|
+
:param int [params.until]: the latest time in ms to fetch funding history for
|
2549
|
+
:returns dict[]: a list of `funding history structures <https://docs.ccxt.com/#/?id=funding-history-structure>`
|
2550
|
+
"""
|
2551
|
+
await self.load_markets()
|
2552
|
+
if symbol is None:
|
2553
|
+
raise ArgumentsRequired(self.id + ' fetchFundingHistory() requires a symbol argument')
|
2554
|
+
market = self.market(symbol)
|
2555
|
+
request: dict = {
|
2556
|
+
'market': market['id'],
|
2557
|
+
}
|
2558
|
+
if since is not None:
|
2559
|
+
request['startDate'] = since
|
2560
|
+
if limit is not None:
|
2561
|
+
request['limit'] = since
|
2562
|
+
request, params = self.handle_until_option('endDate', request, params)
|
2563
|
+
response = await self.v4PrivatePostCollateralAccountFundingHistory(request)
|
2564
|
+
#
|
2565
|
+
# {
|
2566
|
+
# "records": [
|
2567
|
+
# {
|
2568
|
+
# "market": "BTC_PERP",
|
2569
|
+
# "fundingTime": "1708704000000",
|
2570
|
+
# "fundingRate": "0.00017674",
|
2571
|
+
# "fundingAmount": "-0.171053531892",
|
2572
|
+
# "positionAmount": "0.019",
|
2573
|
+
# "settlementPrice": "50938.2",
|
2574
|
+
# "rateCalculatedTime": "1708675200000"
|
2575
|
+
# },
|
2576
|
+
# ],
|
2577
|
+
# "limit": 100,
|
2578
|
+
# "offset": 0
|
2579
|
+
# }
|
2580
|
+
#
|
2581
|
+
data = self.safe_list(response, 'records', [])
|
2582
|
+
return self.parse_funding_histories(data, market, since, limit)
|
2583
|
+
|
2584
|
+
def parse_funding_history(self, contract, market: Market = None):
|
2585
|
+
#
|
2586
|
+
# {
|
2587
|
+
# "market": "BTC_PERP",
|
2588
|
+
# "fundingTime": "1708704000000",
|
2589
|
+
# "fundingRate": "0.00017674",
|
2590
|
+
# "fundingAmount": "-0.171053531892",
|
2591
|
+
# "positionAmount": "0.019",
|
2592
|
+
# "settlementPrice": "50938.2",
|
2593
|
+
# "rateCalculatedTime": "1708675200000"
|
2594
|
+
# }
|
2595
|
+
#
|
2596
|
+
marketId = self.safe_string(contract, 'market')
|
2597
|
+
timestamp = self.safe_integer(contract, 'fundingTime')
|
2598
|
+
return {
|
2599
|
+
'info': contract,
|
2600
|
+
'symbol': self.safe_symbol(marketId, market, None, 'swap'),
|
2601
|
+
'code': None,
|
2602
|
+
'timestamp': timestamp,
|
2603
|
+
'datetime': self.iso8601(timestamp),
|
2604
|
+
'id': None,
|
2605
|
+
'amount': self.safe_number(contract, 'fundingAmount'),
|
2606
|
+
}
|
2607
|
+
|
2608
|
+
def parse_funding_histories(self, contracts, market=None, since: Int = None, limit: Int = None) -> List[FundingHistory]:
|
2609
|
+
result = []
|
2610
|
+
for i in range(0, len(contracts)):
|
2611
|
+
contract = contracts[i]
|
2612
|
+
result.append(self.parse_funding_history(contract, market))
|
2613
|
+
sorted = self.sort_by(result, 'timestamp')
|
2614
|
+
return self.filter_by_since_limit(sorted, since, limit)
|
2615
|
+
|
2518
2616
|
async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
2519
2617
|
"""
|
2520
2618
|
fetch history of deposits and withdrawals
|
@@ -2585,6 +2683,182 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2585
2683
|
records = self.safe_list(response, 'records')
|
2586
2684
|
return self.parse_transactions(records, currency, since, limit)
|
2587
2685
|
|
2686
|
+
async def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
|
2687
|
+
"""
|
2688
|
+
fetch a quote for converting from one currency to another
|
2689
|
+
|
2690
|
+
https://docs.whitebit.com/private/http-trade-v4/#convert-estimate
|
2691
|
+
|
2692
|
+
:param str fromCode: the currency that you want to sell and convert from
|
2693
|
+
:param str toCode: the currency that you want to buy and convert into
|
2694
|
+
:param float amount: how much you want to trade in units of the from currency
|
2695
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2696
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
2697
|
+
"""
|
2698
|
+
await self.load_markets()
|
2699
|
+
fromCurrency = self.currency(fromCode)
|
2700
|
+
toCurrency = self.currency(toCode)
|
2701
|
+
request: dict = {
|
2702
|
+
'from': fromCode,
|
2703
|
+
'to': toCode,
|
2704
|
+
'amount': self.number_to_string(amount),
|
2705
|
+
'direction': 'from',
|
2706
|
+
}
|
2707
|
+
response = await self.v4PrivatePostConvertEstimate(self.extend(request, params))
|
2708
|
+
#
|
2709
|
+
# {
|
2710
|
+
# "give": "4",
|
2711
|
+
# "receive": "0.00004762",
|
2712
|
+
# "rate": "0.0000119",
|
2713
|
+
# "id": "1740889",
|
2714
|
+
# "expireAt": 1741090147,
|
2715
|
+
# "from": "USDT",
|
2716
|
+
# "to": "BTC"
|
2717
|
+
# }
|
2718
|
+
#
|
2719
|
+
return self.parse_conversion(response, fromCurrency, toCurrency)
|
2720
|
+
|
2721
|
+
async def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
|
2722
|
+
"""
|
2723
|
+
convert from one currency to another
|
2724
|
+
|
2725
|
+
https://docs.whitebit.com/private/http-trade-v4/#convert-confirm
|
2726
|
+
|
2727
|
+
:param str id: the id of the trade that you want to make
|
2728
|
+
:param str fromCode: the currency that you want to sell and convert from
|
2729
|
+
:param str toCode: the currency that you want to buy and convert into
|
2730
|
+
:param float [amount]: how much you want to trade in units of the from currency
|
2731
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2732
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
2733
|
+
"""
|
2734
|
+
await self.load_markets()
|
2735
|
+
fromCurrency = self.currency(fromCode)
|
2736
|
+
toCurrency = self.currency(toCode)
|
2737
|
+
request: dict = {
|
2738
|
+
'quoteId': id,
|
2739
|
+
}
|
2740
|
+
response = await self.v4PrivatePostConvertConfirm(self.extend(request, params))
|
2741
|
+
#
|
2742
|
+
# {
|
2743
|
+
# "finalGive": "4",
|
2744
|
+
# "finalReceive": "0.00004772"
|
2745
|
+
# }
|
2746
|
+
#
|
2747
|
+
return self.parse_conversion(response, fromCurrency, toCurrency)
|
2748
|
+
|
2749
|
+
async def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
|
2750
|
+
"""
|
2751
|
+
fetch the users history of conversion trades
|
2752
|
+
|
2753
|
+
https://docs.whitebit.com/private/http-trade-v4/#convert-history
|
2754
|
+
|
2755
|
+
:param str [code]: the unified currency code
|
2756
|
+
:param int [since]: the earliest time in ms to fetch conversions for
|
2757
|
+
:param int [limit]: the maximum number of conversion structures to retrieve, default 20, max 200
|
2758
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2759
|
+
:param str [params.until]: the end time in ms
|
2760
|
+
:param str [params.fromTicker]: the currency that you sold and converted from
|
2761
|
+
:param str [params.toTicker]: the currency that you bought and converted into
|
2762
|
+
:param str [params.quoteId]: the quote id of the conversion
|
2763
|
+
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
|
2764
|
+
"""
|
2765
|
+
await self.load_markets()
|
2766
|
+
request: dict = {}
|
2767
|
+
if code is not None:
|
2768
|
+
request['fromTicker'] = code
|
2769
|
+
if since is not None:
|
2770
|
+
start = self.parse_to_int(since / 1000)
|
2771
|
+
request['from'] = self.number_to_string(start)
|
2772
|
+
if limit is not None:
|
2773
|
+
request['limit'] = limit
|
2774
|
+
request, params = self.handle_until_option('to', request, params, 0.001)
|
2775
|
+
response = await self.v4PrivatePostConvertHistory(self.extend(request, params))
|
2776
|
+
#
|
2777
|
+
# {
|
2778
|
+
# "records": [
|
2779
|
+
# {
|
2780
|
+
# "id": "1741105",
|
2781
|
+
# "path": [
|
2782
|
+
# {
|
2783
|
+
# "from": "USDT",
|
2784
|
+
# "to": "BTC",
|
2785
|
+
# "rate": "0.00001193"
|
2786
|
+
# }
|
2787
|
+
# ],
|
2788
|
+
# "date": 1741090757,
|
2789
|
+
# "give": "4",
|
2790
|
+
# "receive": "0.00004772",
|
2791
|
+
# "rate": "0.00001193"
|
2792
|
+
# }
|
2793
|
+
# ],
|
2794
|
+
# "total": 1,
|
2795
|
+
# "limit": 100,
|
2796
|
+
# "offset": 0
|
2797
|
+
# }
|
2798
|
+
#
|
2799
|
+
rows = self.safe_list(response, 'records', [])
|
2800
|
+
return self.parse_conversions(rows, code, 'fromCurrency', 'toCurrency', since, limit)
|
2801
|
+
|
2802
|
+
def parse_conversion(self, conversion: dict, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
|
2803
|
+
#
|
2804
|
+
# fetchConvertQuote
|
2805
|
+
#
|
2806
|
+
# {
|
2807
|
+
# "give": "4",
|
2808
|
+
# "receive": "0.00004762",
|
2809
|
+
# "rate": "0.0000119",
|
2810
|
+
# "id": "1740889",
|
2811
|
+
# "expireAt": 1741090147,
|
2812
|
+
# "from": "USDT",
|
2813
|
+
# "to": "BTC"
|
2814
|
+
# }
|
2815
|
+
#
|
2816
|
+
# createConvertTrade
|
2817
|
+
#
|
2818
|
+
# {
|
2819
|
+
# "finalGive": "4",
|
2820
|
+
# "finalReceive": "0.00004772"
|
2821
|
+
# }
|
2822
|
+
#
|
2823
|
+
# fetchConvertTradeHistory
|
2824
|
+
#
|
2825
|
+
# {
|
2826
|
+
# "id": "1741105",
|
2827
|
+
# "path": [
|
2828
|
+
# {
|
2829
|
+
# "from": "USDT",
|
2830
|
+
# "to": "BTC",
|
2831
|
+
# "rate": "0.00001193"
|
2832
|
+
# }
|
2833
|
+
# ],
|
2834
|
+
# "date": 1741090757,
|
2835
|
+
# "give": "4",
|
2836
|
+
# "receive": "0.00004772",
|
2837
|
+
# "rate": "0.00001193"
|
2838
|
+
# }
|
2839
|
+
#
|
2840
|
+
path = self.safe_list(conversion, 'path', [])
|
2841
|
+
first = self.safe_dict(path, 0, {})
|
2842
|
+
fromPath = self.safe_string(first, 'from')
|
2843
|
+
toPath = self.safe_string(first, 'to')
|
2844
|
+
timestamp = self.safe_timestamp_2(conversion, 'date', 'expireAt')
|
2845
|
+
fromCoin = self.safe_string(conversion, 'from', fromPath)
|
2846
|
+
fromCode = self.safe_currency_code(fromCoin, fromCurrency)
|
2847
|
+
toCoin = self.safe_string(conversion, 'to', toPath)
|
2848
|
+
toCode = self.safe_currency_code(toCoin, toCurrency)
|
2849
|
+
return {
|
2850
|
+
'info': conversion,
|
2851
|
+
'timestamp': timestamp,
|
2852
|
+
'datetime': self.iso8601(timestamp),
|
2853
|
+
'id': self.safe_string(conversion, 'id'),
|
2854
|
+
'fromCurrency': fromCode,
|
2855
|
+
'fromAmount': self.safe_number_2(conversion, 'give', 'finalGive'),
|
2856
|
+
'toCurrency': toCode,
|
2857
|
+
'toAmount': self.safe_number_2(conversion, 'receive', 'finalReceive'),
|
2858
|
+
'price': self.safe_number(conversion, 'rate'),
|
2859
|
+
'fee': None,
|
2860
|
+
}
|
2861
|
+
|
2588
2862
|
def is_fiat(self, currency: str) -> bool:
|
2589
2863
|
fiatCurrencies = self.safe_value(self.options, 'fiatCurrencies', [])
|
2590
2864
|
return self.in_array(currency, fiatCurrencies)
|
ccxt/base/errors.py
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
|
-
|
3
|
-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
4
|
-
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
5
|
-
# EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
6
|
-
|
7
1
|
error_hierarchy = {
|
8
2
|
'BaseError': {
|
9
3
|
'ExchangeError': {
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.67'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -1742,9 +1742,15 @@ class Exchange(object):
|
|
1742
1742
|
def create_safe_dictionary(self):
|
1743
1743
|
return {}
|
1744
1744
|
|
1745
|
+
def convert_to_safe_dictionary(self, dictionary):
|
1746
|
+
return dictionary
|
1747
|
+
|
1745
1748
|
def rand_number(self, size):
|
1746
1749
|
return int(''.join([str(random.randint(0, 9)) for _ in range(size)]))
|
1747
1750
|
|
1751
|
+
def binary_length(self, binary):
|
1752
|
+
return len(binary)
|
1753
|
+
|
1748
1754
|
# ########################################################################
|
1749
1755
|
# ########################################################################
|
1750
1756
|
# ########################################################################
|
@@ -2001,6 +2007,7 @@ class Exchange(object):
|
|
2001
2007
|
'watchOHLCV': None,
|
2002
2008
|
'watchOHLCVForSymbols': None,
|
2003
2009
|
'watchOrderBook': None,
|
2010
|
+
'watchBidsAsks': None,
|
2004
2011
|
'watchOrderBookForSymbols': None,
|
2005
2012
|
'watchOrders': None,
|
2006
2013
|
'watchOrdersForSymbols': None,
|
ccxt/binance.py
CHANGED
@@ -6167,7 +6167,8 @@ class binance(Exchange, ImplicitAPI):
|
|
6167
6167
|
# don't handle/omit params here, omitting happens inside createOrderRequest
|
6168
6168
|
marketType = self.safe_string(params, 'type', market['type'])
|
6169
6169
|
marginMode = self.safe_string(params, 'marginMode')
|
6170
|
-
|
6170
|
+
porfolioOptionsValue = self.safe_bool_2(self.options, 'papi', 'portfolioMargin', False)
|
6171
|
+
isPortfolioMargin = self.safe_bool_2(params, 'papi', 'portfolioMargin', porfolioOptionsValue)
|
6171
6172
|
triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
|
6172
6173
|
stopLossPrice = self.safe_string(params, 'stopLossPrice')
|
6173
6174
|
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
@@ -6179,8 +6180,9 @@ class binance(Exchange, ImplicitAPI):
|
|
6179
6180
|
sor = self.safe_bool_2(params, 'sor', 'SOR', False)
|
6180
6181
|
test = self.safe_bool(params, 'test', False)
|
6181
6182
|
params = self.omit(params, ['sor', 'SOR', 'test'])
|
6182
|
-
if isPortfolioMargin:
|
6183
|
-
|
6183
|
+
# if isPortfolioMargin:
|
6184
|
+
# params['portfolioMargin'] = isPortfolioMargin
|
6185
|
+
# }
|
6184
6186
|
request = self.create_order_request(symbol, type, side, amount, price, params)
|
6185
6187
|
response = None
|
6186
6188
|
if market['option']:
|
ccxt/bitget.py
CHANGED
@@ -2338,16 +2338,16 @@ class bitget(Exchange, ImplicitAPI):
|
|
2338
2338
|
paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
|
2339
2339
|
if paginate:
|
2340
2340
|
return self.fetch_paginated_call_cursor('fetchDeposits', None, since, limit, params, 'idLessThan', 'idLessThan', None, 100)
|
2341
|
-
if code is None:
|
2342
|
-
raise ArgumentsRequired(self.id + ' fetchDeposits() requires a `code` argument')
|
2343
|
-
currency = self.currency(code)
|
2344
2341
|
if since is None:
|
2345
2342
|
since = self.milliseconds() - 7776000000 # 90 days
|
2346
2343
|
request: dict = {
|
2347
|
-
'coin': currency['id'],
|
2348
2344
|
'startTime': since,
|
2349
2345
|
'endTime': self.milliseconds(),
|
2350
2346
|
}
|
2347
|
+
currency = None
|
2348
|
+
if code is not None:
|
2349
|
+
currency = self.currency(code)
|
2350
|
+
request['coin'] = currency['id']
|
2351
2351
|
if limit is not None:
|
2352
2352
|
request['limit'] = limit
|
2353
2353
|
request, params = self.handle_until_option('endTime', request, params)
|
@@ -2376,7 +2376,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2376
2376
|
# }
|
2377
2377
|
#
|
2378
2378
|
rawTransactions = self.safe_list(response, 'data', [])
|
2379
|
-
return self.parse_transactions(rawTransactions,
|
2379
|
+
return self.parse_transactions(rawTransactions, None, since, limit)
|
2380
2380
|
|
2381
2381
|
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
2382
2382
|
"""
|
@@ -4669,7 +4669,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
4669
4669
|
elif isTakeProfitOrder or isStopLossOrder:
|
4670
4670
|
request['marginCoin'] = market['settleId']
|
4671
4671
|
request['size'] = self.amount_to_precision(symbol, amount)
|
4672
|
-
|
4672
|
+
if price is not None:
|
4673
|
+
request['executePrice'] = self.price_to_precision(symbol, price)
|
4673
4674
|
if isStopLossOrder:
|
4674
4675
|
request['triggerPrice'] = self.price_to_precision(symbol, stopLossPrice)
|
4675
4676
|
elif isTakeProfitOrder:
|
@@ -5450,10 +5451,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
5450
5451
|
:param int [since]: timestamp in ms of the earliest order
|
5451
5452
|
:param int [limit]: the max number of closed orders to return
|
5452
5453
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5453
|
-
:param int [params.until]: the latest time in ms to fetch
|
5454
|
+
:param int [params.until]: the latest time in ms to fetch orders for
|
5455
|
+
:param str [params.planType]: *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
|
5456
|
+
:param boolean [params.trigger]: set to True for fetching trigger orders
|
5454
5457
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
5455
5458
|
:param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
5456
|
-
:param str [params.productType]: *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
5457
5459
|
:param boolean [params.trailing]: set to True if you want to fetch trailing orders
|
5458
5460
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5459
5461
|
"""
|
@@ -5476,10 +5478,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
5476
5478
|
:param int [since]: timestamp in ms of the earliest order
|
5477
5479
|
:param int [limit]: the max number of canceled orders to return
|
5478
5480
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5479
|
-
:param int [params.until]: the latest time in ms to fetch
|
5481
|
+
:param int [params.until]: the latest time in ms to fetch orders for
|
5482
|
+
:param str [params.planType]: *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
|
5483
|
+
:param boolean [params.trigger]: set to True for fetching trigger orders
|
5480
5484
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
5481
5485
|
:param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
5482
|
-
:param str [params.productType]: *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
5483
5486
|
:param boolean [params.trailing]: set to True if you want to fetch trailing orders
|
5484
5487
|
:returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5485
5488
|
"""
|
@@ -5502,6 +5505,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
5502
5505
|
:param int [since]: the earliest time in ms to fetch orders for
|
5503
5506
|
:param int [limit]: the maximum number of order structures to retrieve
|
5504
5507
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5508
|
+
:param int [params.until]: the latest time in ms to fetch orders for
|
5509
|
+
:param str [params.planType]: *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
|
5510
|
+
:param boolean [params.trigger]: set to True for fetching trigger orders
|
5511
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
5512
|
+
:param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
5513
|
+
:param boolean [params.trailing]: set to True if you want to fetch trailing orders
|
5505
5514
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5506
5515
|
"""
|
5507
5516
|
self.load_markets()
|
@@ -5530,7 +5539,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5530
5539
|
cursorReceived = 'endId'
|
5531
5540
|
return self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan')
|
5532
5541
|
response = None
|
5533
|
-
trailing = self.
|
5542
|
+
trailing = self.safe_bool(params, 'trailing')
|
5534
5543
|
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5535
5544
|
params = self.omit(params, ['stop', 'trigger', 'trailing'])
|
5536
5545
|
request, params = self.handle_until_option('endTime', request, params)
|
@@ -5570,11 +5579,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
5570
5579
|
productType = None
|
5571
5580
|
productType, params = self.handle_product_type_and_params(market, params)
|
5572
5581
|
request['productType'] = productType
|
5582
|
+
planTypeDefined = self.safe_string(params, 'planType') is not None
|
5573
5583
|
if trailing:
|
5574
5584
|
planType = self.safe_string(params, 'planType', 'track_plan')
|
5575
5585
|
request['planType'] = planType
|
5576
5586
|
response = self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
|
5577
|
-
elif trigger:
|
5587
|
+
elif trigger or planTypeDefined:
|
5578
5588
|
planType = self.safe_string(params, 'planType', 'normal_plan')
|
5579
5589
|
request['planType'] = planType
|
5580
5590
|
response = self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
|
ccxt/bitrue.py
CHANGED
@@ -1385,6 +1385,7 @@ class bitrue(Exchange, ImplicitAPI):
|
|
1385
1385
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
1386
1386
|
:param int [limit]: the maximum amount of candles to fetch
|
1387
1387
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1388
|
+
:param int [params.until]: the latest time in ms to fetch transfers for
|
1388
1389
|
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
1389
1390
|
"""
|
1390
1391
|
self.load_markets()
|
@@ -1415,8 +1416,10 @@ class bitrue(Exchange, ImplicitAPI):
|
|
1415
1416
|
}
|
1416
1417
|
if limit is not None:
|
1417
1418
|
request['limit'] = limit
|
1418
|
-
|
1419
|
-
|
1419
|
+
until = self.safe_integer(params, 'until')
|
1420
|
+
if until is not None:
|
1421
|
+
params = self.omit(params, 'until')
|
1422
|
+
request['fromIdx'] = until
|
1420
1423
|
response = self.spotV1PublicGetMarketKline(self.extend(request, params))
|
1421
1424
|
data = self.safe_list(response, 'data', [])
|
1422
1425
|
else:
|
ccxt/cryptocom.py
CHANGED
@@ -471,6 +471,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
471
471
|
'exact': {
|
472
472
|
'219': InvalidOrder,
|
473
473
|
'314': InvalidOrder, # {"id" : 1700xxx, "method" : "private/create-order", "code" : 314, "message" : "EXCEEDS_MAX_ORDER_SIZE", "result" : {"client_oid" : "1700xxx", "order_id" : "6530xxx"}}
|
474
|
+
'325': InvalidOrder, # {"id" : 1741xxx, "method" : "private/create-order", "code" : 325, "message" : "EXCEED_DAILY_VOL_LIMIT", "result" : {"client_oid" : "1741xxx", "order_id" : "6530xxx"}}
|
475
|
+
'415': InvalidOrder, # {"id" : 1741xxx, "method" : "private/create-order", "code" : 415, "message" : "BELOW_MIN_ORDER_SIZE", "result" : {"client_oid" : "1741xxx", "order_id" : "6530xxx"}}
|
474
476
|
'10001': ExchangeError,
|
475
477
|
'10002': PermissionDenied,
|
476
478
|
'10003': PermissionDenied,
|