ccxt 4.1.75 → 4.1.77
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 +3 -3
- package/dist/ccxt.browser.js +287 -235
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +2 -0
- package/dist/cjs/src/alpaca.js +2 -0
- package/dist/cjs/src/base/Exchange.js +8 -0
- package/dist/cjs/src/base/errors.js +7 -7
- package/dist/cjs/src/base/ws/Client.js +2 -0
- package/dist/cjs/src/binance.js +4 -0
- package/dist/cjs/src/binanceus.js +2 -0
- package/dist/cjs/src/bingx.js +80 -23
- package/dist/cjs/src/bit2c.js +2 -0
- package/dist/cjs/src/bitbank.js +2 -0
- package/dist/cjs/src/bithumb.js +2 -0
- package/dist/cjs/src/bitmex.js +6 -0
- package/dist/cjs/src/bitopro.js +2 -0
- package/dist/cjs/src/bitpanda.js +2 -0
- package/dist/cjs/src/bitrue.js +27 -1
- package/dist/cjs/src/bitso.js +2 -0
- package/dist/cjs/src/bitstamp.js +5 -2
- package/dist/cjs/src/bittrex.js +2 -0
- package/dist/cjs/src/bitvavo.js +2 -0
- package/dist/cjs/src/bl3p.js +2 -0
- package/dist/cjs/src/btcalpha.js +2 -0
- package/dist/cjs/src/btcbox.js +2 -0
- package/dist/cjs/src/btcmarkets.js +2 -0
- package/dist/cjs/src/btcturk.js +2 -0
- package/dist/cjs/src/bybit.js +2 -0
- package/dist/cjs/src/coinbase.js +37 -6
- package/dist/cjs/src/coincheck.js +2 -0
- package/dist/cjs/src/coinlist.js +2 -0
- package/dist/cjs/src/coinmate.js +2 -0
- package/dist/cjs/src/coinone.js +2 -0
- package/dist/cjs/src/coinsph.js +2 -0
- package/dist/cjs/src/coinspot.js +2 -0
- package/dist/cjs/src/cryptocom.js +2 -185
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/gemini.js +2 -0
- package/dist/cjs/src/idex.js +2 -0
- package/dist/cjs/src/independentreserve.js +2 -0
- package/dist/cjs/src/indodax.js +2 -0
- package/dist/cjs/src/kucoin.js +2 -0
- package/dist/cjs/src/kuna.js +2 -0
- package/dist/cjs/src/latoken.js +2 -0
- package/dist/cjs/src/luno.js +2 -0
- package/dist/cjs/src/mercado.js +2 -0
- package/dist/cjs/src/mexc.js +2 -0
- package/dist/cjs/src/ndax.js +2 -0
- package/dist/cjs/src/novadax.js +2 -0
- package/dist/cjs/src/okx.js +25 -10
- package/dist/cjs/src/p2b.js +2 -0
- package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +8 -11
- package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -8
- package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -12
- package/dist/cjs/src/wavesexchange.js +2 -0
- package/dist/cjs/src/wazirx.js +2 -0
- package/dist/cjs/src/woo.js +2 -0
- package/dist/cjs/src/yobit.js +2 -0
- package/dist/cjs/src/zonda.js +2 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +2 -0
- package/js/src/abstract/binancecoinm.d.ts +2 -0
- package/js/src/abstract/binanceus.d.ts +2 -0
- package/js/src/abstract/binanceusdm.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +14 -0
- package/js/src/ace.js +2 -0
- package/js/src/alpaca.js +2 -0
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +8 -0
- package/js/src/base/errors.d.ts +4 -4
- package/js/src/base/errors.js +7 -7
- package/js/src/base/ws/Client.js +2 -0
- package/js/src/binance.js +4 -0
- package/js/src/binanceus.js +2 -0
- package/js/src/bingx.d.ts +4 -3
- package/js/src/bingx.js +80 -23
- package/js/src/bit2c.js +2 -0
- package/js/src/bitbank.js +2 -0
- package/js/src/bithumb.js +2 -0
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +6 -0
- package/js/src/bitopro.js +2 -0
- package/js/src/bitpanda.js +2 -0
- package/js/src/bitrue.d.ts +1 -0
- package/js/src/bitrue.js +27 -1
- package/js/src/bitso.js +2 -0
- package/js/src/bitstamp.js +5 -2
- package/js/src/bittrex.js +2 -0
- package/js/src/bitvavo.js +2 -0
- package/js/src/bl3p.js +2 -0
- package/js/src/btcalpha.js +2 -0
- package/js/src/btcbox.js +2 -0
- package/js/src/btcmarkets.js +2 -0
- package/js/src/btcturk.js +2 -0
- package/js/src/bybit.js +2 -0
- package/js/src/coinbase.d.ts +1 -0
- package/js/src/coinbase.js +37 -6
- package/js/src/coincheck.js +2 -0
- package/js/src/coinlist.js +2 -0
- package/js/src/coinmate.js +2 -0
- package/js/src/coinone.js +2 -0
- package/js/src/coinsph.js +2 -0
- package/js/src/coinspot.js +2 -0
- package/js/src/cryptocom.d.ts +0 -24
- package/js/src/cryptocom.js +2 -185
- package/js/src/gate.js +1 -0
- package/js/src/gemini.js +2 -0
- package/js/src/idex.js +2 -0
- package/js/src/independentreserve.js +2 -0
- package/js/src/indodax.js +2 -0
- package/js/src/kucoin.js +2 -0
- package/js/src/kuna.js +2 -0
- package/js/src/latoken.js +2 -0
- package/js/src/luno.js +2 -0
- package/js/src/mercado.js +2 -0
- package/js/src/mexc.js +2 -0
- package/js/src/ndax.js +2 -0
- package/js/src/novadax.js +2 -0
- package/js/src/okx.js +25 -10
- package/js/src/p2b.js +2 -0
- package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +9 -8
- package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -7
- package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -7
- package/js/src/wavesexchange.js +2 -0
- package/js/src/wazirx.js +2 -0
- package/js/src/woo.js +2 -0
- package/js/src/yobit.js +2 -0
- package/js/src/zonda.js +2 -0
- package/package.json +1 -1
package/dist/cjs/src/wazirx.js
CHANGED
package/dist/cjs/src/woo.js
CHANGED
package/dist/cjs/src/yobit.js
CHANGED
package/dist/cjs/src/zonda.js
CHANGED
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.1.
|
|
7
|
+
declare const version = "4.1.76";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.1.
|
|
41
|
+
const version = '4.1.77';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -552,6 +552,7 @@ interface Exchange {
|
|
|
552
552
|
publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
|
|
553
553
|
publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
554
554
|
publicGetTicker(params?: {}): Promise<implicitReturnType>;
|
|
555
|
+
publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
|
|
555
556
|
publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
556
557
|
publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
557
558
|
publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
@@ -570,6 +571,7 @@ interface Exchange {
|
|
|
570
571
|
privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
|
|
571
572
|
privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
|
|
572
573
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
574
|
+
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
573
575
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
574
576
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
575
577
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
@@ -552,6 +552,7 @@ interface binance {
|
|
|
552
552
|
publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
|
|
553
553
|
publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
554
554
|
publicGetTicker(params?: {}): Promise<implicitReturnType>;
|
|
555
|
+
publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
|
|
555
556
|
publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
556
557
|
publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
557
558
|
publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
@@ -570,6 +571,7 @@ interface binance {
|
|
|
570
571
|
privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
|
|
571
572
|
privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
|
|
572
573
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
574
|
+
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
573
575
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
574
576
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
575
577
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
@@ -552,6 +552,7 @@ interface binance {
|
|
|
552
552
|
publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
|
|
553
553
|
publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
554
554
|
publicGetTicker(params?: {}): Promise<implicitReturnType>;
|
|
555
|
+
publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
|
|
555
556
|
publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
556
557
|
publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
557
558
|
publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
@@ -570,6 +571,7 @@ interface binance {
|
|
|
570
571
|
privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
|
|
571
572
|
privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
|
|
572
573
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
574
|
+
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
573
575
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
574
576
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
575
577
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
@@ -552,6 +552,7 @@ interface binance {
|
|
|
552
552
|
publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
|
|
553
553
|
publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
554
554
|
publicGetTicker(params?: {}): Promise<implicitReturnType>;
|
|
555
|
+
publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
|
|
555
556
|
publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
556
557
|
publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
557
558
|
publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
@@ -570,6 +571,7 @@ interface binance {
|
|
|
570
571
|
privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
|
|
571
572
|
privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
|
|
572
573
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
574
|
+
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
573
575
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
574
576
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
575
577
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
package/js/src/abstract/okx.d.ts
CHANGED
|
@@ -65,6 +65,12 @@ interface Exchange {
|
|
|
65
65
|
publicGetFinanceSavingsLendingRateSummary(params?: {}): Promise<implicitReturnType>;
|
|
66
66
|
publicGetFinanceSavingsLendingRateHistory(params?: {}): Promise<implicitReturnType>;
|
|
67
67
|
publicGetFinanceSfpDcdProducts(params?: {}): Promise<implicitReturnType>;
|
|
68
|
+
publicGetCopytradingPublicLeadTraders(params?: {}): Promise<implicitReturnType>;
|
|
69
|
+
publicGetCopytradingPublicWeeklyPnl(params?: {}): Promise<implicitReturnType>;
|
|
70
|
+
publicGetCopytradingPublicStats(params?: {}): Promise<implicitReturnType>;
|
|
71
|
+
publicGetCopytradingPublicPreferenceCurrency(params?: {}): Promise<implicitReturnType>;
|
|
72
|
+
publicGetCopytradingPublicCurrentSubpositions(params?: {}): Promise<implicitReturnType>;
|
|
73
|
+
publicGetCopytradingPublicSubpositionsHistory(params?: {}): Promise<implicitReturnType>;
|
|
68
74
|
privateGetRfqCounterparties(params?: {}): Promise<implicitReturnType>;
|
|
69
75
|
privateGetRfqMakerInstrumentSettings(params?: {}): Promise<implicitReturnType>;
|
|
70
76
|
privateGetRfqRfqs(params?: {}): Promise<implicitReturnType>;
|
|
@@ -166,6 +172,10 @@ interface Exchange {
|
|
|
166
172
|
privateGetCopytradingProfitSharingDetails(params?: {}): Promise<implicitReturnType>;
|
|
167
173
|
privateGetCopytradingTotalProfitSharing(params?: {}): Promise<implicitReturnType>;
|
|
168
174
|
privateGetCopytradingUnrealizedProfitSharingDetails(params?: {}): Promise<implicitReturnType>;
|
|
175
|
+
privateGetCopytradingCopySettings(params?: {}): Promise<implicitReturnType>;
|
|
176
|
+
privateGetCopytradingBatchLeverageInfo(params?: {}): Promise<implicitReturnType>;
|
|
177
|
+
privateGetCopytradingCurrentLeadTraders(params?: {}): Promise<implicitReturnType>;
|
|
178
|
+
privateGetCopytradingLeadTradersHistory(params?: {}): Promise<implicitReturnType>;
|
|
169
179
|
privateGetBrokerNdInfo(params?: {}): Promise<implicitReturnType>;
|
|
170
180
|
privateGetBrokerNdSubaccountInfo(params?: {}): Promise<implicitReturnType>;
|
|
171
181
|
privateGetBrokerNdSubaccountApikey(params?: {}): Promise<implicitReturnType>;
|
|
@@ -259,6 +269,10 @@ interface Exchange {
|
|
|
259
269
|
privatePostCopytradingAlgoOrder(params?: {}): Promise<implicitReturnType>;
|
|
260
270
|
privatePostCopytradingCloseSubposition(params?: {}): Promise<implicitReturnType>;
|
|
261
271
|
privatePostCopytradingSetInstruments(params?: {}): Promise<implicitReturnType>;
|
|
272
|
+
privatePostCopytradingFirstCopySettings(params?: {}): Promise<implicitReturnType>;
|
|
273
|
+
privatePostCopytradingAmendCopySettings(params?: {}): Promise<implicitReturnType>;
|
|
274
|
+
privatePostCopytradingStopCopyTrading(params?: {}): Promise<implicitReturnType>;
|
|
275
|
+
privatePostCopytradingBatchSetLeverage(params?: {}): Promise<implicitReturnType>;
|
|
262
276
|
privatePostBrokerNdCreateSubaccount(params?: {}): Promise<implicitReturnType>;
|
|
263
277
|
privatePostBrokerNdDeleteSubaccount(params?: {}): Promise<implicitReturnType>;
|
|
264
278
|
privatePostBrokerNdSubaccountApikey(params?: {}): Promise<implicitReturnType>;
|
package/js/src/ace.js
CHANGED
package/js/src/alpaca.js
CHANGED
|
@@ -291,6 +291,8 @@ export default class Exchange {
|
|
|
291
291
|
cancelAllOrders: any;
|
|
292
292
|
cancelOrder: boolean;
|
|
293
293
|
cancelOrders: any;
|
|
294
|
+
closeAllPositions: any;
|
|
295
|
+
closePosition: any;
|
|
294
296
|
createDepositAddress: any;
|
|
295
297
|
createLimitOrder: boolean;
|
|
296
298
|
createMarketOrder: boolean;
|
|
@@ -790,6 +792,8 @@ export default class Exchange {
|
|
|
790
792
|
fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
|
|
791
793
|
fetchFundingRateHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
792
794
|
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
795
|
+
closePosition(symbol: string, side?: OrderSide, marginMode?: string, params?: {}): Promise<Position>;
|
|
796
|
+
closeAllPositions(params?: {}): Promise<Position[]>;
|
|
793
797
|
parseLastPrice(price: any, market?: Market): any;
|
|
794
798
|
fetchDepositAddress(code: string, params?: {}): Promise<any>;
|
|
795
799
|
account(): Account;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -349,6 +349,8 @@ export default class Exchange {
|
|
|
349
349
|
'cancelAllOrders': undefined,
|
|
350
350
|
'cancelOrder': true,
|
|
351
351
|
'cancelOrders': undefined,
|
|
352
|
+
'closeAllPositions': undefined,
|
|
353
|
+
'closePosition': undefined,
|
|
352
354
|
'createDepositAddress': undefined,
|
|
353
355
|
'createLimitOrder': true,
|
|
354
356
|
'createMarketOrder': true,
|
|
@@ -3694,6 +3696,12 @@ export default class Exchange {
|
|
|
3694
3696
|
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3695
3697
|
throw new NotSupported(this.id + ' fetchFundingHistory() is not supported yet');
|
|
3696
3698
|
}
|
|
3699
|
+
async closePosition(symbol, side = undefined, marginMode = undefined, params = {}) {
|
|
3700
|
+
throw new NotSupported(this.id + ' closePositions() is not supported yet');
|
|
3701
|
+
}
|
|
3702
|
+
async closeAllPositions(params = {}) {
|
|
3703
|
+
throw new NotSupported(this.id + ' closeAllPositions() is not supported yet');
|
|
3704
|
+
}
|
|
3697
3705
|
parseLastPrice(price, market = undefined) {
|
|
3698
3706
|
throw new NotSupported(this.id + ' parseLastPrice() is not supported yet');
|
|
3699
3707
|
}
|
package/js/src/base/errors.d.ts
CHANGED
|
@@ -76,7 +76,10 @@ declare class DuplicateOrderId extends InvalidOrder {
|
|
|
76
76
|
declare class NotSupported extends ExchangeError {
|
|
77
77
|
constructor(message: any);
|
|
78
78
|
}
|
|
79
|
-
declare class
|
|
79
|
+
declare class OperationFailed extends BaseError {
|
|
80
|
+
constructor(message: any);
|
|
81
|
+
}
|
|
82
|
+
declare class NetworkError extends OperationFailed {
|
|
80
83
|
constructor(message: any);
|
|
81
84
|
}
|
|
82
85
|
declare class DDoSProtection extends NetworkError {
|
|
@@ -97,9 +100,6 @@ declare class InvalidNonce extends NetworkError {
|
|
|
97
100
|
declare class RequestTimeout extends NetworkError {
|
|
98
101
|
constructor(message: any);
|
|
99
102
|
}
|
|
100
|
-
declare class OperationFailed extends BaseError {
|
|
101
|
-
constructor(message: any);
|
|
102
|
-
}
|
|
103
103
|
declare const errors: {
|
|
104
104
|
BaseError: typeof BaseError;
|
|
105
105
|
ExchangeError: typeof ExchangeError;
|
package/js/src/base/errors.js
CHANGED
|
@@ -192,8 +192,14 @@ class NotSupported extends ExchangeError {
|
|
|
192
192
|
this.name = 'NotSupported';
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
+
class OperationFailed extends BaseError {
|
|
196
|
+
constructor(message) {
|
|
197
|
+
super(message);
|
|
198
|
+
this.name = 'OperationFailed';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
195
201
|
// Network error
|
|
196
|
-
class NetworkError extends
|
|
202
|
+
class NetworkError extends OperationFailed {
|
|
197
203
|
constructor(message) {
|
|
198
204
|
super(message);
|
|
199
205
|
this.name = 'NetworkError';
|
|
@@ -235,12 +241,6 @@ class RequestTimeout extends NetworkError {
|
|
|
235
241
|
this.name = 'RequestTimeout';
|
|
236
242
|
}
|
|
237
243
|
}
|
|
238
|
-
class OperationFailed extends BaseError {
|
|
239
|
-
constructor(message) {
|
|
240
|
-
super(message);
|
|
241
|
-
this.name = 'OperationFailed';
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
244
|
/* ------------------------------------------------------------------------ */
|
|
245
245
|
// export default subclass (
|
|
246
246
|
// // Root class
|
package/js/src/base/ws/Client.js
CHANGED
|
@@ -199,6 +199,7 @@ export default class Client {
|
|
|
199
199
|
this.reset(this.error);
|
|
200
200
|
this.onErrorCallback(this, this.error);
|
|
201
201
|
}
|
|
202
|
+
/* eslint-disable no-shadow */
|
|
202
203
|
onClose(event) {
|
|
203
204
|
if (this.verbose) {
|
|
204
205
|
this.log(new Date(), 'onClose', event);
|
|
@@ -226,6 +227,7 @@ export default class Client {
|
|
|
226
227
|
message = (typeof message === 'string') ? message : JSON.stringify(message);
|
|
227
228
|
const future = createFuture();
|
|
228
229
|
if (isNode) {
|
|
230
|
+
/* eslint-disable no-inner-declarations */
|
|
229
231
|
function onSendComplete(error) {
|
|
230
232
|
if (error) {
|
|
231
233
|
future.reject(error);
|
package/js/src/binance.js
CHANGED
|
@@ -41,6 +41,8 @@ export default class binance extends Exchange {
|
|
|
41
41
|
'cancelAllOrders': true,
|
|
42
42
|
'cancelOrder': true,
|
|
43
43
|
'cancelOrders': true,
|
|
44
|
+
'closeAllPositions': false,
|
|
45
|
+
'closePosition': false,
|
|
44
46
|
'createDepositAddress': false,
|
|
45
47
|
'createOrder': true,
|
|
46
48
|
'createOrders': true,
|
|
@@ -877,6 +879,7 @@ export default class binance extends Exchange {
|
|
|
877
879
|
'uiKlines': 0.4,
|
|
878
880
|
'ticker/24hr': { 'cost': 0.4, 'noSymbol': 16 },
|
|
879
881
|
'ticker': { 'cost': 0.4, 'noSymbol': 16 },
|
|
882
|
+
'ticker/tradingDay': 0.8,
|
|
880
883
|
'ticker/price': { 'cost': 0.4, 'noSymbol': 0.8 },
|
|
881
884
|
'ticker/bookTicker': { 'cost': 0.4, 'noSymbol': 0.8 },
|
|
882
885
|
'exchangeInfo': 4,
|
|
@@ -905,6 +908,7 @@ export default class binance extends Exchange {
|
|
|
905
908
|
'rateLimit/order': 8,
|
|
906
909
|
'myPreventedMatches': 4,
|
|
907
910
|
'myAllocations': 4,
|
|
911
|
+
'account/commission': 4,
|
|
908
912
|
},
|
|
909
913
|
'post': {
|
|
910
914
|
'order/oco': 0.2,
|
package/js/src/binanceus.js
CHANGED
|
@@ -51,6 +51,8 @@ export default class binanceus extends binance {
|
|
|
51
51
|
'option': false,
|
|
52
52
|
'addMargin': false,
|
|
53
53
|
'borrowMargin': false,
|
|
54
|
+
'closeAllPositions': false,
|
|
55
|
+
'closePosition': false,
|
|
54
56
|
'createReduceOnlyOrder': false,
|
|
55
57
|
'fetchBorrowInterest': false,
|
|
56
58
|
'fetchBorrowRate': false,
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bingx.js';
|
|
2
|
-
import { Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency } from './base/types.js';
|
|
2
|
+
import { Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position } from './base/types.js';
|
|
3
3
|
export default class bingx extends Exchange {
|
|
4
4
|
describe(): any;
|
|
5
5
|
fetchTime(params?: {}): Promise<number>;
|
|
@@ -59,8 +59,8 @@ export default class bingx extends Exchange {
|
|
|
59
59
|
parseTicker(ticker: any, market?: Market): Ticker;
|
|
60
60
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
61
61
|
parseBalance(response: any): Balances;
|
|
62
|
-
fetchPositions(symbols?: Strings, params?: {}): Promise<
|
|
63
|
-
parsePosition(position: any, market?: Market):
|
|
62
|
+
fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
|
|
63
|
+
parsePosition(position: any, market?: Market): Position;
|
|
64
64
|
createMarketOrderWithCost(symbol: string, side: OrderSide, cost: any, params?: {}): Promise<Order>;
|
|
65
65
|
createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
66
66
|
createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
@@ -133,6 +133,7 @@ export default class bingx extends Exchange {
|
|
|
133
133
|
parseParams(params: any): {};
|
|
134
134
|
fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
|
|
135
135
|
parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
|
|
136
|
+
closeAllPositions(params?: {}): Promise<Position[]>;
|
|
136
137
|
sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
137
138
|
url: any;
|
|
138
139
|
method: string;
|
package/js/src/bingx.js
CHANGED
|
@@ -32,6 +32,8 @@ export default class bingx extends Exchange {
|
|
|
32
32
|
'cancelAllOrders': true,
|
|
33
33
|
'cancelOrder': true,
|
|
34
34
|
'cancelOrders': true,
|
|
35
|
+
'closeAllPosition': true,
|
|
36
|
+
'closePosition': false,
|
|
35
37
|
'createMarketBuyOrderWithCost': true,
|
|
36
38
|
'createMarketOrderWithCost': true,
|
|
37
39
|
'createMarketSellOrderWithCost': true,
|
|
@@ -83,10 +85,18 @@ export default class bingx extends Exchange {
|
|
|
83
85
|
'www': 'https://bingx.com/',
|
|
84
86
|
'doc': 'https://bingx-api.github.io/docs/',
|
|
85
87
|
'referral': 'https://bingx.com/invite/OHETOM',
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
},
|
|
89
|
+
'fees': {
|
|
90
|
+
'tierBased': true,
|
|
91
|
+
'spot': {
|
|
92
|
+
'feeSide': 'get',
|
|
93
|
+
'maker': this.parseNumber('0.001'),
|
|
94
|
+
'taker': this.parseNumber('0.001'),
|
|
95
|
+
},
|
|
96
|
+
'swap': {
|
|
97
|
+
'feeSide': 'quote',
|
|
98
|
+
'maker': this.parseNumber('0.0002'),
|
|
99
|
+
'taker': this.parseNumber('0.0005'),
|
|
90
100
|
},
|
|
91
101
|
},
|
|
92
102
|
'requiredCredentials': {
|
|
@@ -305,9 +315,6 @@ export default class bingx extends Exchange {
|
|
|
305
315
|
'1w': '1w',
|
|
306
316
|
'1M': '1M',
|
|
307
317
|
},
|
|
308
|
-
'fees': {
|
|
309
|
-
'trading': {},
|
|
310
|
-
},
|
|
311
318
|
'precisionMode': DECIMAL_PLACES,
|
|
312
319
|
'exceptions': {
|
|
313
320
|
'exact': {
|
|
@@ -559,11 +566,12 @@ export default class bingx extends Exchange {
|
|
|
559
566
|
if (settle !== undefined) {
|
|
560
567
|
symbol += ':' + settle;
|
|
561
568
|
}
|
|
569
|
+
const fees = this.safeValue(this.fees, type, {});
|
|
562
570
|
const contractSize = this.safeNumber(market, 'size');
|
|
563
571
|
const isActive = this.safeString(market, 'status') === '1';
|
|
564
572
|
const isInverse = (spot) ? undefined : false;
|
|
565
573
|
const isLinear = (spot) ? undefined : swap;
|
|
566
|
-
return {
|
|
574
|
+
return this.safeMarketStructure({
|
|
567
575
|
'id': id,
|
|
568
576
|
'symbol': symbol,
|
|
569
577
|
'base': base,
|
|
@@ -582,8 +590,9 @@ export default class bingx extends Exchange {
|
|
|
582
590
|
'contract': swap,
|
|
583
591
|
'linear': isLinear,
|
|
584
592
|
'inverse': isInverse,
|
|
585
|
-
'taker':
|
|
586
|
-
'maker':
|
|
593
|
+
'taker': this.safeNumber(fees, 'taker'),
|
|
594
|
+
'maker': this.safeNumber(fees, 'maker'),
|
|
595
|
+
'feeSide': this.safeString(fees, 'feeSide'),
|
|
587
596
|
'contractSize': contractSize,
|
|
588
597
|
'expiry': undefined,
|
|
589
598
|
'expiryDatetime': undefined,
|
|
@@ -613,7 +622,7 @@ export default class bingx extends Exchange {
|
|
|
613
622
|
},
|
|
614
623
|
'created': undefined,
|
|
615
624
|
'info': market,
|
|
616
|
-
};
|
|
625
|
+
});
|
|
617
626
|
}
|
|
618
627
|
async fetchMarkets(params = {}) {
|
|
619
628
|
/**
|
|
@@ -1579,23 +1588,28 @@ export default class bingx extends Exchange {
|
|
|
1579
1588
|
// "avgPrice": "2.2",
|
|
1580
1589
|
// "leverage": 10,
|
|
1581
1590
|
// }
|
|
1591
|
+
//
|
|
1582
1592
|
// standard position
|
|
1593
|
+
//
|
|
1583
1594
|
// {
|
|
1584
|
-
// "currentPrice":"82.91",
|
|
1585
|
-
// "symbol":"LTC/USDT",
|
|
1586
|
-
// "initialMargin":"5.00000000000000000000",
|
|
1587
|
-
// "unrealizedProfit":"-0.26464500",
|
|
1588
|
-
// "leverage":"20.000000000",
|
|
1589
|
-
// "isolated":true,
|
|
1590
|
-
// "entryPrice":"83.13",
|
|
1591
|
-
// "positionSide":"LONG",
|
|
1592
|
-
// "positionAmt":"1.20365912",
|
|
1595
|
+
// "currentPrice": "82.91",
|
|
1596
|
+
// "symbol": "LTC/USDT",
|
|
1597
|
+
// "initialMargin": "5.00000000000000000000",
|
|
1598
|
+
// "unrealizedProfit": "-0.26464500",
|
|
1599
|
+
// "leverage": "20.000000000",
|
|
1600
|
+
// "isolated": true,
|
|
1601
|
+
// "entryPrice": "83.13",
|
|
1602
|
+
// "positionSide": "LONG",
|
|
1603
|
+
// "positionAmt": "1.20365912",
|
|
1593
1604
|
// }
|
|
1594
1605
|
//
|
|
1595
|
-
let marketId = this.safeString(position, 'symbol');
|
|
1606
|
+
let marketId = this.safeString(position, 'symbol', '');
|
|
1596
1607
|
marketId = marketId.replace('/', '-'); // standard return different format
|
|
1597
1608
|
const isolated = this.safeValue(position, 'isolated');
|
|
1598
|
-
|
|
1609
|
+
let marginMode = undefined;
|
|
1610
|
+
if (isolated !== undefined) {
|
|
1611
|
+
marginMode = isolated ? 'isolated' : 'cross';
|
|
1612
|
+
}
|
|
1599
1613
|
return this.safePosition({
|
|
1600
1614
|
'info': position,
|
|
1601
1615
|
'id': this.safeString(position, 'positionId'),
|
|
@@ -1791,7 +1805,6 @@ export default class bingx extends Exchange {
|
|
|
1791
1805
|
* @method
|
|
1792
1806
|
* @name bingx#createOrder
|
|
1793
1807
|
* @description create a trade order
|
|
1794
|
-
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
|
|
1795
1808
|
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
|
1796
1809
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1797
1810
|
* @param {string} type 'market' or 'limit'
|
|
@@ -3412,6 +3425,50 @@ export default class bingx extends Exchange {
|
|
|
3412
3425
|
'datetime': this.iso8601(timestamp),
|
|
3413
3426
|
});
|
|
3414
3427
|
}
|
|
3428
|
+
async closeAllPositions(params = {}) {
|
|
3429
|
+
/**
|
|
3430
|
+
* @method
|
|
3431
|
+
* @name bitget#closePositions
|
|
3432
|
+
* @description closes open positions for a market
|
|
3433
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
|
|
3434
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3435
|
+
* @param {string} [params.recvWindow] request valid time window value
|
|
3436
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
3437
|
+
*/
|
|
3438
|
+
await this.loadMarkets();
|
|
3439
|
+
const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
|
|
3440
|
+
const recvWindow = this.safeInteger(this.parseParams, 'recvWindow', defaultRecvWindow);
|
|
3441
|
+
let marketType = undefined;
|
|
3442
|
+
[marketType, params] = this.handleMarketTypeAndParams('closeAllPositions', undefined, params);
|
|
3443
|
+
if (marketType === 'margin') {
|
|
3444
|
+
throw new BadRequest(this.id + ' closePositions () cannot be used for ' + marketType + ' markets');
|
|
3445
|
+
}
|
|
3446
|
+
const request = {
|
|
3447
|
+
'recvWindow': recvWindow,
|
|
3448
|
+
};
|
|
3449
|
+
const response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
|
|
3450
|
+
//
|
|
3451
|
+
// {
|
|
3452
|
+
// "code": 0,
|
|
3453
|
+
// "msg": "",
|
|
3454
|
+
// "data": {
|
|
3455
|
+
// "success": [
|
|
3456
|
+
// 1727686766700486656,
|
|
3457
|
+
// 1727686767048613888
|
|
3458
|
+
// ],
|
|
3459
|
+
// "failed": null
|
|
3460
|
+
// }
|
|
3461
|
+
// }
|
|
3462
|
+
//
|
|
3463
|
+
const data = this.safeValue(response, 'data', {});
|
|
3464
|
+
const success = this.safeValue(data, 'success', []);
|
|
3465
|
+
const positions = [];
|
|
3466
|
+
for (let i = 0; i < success.length; i++) {
|
|
3467
|
+
const position = this.parsePosition({ 'positionId': success[i] });
|
|
3468
|
+
positions.push(position);
|
|
3469
|
+
}
|
|
3470
|
+
return positions;
|
|
3471
|
+
}
|
|
3415
3472
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3416
3473
|
const type = section[0];
|
|
3417
3474
|
const version = section[1];
|
package/js/src/bit2c.js
CHANGED
package/js/src/bitbank.js
CHANGED
package/js/src/bithumb.js
CHANGED
|
@@ -31,6 +31,8 @@ export default class bithumb extends Exchange {
|
|
|
31
31
|
'option': false,
|
|
32
32
|
'addMargin': false,
|
|
33
33
|
'cancelOrder': true,
|
|
34
|
+
'closeAllPositions': false,
|
|
35
|
+
'closePosition': false,
|
|
34
36
|
'createMarketOrder': true,
|
|
35
37
|
'createOrder': true,
|
|
36
38
|
'createReduceOnlyOrder': false,
|
package/js/src/bitmex.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export default class bitmex extends Exchange {
|
|
|
8
8
|
describe(): any;
|
|
9
9
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
10
10
|
convertFromRealAmount(code: any, amount: any): number;
|
|
11
|
-
convertToRealAmount(code:
|
|
11
|
+
convertToRealAmount(code: Str, amount: Str): string;
|
|
12
12
|
amountToPrecision(symbol: any, amount: any): any;
|
|
13
13
|
convertFromRawQuantity(symbol: any, rawQuantity: any, currencySide?: string): number;
|
|
14
14
|
convertFromRawCost(symbol: any, rawQuantity: any): number;
|
package/js/src/bitmex.js
CHANGED
|
@@ -391,6 +391,12 @@ export default class bitmex extends Exchange {
|
|
|
391
391
|
return this.parseNumber(finalAmount);
|
|
392
392
|
}
|
|
393
393
|
convertToRealAmount(code, amount) {
|
|
394
|
+
if (code === undefined) {
|
|
395
|
+
return amount;
|
|
396
|
+
}
|
|
397
|
+
else if (amount === undefined) {
|
|
398
|
+
return undefined;
|
|
399
|
+
}
|
|
394
400
|
const currency = this.currency(code);
|
|
395
401
|
const precision = this.safeString(currency, 'precision');
|
|
396
402
|
return Precise.stringMul(amount, precision);
|
package/js/src/bitopro.js
CHANGED
package/js/src/bitpanda.js
CHANGED
|
@@ -35,6 +35,8 @@ export default class bitpanda extends Exchange {
|
|
|
35
35
|
'cancelAllOrders': true,
|
|
36
36
|
'cancelOrder': true,
|
|
37
37
|
'cancelOrders': true,
|
|
38
|
+
'closeAllPositions': false,
|
|
39
|
+
'closePosition': false,
|
|
38
40
|
'createDepositAddress': true,
|
|
39
41
|
'createOrder': true,
|
|
40
42
|
'createReduceOnlyOrder': false,
|
package/js/src/bitrue.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export default class bitrue extends Exchange {
|
|
|
33
33
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
34
34
|
parseOrderStatus(status: any): string;
|
|
35
35
|
parseOrder(order: any, market?: Market): Order;
|
|
36
|
+
createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
36
37
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
37
38
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
38
39
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|