ccxt 4.1.24 → 4.1.25
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 +1172 -200
- package/dist/ccxt.browser.min.js +4 -4
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +1 -1
- package/dist/cjs/src/base/Exchange.js +7 -3
- package/dist/cjs/src/base/functions/crypto.js +11 -2
- package/dist/cjs/src/base/functions/generic.js +5 -3
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/binance.js +108 -5
- package/dist/cjs/src/bitget.js +289 -21
- package/dist/cjs/src/bybit.js +132 -15
- package/dist/cjs/src/cryptocom.js +262 -15
- package/dist/cjs/src/gate.js +191 -88
- package/dist/cjs/src/krakenfutures.js +86 -20
- package/dist/cjs/src/oceanex.js +0 -12
- package/dist/cjs/src/okx.js +60 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-curves/abstract/edwards.js +8 -6
- package/dist/cjs/src/wavesexchange.js +6 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/gate.d.ts +2 -7
- package/js/src/abstract/gateio.d.ts +2 -7
- package/js/src/ace.js +1 -1
- package/js/src/base/Exchange.d.ts +4 -2
- package/js/src/base/Exchange.js +7 -3
- package/js/src/base/functions/crypto.d.ts +3 -2
- package/js/src/base/functions/crypto.js +11 -3
- package/js/src/base/functions/generic.d.ts +1 -1
- package/js/src/base/functions/generic.js +5 -3
- package/js/src/base/types.d.ts +8 -0
- package/js/src/binance.d.ts +2 -1
- package/js/src/binance.js +108 -5
- package/js/src/bitget.d.ts +15 -1
- package/js/src/bitget.js +289 -21
- package/js/src/bybit.d.ts +4 -2
- package/js/src/bybit.js +132 -15
- package/js/src/cryptocom.d.ts +4 -1
- package/js/src/cryptocom.js +262 -15
- package/js/src/gate.d.ts +3 -1
- package/js/src/gate.js +191 -88
- package/js/src/krakenfutures.d.ts +3 -1
- package/js/src/krakenfutures.js +86 -20
- package/js/src/oceanex.d.ts +0 -1
- package/js/src/oceanex.js +0 -12
- package/js/src/okx.d.ts +2 -1
- package/js/src/okx.js +60 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/static_dependencies/noble-curves/abstract/edwards.d.ts +1 -0
- package/js/src/static_dependencies/noble-curves/abstract/edwards.js +5 -3
- package/js/src/wavesexchange.js +7 -7
- package/package.json +1 -1
- package/skip-tests.json +2 -3
|
@@ -752,7 +752,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
752
752
|
const messageHex = this.binaryToBase16(this.encode(message));
|
|
753
753
|
const payload = prefix + messageHex;
|
|
754
754
|
const hexKey = this.binaryToBase16(this.base58ToBinary(this.secret));
|
|
755
|
-
const signature = crypto.
|
|
755
|
+
const signature = crypto.axolotl(payload, hexKey, ed25519.ed25519);
|
|
756
756
|
const request = {
|
|
757
757
|
'grant_type': 'password',
|
|
758
758
|
'scope': 'general',
|
|
@@ -1421,7 +1421,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1421
1421
|
if ((serializedOrder[0] === '"') && (serializedOrder[(serializedOrder.length - 1)] === '"')) {
|
|
1422
1422
|
serializedOrder = serializedOrder.slice(1, serializedOrder.length - 1);
|
|
1423
1423
|
}
|
|
1424
|
-
const signature = crypto.
|
|
1424
|
+
const signature = crypto.axolotl(this.binaryToBase16(this.base58ToBinary(serializedOrder)), this.binaryToBase16(this.base58ToBinary(this.secret)), ed25519.ed25519);
|
|
1425
1425
|
body['signature'] = signature;
|
|
1426
1426
|
//
|
|
1427
1427
|
// {
|
|
@@ -1536,7 +1536,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1536
1536
|
];
|
|
1537
1537
|
const binary = this.binaryConcatArray(byteArray);
|
|
1538
1538
|
const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
|
|
1539
|
-
const signature = crypto.
|
|
1539
|
+
const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
|
|
1540
1540
|
const request = {
|
|
1541
1541
|
'Timestamp': timestamp.toString(),
|
|
1542
1542
|
'Signature': signature,
|
|
@@ -1571,7 +1571,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1571
1571
|
];
|
|
1572
1572
|
const binary = this.binaryConcatArray(byteArray);
|
|
1573
1573
|
const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
|
|
1574
|
-
const signature = crypto.
|
|
1574
|
+
const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
|
|
1575
1575
|
const request = {
|
|
1576
1576
|
'Accept': 'application/json',
|
|
1577
1577
|
'Timestamp': timestamp.toString(),
|
|
@@ -1935,7 +1935,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1935
1935
|
];
|
|
1936
1936
|
const binary = this.binaryConcatArray(byteArray);
|
|
1937
1937
|
const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
|
|
1938
|
-
const signature = crypto.
|
|
1938
|
+
const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
|
|
1939
1939
|
const matcherRequest = {
|
|
1940
1940
|
'publicKey': this.apiKey,
|
|
1941
1941
|
'signature': signature,
|
|
@@ -2533,7 +2533,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
2533
2533
|
];
|
|
2534
2534
|
const binary = this.binaryConcatArray(byteArray);
|
|
2535
2535
|
const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
|
|
2536
|
-
const signature = crypto.
|
|
2536
|
+
const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
|
|
2537
2537
|
const request = {
|
|
2538
2538
|
'senderPublicKey': this.apiKey,
|
|
2539
2539
|
'amount': amountInteger,
|
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 } 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.24";
|
|
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.25';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -79,8 +79,6 @@ interface Exchange {
|
|
|
79
79
|
privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
|
|
80
80
|
privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
|
|
81
81
|
privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
|
|
82
|
-
privatePortfolioGetSpotCurrencyPairs(params?: {}): Promise<implicitReturnType>;
|
|
83
|
-
privatePortfolioGetSpotCurrencyPairsCurrencyPair(params?: {}): Promise<implicitReturnType>;
|
|
84
82
|
privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
|
|
85
83
|
privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
|
|
86
84
|
privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
|
|
@@ -88,13 +86,8 @@ interface Exchange {
|
|
|
88
86
|
privatePortfolioGetLoans(params?: {}): Promise<implicitReturnType>;
|
|
89
87
|
privatePortfolioGetLoanRecords(params?: {}): Promise<implicitReturnType>;
|
|
90
88
|
privatePortfolioGetInterestRecords(params?: {}): Promise<implicitReturnType>;
|
|
91
|
-
privatePortfolioGetSpotOrders(params?: {}): Promise<implicitReturnType>;
|
|
92
|
-
privatePortfolioGetSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
93
89
|
privatePortfolioPostAccountMode(params?: {}): Promise<implicitReturnType>;
|
|
94
90
|
privatePortfolioPostLoans(params?: {}): Promise<implicitReturnType>;
|
|
95
|
-
privatePortfolioPostSpotOrders(params?: {}): Promise<implicitReturnType>;
|
|
96
|
-
privatePortfolioDeleteSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
97
|
-
privatePortfolioPatchSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
98
91
|
privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
|
|
99
92
|
privateSpotGetBatchFee(params?: {}): Promise<implicitReturnType>;
|
|
100
93
|
privateSpotGetAccounts(params?: {}): Promise<implicitReturnType>;
|
|
@@ -110,6 +103,7 @@ interface Exchange {
|
|
|
110
103
|
privateSpotPostOrders(params?: {}): Promise<implicitReturnType>;
|
|
111
104
|
privateSpotPostCancelBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
112
105
|
privateSpotPostCountdownCancelAll(params?: {}): Promise<implicitReturnType>;
|
|
106
|
+
privateSpotPostAmendBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
113
107
|
privateSpotPostPriceOrders(params?: {}): Promise<implicitReturnType>;
|
|
114
108
|
privateSpotDeleteOrders(params?: {}): Promise<implicitReturnType>;
|
|
115
109
|
privateSpotDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
@@ -227,6 +221,7 @@ interface Exchange {
|
|
|
227
221
|
privateEarnGetUniInterestsCurrency(params?: {}): Promise<implicitReturnType>;
|
|
228
222
|
privateEarnGetUniInterestRecords(params?: {}): Promise<implicitReturnType>;
|
|
229
223
|
privateEarnPostUniLends(params?: {}): Promise<implicitReturnType>;
|
|
224
|
+
privateEarnPutUniInterestReinvest(params?: {}): Promise<implicitReturnType>;
|
|
230
225
|
privateEarnPatchUniLends(params?: {}): Promise<implicitReturnType>;
|
|
231
226
|
privateLoanGetCollateralOrders(params?: {}): Promise<implicitReturnType>;
|
|
232
227
|
privateLoanGetCollateralOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
@@ -79,8 +79,6 @@ interface gate {
|
|
|
79
79
|
privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
|
|
80
80
|
privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
|
|
81
81
|
privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
|
|
82
|
-
privatePortfolioGetSpotCurrencyPairs(params?: {}): Promise<implicitReturnType>;
|
|
83
|
-
privatePortfolioGetSpotCurrencyPairsCurrencyPair(params?: {}): Promise<implicitReturnType>;
|
|
84
82
|
privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
|
|
85
83
|
privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
|
|
86
84
|
privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
|
|
@@ -88,13 +86,8 @@ interface gate {
|
|
|
88
86
|
privatePortfolioGetLoans(params?: {}): Promise<implicitReturnType>;
|
|
89
87
|
privatePortfolioGetLoanRecords(params?: {}): Promise<implicitReturnType>;
|
|
90
88
|
privatePortfolioGetInterestRecords(params?: {}): Promise<implicitReturnType>;
|
|
91
|
-
privatePortfolioGetSpotOrders(params?: {}): Promise<implicitReturnType>;
|
|
92
|
-
privatePortfolioGetSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
93
89
|
privatePortfolioPostAccountMode(params?: {}): Promise<implicitReturnType>;
|
|
94
90
|
privatePortfolioPostLoans(params?: {}): Promise<implicitReturnType>;
|
|
95
|
-
privatePortfolioPostSpotOrders(params?: {}): Promise<implicitReturnType>;
|
|
96
|
-
privatePortfolioDeleteSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
97
|
-
privatePortfolioPatchSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
98
91
|
privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
|
|
99
92
|
privateSpotGetBatchFee(params?: {}): Promise<implicitReturnType>;
|
|
100
93
|
privateSpotGetAccounts(params?: {}): Promise<implicitReturnType>;
|
|
@@ -110,6 +103,7 @@ interface gate {
|
|
|
110
103
|
privateSpotPostOrders(params?: {}): Promise<implicitReturnType>;
|
|
111
104
|
privateSpotPostCancelBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
112
105
|
privateSpotPostCountdownCancelAll(params?: {}): Promise<implicitReturnType>;
|
|
106
|
+
privateSpotPostAmendBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
113
107
|
privateSpotPostPriceOrders(params?: {}): Promise<implicitReturnType>;
|
|
114
108
|
privateSpotDeleteOrders(params?: {}): Promise<implicitReturnType>;
|
|
115
109
|
privateSpotDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
@@ -227,6 +221,7 @@ interface gate {
|
|
|
227
221
|
privateEarnGetUniInterestsCurrency(params?: {}): Promise<implicitReturnType>;
|
|
228
222
|
privateEarnGetUniInterestRecords(params?: {}): Promise<implicitReturnType>;
|
|
229
223
|
privateEarnPostUniLends(params?: {}): Promise<implicitReturnType>;
|
|
224
|
+
privateEarnPutUniInterestReinvest(params?: {}): Promise<implicitReturnType>;
|
|
230
225
|
privateEarnPatchUniLends(params?: {}): Promise<implicitReturnType>;
|
|
231
226
|
privateLoanGetCollateralOrders(params?: {}): Promise<implicitReturnType>;
|
|
232
227
|
privateLoanGetCollateralOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
package/js/src/ace.js
CHANGED
|
@@ -1017,7 +1017,7 @@ export default class ace extends Exchange {
|
|
|
1017
1017
|
'timeStamp': nonce,
|
|
1018
1018
|
}, params);
|
|
1019
1019
|
const dataKeys = Object.keys(data);
|
|
1020
|
-
const sortedDataKeys = this.sortBy(dataKeys, 0);
|
|
1020
|
+
const sortedDataKeys = this.sortBy(dataKeys, 0, false, '');
|
|
1021
1021
|
for (let i = 0; i < sortedDataKeys.length; i++) {
|
|
1022
1022
|
const key = sortedDataKeys[i];
|
|
1023
1023
|
auth += this.safeString(data, key);
|
|
@@ -4,7 +4,7 @@ ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotA
|
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { Future } from './ws/Future.js';
|
|
6
6
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
7
|
-
import { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, OpenInterest, Liquidation } from './types.js';
|
|
7
|
+
import { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, OpenInterest, Liquidation, OrderRequest } from './types.js';
|
|
8
8
|
export { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation } from './types.js';
|
|
9
9
|
/**
|
|
10
10
|
* @class Exchange
|
|
@@ -161,7 +161,7 @@ export default class Exchange {
|
|
|
161
161
|
flatten: (x: any, out?: any[]) => any[];
|
|
162
162
|
unique: (x: any) => any[];
|
|
163
163
|
indexBy: (x: any, k: any, out?: {}) => {};
|
|
164
|
-
sortBy: (array: any, key: any, descending?: boolean, direction?: number) => any;
|
|
164
|
+
sortBy: (array: any, key: any, descending?: boolean, defaultValue?: any, direction?: number) => any;
|
|
165
165
|
sortBy2: (array: any, key1: any, key2: any, descending?: boolean, direction?: number) => any;
|
|
166
166
|
groupBy: (x: any, k: any, out?: {}) => {};
|
|
167
167
|
aggregate: typeof functions.aggregate;
|
|
@@ -285,6 +285,7 @@ export default class Exchange {
|
|
|
285
285
|
createLimitOrder: boolean;
|
|
286
286
|
createMarketOrder: boolean;
|
|
287
287
|
createOrder: boolean;
|
|
288
|
+
createOrders: any;
|
|
288
289
|
createPostOnlyOrder: any;
|
|
289
290
|
createReduceOnlyOrder: any;
|
|
290
291
|
createStopOrder: any;
|
|
@@ -714,6 +715,7 @@ export default class Exchange {
|
|
|
714
715
|
fetchOrderStatus(id: string, symbol?: string, params?: {}): Promise<string>;
|
|
715
716
|
fetchUnifiedOrder(order: any, params?: {}): Promise<Order>;
|
|
716
717
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
718
|
+
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
717
719
|
createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
718
720
|
cancelOrder(id: string, symbol?: string, params?: {}): Promise<any>;
|
|
719
721
|
cancelOrderWs(id: string, symbol?: string, params?: {}): Promise<any>;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -335,6 +335,7 @@ export default class Exchange {
|
|
|
335
335
|
'createLimitOrder': true,
|
|
336
336
|
'createMarketOrder': true,
|
|
337
337
|
'createOrder': true,
|
|
338
|
+
'createOrders': undefined,
|
|
338
339
|
'createPostOnlyOrder': undefined,
|
|
339
340
|
'createReduceOnlyOrder': undefined,
|
|
340
341
|
'createStopOrder': undefined,
|
|
@@ -1609,7 +1610,7 @@ export default class Exchange {
|
|
|
1609
1610
|
this.markets_by_id = {};
|
|
1610
1611
|
// handle marketId conflicts
|
|
1611
1612
|
// we insert spot markets first
|
|
1612
|
-
const marketValues = this.sortBy(this.toArray(markets), 'spot', true);
|
|
1613
|
+
const marketValues = this.sortBy(this.toArray(markets), 'spot', true, true);
|
|
1613
1614
|
for (let i = 0; i < marketValues.length; i++) {
|
|
1614
1615
|
const value = marketValues[i];
|
|
1615
1616
|
if (value['id'] in this.markets_by_id) {
|
|
@@ -1659,8 +1660,8 @@ export default class Exchange {
|
|
|
1659
1660
|
quoteCurrencies.push(currency);
|
|
1660
1661
|
}
|
|
1661
1662
|
}
|
|
1662
|
-
baseCurrencies = this.sortBy(baseCurrencies, 'code');
|
|
1663
|
-
quoteCurrencies = this.sortBy(quoteCurrencies, 'code');
|
|
1663
|
+
baseCurrencies = this.sortBy(baseCurrencies, 'code', false, '');
|
|
1664
|
+
quoteCurrencies = this.sortBy(quoteCurrencies, 'code', false, '');
|
|
1664
1665
|
this.baseCurrencies = this.indexBy(baseCurrencies, 'code');
|
|
1665
1666
|
this.quoteCurrencies = this.indexBy(quoteCurrencies, 'code');
|
|
1666
1667
|
const allCurrencies = this.arrayConcat(baseCurrencies, quoteCurrencies);
|
|
@@ -3322,6 +3323,9 @@ export default class Exchange {
|
|
|
3322
3323
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3323
3324
|
throw new NotSupported(this.id + ' createOrder() is not supported yet');
|
|
3324
3325
|
}
|
|
3326
|
+
async createOrders(orders, params = {}) {
|
|
3327
|
+
throw new NotSupported(this.id + ' createOrders() is not supported yet');
|
|
3328
|
+
}
|
|
3325
3329
|
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3326
3330
|
throw new NotSupported(this.id + ' createOrderWs() is not supported yet');
|
|
3327
3331
|
}
|
|
@@ -10,6 +10,7 @@ declare function ecdsa(request: Hex, secret: Hex, curve: CurveFn, prehash?: CHas
|
|
|
10
10
|
s: string;
|
|
11
11
|
v: number;
|
|
12
12
|
};
|
|
13
|
-
declare function
|
|
13
|
+
declare function axolotl(request: Hex, secret: Hex, curve: CurveFnEDDSA): string;
|
|
14
|
+
declare function eddsa(request: Hex, secret: string, curve: CurveFnEDDSA): string;
|
|
14
15
|
declare function crc32(str: any, signed?: boolean): number;
|
|
15
|
-
export { hash, hmac, crc32, ecdsa, eddsa, };
|
|
16
|
+
export { hash, hmac, crc32, ecdsa, eddsa, axolotl, };
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
/* ------------------------------------------------------------------------ */
|
|
8
8
|
import { hmac as _hmac } from '../../static_dependencies/noble-hashes/hmac.js';
|
|
9
9
|
import { base16, base64, base58 } from '../../static_dependencies/scure-base/index.js';
|
|
10
|
+
import { Base64 } from '../../static_dependencies/jsencrypt/lib/asn1js/base64.js';
|
|
10
11
|
/* ------------------------------------------------------------------------ */
|
|
11
12
|
const encoders = {
|
|
12
13
|
binary: x => x,
|
|
@@ -35,11 +36,18 @@ function ecdsa(request, secret, curve, prehash = null) {
|
|
|
35
36
|
'v': signature.recovery,
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function axolotl(request, secret, curve) {
|
|
39
40
|
// used for waves.exchange (that's why the output is base58)
|
|
40
|
-
const signature = curve.
|
|
41
|
+
const signature = curve.signModified(request, secret);
|
|
41
42
|
return base58.encode(signature);
|
|
42
43
|
}
|
|
44
|
+
function eddsa(request, secret, curve) {
|
|
45
|
+
// secret is the base64 pem encoded key
|
|
46
|
+
// we get the last 32 bytes
|
|
47
|
+
const privateKey = new Uint8Array(Base64.unarmor(secret).slice(16));
|
|
48
|
+
const signature = curve.sign(request, privateKey);
|
|
49
|
+
return base64.encode(signature);
|
|
50
|
+
}
|
|
43
51
|
/* ------------------------------------------------------------------------ */
|
|
44
52
|
// source: https://stackoverflow.com/a/18639975/1067003
|
|
45
53
|
function crc32(str, signed = false) {
|
|
@@ -62,5 +70,5 @@ function crc32(str, signed = false) {
|
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
/* ------------------------------------------------------------------------ */
|
|
65
|
-
export { hash, hmac, crc32, ecdsa, eddsa, };
|
|
73
|
+
export { hash, hmac, crc32, ecdsa, eddsa, axolotl, };
|
|
66
74
|
/* ------------------------------------------------------------------------ */
|
|
@@ -16,7 +16,7 @@ declare const keysort: (x: any, out?: {}) => {};
|
|
|
16
16
|
declare const groupBy: (x: any, k: any, out?: {}) => {};
|
|
17
17
|
declare const indexBy: (x: any, k: any, out?: {}) => {};
|
|
18
18
|
declare const filterBy: (x: any, k: any, value?: any, out?: any[]) => any[];
|
|
19
|
-
declare const sortBy: (array: any, key: any, descending?: boolean, direction?: number) => any;
|
|
19
|
+
declare const sortBy: (array: any, key: any, descending?: boolean, defaultValue?: any, direction?: number) => any;
|
|
20
20
|
declare const sortBy2: (array: any, key1: any, key2: any, descending?: boolean, direction?: number) => any;
|
|
21
21
|
declare const flatten: (x: any, out?: any[]) => any[];
|
|
22
22
|
declare const pluck: (x: any, k: any) => any[];
|
|
@@ -72,11 +72,13 @@ const filterBy = (x, k, value = undefined, out = []) => {
|
|
|
72
72
|
}
|
|
73
73
|
return out;
|
|
74
74
|
};
|
|
75
|
-
const sortBy = (array, key, descending = false, direction = descending ? -1 : 1) => array.sort((a, b) => {
|
|
76
|
-
|
|
75
|
+
const sortBy = (array, key, descending = false, defaultValue = 0, direction = descending ? -1 : 1) => array.sort((a, b) => {
|
|
76
|
+
const first = (key in a) ? a[key] : defaultValue;
|
|
77
|
+
const second = (key in b) ? b[key] : defaultValue;
|
|
78
|
+
if (first < second) {
|
|
77
79
|
return -direction;
|
|
78
80
|
}
|
|
79
|
-
else if (
|
|
81
|
+
else if (first > second) {
|
|
80
82
|
return direction;
|
|
81
83
|
}
|
|
82
84
|
else {
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -230,6 +230,14 @@ export interface Liquidation {
|
|
|
230
230
|
baseValue?: number;
|
|
231
231
|
quoteValue?: number;
|
|
232
232
|
}
|
|
233
|
+
export interface OrderRequest {
|
|
234
|
+
symbol: string;
|
|
235
|
+
type: string;
|
|
236
|
+
side: string;
|
|
237
|
+
amount?: number;
|
|
238
|
+
price?: number | undefined;
|
|
239
|
+
params?: any;
|
|
240
|
+
}
|
|
233
241
|
/** [ timestamp, open, high, low, close, volume ] */
|
|
234
242
|
export declare type OHLCV = [number, number, number, number, number, number];
|
|
235
243
|
/** [ timestamp, open, high, low, close, volume, count ] */
|
package/js/src/binance.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/binance.js';
|
|
2
|
-
import { Market, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation } from './base/types.js';
|
|
2
|
+
import { Market, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class binance
|
|
5
5
|
* @extends Exchange
|
|
@@ -124,6 +124,7 @@ export default class binance extends Exchange {
|
|
|
124
124
|
editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
|
|
125
125
|
parseOrderStatus(status: any): string;
|
|
126
126
|
parseOrder(order: any, market?: any): Order;
|
|
127
|
+
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
127
128
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
128
129
|
createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
|
|
129
130
|
fetchOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
|
package/js/src/binance.js
CHANGED
|
@@ -11,6 +11,8 @@ import { Precise } from './base/Precise.js';
|
|
|
11
11
|
import { TRUNCATE, DECIMAL_PLACES } from './base/functions/number.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
import { rsa } from './base/functions/rsa.js';
|
|
14
|
+
import { eddsa } from './base/functions/crypto.js';
|
|
15
|
+
import { ed25519 } from './static_dependencies/noble-curves/ed25519.js';
|
|
14
16
|
// ---------------------------------------------------------------------------
|
|
15
17
|
/**
|
|
16
18
|
* @class binance
|
|
@@ -40,6 +42,7 @@ export default class binance extends Exchange {
|
|
|
40
42
|
'cancelOrders': true,
|
|
41
43
|
'createDepositAddress': false,
|
|
42
44
|
'createOrder': true,
|
|
45
|
+
'createOrders': true,
|
|
43
46
|
'createPostOnlyOrder': true,
|
|
44
47
|
'createReduceOnlyOrder': true,
|
|
45
48
|
'createStopLimitOrder': true,
|
|
@@ -4268,7 +4271,17 @@ export default class binance extends Exchange {
|
|
|
4268
4271
|
// "lastTrade": {"id":"69","time":"1676084430567","price":"24.9","qty":"1.00"},
|
|
4269
4272
|
// "mmp": false
|
|
4270
4273
|
// }
|
|
4274
|
+
// {
|
|
4275
|
+
// cancelOrders/createOrders
|
|
4276
|
+
// "code": -4005,
|
|
4277
|
+
// "msg": "Quantity greater than max quantity."
|
|
4278
|
+
// },
|
|
4271
4279
|
//
|
|
4280
|
+
const code = this.safeString(order, 'code');
|
|
4281
|
+
if (code !== undefined) {
|
|
4282
|
+
// cancelOrders/createOrders might have a partial success
|
|
4283
|
+
return this.safeOrder({ 'info': order, 'status': 'rejected' }, market);
|
|
4284
|
+
}
|
|
4272
4285
|
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
4273
4286
|
const marketId = this.safeString(order, 'symbol');
|
|
4274
4287
|
const marketType = ('closePosition' in order) ? 'contract' : 'spot';
|
|
@@ -4342,6 +4355,85 @@ export default class binance extends Exchange {
|
|
|
4342
4355
|
'trades': fills,
|
|
4343
4356
|
}, market);
|
|
4344
4357
|
}
|
|
4358
|
+
async createOrders(orders, params = {}) {
|
|
4359
|
+
/**
|
|
4360
|
+
* @method
|
|
4361
|
+
* @name binance#createOrders
|
|
4362
|
+
* @description *contract only* create a list of trade orders
|
|
4363
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#place-multiple-orders-trade
|
|
4364
|
+
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
4365
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
4366
|
+
*/
|
|
4367
|
+
await this.loadMarkets();
|
|
4368
|
+
const ordersRequests = [];
|
|
4369
|
+
let orderSymbols = [];
|
|
4370
|
+
for (let i = 0; i < orders.length; i++) {
|
|
4371
|
+
const rawOrder = orders[i];
|
|
4372
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
4373
|
+
orderSymbols.push(marketId);
|
|
4374
|
+
const type = this.safeString(rawOrder, 'type');
|
|
4375
|
+
const side = this.safeString(rawOrder, 'side');
|
|
4376
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
4377
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
4378
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
4379
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
4380
|
+
ordersRequests.push(orderRequest);
|
|
4381
|
+
}
|
|
4382
|
+
orderSymbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
|
|
4383
|
+
const market = this.market(orderSymbols[0]);
|
|
4384
|
+
if (market['spot']) {
|
|
4385
|
+
throw new NotSupported(this.id + ' createOrders() does not support ' + market['type'] + ' orders');
|
|
4386
|
+
}
|
|
4387
|
+
let response = undefined;
|
|
4388
|
+
let request = {
|
|
4389
|
+
'batchOrders': ordersRequests,
|
|
4390
|
+
};
|
|
4391
|
+
request = this.extend(request, params);
|
|
4392
|
+
if (market['linear']) {
|
|
4393
|
+
response = await this.fapiPrivatePostBatchOrders(request);
|
|
4394
|
+
}
|
|
4395
|
+
else if (market['option']) {
|
|
4396
|
+
response = await this.eapiPrivatePostBatchOrders(request);
|
|
4397
|
+
}
|
|
4398
|
+
else {
|
|
4399
|
+
response = await this.dapiPrivatePostBatchOrders(request);
|
|
4400
|
+
}
|
|
4401
|
+
//
|
|
4402
|
+
// [
|
|
4403
|
+
// {
|
|
4404
|
+
// "code": -4005,
|
|
4405
|
+
// "msg": "Quantity greater than max quantity."
|
|
4406
|
+
// },
|
|
4407
|
+
// {
|
|
4408
|
+
// "orderId": 650640530,
|
|
4409
|
+
// "symbol": "LTCUSDT",
|
|
4410
|
+
// "status": "NEW",
|
|
4411
|
+
// "clientOrderId": "x-xcKtGhcu32184eb13585491289bbaf",
|
|
4412
|
+
// "price": "54.00",
|
|
4413
|
+
// "avgPrice": "0.00",
|
|
4414
|
+
// "origQty": "0.100",
|
|
4415
|
+
// "executedQty": "0.000",
|
|
4416
|
+
// "cumQty": "0.000",
|
|
4417
|
+
// "cumQuote": "0.00000",
|
|
4418
|
+
// "timeInForce": "GTC",
|
|
4419
|
+
// "type": "LIMIT",
|
|
4420
|
+
// "reduceOnly": false,
|
|
4421
|
+
// "closePosition": false,
|
|
4422
|
+
// "side": "BUY",
|
|
4423
|
+
// "positionSide": "BOTH",
|
|
4424
|
+
// "stopPrice": "0.00",
|
|
4425
|
+
// "workingType": "CONTRACT_PRICE",
|
|
4426
|
+
// "priceProtect": false,
|
|
4427
|
+
// "origType": "LIMIT",
|
|
4428
|
+
// "priceMatch": "NONE",
|
|
4429
|
+
// "selfTradePreventionMode": "NONE",
|
|
4430
|
+
// "goodTillDate": 0,
|
|
4431
|
+
// "updateTime": 1698073926929
|
|
4432
|
+
// }
|
|
4433
|
+
// ]
|
|
4434
|
+
//
|
|
4435
|
+
return this.parseOrders(response);
|
|
4436
|
+
}
|
|
4345
4437
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
4346
4438
|
/**
|
|
4347
4439
|
* @method
|
|
@@ -8437,6 +8529,12 @@ export default class binance extends Exchange {
|
|
|
8437
8529
|
}
|
|
8438
8530
|
}
|
|
8439
8531
|
let query = undefined;
|
|
8532
|
+
// handle batchOrders
|
|
8533
|
+
if ((path === 'batchOrders') && (method === 'POST')) {
|
|
8534
|
+
const batchOrders = this.safeValue(params, 'batchOrders');
|
|
8535
|
+
const queryBatch = (this.json(batchOrders));
|
|
8536
|
+
params['batchOrders'] = queryBatch;
|
|
8537
|
+
}
|
|
8440
8538
|
const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
|
|
8441
8539
|
let extendedParams = this.extend({
|
|
8442
8540
|
'timestamp': this.nonce(),
|
|
@@ -8475,7 +8573,12 @@ export default class binance extends Exchange {
|
|
|
8475
8573
|
}
|
|
8476
8574
|
let signature = undefined;
|
|
8477
8575
|
if (this.secret.indexOf('PRIVATE KEY') > -1) {
|
|
8478
|
-
|
|
8576
|
+
if (this.secret.length > 120) {
|
|
8577
|
+
signature = this.encodeURIComponent(rsa(query, this.secret, sha256));
|
|
8578
|
+
}
|
|
8579
|
+
else {
|
|
8580
|
+
signature = this.encodeURIComponent(eddsa(this.encode(query), this.secret, ed25519));
|
|
8581
|
+
}
|
|
8479
8582
|
}
|
|
8480
8583
|
else {
|
|
8481
8584
|
signature = this.hmac(this.encode(query), this.encode(this.secret), sha256);
|
|
@@ -8574,10 +8677,10 @@ export default class binance extends Exchange {
|
|
|
8574
8677
|
}
|
|
8575
8678
|
if (Array.isArray(response)) {
|
|
8576
8679
|
// cancelOrders returns an array like this: [{"code":-2011,"msg":"Unknown order sent."}]
|
|
8577
|
-
const
|
|
8578
|
-
if (
|
|
8579
|
-
const
|
|
8580
|
-
const errorCode = this.safeString(
|
|
8680
|
+
const arrayLength = response.length;
|
|
8681
|
+
if (arrayLength === 1) { // when there's a single error we can throw, otherwise we have a partial success
|
|
8682
|
+
const element = response[0];
|
|
8683
|
+
const errorCode = this.safeString(element, 'code');
|
|
8581
8684
|
if (errorCode !== undefined) {
|
|
8582
8685
|
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, this.id + ' ' + body);
|
|
8583
8686
|
}
|
package/js/src/bitget.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bitget.js';
|
|
2
|
-
import { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory } from './base/types.js';
|
|
2
|
+
import { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bitget
|
|
5
5
|
* @extends Exchange
|
|
@@ -150,6 +150,8 @@ export default class bitget extends Exchange {
|
|
|
150
150
|
parseOrderStatus(status: any): string;
|
|
151
151
|
parseOrder(order: any, market?: any): Order;
|
|
152
152
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
153
|
+
createOrderRequest(symbol: any, type: any, side: any, amount: any, price?: any, params?: {}): any;
|
|
154
|
+
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
153
155
|
editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
|
|
154
156
|
cancelOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
|
|
155
157
|
cancelOrders(ids: any, symbol?: string, params?: {}): Promise<any>;
|
|
@@ -314,6 +316,18 @@ export default class bitget extends Exchange {
|
|
|
314
316
|
datetime: any;
|
|
315
317
|
info: any;
|
|
316
318
|
};
|
|
319
|
+
fetchMyLiquidations(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
|
|
320
|
+
parseLiquidation(liquidation: any, market?: any): {
|
|
321
|
+
info: any;
|
|
322
|
+
symbol: any;
|
|
323
|
+
contracts: any;
|
|
324
|
+
contractSize: any;
|
|
325
|
+
price: any;
|
|
326
|
+
baseValue: any;
|
|
327
|
+
quoteValue: number;
|
|
328
|
+
timestamp: number;
|
|
329
|
+
datetime: string;
|
|
330
|
+
};
|
|
317
331
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
318
332
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|
|
319
333
|
url: string;
|