ccxt 4.2.59 → 4.2.61
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.
- package/README.md +103 -102
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +11853 -3790
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/hyperliquid.js +9 -0
- package/dist/cjs/src/ascendex.js +10 -12
- package/dist/cjs/src/base/Exchange.js +22 -1
- package/dist/cjs/src/base/functions/encode.js +5 -0
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/bingx.js +38 -0
- package/dist/cjs/src/bitfinex2.js +20 -3
- package/dist/cjs/src/bitget.js +9 -2
- package/dist/cjs/src/bitmart.js +41 -23
- package/dist/cjs/src/blofin.js +59 -1
- package/dist/cjs/src/coinbase.js +108 -103
- package/dist/cjs/src/coinex.js +61 -1
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/hyperliquid.js +2035 -0
- package/dist/cjs/src/kraken.js +50 -41
- package/dist/cjs/src/krakenfutures.js +28 -0
- package/dist/cjs/src/kucoinfutures.js +3 -2
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +2 -2
- package/dist/cjs/src/pro/binance.js +16 -3
- package/dist/cjs/src/pro/bingx.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +158 -0
- package/dist/cjs/src/static_dependencies/ethers/address/address.js +144 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +407 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/address.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +28 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/array.js +176 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +52 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/null.js +30 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/number.js +60 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/string.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +68 -0
- package/dist/cjs/src/static_dependencies/ethers/fragments.js +614 -0
- package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +492 -0
- package/dist/cjs/src/static_dependencies/ethers/index.js +35 -0
- package/dist/cjs/src/static_dependencies/ethers/interface.js +44 -0
- package/dist/cjs/src/static_dependencies/ethers/typed.js +618 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +20 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/data.js +134 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +228 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/events.js +13 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +29 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/index.js +53 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +231 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +47 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +218 -0
- package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +292 -0
- package/dist/cjs/src/tokocrypto.js +22 -2
- package/dist/cjs/src/wazirx.js +314 -4
- package/dist/cjs/src/woo.js +157 -77
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/coinbase.d.ts +3 -3
- package/js/src/abstract/hyperliquid.d.ts +9 -0
- package/js/src/abstract/hyperliquid.js +11 -0
- package/js/src/abstract/wazirx.d.ts +5 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/ascendex.js +10 -12
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +13 -1
- package/js/src/base/functions/encode.d.ts +2 -1
- package/js/src/base/functions/encode.js +5 -1
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +38 -0
- package/js/src/bitfinex2.js +20 -3
- package/js/src/bitget.js +9 -2
- package/js/src/bitmart.d.ts +9 -2
- package/js/src/bitmart.js +41 -23
- package/js/src/blofin.d.ts +2 -1
- package/js/src/blofin.js +59 -1
- package/js/src/coinbase.js +108 -103
- package/js/src/coinex.d.ts +3 -1
- package/js/src/coinex.js +61 -1
- package/js/src/hitbtc.js +1 -1
- package/js/src/htx.js +4 -1
- package/js/src/hyperliquid.d.ts +83 -0
- package/js/src/hyperliquid.js +2036 -0
- package/js/src/kraken.js +50 -41
- package/js/src/krakenfutures.d.ts +2 -1
- package/js/src/krakenfutures.js +28 -0
- package/js/src/kucoinfutures.js +3 -2
- package/js/src/okx.js +1 -1
- package/js/src/phemex.js +2 -2
- package/js/src/pro/binance.js +16 -3
- package/js/src/pro/bingx.js +1 -0
- package/js/src/pro/deribit.d.ts +1 -1
- package/js/src/static_dependencies/ethers/abi-coder.d.ts +50 -0
- package/js/src/static_dependencies/ethers/abi-coder.js +148 -0
- package/js/src/static_dependencies/ethers/address/address.d.ts +55 -0
- package/js/src/static_dependencies/ethers/address/address.js +162 -0
- package/js/src/static_dependencies/ethers/address/checks.d.ts +80 -0
- package/js/src/static_dependencies/ethers/address/checks.js +119 -0
- package/js/src/static_dependencies/ethers/address/contract-address.d.ts +47 -0
- package/js/src/static_dependencies/ethers/address/contract-address.js +73 -0
- package/js/src/static_dependencies/ethers/address/index.d.ts +48 -0
- package/js/src/static_dependencies/ethers/address/index.js +24 -0
- package/js/src/static_dependencies/ethers/bytes32.d.ts +14 -0
- package/js/src/static_dependencies/ethers/bytes32.js +45 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.d.ts +120 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.js +424 -0
- package/js/src/static_dependencies/ethers/coders/address.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/address.js +34 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.js +27 -0
- package/js/src/static_dependencies/ethers/coders/array.d.ts +24 -0
- package/js/src/static_dependencies/ethers/coders/array.js +162 -0
- package/js/src/static_dependencies/ethers/coders/boolean.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/boolean.js +26 -0
- package/js/src/static_dependencies/ethers/coders/bytes.d.ts +18 -0
- package/js/src/static_dependencies/ethers/coders/bytes.js +39 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +32 -0
- package/js/src/static_dependencies/ethers/coders/null.d.ts +11 -0
- package/js/src/static_dependencies/ethers/coders/null.js +29 -0
- package/js/src/static_dependencies/ethers/coders/number.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/number.js +48 -0
- package/js/src/static_dependencies/ethers/coders/string.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/string.js +26 -0
- package/js/src/static_dependencies/ethers/coders/tuple.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/tuple.js +67 -0
- package/js/src/static_dependencies/ethers/fragments.d.ts +458 -0
- package/js/src/static_dependencies/ethers/fragments.js +1252 -0
- package/js/src/static_dependencies/ethers/hash/index.d.ts +10 -0
- package/js/src/static_dependencies/ethers/hash/index.js +15 -0
- package/js/src/static_dependencies/ethers/hash/solidity.d.ts +30 -0
- package/js/src/static_dependencies/ethers/hash/solidity.js +107 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.d.ts +144 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.js +490 -0
- package/js/src/static_dependencies/ethers/index.d.ts +19 -0
- package/js/src/static_dependencies/ethers/index.js +22 -0
- package/js/src/static_dependencies/ethers/interface.d.ts +380 -0
- package/js/src/static_dependencies/ethers/interface.js +990 -0
- package/js/src/static_dependencies/ethers/typed.d.ts +569 -0
- package/js/src/static_dependencies/ethers/typed.js +608 -0
- package/js/src/static_dependencies/ethers/utils/base58.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/base58.js +68 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.d.ts +3 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.js +24 -0
- package/js/src/static_dependencies/ethers/utils/base64.d.ts +39 -0
- package/js/src/static_dependencies/ethers/utils/base64.js +58 -0
- package/js/src/static_dependencies/ethers/utils/data.d.ts +92 -0
- package/js/src/static_dependencies/ethers/utils/data.js +175 -0
- package/js/src/static_dependencies/ethers/utils/errors.d.ts +509 -0
- package/js/src/static_dependencies/ethers/utils/errors.js +227 -0
- package/js/src/static_dependencies/ethers/utils/events.d.ts +76 -0
- package/js/src/static_dependencies/ethers/utils/events.js +52 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.d.ts +251 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.js +529 -0
- package/js/src/static_dependencies/ethers/utils/index.d.ts +30 -0
- package/js/src/static_dependencies/ethers/utils/index.js +38 -0
- package/js/src/static_dependencies/ethers/utils/maths.d.ts +65 -0
- package/js/src/static_dependencies/ethers/utils/maths.js +220 -0
- package/js/src/static_dependencies/ethers/utils/properties.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/properties.js +59 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.js +84 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.js +54 -0
- package/js/src/static_dependencies/ethers/utils/rlp.d.ts +16 -0
- package/js/src/static_dependencies/ethers/utils/rlp.js +14 -0
- package/js/src/static_dependencies/ethers/utils/units.d.ts +23 -0
- package/js/src/static_dependencies/ethers/utils/units.js +88 -0
- package/js/src/static_dependencies/ethers/utils/utf8.d.ts +95 -0
- package/js/src/static_dependencies/ethers/utils/utf8.js +225 -0
- package/js/src/static_dependencies/ethers/utils/uuid.d.ts +7 -0
- package/js/src/static_dependencies/ethers/utils/uuid.js +35 -0
- package/js/src/static_dependencies/messagepack/msgpack.d.ts +2 -0
- package/js/src/static_dependencies/messagepack/msgpack.js +572 -0
- package/js/src/tokocrypto.js +22 -2
- package/js/src/wazirx.d.ts +12 -1
- package/js/src/wazirx.js +314 -4
- package/js/src/woo.d.ts +8 -0
- package/js/src/woo.js +157 -77
- package/package.json +1 -1
- package/skip-tests.json +60 -16
package/js/src/kraken.js
CHANGED
|
@@ -24,7 +24,10 @@ export default class kraken extends Exchange {
|
|
|
24
24
|
'name': 'Kraken',
|
|
25
25
|
'countries': ['US'],
|
|
26
26
|
'version': '0',
|
|
27
|
-
|
|
27
|
+
// rate-limits: https://support.kraken.com/hc/en-us/articles/206548367-What-are-the-API-rate-limits-#1
|
|
28
|
+
// for public: 1 req/s
|
|
29
|
+
// for private: every second 0.33 weight added to your allowed capacity (some private endpoints need 1 weight, some need 2)
|
|
30
|
+
'rateLimit': 1000,
|
|
28
31
|
'certified': false,
|
|
29
32
|
'pro': true,
|
|
30
33
|
'has': {
|
|
@@ -154,7 +157,7 @@ export default class kraken extends Exchange {
|
|
|
154
157
|
},
|
|
155
158
|
'public': {
|
|
156
159
|
'get': {
|
|
157
|
-
//
|
|
160
|
+
// rate-limits explained in comment in the top of this file
|
|
158
161
|
'Assets': 1,
|
|
159
162
|
'AssetPairs': 1,
|
|
160
163
|
'Depth': 1,
|
|
@@ -170,48 +173,48 @@ export default class kraken extends Exchange {
|
|
|
170
173
|
'post': {
|
|
171
174
|
'AddOrder': 0,
|
|
172
175
|
'AddOrderBatch': 0,
|
|
173
|
-
'AddExport':
|
|
174
|
-
'Balance':
|
|
175
|
-
'CancelAll':
|
|
176
|
-
'CancelAllOrdersAfter':
|
|
176
|
+
'AddExport': 3,
|
|
177
|
+
'Balance': 3,
|
|
178
|
+
'CancelAll': 3,
|
|
179
|
+
'CancelAllOrdersAfter': 3,
|
|
177
180
|
'CancelOrder': 0,
|
|
178
181
|
'CancelOrderBatch': 0,
|
|
179
|
-
'ClosedOrders':
|
|
180
|
-
'DepositAddresses':
|
|
181
|
-
'DepositMethods':
|
|
182
|
-
'DepositStatus':
|
|
182
|
+
'ClosedOrders': 3,
|
|
183
|
+
'DepositAddresses': 3,
|
|
184
|
+
'DepositMethods': 3,
|
|
185
|
+
'DepositStatus': 3,
|
|
183
186
|
'EditOrder': 0,
|
|
184
|
-
'ExportStatus':
|
|
185
|
-
'GetWebSocketsToken':
|
|
186
|
-
'Ledgers':
|
|
187
|
-
'OpenOrders':
|
|
188
|
-
'OpenPositions':
|
|
189
|
-
'QueryLedgers':
|
|
190
|
-
'QueryOrders':
|
|
191
|
-
'QueryTrades':
|
|
192
|
-
'RetrieveExport':
|
|
193
|
-
'RemoveExport':
|
|
194
|
-
'BalanceEx':
|
|
195
|
-
'TradeBalance':
|
|
196
|
-
'TradesHistory':
|
|
197
|
-
'TradeVolume':
|
|
198
|
-
'Withdraw':
|
|
199
|
-
'WithdrawCancel':
|
|
200
|
-
'WithdrawInfo':
|
|
201
|
-
'WithdrawMethods':
|
|
202
|
-
'WithdrawAddresses':
|
|
203
|
-
'WithdrawStatus':
|
|
204
|
-
'WalletTransfer':
|
|
187
|
+
'ExportStatus': 3,
|
|
188
|
+
'GetWebSocketsToken': 3,
|
|
189
|
+
'Ledgers': 6,
|
|
190
|
+
'OpenOrders': 3,
|
|
191
|
+
'OpenPositions': 3,
|
|
192
|
+
'QueryLedgers': 3,
|
|
193
|
+
'QueryOrders': 3,
|
|
194
|
+
'QueryTrades': 3,
|
|
195
|
+
'RetrieveExport': 3,
|
|
196
|
+
'RemoveExport': 3,
|
|
197
|
+
'BalanceEx': 3,
|
|
198
|
+
'TradeBalance': 3,
|
|
199
|
+
'TradesHistory': 6,
|
|
200
|
+
'TradeVolume': 3,
|
|
201
|
+
'Withdraw': 3,
|
|
202
|
+
'WithdrawCancel': 3,
|
|
203
|
+
'WithdrawInfo': 3,
|
|
204
|
+
'WithdrawMethods': 3,
|
|
205
|
+
'WithdrawAddresses': 3,
|
|
206
|
+
'WithdrawStatus': 3,
|
|
207
|
+
'WalletTransfer': 3,
|
|
205
208
|
// sub accounts
|
|
206
|
-
'CreateSubaccount':
|
|
207
|
-
'AccountTransfer':
|
|
209
|
+
'CreateSubaccount': 3,
|
|
210
|
+
'AccountTransfer': 3,
|
|
208
211
|
// earn
|
|
209
|
-
'Earn/Allocate':
|
|
210
|
-
'Earn/Deallocate':
|
|
211
|
-
'Earn/AllocateStatus':
|
|
212
|
-
'Earn/DeallocateStatus':
|
|
213
|
-
'Earn/Strategies':
|
|
214
|
-
'Earn/Allocations':
|
|
212
|
+
'Earn/Allocate': 3,
|
|
213
|
+
'Earn/Deallocate': 3,
|
|
214
|
+
'Earn/AllocateStatus': 3,
|
|
215
|
+
'Earn/DeallocateStatus': 3,
|
|
216
|
+
'Earn/Strategies': 3,
|
|
217
|
+
'Earn/Allocations': 3,
|
|
215
218
|
},
|
|
216
219
|
},
|
|
217
220
|
},
|
|
@@ -1547,8 +1550,14 @@ export default class kraken extends Exchange {
|
|
|
1547
1550
|
// }
|
|
1548
1551
|
// }
|
|
1549
1552
|
//
|
|
1550
|
-
const description = this.
|
|
1551
|
-
|
|
1553
|
+
const description = this.safeDict(order, 'descr', {});
|
|
1554
|
+
let orderDescription = undefined;
|
|
1555
|
+
if (description !== undefined) {
|
|
1556
|
+
orderDescription = this.safeString(description, 'order');
|
|
1557
|
+
}
|
|
1558
|
+
else {
|
|
1559
|
+
orderDescription = this.safeString(order, 'descr');
|
|
1560
|
+
}
|
|
1552
1561
|
let side = undefined;
|
|
1553
1562
|
let type = undefined;
|
|
1554
1563
|
let marketId = undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/krakenfutures.js';
|
|
2
|
-
import type { TransferEntry, Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OrderRequest, Order, Balances, Str, Ticker, OrderBook, Tickers, Strings, Market, Currency, Leverage } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OrderRequest, Order, Balances, Str, Ticker, OrderBook, Tickers, Strings, Market, Currency, Leverage, Leverages } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class krakenfutures
|
|
5
5
|
* @augments Exchange
|
|
@@ -94,6 +94,7 @@ export default class krakenfutures extends Exchange {
|
|
|
94
94
|
transferOut(code: string, amount: any, params?: {}): Promise<TransferEntry>;
|
|
95
95
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
|
96
96
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
97
|
+
fetchLeverages(symbols?: string[], params?: {}): Promise<Leverages>;
|
|
97
98
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
98
99
|
parseLeverage(leverage: any, market?: any): Leverage;
|
|
99
100
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -58,6 +58,7 @@ export default class krakenfutures extends Exchange {
|
|
|
58
58
|
'fetchIsolatedBorrowRates': false,
|
|
59
59
|
'fetchIsolatedPositions': false,
|
|
60
60
|
'fetchLeverage': true,
|
|
61
|
+
'fetchLeverages': true,
|
|
61
62
|
'fetchLeverageTiers': true,
|
|
62
63
|
'fetchMarketLeverageTiers': 'emulated',
|
|
63
64
|
'fetchMarkets': true,
|
|
@@ -2459,6 +2460,33 @@ export default class krakenfutures extends Exchange {
|
|
|
2459
2460
|
//
|
|
2460
2461
|
return await this.privatePutLeveragepreferences(this.extend(request, params));
|
|
2461
2462
|
}
|
|
2463
|
+
async fetchLeverages(symbols = undefined, params = {}) {
|
|
2464
|
+
/**
|
|
2465
|
+
* @method
|
|
2466
|
+
* @name krakenfutures#fetchLeverages
|
|
2467
|
+
* @description fetch the set leverage for all contract and margin markets
|
|
2468
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
|
|
2469
|
+
* @param {string[]} [symbols] a list of unified market symbols
|
|
2470
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2471
|
+
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
2472
|
+
*/
|
|
2473
|
+
await this.loadMarkets();
|
|
2474
|
+
const response = await this.privateGetLeveragepreferences(params);
|
|
2475
|
+
//
|
|
2476
|
+
// {
|
|
2477
|
+
// "result": "success",
|
|
2478
|
+
// "serverTime": "2024-03-06T02:35:46.336Z",
|
|
2479
|
+
// "leveragePreferences": [
|
|
2480
|
+
// {
|
|
2481
|
+
// "symbol": "PF_ETHUSD",
|
|
2482
|
+
// "maxLeverage": 30.00
|
|
2483
|
+
// },
|
|
2484
|
+
// ]
|
|
2485
|
+
// }
|
|
2486
|
+
//
|
|
2487
|
+
const leveragePreferences = this.safeList(response, 'leveragePreferences', []);
|
|
2488
|
+
return this.parseLeverages(leveragePreferences, symbols, 'symbol');
|
|
2489
|
+
}
|
|
2462
2490
|
async fetchLeverage(symbol, params = {}) {
|
|
2463
2491
|
/**
|
|
2464
2492
|
* @method
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -36,6 +36,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
36
36
|
'addMargin': true,
|
|
37
37
|
'cancelAllOrders': true,
|
|
38
38
|
'cancelOrder': true,
|
|
39
|
+
'closeAllPositions': false,
|
|
39
40
|
'closePosition': true,
|
|
40
41
|
'closePositions': false,
|
|
41
42
|
'createDepositAddress': true,
|
|
@@ -2073,8 +2074,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
2073
2074
|
// }
|
|
2074
2075
|
// }
|
|
2075
2076
|
//
|
|
2076
|
-
const data = this.
|
|
2077
|
-
const trades = this.
|
|
2077
|
+
const data = this.safeDict(response, 'data', {});
|
|
2078
|
+
const trades = this.safeList(data, 'items', []);
|
|
2078
2079
|
return this.parseTrades(trades, market, since, limit);
|
|
2079
2080
|
}
|
|
2080
2081
|
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
package/js/src/okx.js
CHANGED
|
@@ -5671,7 +5671,7 @@ export default class okx extends Exchange {
|
|
|
5671
5671
|
const fromAccountId = this.safeString(transfer, 'from');
|
|
5672
5672
|
const toAccountId = this.safeString(transfer, 'to');
|
|
5673
5673
|
const accountsById = this.safeValue(this.options, 'accountsById', {});
|
|
5674
|
-
const timestamp = this.safeInteger(transfer, 'ts'
|
|
5674
|
+
const timestamp = this.safeInteger(transfer, 'ts');
|
|
5675
5675
|
const balanceChange = this.safeString(transfer, 'sz');
|
|
5676
5676
|
if (balanceChange !== undefined) {
|
|
5677
5677
|
amount = this.parseNumber(Precise.stringAbs(balanceChange));
|
package/js/src/phemex.js
CHANGED
|
@@ -3361,7 +3361,7 @@ export default class phemex extends Exchange {
|
|
|
3361
3361
|
// ]
|
|
3362
3362
|
// }
|
|
3363
3363
|
//
|
|
3364
|
-
const data = this.
|
|
3364
|
+
const data = this.safeList(response, 'data', []);
|
|
3365
3365
|
return this.parseTransactions(data, currency, since, limit);
|
|
3366
3366
|
}
|
|
3367
3367
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -3401,7 +3401,7 @@ export default class phemex extends Exchange {
|
|
|
3401
3401
|
// ]
|
|
3402
3402
|
// }
|
|
3403
3403
|
//
|
|
3404
|
-
const data = this.
|
|
3404
|
+
const data = this.safeList(response, 'data', []);
|
|
3405
3405
|
return this.parseTransactions(data, currency, since, limit);
|
|
3406
3406
|
}
|
|
3407
3407
|
parseTransactionStatus(status) {
|
package/js/src/pro/binance.js
CHANGED
|
@@ -2602,8 +2602,21 @@ export default class binance extends binanceRest {
|
|
|
2602
2602
|
// }
|
|
2603
2603
|
//
|
|
2604
2604
|
const marketId = this.safeString(position, 's');
|
|
2605
|
-
const
|
|
2606
|
-
const
|
|
2605
|
+
const contracts = this.safeString(position, 'pa');
|
|
2606
|
+
const contractsAbs = Precise.stringAbs(this.safeString(position, 'pa'));
|
|
2607
|
+
let positionSide = this.safeStringLower(position, 'ps');
|
|
2608
|
+
let hedged = true;
|
|
2609
|
+
if (positionSide === 'both') {
|
|
2610
|
+
hedged = false;
|
|
2611
|
+
if (!Precise.stringEq(contracts, '0')) {
|
|
2612
|
+
if (Precise.stringLt(contracts, '0')) {
|
|
2613
|
+
positionSide = 'short';
|
|
2614
|
+
}
|
|
2615
|
+
else {
|
|
2616
|
+
positionSide = 'long';
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2607
2620
|
return this.safePosition({
|
|
2608
2621
|
'info': position,
|
|
2609
2622
|
'id': undefined,
|
|
@@ -2614,7 +2627,7 @@ export default class binance extends binanceRest {
|
|
|
2614
2627
|
'entryPrice': this.safeNumber(position, 'ep'),
|
|
2615
2628
|
'unrealizedPnl': this.safeNumber(position, 'up'),
|
|
2616
2629
|
'percentage': undefined,
|
|
2617
|
-
'contracts': this.
|
|
2630
|
+
'contracts': this.parseNumber(contractsAbs),
|
|
2618
2631
|
'contractSize': undefined,
|
|
2619
2632
|
'markPrice': undefined,
|
|
2620
2633
|
'side': positionSide,
|
package/js/src/pro/bingx.js
CHANGED
|
@@ -559,6 +559,7 @@ export default class bingx extends bingxRest {
|
|
|
559
559
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
560
560
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
561
561
|
*/
|
|
562
|
+
await this.loadMarkets();
|
|
562
563
|
const market = this.market(symbol);
|
|
563
564
|
const [marketType, query] = this.handleMarketTypeAndParams('watchOHLCV', market, params);
|
|
564
565
|
const url = this.safeValue(this.urls['api']['ws'], marketType);
|
package/js/src/pro/deribit.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export default class deribit extends deribitRest {
|
|
|
25
25
|
watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<import("../base/types.js").Dictionary<import("../base/types.js").Dictionary<OHLCV[]>>>;
|
|
26
26
|
handleOHLCV(client: Client, message: any): void;
|
|
27
27
|
parseWsOHLCV(ohlcv: any, market?: any): OHLCV;
|
|
28
|
-
watchMultipleWrapper(channelName: string, channelDescriptor:
|
|
28
|
+
watchMultipleWrapper(channelName: string, channelDescriptor: Str, symbolsArray?: any, params?: {}): Promise<any>;
|
|
29
29
|
handleMessage(client: Client, message: any): void;
|
|
30
30
|
handleAuthenticationMessage(client: Client, message: any): any;
|
|
31
31
|
authenticate(params?: {}): Promise<any>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When sending values to or receiving values from a [[Contract]], the
|
|
3
|
+
* data is generally encoded using the [ABI standard](link-solc-abi).
|
|
4
|
+
*
|
|
5
|
+
* The AbiCoder provides a utility to encode values to ABI data and
|
|
6
|
+
* decode values from ABI data.
|
|
7
|
+
*
|
|
8
|
+
* Most of the time, developers should favour the [[Contract]] class,
|
|
9
|
+
* which further abstracts a lot of the finer details of ABI data.
|
|
10
|
+
*
|
|
11
|
+
* @_section api/abi/abi-coder:ABI Encoding
|
|
12
|
+
*/
|
|
13
|
+
import { Result } from "./coders/abstract-coder.js";
|
|
14
|
+
import { ParamType } from "./fragments.js";
|
|
15
|
+
import type { BytesLike } from "./utils/index.js";
|
|
16
|
+
/**
|
|
17
|
+
* The **AbiCoder** is a low-level class responsible for encoding JavaScript
|
|
18
|
+
* values into binary data and decoding binary data into JavaScript values.
|
|
19
|
+
*/
|
|
20
|
+
export declare class AbiCoder {
|
|
21
|
+
#private;
|
|
22
|
+
/**
|
|
23
|
+
* Get the default values for the given %%types%%.
|
|
24
|
+
*
|
|
25
|
+
* For example, a ``uint`` is by default ``0`` and ``bool``
|
|
26
|
+
* is by default ``false``.
|
|
27
|
+
*/
|
|
28
|
+
getDefaultValue(types: ReadonlyArray<string | ParamType>): Result;
|
|
29
|
+
/**
|
|
30
|
+
* Encode the %%values%% as the %%types%% into ABI data.
|
|
31
|
+
*
|
|
32
|
+
* @returns DataHexstring
|
|
33
|
+
*/
|
|
34
|
+
encode(types: ReadonlyArray<string | ParamType>, values: ReadonlyArray<any>): string;
|
|
35
|
+
/**
|
|
36
|
+
* Decode the ABI %%data%% as the %%types%% into values.
|
|
37
|
+
*
|
|
38
|
+
* If %%loose%% decoding is enabled, then strict padding is
|
|
39
|
+
* not enforced. Some older versions of Solidity incorrectly
|
|
40
|
+
* padded event data emitted from ``external`` functions.
|
|
41
|
+
*/
|
|
42
|
+
decode(types: ReadonlyArray<string | ParamType>, data: BytesLike, loose?: boolean): Result;
|
|
43
|
+
static _setDefaultMaxInflation(value: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the shared singleton instance of a default [[AbiCoder]].
|
|
46
|
+
*
|
|
47
|
+
* On the first call, the instance is created internally.
|
|
48
|
+
*/
|
|
49
|
+
static defaultAbiCoder(): AbiCoder;
|
|
50
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* When sending values to or receiving values from a [[Contract]], the
|
|
9
|
+
* data is generally encoded using the [ABI standard](link-solc-abi).
|
|
10
|
+
*
|
|
11
|
+
* The AbiCoder provides a utility to encode values to ABI data and
|
|
12
|
+
* decode values from ABI data.
|
|
13
|
+
*
|
|
14
|
+
* Most of the time, developers should favour the [[Contract]] class,
|
|
15
|
+
* which further abstracts a lot of the finer details of ABI data.
|
|
16
|
+
*
|
|
17
|
+
* @_section api/abi/abi-coder:ABI Encoding
|
|
18
|
+
*/
|
|
19
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
20
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
21
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
22
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
23
|
+
};
|
|
24
|
+
var _AbiCoder_instances, _AbiCoder_getCoder;
|
|
25
|
+
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
|
|
26
|
+
import { assertArgumentCount, assertArgument } from "./utils/index.js";
|
|
27
|
+
import { Reader, Writer } from "./coders/abstract-coder.js";
|
|
28
|
+
import { AddressCoder } from "./coders/address.js";
|
|
29
|
+
import { ArrayCoder } from "./coders/array.js";
|
|
30
|
+
import { BooleanCoder } from "./coders/boolean.js";
|
|
31
|
+
import { BytesCoder } from "./coders/bytes.js";
|
|
32
|
+
import { FixedBytesCoder } from "./coders/fixed-bytes.js";
|
|
33
|
+
import { NullCoder } from "./coders/null.js";
|
|
34
|
+
import { NumberCoder } from "./coders/number.js";
|
|
35
|
+
import { StringCoder } from "./coders/string.js";
|
|
36
|
+
import { TupleCoder } from "./coders/tuple.js";
|
|
37
|
+
import { ParamType } from "./fragments.js";
|
|
38
|
+
// https://docs.soliditylang.org/en/v0.8.17/control-structures.html
|
|
39
|
+
const PanicReasons = new Map();
|
|
40
|
+
PanicReasons.set(0x00, "GENERIC_PANIC");
|
|
41
|
+
PanicReasons.set(0x01, "ASSERT_FALSE");
|
|
42
|
+
PanicReasons.set(0x11, "OVERFLOW");
|
|
43
|
+
PanicReasons.set(0x12, "DIVIDE_BY_ZERO");
|
|
44
|
+
PanicReasons.set(0x21, "ENUM_RANGE_ERROR");
|
|
45
|
+
PanicReasons.set(0x22, "BAD_STORAGE_DATA");
|
|
46
|
+
PanicReasons.set(0x31, "STACK_UNDERFLOW");
|
|
47
|
+
PanicReasons.set(0x32, "ARRAY_RANGE_ERROR");
|
|
48
|
+
PanicReasons.set(0x41, "OUT_OF_MEMORY");
|
|
49
|
+
PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL");
|
|
50
|
+
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
|
|
51
|
+
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
|
|
52
|
+
let defaultCoder = null;
|
|
53
|
+
let defaultMaxInflation = 1024;
|
|
54
|
+
/**
|
|
55
|
+
* The **AbiCoder** is a low-level class responsible for encoding JavaScript
|
|
56
|
+
* values into binary data and decoding binary data into JavaScript values.
|
|
57
|
+
*/
|
|
58
|
+
export class AbiCoder {
|
|
59
|
+
constructor() {
|
|
60
|
+
_AbiCoder_instances.add(this);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the default values for the given %%types%%.
|
|
64
|
+
*
|
|
65
|
+
* For example, a ``uint`` is by default ``0`` and ``bool``
|
|
66
|
+
* is by default ``false``.
|
|
67
|
+
*/
|
|
68
|
+
getDefaultValue(types) {
|
|
69
|
+
const coders = types.map((type) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, ParamType.from(type)));
|
|
70
|
+
const coder = new TupleCoder(coders, "_");
|
|
71
|
+
return coder.defaultValue();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Encode the %%values%% as the %%types%% into ABI data.
|
|
75
|
+
*
|
|
76
|
+
* @returns DataHexstring
|
|
77
|
+
*/
|
|
78
|
+
encode(types, values) {
|
|
79
|
+
assertArgumentCount(values.length, types.length, "types/values length mismatch");
|
|
80
|
+
const coders = types.map((type) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, ParamType.from(type)));
|
|
81
|
+
const coder = (new TupleCoder(coders, "_"));
|
|
82
|
+
const writer = new Writer();
|
|
83
|
+
coder.encode(writer, values);
|
|
84
|
+
return writer.data;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Decode the ABI %%data%% as the %%types%% into values.
|
|
88
|
+
*
|
|
89
|
+
* If %%loose%% decoding is enabled, then strict padding is
|
|
90
|
+
* not enforced. Some older versions of Solidity incorrectly
|
|
91
|
+
* padded event data emitted from ``external`` functions.
|
|
92
|
+
*/
|
|
93
|
+
decode(types, data, loose) {
|
|
94
|
+
const coders = types.map((type) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, ParamType.from(type)));
|
|
95
|
+
const coder = new TupleCoder(coders, "_");
|
|
96
|
+
return coder.decode(new Reader(data, loose, defaultMaxInflation));
|
|
97
|
+
}
|
|
98
|
+
static _setDefaultMaxInflation(value) {
|
|
99
|
+
assertArgument(typeof (value) === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value);
|
|
100
|
+
defaultMaxInflation = value;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Returns the shared singleton instance of a default [[AbiCoder]].
|
|
104
|
+
*
|
|
105
|
+
* On the first call, the instance is created internally.
|
|
106
|
+
*/
|
|
107
|
+
static defaultAbiCoder() {
|
|
108
|
+
if (defaultCoder == null) {
|
|
109
|
+
defaultCoder = new AbiCoder();
|
|
110
|
+
}
|
|
111
|
+
return defaultCoder;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
_AbiCoder_instances = new WeakSet(), _AbiCoder_getCoder = function _AbiCoder_getCoder(param) {
|
|
115
|
+
if (param.isArray()) {
|
|
116
|
+
return new ArrayCoder(__classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, param.arrayChildren), param.arrayLength, param.name);
|
|
117
|
+
}
|
|
118
|
+
if (param.isTuple()) {
|
|
119
|
+
return new TupleCoder(param.components.map((c) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, c)), param.name);
|
|
120
|
+
}
|
|
121
|
+
switch (param.baseType) {
|
|
122
|
+
case "address":
|
|
123
|
+
return new AddressCoder(param.name);
|
|
124
|
+
case "bool":
|
|
125
|
+
return new BooleanCoder(param.name);
|
|
126
|
+
case "string":
|
|
127
|
+
return new StringCoder(param.name);
|
|
128
|
+
case "bytes":
|
|
129
|
+
return new BytesCoder(param.name);
|
|
130
|
+
case "":
|
|
131
|
+
return new NullCoder(param.name);
|
|
132
|
+
}
|
|
133
|
+
// u?int[0-9]*
|
|
134
|
+
let match = param.type.match(paramTypeNumber);
|
|
135
|
+
if (match) {
|
|
136
|
+
let size = parseInt(match[2] || "256");
|
|
137
|
+
assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, "invalid " + match[1] + " bit length", "param", param);
|
|
138
|
+
return new NumberCoder(size / 8, (match[1] === "int"), param.name);
|
|
139
|
+
}
|
|
140
|
+
// bytes[0-9]+
|
|
141
|
+
match = param.type.match(paramTypeBytes);
|
|
142
|
+
if (match) {
|
|
143
|
+
let size = parseInt(match[1]);
|
|
144
|
+
assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param);
|
|
145
|
+
return new FixedBytesCoder(size, param.name);
|
|
146
|
+
}
|
|
147
|
+
assertArgument(false, "invalid type", "type", param.type);
|
|
148
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a normalized and checksumed address for %%address%%.
|
|
3
|
+
* This accepts non-checksum addresses, checksum addresses and
|
|
4
|
+
* [[getIcapAddress]] formats.
|
|
5
|
+
*
|
|
6
|
+
* The checksum in Ethereum uses the capitalization (upper-case
|
|
7
|
+
* vs lower-case) of the characters within an address to encode
|
|
8
|
+
* its checksum, which offers, on average, a checksum of 15-bits.
|
|
9
|
+
*
|
|
10
|
+
* If %%address%% contains both upper-case and lower-case, it is
|
|
11
|
+
* assumed to already be a checksum address and its checksum is
|
|
12
|
+
* validated, and if the address fails its expected checksum an
|
|
13
|
+
* error is thrown.
|
|
14
|
+
*
|
|
15
|
+
* If you wish the checksum of %%address%% to be ignore, it should
|
|
16
|
+
* be converted to lower-case (i.e. ``.toLowercase()``) before
|
|
17
|
+
* being passed in. This should be a very rare situation though,
|
|
18
|
+
* that you wish to bypass the safegaurds in place to protect
|
|
19
|
+
* against an address that has been incorrectly copied from another
|
|
20
|
+
* source.
|
|
21
|
+
*
|
|
22
|
+
* @example:
|
|
23
|
+
* // Adds the checksum (via upper-casing specific letters)
|
|
24
|
+
* getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72")
|
|
25
|
+
* //_result:
|
|
26
|
+
*
|
|
27
|
+
* // Converts ICAP address and adds checksum
|
|
28
|
+
* getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
|
|
29
|
+
* //_result:
|
|
30
|
+
*
|
|
31
|
+
* // Throws an error if an address contains mixed case,
|
|
32
|
+
* // but the checksum fails
|
|
33
|
+
* getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
|
|
34
|
+
* //_error:
|
|
35
|
+
*/
|
|
36
|
+
export declare function getAddress(address: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* The [ICAP Address format](link-icap) format is an early checksum
|
|
39
|
+
* format which attempts to be compatible with the banking
|
|
40
|
+
* industry [IBAN format](link-wiki-iban) for bank accounts.
|
|
41
|
+
*
|
|
42
|
+
* It is no longer common or a recommended format.
|
|
43
|
+
*
|
|
44
|
+
* @example:
|
|
45
|
+
* getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72");
|
|
46
|
+
* //_result:
|
|
47
|
+
*
|
|
48
|
+
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
|
|
49
|
+
* //_result:
|
|
50
|
+
*
|
|
51
|
+
* // Throws an error if the ICAP checksum is wrong
|
|
52
|
+
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37");
|
|
53
|
+
* //_error:
|
|
54
|
+
*/
|
|
55
|
+
export declare function getIcapAddress(address: string): string;
|