ccxt 4.4.1 → 4.4.3
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 +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +69 -0
- package/dist/cjs/src/binance.js +88 -18
- package/dist/cjs/src/bitmart.js +3 -1
- package/dist/cjs/src/bitstamp.js +24 -36
- package/dist/cjs/src/bybit.js +1 -0
- package/dist/cjs/src/cryptocom.js +3 -2
- package/dist/cjs/src/currencycom.js +1 -2
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/mexc.js +88 -1
- package/dist/cjs/src/pro/binance.js +3 -63
- package/dist/cjs/src/pro/bitget.js +1 -9
- package/dist/cjs/src/pro/bitmex.js +11 -1
- package/dist/cjs/src/pro/bybit.js +2 -54
- package/dist/cjs/src/pro/cryptocom.js +193 -61
- package/dist/cjs/src/pro/gate.js +1 -9
- package/dist/cjs/src/pro/hyperliquid.js +4 -36
- package/dist/cjs/src/pro/kucoin.js +2 -59
- package/dist/cjs/src/pro/kucoinfutures.js +139 -1
- package/dist/cjs/src/pro/mexc.js +82 -3
- package/dist/cjs/src/pro/okx.js +14 -39
- package/dist/cjs/src/pro/oxfun.js +75 -0
- package/dist/cjs/src/pro/phemex.js +45 -1
- package/dist/cjs/src/pro/woofipro.js +67 -0
- package/dist/cjs/src/xt.js +7 -2
- package/examples/js/cli.js +8 -4
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +70 -1
- package/js/src/base/types.d.ts +5 -4
- package/js/src/binance.js +88 -18
- package/js/src/bitmart.js +3 -1
- package/js/src/bitstamp.js +24 -36
- package/js/src/bybit.js +2 -1
- package/js/src/cryptocom.js +3 -2
- package/js/src/currencycom.js +1 -2
- package/js/src/htx.js +1 -1
- package/js/src/mexc.js +88 -1
- package/js/src/pro/binance.d.ts +0 -1
- package/js/src/pro/binance.js +4 -64
- package/js/src/pro/bitget.js +1 -9
- package/js/src/pro/bitmex.js +11 -1
- package/js/src/pro/bybit.d.ts +1 -2
- package/js/src/pro/bybit.js +3 -55
- package/js/src/pro/cryptocom.d.ts +7 -2
- package/js/src/pro/cryptocom.js +194 -62
- package/js/src/pro/gate.js +2 -10
- package/js/src/pro/hyperliquid.js +5 -37
- package/js/src/pro/kucoin.d.ts +0 -1
- package/js/src/pro/kucoin.js +3 -60
- package/js/src/pro/kucoinfutures.d.ts +7 -1
- package/js/src/pro/kucoinfutures.js +139 -1
- package/js/src/pro/mexc.d.ts +3 -1
- package/js/src/pro/mexc.js +82 -3
- package/js/src/pro/okx.js +15 -40
- package/js/src/pro/oxfun.d.ts +3 -0
- package/js/src/pro/oxfun.js +75 -0
- package/js/src/pro/phemex.d.ts +2 -1
- package/js/src/pro/phemex.js +45 -1
- package/js/src/pro/woofipro.d.ts +3 -0
- package/js/src/pro/woofipro.js +67 -0
- package/js/src/xt.js +7 -2
- package/package.json +1 -1
package/js/src/base/Exchange.js
CHANGED
|
@@ -11,7 +11,7 @@ const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sor
|
|
|
11
11
|
import { keys as keysFunc, values as valuesFunc, vwap as vwapFunc } from './functions.js';
|
|
12
12
|
// import exceptions from "./errors.js"
|
|
13
13
|
import { // eslint-disable-line object-curly-newline
|
|
14
|
-
ExchangeError, BadSymbol, NullResponse, InvalidAddress, InvalidOrder, NotSupported, BadResponse, AuthenticationError, DDoSProtection, RequestTimeout, NetworkError, InvalidProxySettings, ExchangeNotAvailable, ArgumentsRequired, RateLimitExceeded, BadRequest, ExchangeClosedByUser } from "./errors.js";
|
|
14
|
+
ExchangeError, BadSymbol, NullResponse, InvalidAddress, InvalidOrder, NotSupported, BadResponse, AuthenticationError, DDoSProtection, RequestTimeout, NetworkError, InvalidProxySettings, ExchangeNotAvailable, ArgumentsRequired, RateLimitExceeded, BadRequest, ExchangeClosedByUser, UnsubscribeError } from "./errors.js";
|
|
15
15
|
import { Precise } from './Precise.js';
|
|
16
16
|
//-----------------------------------------------------------------------------
|
|
17
17
|
import WsClient from './ws/WsClient.js';
|
|
@@ -2381,6 +2381,10 @@ export default class Exchange {
|
|
|
2381
2381
|
'max': undefined,
|
|
2382
2382
|
},
|
|
2383
2383
|
},
|
|
2384
|
+
'marginModes': {
|
|
2385
|
+
'cross': undefined,
|
|
2386
|
+
'isolated': undefined,
|
|
2387
|
+
},
|
|
2384
2388
|
'created': undefined,
|
|
2385
2389
|
'info': undefined,
|
|
2386
2390
|
};
|
|
@@ -6487,5 +6491,70 @@ export default class Exchange {
|
|
|
6487
6491
|
*/
|
|
6488
6492
|
throw new NotSupported(this.id + ' fetchTransfers () is not supported yet');
|
|
6489
6493
|
}
|
|
6494
|
+
cleanUnsubscription(client, subHash, unsubHash) {
|
|
6495
|
+
if (unsubHash in client.subscriptions) {
|
|
6496
|
+
delete client.subscriptions[unsubHash];
|
|
6497
|
+
}
|
|
6498
|
+
if (subHash in client.subscriptions) {
|
|
6499
|
+
delete client.subscriptions[subHash];
|
|
6500
|
+
}
|
|
6501
|
+
if (subHash in client.futures) {
|
|
6502
|
+
const error = new UnsubscribeError(this.id + ' ' + subHash);
|
|
6503
|
+
client.reject(error, subHash);
|
|
6504
|
+
}
|
|
6505
|
+
client.resolve(true, unsubHash);
|
|
6506
|
+
}
|
|
6507
|
+
cleanCache(subscription) {
|
|
6508
|
+
const topic = this.safeString(subscription, 'topic');
|
|
6509
|
+
const symbols = this.safeList(subscription, 'symbols', []);
|
|
6510
|
+
const symbolsLength = symbols.length;
|
|
6511
|
+
if (topic === 'ohlcv') {
|
|
6512
|
+
const symbolsAndTimeFrames = this.safeList(subscription, 'symbolsAndTimeframes', []);
|
|
6513
|
+
for (let i = 0; i < symbolsAndTimeFrames.length; i++) {
|
|
6514
|
+
const symbolAndTimeFrame = symbolsAndTimeFrames[i];
|
|
6515
|
+
const symbol = this.safeString(symbolAndTimeFrame, 0);
|
|
6516
|
+
const timeframe = this.safeString(symbolAndTimeFrame, 1);
|
|
6517
|
+
if (timeframe in this.ohlcvs[symbol]) {
|
|
6518
|
+
delete this.ohlcvs[symbol][timeframe];
|
|
6519
|
+
}
|
|
6520
|
+
}
|
|
6521
|
+
}
|
|
6522
|
+
else if (symbolsLength > 0) {
|
|
6523
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
6524
|
+
const symbol = symbols[i];
|
|
6525
|
+
if (topic === 'trades') {
|
|
6526
|
+
delete this.trades[symbol];
|
|
6527
|
+
}
|
|
6528
|
+
else if (topic === 'orderbook') {
|
|
6529
|
+
delete this.orderbooks[symbol];
|
|
6530
|
+
}
|
|
6531
|
+
else if (topic === 'ticker') {
|
|
6532
|
+
delete this.tickers[symbol];
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
else {
|
|
6537
|
+
if (topic === 'myTrades') {
|
|
6538
|
+
// don't reset this.myTrades directly here
|
|
6539
|
+
// because in c# we need to use a different object
|
|
6540
|
+
const keys = Object.keys(this.myTrades);
|
|
6541
|
+
for (let i = 0; i < keys.length; i++) {
|
|
6542
|
+
delete this.myTrades[keys[i]];
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
else if (topic === 'orders') {
|
|
6546
|
+
const orderSymbols = Object.keys(this.orders);
|
|
6547
|
+
for (let i = 0; i < orderSymbols.length; i++) {
|
|
6548
|
+
delete this.orders[orderSymbols[i]];
|
|
6549
|
+
}
|
|
6550
|
+
}
|
|
6551
|
+
else if (topic === 'ticker') {
|
|
6552
|
+
const tickerSymbols = Object.keys(this.tickers);
|
|
6553
|
+
for (let i = 0; i < tickerSymbols.length; i++) {
|
|
6554
|
+
delete this.tickers[tickerSymbols[i]];
|
|
6555
|
+
}
|
|
6556
|
+
}
|
|
6557
|
+
}
|
|
6558
|
+
}
|
|
6490
6559
|
}
|
|
6491
6560
|
export { Exchange, };
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export interface TradingFeeInterface {
|
|
|
35
35
|
tierBased: Bool;
|
|
36
36
|
}
|
|
37
37
|
export declare type Fee = FeeInterface | undefined;
|
|
38
|
+
export interface MarketMarginModes {
|
|
39
|
+
isolated: boolean;
|
|
40
|
+
cross: boolean;
|
|
41
|
+
}
|
|
38
42
|
export interface MarketInterface {
|
|
39
43
|
id: Str;
|
|
40
44
|
numericId?: Num;
|
|
@@ -74,10 +78,7 @@ export interface MarketInterface {
|
|
|
74
78
|
price: Num;
|
|
75
79
|
cost?: Num;
|
|
76
80
|
};
|
|
77
|
-
|
|
78
|
-
isolated: boolean;
|
|
79
|
-
cross: boolean;
|
|
80
|
-
};
|
|
81
|
+
marginModes?: MarketMarginModes;
|
|
81
82
|
limits: {
|
|
82
83
|
amount?: MinMax;
|
|
83
84
|
cost?: MinMax;
|
package/js/src/binance.js
CHANGED
|
@@ -2644,6 +2644,7 @@ export default class binance extends Exchange {
|
|
|
2644
2644
|
* @name binance#fetchCurrencies
|
|
2645
2645
|
* @description fetches all available currencies on an exchange
|
|
2646
2646
|
* @see https://developers.binance.com/docs/wallet/capital/all-coins-info
|
|
2647
|
+
* @see https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets
|
|
2647
2648
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2648
2649
|
* @returns {object} an associative dictionary of currencies
|
|
2649
2650
|
*/
|
|
@@ -2663,9 +2664,13 @@ export default class binance extends Exchange {
|
|
|
2663
2664
|
if (apiBackup !== undefined) {
|
|
2664
2665
|
return undefined;
|
|
2665
2666
|
}
|
|
2666
|
-
const
|
|
2667
|
+
const promises = [this.sapiGetCapitalConfigGetall(params), this.sapiGetMarginAllAssets(params)];
|
|
2668
|
+
const results = await Promise.all(promises);
|
|
2669
|
+
const responseCurrencies = results[0];
|
|
2670
|
+
const responseMarginables = results[1];
|
|
2671
|
+
const marginablesById = this.indexBy(responseMarginables, 'assetName');
|
|
2667
2672
|
const result = {};
|
|
2668
|
-
for (let i = 0; i <
|
|
2673
|
+
for (let i = 0; i < responseCurrencies.length; i++) {
|
|
2669
2674
|
//
|
|
2670
2675
|
// {
|
|
2671
2676
|
// "coin": "LINK",
|
|
@@ -2761,7 +2766,7 @@ export default class binance extends Exchange {
|
|
|
2761
2766
|
// ]
|
|
2762
2767
|
// }
|
|
2763
2768
|
//
|
|
2764
|
-
const entry =
|
|
2769
|
+
const entry = responseCurrencies[i];
|
|
2765
2770
|
const id = this.safeString(entry, 'coin');
|
|
2766
2771
|
const name = this.safeString(entry, 'name');
|
|
2767
2772
|
const code = this.safeCurrencyCode(id);
|
|
@@ -2816,6 +2821,17 @@ export default class binance extends Exchange {
|
|
|
2816
2821
|
}
|
|
2817
2822
|
const trading = this.safeBool(entry, 'trading');
|
|
2818
2823
|
const active = (isWithdrawEnabled && isDepositEnabled && trading);
|
|
2824
|
+
const marginEntry = this.safeDict(marginablesById, id, {});
|
|
2825
|
+
//
|
|
2826
|
+
// {
|
|
2827
|
+
// assetName: "BTC",
|
|
2828
|
+
// assetFullName: "Bitcoin",
|
|
2829
|
+
// isBorrowable: true,
|
|
2830
|
+
// isMortgageable: true,
|
|
2831
|
+
// userMinBorrow: "0",
|
|
2832
|
+
// userMinRepay: "0",
|
|
2833
|
+
// }
|
|
2834
|
+
//
|
|
2819
2835
|
result[code] = {
|
|
2820
2836
|
'id': id,
|
|
2821
2837
|
'name': name,
|
|
@@ -2829,6 +2845,7 @@ export default class binance extends Exchange {
|
|
|
2829
2845
|
'fee': fee,
|
|
2830
2846
|
'fees': fees,
|
|
2831
2847
|
'limits': this.limits,
|
|
2848
|
+
'margin': this.safeBool(marginEntry, 'isBorrowable'),
|
|
2832
2849
|
};
|
|
2833
2850
|
}
|
|
2834
2851
|
return result;
|
|
@@ -2842,6 +2859,8 @@ export default class binance extends Exchange {
|
|
|
2842
2859
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Exchange-Information // swap
|
|
2843
2860
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Exchange-Information // future
|
|
2844
2861
|
* @see https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information // option
|
|
2862
|
+
* @see https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs // cross margin
|
|
2863
|
+
* @see https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol // isolated margin
|
|
2845
2864
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2846
2865
|
* @returns {object[]} an array of objects representing market data
|
|
2847
2866
|
*/
|
|
@@ -2856,10 +2875,16 @@ export default class binance extends Exchange {
|
|
|
2856
2875
|
}
|
|
2857
2876
|
fetchMarkets.push(type);
|
|
2858
2877
|
}
|
|
2878
|
+
let fetchMargins = false;
|
|
2859
2879
|
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
2860
2880
|
const marketType = fetchMarkets[i];
|
|
2861
2881
|
if (marketType === 'spot') {
|
|
2862
2882
|
promisesRaw.push(this.publicGetExchangeInfo(params));
|
|
2883
|
+
if (this.checkRequiredCredentials(false) && !sandboxMode) {
|
|
2884
|
+
fetchMargins = true;
|
|
2885
|
+
promisesRaw.push(this.sapiGetMarginAllPairs(params));
|
|
2886
|
+
promisesRaw.push(this.sapiGetMarginIsolatedAllPairs(params));
|
|
2887
|
+
}
|
|
2863
2888
|
}
|
|
2864
2889
|
else if (marketType === 'linear') {
|
|
2865
2890
|
promisesRaw.push(this.fapiPublicGetExchangeInfo(params));
|
|
@@ -2874,12 +2899,27 @@ export default class binance extends Exchange {
|
|
|
2874
2899
|
throw new ExchangeError(this.id + ' fetchMarkets() this.options fetchMarkets "' + marketType + '" is not a supported market type');
|
|
2875
2900
|
}
|
|
2876
2901
|
}
|
|
2877
|
-
const
|
|
2902
|
+
const results = await Promise.all(promisesRaw);
|
|
2878
2903
|
let markets = [];
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2904
|
+
this.options['crossMarginPairsData'] = [];
|
|
2905
|
+
this.options['isolatedMarginPairsData'] = [];
|
|
2906
|
+
for (let i = 0; i < results.length; i++) {
|
|
2907
|
+
const res = this.safeValue(results, i);
|
|
2908
|
+
if (fetchMargins && Array.isArray(res)) {
|
|
2909
|
+
const keysList = Object.keys(this.indexBy(res, 'symbol'));
|
|
2910
|
+
const length = (Object.keys(this.options['crossMarginPairsData'])).length;
|
|
2911
|
+
// first one is the cross-margin promise
|
|
2912
|
+
if (length === 0) {
|
|
2913
|
+
this.options['crossMarginPairsData'] = keysList;
|
|
2914
|
+
}
|
|
2915
|
+
else {
|
|
2916
|
+
this.options['isolatedMarginPairsData'] = keysList;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
else {
|
|
2920
|
+
const resultMarkets = this.safeList2(res, 'symbols', 'optionSymbols', []);
|
|
2921
|
+
markets = this.arrayConcat(markets, resultMarkets);
|
|
2922
|
+
}
|
|
2883
2923
|
}
|
|
2884
2924
|
//
|
|
2885
2925
|
// spot / margin
|
|
@@ -2925,6 +2965,20 @@ export default class binance extends Exchange {
|
|
|
2925
2965
|
// ],
|
|
2926
2966
|
// }
|
|
2927
2967
|
//
|
|
2968
|
+
// cross & isolated pairs response:
|
|
2969
|
+
//
|
|
2970
|
+
// [
|
|
2971
|
+
// {
|
|
2972
|
+
// symbol: "BTCUSDT",
|
|
2973
|
+
// base: "BTC",
|
|
2974
|
+
// quote: "USDT",
|
|
2975
|
+
// isMarginTrade: true,
|
|
2976
|
+
// isBuyAllowed: true,
|
|
2977
|
+
// isSellAllowed: true,
|
|
2978
|
+
// id: "376870555451677893", // doesn't exist in isolated
|
|
2979
|
+
// },
|
|
2980
|
+
// ]
|
|
2981
|
+
//
|
|
2928
2982
|
// futures/usdt-margined (fapi)
|
|
2929
2983
|
//
|
|
2930
2984
|
// {
|
|
@@ -3159,6 +3213,21 @@ export default class binance extends Exchange {
|
|
|
3159
3213
|
}
|
|
3160
3214
|
}
|
|
3161
3215
|
const isMarginTradingAllowed = this.safeBool(market, 'isMarginTradingAllowed', false);
|
|
3216
|
+
let marginModes = undefined;
|
|
3217
|
+
if (spot) {
|
|
3218
|
+
const hasCrossMargin = this.inArray(id, this.options['crossMarginPairsData']);
|
|
3219
|
+
const hasIsolatedMargin = this.inArray(id, this.options['isolatedMarginPairsData']);
|
|
3220
|
+
marginModes = {
|
|
3221
|
+
'cross': hasCrossMargin,
|
|
3222
|
+
'isolated': hasIsolatedMargin,
|
|
3223
|
+
};
|
|
3224
|
+
}
|
|
3225
|
+
else if (linear || inverse) {
|
|
3226
|
+
marginModes = {
|
|
3227
|
+
'cross': true,
|
|
3228
|
+
'isolated': true,
|
|
3229
|
+
};
|
|
3230
|
+
}
|
|
3162
3231
|
let unifiedType = undefined;
|
|
3163
3232
|
if (spot) {
|
|
3164
3233
|
unifiedType = 'spot';
|
|
@@ -3190,6 +3259,7 @@ export default class binance extends Exchange {
|
|
|
3190
3259
|
'type': unifiedType,
|
|
3191
3260
|
'spot': spot,
|
|
3192
3261
|
'margin': spot && isMarginTradingAllowed,
|
|
3262
|
+
'marginModes': marginModes,
|
|
3193
3263
|
'swap': swap,
|
|
3194
3264
|
'future': future,
|
|
3195
3265
|
'option': option,
|
|
@@ -6333,8 +6403,8 @@ export default class binance extends Exchange {
|
|
|
6333
6403
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOrders', params);
|
|
6334
6404
|
let isPortfolioMargin = undefined;
|
|
6335
6405
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOrders', 'papi', 'portfolioMargin', false);
|
|
6336
|
-
const isConditional = this.
|
|
6337
|
-
params = this.omit(params, ['stop', 'conditional', 'type']);
|
|
6406
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
6407
|
+
params = this.omit(params, ['stop', 'trigger', 'conditional', 'type']);
|
|
6338
6408
|
let request = {
|
|
6339
6409
|
'symbol': market['id'],
|
|
6340
6410
|
};
|
|
@@ -6603,7 +6673,7 @@ export default class binance extends Exchange {
|
|
|
6603
6673
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
6604
6674
|
let isPortfolioMargin = undefined;
|
|
6605
6675
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', false);
|
|
6606
|
-
const isConditional = this.safeBoolN(params, ['stop', '
|
|
6676
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
6607
6677
|
if (symbol !== undefined) {
|
|
6608
6678
|
market = this.market(symbol);
|
|
6609
6679
|
request['symbol'] = market['id'];
|
|
@@ -6620,7 +6690,7 @@ export default class binance extends Exchange {
|
|
|
6620
6690
|
}
|
|
6621
6691
|
let subType = undefined;
|
|
6622
6692
|
[subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
|
|
6623
|
-
params = this.omit(params, ['type', 'stop', '
|
|
6693
|
+
params = this.omit(params, ['type', 'stop', 'trigger', 'conditional']);
|
|
6624
6694
|
let response = undefined;
|
|
6625
6695
|
if (type === 'option') {
|
|
6626
6696
|
if (since !== undefined) {
|
|
@@ -6703,8 +6773,8 @@ export default class binance extends Exchange {
|
|
|
6703
6773
|
};
|
|
6704
6774
|
let isPortfolioMargin = undefined;
|
|
6705
6775
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrder', 'papi', 'portfolioMargin', false);
|
|
6706
|
-
const isConditional = this.safeBoolN(params, ['stop', '
|
|
6707
|
-
params = this.omit(params, ['stop', '
|
|
6776
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
6777
|
+
params = this.omit(params, ['stop', 'trigger', 'conditional']);
|
|
6708
6778
|
const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
|
|
6709
6779
|
const orderIdRequest = isPortfolioMarginConditional ? 'strategyId' : 'orderId';
|
|
6710
6780
|
request[orderIdRequest] = id;
|
|
@@ -7019,7 +7089,7 @@ export default class binance extends Exchange {
|
|
|
7019
7089
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
7020
7090
|
let isPortfolioMargin = undefined;
|
|
7021
7091
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelOrder', 'papi', 'portfolioMargin', false);
|
|
7022
|
-
const isConditional = this.
|
|
7092
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
7023
7093
|
const request = {
|
|
7024
7094
|
'symbol': market['id'],
|
|
7025
7095
|
};
|
|
@@ -7045,7 +7115,7 @@ export default class binance extends Exchange {
|
|
|
7045
7115
|
request['orderId'] = id;
|
|
7046
7116
|
}
|
|
7047
7117
|
}
|
|
7048
|
-
params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'conditional']);
|
|
7118
|
+
params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional']);
|
|
7049
7119
|
let response = undefined;
|
|
7050
7120
|
if (market['option']) {
|
|
7051
7121
|
response = await this.eapiPrivateDeleteOrder(this.extend(request, params));
|
|
@@ -7123,9 +7193,9 @@ export default class binance extends Exchange {
|
|
|
7123
7193
|
};
|
|
7124
7194
|
let isPortfolioMargin = undefined;
|
|
7125
7195
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelAllOrders', 'papi', 'portfolioMargin', false);
|
|
7126
|
-
const isConditional = this.
|
|
7196
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
7127
7197
|
const type = this.safeString(params, 'type', market['type']);
|
|
7128
|
-
params = this.omit(params, ['type', 'stop', 'conditional']);
|
|
7198
|
+
params = this.omit(params, ['type', 'stop', 'trigger', 'conditional']);
|
|
7129
7199
|
let marginMode = undefined;
|
|
7130
7200
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
7131
7201
|
let response = undefined;
|
package/js/src/bitmart.js
CHANGED
|
@@ -232,6 +232,7 @@ export default class bitmart extends Exchange {
|
|
|
232
232
|
'spot/v4/query/trades': 5,
|
|
233
233
|
'spot/v4/query/order-trades': 5,
|
|
234
234
|
'spot/v4/cancel_orders': 3,
|
|
235
|
+
'spot/v4/cancel_all': 90,
|
|
235
236
|
'spot/v4/batch_orders': 3,
|
|
236
237
|
// newer endpoint
|
|
237
238
|
'spot/v3/cancel_order': 1,
|
|
@@ -2967,6 +2968,7 @@ export default class bitmart extends Exchange {
|
|
|
2967
2968
|
* @name bitmart#cancelAllOrders
|
|
2968
2969
|
* @description cancel all open orders in a market
|
|
2969
2970
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
|
2971
|
+
* @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
|
|
2970
2972
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
|
2971
2973
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
|
2972
2974
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
@@ -2985,7 +2987,7 @@ export default class bitmart extends Exchange {
|
|
|
2985
2987
|
let type = undefined;
|
|
2986
2988
|
[type, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
2987
2989
|
if (type === 'spot') {
|
|
2988
|
-
response = await this.
|
|
2990
|
+
response = await this.privatePostSpotV4CancelAll(this.extend(request, params));
|
|
2989
2991
|
}
|
|
2990
2992
|
else if (type === 'swap') {
|
|
2991
2993
|
if (symbol === undefined) {
|
package/js/src/bitstamp.js
CHANGED
|
@@ -392,46 +392,34 @@ export default class bitstamp extends Exchange {
|
|
|
392
392
|
'trading': {
|
|
393
393
|
'tierBased': true,
|
|
394
394
|
'percentage': true,
|
|
395
|
-
'taker': this.parseNumber('0.
|
|
396
|
-
'maker': this.parseNumber('0.
|
|
395
|
+
'taker': this.parseNumber('0.004'),
|
|
396
|
+
'maker': this.parseNumber('0.004'),
|
|
397
397
|
'tiers': {
|
|
398
398
|
'taker': [
|
|
399
|
-
[this.parseNumber('0'), this.parseNumber('0.
|
|
400
|
-
[this.parseNumber('
|
|
401
|
-
[this.parseNumber('100000'), this.parseNumber('0.
|
|
402
|
-
[this.parseNumber('
|
|
403
|
-
[this.parseNumber('
|
|
404
|
-
[this.parseNumber('
|
|
405
|
-
[this.parseNumber('
|
|
406
|
-
[this.parseNumber('
|
|
407
|
-
[this.parseNumber('
|
|
408
|
-
[this.parseNumber('
|
|
409
|
-
[this.parseNumber('
|
|
410
|
-
[this.parseNumber('100000000'), this.parseNumber('0.0007')],
|
|
411
|
-
[this.parseNumber('500000000'), this.parseNumber('0.0005')],
|
|
412
|
-
[this.parseNumber('2000000000'), this.parseNumber('0.0003')],
|
|
413
|
-
[this.parseNumber('6000000000'), this.parseNumber('0.0001')],
|
|
414
|
-
[this.parseNumber('20000000000'), this.parseNumber('0.00005')],
|
|
415
|
-
[this.parseNumber('20000000001'), this.parseNumber('0')],
|
|
399
|
+
[this.parseNumber('0'), this.parseNumber('0.004')],
|
|
400
|
+
[this.parseNumber('10000'), this.parseNumber('0.003')],
|
|
401
|
+
[this.parseNumber('100000'), this.parseNumber('0.002')],
|
|
402
|
+
[this.parseNumber('500000'), this.parseNumber('0.0018')],
|
|
403
|
+
[this.parseNumber('1500000'), this.parseNumber('0.0016')],
|
|
404
|
+
[this.parseNumber('5000000'), this.parseNumber('0.0012')],
|
|
405
|
+
[this.parseNumber('20000000'), this.parseNumber('0.001')],
|
|
406
|
+
[this.parseNumber('50000000'), this.parseNumber('0.0008')],
|
|
407
|
+
[this.parseNumber('100000000'), this.parseNumber('0.0006')],
|
|
408
|
+
[this.parseNumber('250000000'), this.parseNumber('0.0005')],
|
|
409
|
+
[this.parseNumber('1000000000'), this.parseNumber('0.0003')],
|
|
416
410
|
],
|
|
417
411
|
'maker': [
|
|
418
|
-
[this.parseNumber('0'), this.parseNumber('0.
|
|
419
|
-
[this.parseNumber('
|
|
420
|
-
[this.parseNumber('100000'), this.parseNumber('0.
|
|
421
|
-
[this.parseNumber('
|
|
422
|
-
[this.parseNumber('
|
|
423
|
-
[this.parseNumber('
|
|
424
|
-
[this.parseNumber('
|
|
425
|
-
[this.parseNumber('
|
|
426
|
-
[this.parseNumber('
|
|
427
|
-
[this.parseNumber('
|
|
428
|
-
[this.parseNumber('
|
|
429
|
-
[this.parseNumber('100000000'), this.parseNumber('0.0007')],
|
|
430
|
-
[this.parseNumber('500000000'), this.parseNumber('0.0005')],
|
|
431
|
-
[this.parseNumber('2000000000'), this.parseNumber('0.0003')],
|
|
432
|
-
[this.parseNumber('6000000000'), this.parseNumber('0.0001')],
|
|
433
|
-
[this.parseNumber('20000000000'), this.parseNumber('0.00005')],
|
|
434
|
-
[this.parseNumber('20000000001'), this.parseNumber('0')],
|
|
412
|
+
[this.parseNumber('0'), this.parseNumber('0.003')],
|
|
413
|
+
[this.parseNumber('10000'), this.parseNumber('0.002')],
|
|
414
|
+
[this.parseNumber('100000'), this.parseNumber('0.001')],
|
|
415
|
+
[this.parseNumber('500000'), this.parseNumber('0.0008')],
|
|
416
|
+
[this.parseNumber('1500000'), this.parseNumber('0.0006')],
|
|
417
|
+
[this.parseNumber('5000000'), this.parseNumber('0.0003')],
|
|
418
|
+
[this.parseNumber('20000000'), this.parseNumber('0.002')],
|
|
419
|
+
[this.parseNumber('50000000'), this.parseNumber('0.0001')],
|
|
420
|
+
[this.parseNumber('100000000'), this.parseNumber('0')],
|
|
421
|
+
[this.parseNumber('250000000'), this.parseNumber('0')],
|
|
422
|
+
[this.parseNumber('1000000000'), this.parseNumber('0')],
|
|
435
423
|
],
|
|
436
424
|
},
|
|
437
425
|
},
|
package/js/src/bybit.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/bybit.js';
|
|
9
9
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
10
|
-
import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, MarginModeAlreadySet, NoChange, ManualInteractionNeeded } from './base/errors.js';
|
|
10
|
+
import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, MarginModeAlreadySet, NoChange, ManualInteractionNeeded, BadSymbol } from './base/errors.js';
|
|
11
11
|
import { Precise } from './base/Precise.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
import { rsa } from './base/functions/rsa.js';
|
|
@@ -979,6 +979,7 @@ export default class bybit extends Exchange {
|
|
|
979
979
|
'3200300': InsufficientFunds, // {"retCode":3200300,"retMsg":"Insufficient margin balance.","result":null,"retExtMap":{}}
|
|
980
980
|
},
|
|
981
981
|
'broad': {
|
|
982
|
+
'Not supported symbols': BadSymbol,
|
|
982
983
|
'Request timeout': RequestTimeout,
|
|
983
984
|
'unknown orderInfo': OrderNotFound,
|
|
984
985
|
'invalid api_key': AuthenticationError,
|
package/js/src/cryptocom.js
CHANGED
|
@@ -141,7 +141,7 @@ export default class cryptocom extends Exchange {
|
|
|
141
141
|
'www': 'https://crypto.com/',
|
|
142
142
|
'referral': {
|
|
143
143
|
'url': 'https://crypto.com/exch/kdacthrnxt',
|
|
144
|
-
'discount': 0.
|
|
144
|
+
'discount': 0.75,
|
|
145
145
|
},
|
|
146
146
|
'doc': [
|
|
147
147
|
'https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html',
|
|
@@ -605,7 +605,7 @@ export default class cryptocom extends Exchange {
|
|
|
605
605
|
* @method
|
|
606
606
|
* @name cryptocom#fetchTickers
|
|
607
607
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
608
|
-
* @see https://exchange-docs.crypto.com/
|
|
608
|
+
* @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
|
|
609
609
|
* @see https://exchange-docs.crypto.com/derivatives/index.html#public-get-tickers
|
|
610
610
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
611
611
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1799,6 +1799,7 @@ export default class cryptocom extends Exchange {
|
|
|
1799
1799
|
* @method
|
|
1800
1800
|
* @name cryptocom#fetchDepositAddress
|
|
1801
1801
|
* @description fetch the deposit address for a currency associated with this account
|
|
1802
|
+
* @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address
|
|
1802
1803
|
* @param {string} code unified currency code
|
|
1803
1804
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1804
1805
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
package/js/src/currencycom.js
CHANGED
|
@@ -1992,7 +1992,7 @@ export default class currencycom extends Exchange {
|
|
|
1992
1992
|
'collateral': undefined,
|
|
1993
1993
|
'side': side,
|
|
1994
1994
|
// 'realizedProfit': this.safeNumber (position, 'rpl'),
|
|
1995
|
-
'
|
|
1995
|
+
'unrealizedPnl': unrealizedProfit,
|
|
1996
1996
|
'leverage': leverage,
|
|
1997
1997
|
'percentage': undefined,
|
|
1998
1998
|
'marginMode': undefined,
|
|
@@ -2006,7 +2006,6 @@ export default class currencycom extends Exchange {
|
|
|
2006
2006
|
'maintenanceMarginPercentage': undefined,
|
|
2007
2007
|
'marginRatio': undefined,
|
|
2008
2008
|
'id': undefined,
|
|
2009
|
-
'unrealizedPnl': undefined,
|
|
2010
2009
|
'hedged': undefined,
|
|
2011
2010
|
'stopLossPrice': undefined,
|
|
2012
2011
|
'takeProfitPrice': undefined,
|
package/js/src/htx.js
CHANGED
|
@@ -7645,7 +7645,7 @@ export default class htx extends Exchange {
|
|
|
7645
7645
|
'entryPrice': entryPrice,
|
|
7646
7646
|
'collateral': this.parseNumber(collateral),
|
|
7647
7647
|
'side': side,
|
|
7648
|
-
'
|
|
7648
|
+
'unrealizedPnl': unrealizedProfit,
|
|
7649
7649
|
'leverage': this.parseNumber(leverage),
|
|
7650
7650
|
'percentage': this.parseNumber(percentage),
|
|
7651
7651
|
'marginMode': marginMode,
|