ccxt 4.4.40 → 4.4.41
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.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +20 -3
- package/dist/cjs/src/binance.js +24 -24
- package/dist/cjs/src/bingx.js +3 -1
- package/dist/cjs/src/bitfinex.js +1 -1
- package/dist/cjs/src/bitget.js +1 -0
- package/dist/cjs/src/bitmart.js +254 -1
- package/dist/cjs/src/bybit.js +8 -8
- package/dist/cjs/src/exmo.js +62 -4
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/hyperliquid.js +65 -1
- package/dist/cjs/src/kraken.js +129 -26
- package/dist/cjs/src/kucoin.js +6 -1
- package/dist/cjs/src/mexc.js +3 -3
- package/dist/cjs/src/okx.js +6 -1
- package/dist/cjs/src/xt.js +5 -2
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +5 -0
- package/js/src/base/Exchange.d.ts +6 -3
- package/js/src/base/Exchange.js +20 -3
- package/js/src/base/types.d.ts +2 -0
- package/js/src/binance.js +24 -24
- package/js/src/bingx.js +3 -1
- package/js/src/bitfinex.js +1 -1
- package/js/src/bitget.js +1 -0
- package/js/src/bitmart.d.ts +52 -1
- package/js/src/bitmart.js +254 -1
- package/js/src/bybit.js +8 -8
- package/js/src/exmo.d.ts +35 -0
- package/js/src/exmo.js +62 -4
- package/js/src/gate.js +1 -1
- package/js/src/htx.js +1 -1
- package/js/src/hyperliquid.d.ts +20 -1
- package/js/src/hyperliquid.js +65 -1
- package/js/src/kraken.d.ts +13 -7
- package/js/src/kraken.js +129 -26
- package/js/src/kucoin.js +6 -1
- package/js/src/mexc.js +3 -3
- package/js/src/okx.js +6 -1
- package/js/src/xt.js +5 -2
- package/package.json +2 -2
package/js/src/abstract/okx.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ interface Exchange {
|
|
|
67
67
|
publicGetTradingBotPublicRsiBackTesting(params?: {}): Promise<implicitReturnType>;
|
|
68
68
|
publicGetAssetExchangeList(params?: {}): Promise<implicitReturnType>;
|
|
69
69
|
publicGetFinanceStakingDefiEthApyHistory(params?: {}): Promise<implicitReturnType>;
|
|
70
|
+
publicGetFinanceStakingDefiSolApyHistory(params?: {}): Promise<implicitReturnType>;
|
|
70
71
|
publicGetFinanceSavingsLendingRateSummary(params?: {}): Promise<implicitReturnType>;
|
|
71
72
|
publicGetFinanceSavingsLendingRateHistory(params?: {}): Promise<implicitReturnType>;
|
|
72
73
|
publicGetFinanceFixedLoanLendingOffers(params?: {}): Promise<implicitReturnType>;
|
|
@@ -190,6 +191,8 @@ interface Exchange {
|
|
|
190
191
|
privateGetFinanceStakingDefiEthBalance(params?: {}): Promise<implicitReturnType>;
|
|
191
192
|
privateGetFinanceStakingDefiEthPurchaseRedeemHistory(params?: {}): Promise<implicitReturnType>;
|
|
192
193
|
privateGetFinanceStakingDefiEthProductInfo(params?: {}): Promise<implicitReturnType>;
|
|
194
|
+
privateGetFinanceStakingDefiSolBalance(params?: {}): Promise<implicitReturnType>;
|
|
195
|
+
privateGetFinanceStakingDefiSolPurchaseRedeemHistory(params?: {}): Promise<implicitReturnType>;
|
|
193
196
|
privateGetCopytradingCurrentSubpositions(params?: {}): Promise<implicitReturnType>;
|
|
194
197
|
privateGetCopytradingSubpositionsHistory(params?: {}): Promise<implicitReturnType>;
|
|
195
198
|
privateGetCopytradingInstruments(params?: {}): Promise<implicitReturnType>;
|
|
@@ -310,6 +313,8 @@ interface Exchange {
|
|
|
310
313
|
privatePostFinanceStakingDefiCancel(params?: {}): Promise<implicitReturnType>;
|
|
311
314
|
privatePostFinanceStakingDefiEthPurchase(params?: {}): Promise<implicitReturnType>;
|
|
312
315
|
privatePostFinanceStakingDefiEthRedeem(params?: {}): Promise<implicitReturnType>;
|
|
316
|
+
privatePostFinanceStakingDefiSolPurchase(params?: {}): Promise<implicitReturnType>;
|
|
317
|
+
privatePostFinanceStakingDefiSolRedeem(params?: {}): Promise<implicitReturnType>;
|
|
313
318
|
privatePostCopytradingAlgoOrder(params?: {}): Promise<implicitReturnType>;
|
|
314
319
|
privatePostCopytradingCloseSubposition(params?: {}): Promise<implicitReturnType>;
|
|
315
320
|
privatePostCopytradingSetInstruments(params?: {}): Promise<implicitReturnType>;
|
|
@@ -3,7 +3,7 @@ import { // eslint-disable-line object-curly-newline
|
|
|
3
3
|
ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotAvailable, RateLimitExceeded } from "./errors.js";
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
|
-
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CancellationRequest, IsolatedBorrowRate, IsolatedBorrowRates, CrossBorrowRates, CrossBorrowRate, Dict, FundingRates, LeverageTiers, Bool, int, DepositAddress, LongShortRatio } from './types.js';
|
|
6
|
+
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CancellationRequest, IsolatedBorrowRate, IsolatedBorrowRates, CrossBorrowRates, CrossBorrowRate, Dict, FundingRates, LeverageTiers, Bool, int, DepositAddress, LongShortRatio, OpenInterests } from './types.js';
|
|
7
7
|
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, Bool, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, CrossBorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, Conversion, DepositAddress, LongShortRatio } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
@@ -531,6 +531,7 @@ export default class Exchange {
|
|
|
531
531
|
fetchOHLCV: any;
|
|
532
532
|
fetchOHLCVWs: any;
|
|
533
533
|
fetchOpenInterest: any;
|
|
534
|
+
fetchOpenInterests: any;
|
|
534
535
|
fetchOpenInterestHistory: any;
|
|
535
536
|
fetchOpenOrder: any;
|
|
536
537
|
fetchOpenOrders: any;
|
|
@@ -815,6 +816,7 @@ export default class Exchange {
|
|
|
815
816
|
fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<DepositAddress[]>;
|
|
816
817
|
fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OpenInterest[]>;
|
|
817
818
|
fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
|
|
819
|
+
fetchOpenInterests(symbols?: Strings, params?: {}): Promise<OpenInterests>;
|
|
818
820
|
signIn(params?: {}): Promise<{}>;
|
|
819
821
|
fetchPaymentMethods(params?: {}): Promise<{}>;
|
|
820
822
|
parseToInt(number: any): number;
|
|
@@ -1124,6 +1126,7 @@ export default class Exchange {
|
|
|
1124
1126
|
safeSymbol(marketId: Str, market?: Market, delimiter?: Str, marketType?: Str): string;
|
|
1125
1127
|
parseFundingRate(contract: string, market?: Market): FundingRate;
|
|
1126
1128
|
parseFundingRates(response: any, market?: Market): FundingRates;
|
|
1129
|
+
parseOpenInterests(response: any, market?: Market): OpenInterests;
|
|
1127
1130
|
parseLongShortRatio(info: Dict, market?: Market): LongShortRatio;
|
|
1128
1131
|
parseLongShortRatioHistory(response: any, market?: any, since?: Int, limit?: Int): LongShortRatio[];
|
|
1129
1132
|
handleTriggerAndParams(params: any): any[];
|
|
@@ -1136,7 +1139,7 @@ export default class Exchange {
|
|
|
1136
1139
|
fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
|
|
1137
1140
|
fetchConvertCurrencies(params?: {}): Promise<Currencies>;
|
|
1138
1141
|
parseOpenInterest(interest: any, market?: Market): OpenInterest;
|
|
1139
|
-
|
|
1142
|
+
parseOpenInterestsHistory(response: any, market?: any, since?: Int, limit?: Int): OpenInterest[];
|
|
1140
1143
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
1141
1144
|
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
1142
1145
|
fetchMarkOHLCV(symbol: any, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
@@ -1159,7 +1162,7 @@ export default class Exchange {
|
|
|
1159
1162
|
filterByArrayTickers(objects: any, key: IndexType, values?: any, indexed?: boolean): Dictionary<Ticker>;
|
|
1160
1163
|
createOHLCVObject(symbol: string, timeframe: string, data: any): Dictionary<Dictionary<OHLCV[]>>;
|
|
1161
1164
|
handleMaxEntriesPerRequestAndParams(method: string, maxEntriesPerRequest?: Int, params?: {}): [Int, any];
|
|
1162
|
-
fetchPaginatedCallDynamic(method: string, symbol?: Str, since?: Int, limit?: Int, params?: {}, maxEntriesPerRequest?: Int): Promise<any>;
|
|
1165
|
+
fetchPaginatedCallDynamic(method: string, symbol?: Str, since?: Int, limit?: Int, params?: {}, maxEntriesPerRequest?: Int, removeRepeated?: boolean): Promise<any>;
|
|
1163
1166
|
safeDeterministicCall(method: string, symbol?: Str, since?: Int, limit?: Int, timeframe?: Str, params?: {}): Promise<any>;
|
|
1164
1167
|
fetchPaginatedCallDeterministic(method: string, symbol?: Str, since?: Int, limit?: Int, timeframe?: Str, params?: {}, maxEntriesPerRequest?: any): Promise<any>;
|
|
1165
1168
|
fetchPaginatedCallCursor(method: string, symbol?: Str, since?: any, limit?: any, params?: {}, cursorReceived?: any, cursorSent?: any, cursorIncrement?: any, maxEntriesPerRequest?: any): Promise<any>;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1427,6 +1427,7 @@ export default class Exchange {
|
|
|
1427
1427
|
'fetchOHLCV': undefined,
|
|
1428
1428
|
'fetchOHLCVWs': undefined,
|
|
1429
1429
|
'fetchOpenInterest': undefined,
|
|
1430
|
+
'fetchOpenInterests': undefined,
|
|
1430
1431
|
'fetchOpenInterestHistory': undefined,
|
|
1431
1432
|
'fetchOpenOrder': undefined,
|
|
1432
1433
|
'fetchOpenOrders': undefined,
|
|
@@ -2261,6 +2262,9 @@ export default class Exchange {
|
|
|
2261
2262
|
async fetchOpenInterest(symbol, params = {}) {
|
|
2262
2263
|
throw new NotSupported(this.id + ' fetchOpenInterest() is not supported yet');
|
|
2263
2264
|
}
|
|
2265
|
+
async fetchOpenInterests(symbols = undefined, params = {}) {
|
|
2266
|
+
throw new NotSupported(this.id + ' fetchOpenInterests() is not supported yet');
|
|
2267
|
+
}
|
|
2264
2268
|
async signIn(params = {}) {
|
|
2265
2269
|
throw new NotSupported(this.id + ' signIn() is not supported yet');
|
|
2266
2270
|
}
|
|
@@ -5716,6 +5720,14 @@ export default class Exchange {
|
|
|
5716
5720
|
}
|
|
5717
5721
|
return result;
|
|
5718
5722
|
}
|
|
5723
|
+
parseOpenInterests(response, market = undefined) {
|
|
5724
|
+
const result = {};
|
|
5725
|
+
for (let i = 0; i < response.length; i++) {
|
|
5726
|
+
const parsed = this.parseOpenInterest(response[i], market);
|
|
5727
|
+
result[parsed['symbol']] = parsed;
|
|
5728
|
+
}
|
|
5729
|
+
return result;
|
|
5730
|
+
}
|
|
5719
5731
|
parseLongShortRatio(info, market = undefined) {
|
|
5720
5732
|
throw new NotSupported(this.id + ' parseLongShortRatio() is not supported yet');
|
|
5721
5733
|
}
|
|
@@ -5825,7 +5837,7 @@ export default class Exchange {
|
|
|
5825
5837
|
parseOpenInterest(interest, market = undefined) {
|
|
5826
5838
|
throw new NotSupported(this.id + ' parseOpenInterest () is not supported yet');
|
|
5827
5839
|
}
|
|
5828
|
-
|
|
5840
|
+
parseOpenInterestsHistory(response, market = undefined, since = undefined, limit = undefined) {
|
|
5829
5841
|
const interests = [];
|
|
5830
5842
|
for (let i = 0; i < response.length; i++) {
|
|
5831
5843
|
const entry = response[i];
|
|
@@ -6177,7 +6189,7 @@ export default class Exchange {
|
|
|
6177
6189
|
}
|
|
6178
6190
|
return [maxEntriesPerRequest, params];
|
|
6179
6191
|
}
|
|
6180
|
-
async fetchPaginatedCallDynamic(method, symbol = undefined, since = undefined, limit = undefined, params = {}, maxEntriesPerRequest = undefined) {
|
|
6192
|
+
async fetchPaginatedCallDynamic(method, symbol = undefined, since = undefined, limit = undefined, params = {}, maxEntriesPerRequest = undefined, removeRepeated = true) {
|
|
6181
6193
|
let maxCalls = undefined;
|
|
6182
6194
|
[maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
|
|
6183
6195
|
let maxRetries = undefined;
|
|
@@ -6185,6 +6197,8 @@ export default class Exchange {
|
|
|
6185
6197
|
let paginationDirection = undefined;
|
|
6186
6198
|
[paginationDirection, params] = this.handleOptionAndParams(params, method, 'paginationDirection', 'backward');
|
|
6187
6199
|
let paginationTimestamp = undefined;
|
|
6200
|
+
let removeRepeatedOption = removeRepeated;
|
|
6201
|
+
[removeRepeatedOption, params] = this.handleOptionAndParams(params, method, 'removeRepeated', removeRepeated);
|
|
6188
6202
|
let calls = 0;
|
|
6189
6203
|
let result = [];
|
|
6190
6204
|
let errors = 0;
|
|
@@ -6255,7 +6269,10 @@ export default class Exchange {
|
|
|
6255
6269
|
}
|
|
6256
6270
|
}
|
|
6257
6271
|
}
|
|
6258
|
-
|
|
6272
|
+
let uniqueResults = result;
|
|
6273
|
+
if (removeRepeatedOption) {
|
|
6274
|
+
uniqueResults = this.removeRepeatedElementsFromArray(result);
|
|
6275
|
+
}
|
|
6259
6276
|
const key = (method === 'fetchOHLCV') ? 0 : 'timestamp';
|
|
6260
6277
|
return this.filterBySinceLimit(uniqueResults, since, limit, key);
|
|
6261
6278
|
}
|
package/js/src/base/types.d.ts
CHANGED
package/js/src/binance.js
CHANGED
|
@@ -5232,8 +5232,8 @@ export default class binance extends Exchange {
|
|
|
5232
5232
|
uppercaseType = 'LIMIT_MAKER';
|
|
5233
5233
|
}
|
|
5234
5234
|
request['type'] = uppercaseType;
|
|
5235
|
-
const
|
|
5236
|
-
if (
|
|
5235
|
+
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
|
|
5236
|
+
if (triggerPrice !== undefined) {
|
|
5237
5237
|
if (uppercaseType === 'MARKET') {
|
|
5238
5238
|
uppercaseType = 'STOP_LOSS';
|
|
5239
5239
|
}
|
|
@@ -5244,7 +5244,7 @@ export default class binance extends Exchange {
|
|
|
5244
5244
|
const validOrderTypes = this.safeList(market['info'], 'orderTypes');
|
|
5245
5245
|
if (!this.inArray(uppercaseType, validOrderTypes)) {
|
|
5246
5246
|
if (initialUppercaseType !== uppercaseType) {
|
|
5247
|
-
throw new InvalidOrder(this.id + '
|
|
5247
|
+
throw new InvalidOrder(this.id + ' triggerPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
|
|
5248
5248
|
}
|
|
5249
5249
|
else {
|
|
5250
5250
|
throw new InvalidOrder(this.id + ' ' + type + ' is not a valid order type for the ' + symbol + ' market');
|
|
@@ -5265,7 +5265,7 @@ export default class binance extends Exchange {
|
|
|
5265
5265
|
request['newOrderRespType'] = this.safeValue(this.options['newOrderRespType'], type, 'RESULT'); // 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
|
|
5266
5266
|
let timeInForceIsRequired = false;
|
|
5267
5267
|
let priceIsRequired = false;
|
|
5268
|
-
let
|
|
5268
|
+
let triggerPriceIsRequired = false;
|
|
5269
5269
|
let quantityIsRequired = false;
|
|
5270
5270
|
if (uppercaseType === 'MARKET') {
|
|
5271
5271
|
const quoteOrderQty = this.safeBool(this.options, 'quoteOrderQty', true);
|
|
@@ -5295,12 +5295,12 @@ export default class binance extends Exchange {
|
|
|
5295
5295
|
quantityIsRequired = true;
|
|
5296
5296
|
}
|
|
5297
5297
|
else if ((uppercaseType === 'STOP_LOSS') || (uppercaseType === 'TAKE_PROFIT')) {
|
|
5298
|
-
|
|
5298
|
+
triggerPriceIsRequired = true;
|
|
5299
5299
|
quantityIsRequired = true;
|
|
5300
5300
|
}
|
|
5301
5301
|
else if ((uppercaseType === 'STOP_LOSS_LIMIT') || (uppercaseType === 'TAKE_PROFIT_LIMIT')) {
|
|
5302
5302
|
quantityIsRequired = true;
|
|
5303
|
-
|
|
5303
|
+
triggerPriceIsRequired = true;
|
|
5304
5304
|
priceIsRequired = true;
|
|
5305
5305
|
timeInForceIsRequired = true;
|
|
5306
5306
|
}
|
|
@@ -5320,12 +5320,12 @@ export default class binance extends Exchange {
|
|
|
5320
5320
|
if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined)) {
|
|
5321
5321
|
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
5322
5322
|
}
|
|
5323
|
-
if (
|
|
5324
|
-
if (
|
|
5325
|
-
throw new InvalidOrder(this.id + ' editOrder() requires a
|
|
5323
|
+
if (triggerPriceIsRequired) {
|
|
5324
|
+
if (triggerPrice === undefined) {
|
|
5325
|
+
throw new InvalidOrder(this.id + ' editOrder() requires a triggerPrice extra param for a ' + type + ' order');
|
|
5326
5326
|
}
|
|
5327
5327
|
else {
|
|
5328
|
-
request['stopPrice'] = this.priceToPrecision(symbol,
|
|
5328
|
+
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
5329
5329
|
}
|
|
5330
5330
|
}
|
|
5331
5331
|
request['cancelReplaceMode'] = 'STOP_ON_FAILURE'; // If the cancel request fails, the new order placement will not be attempted.
|
|
@@ -5989,7 +5989,7 @@ export default class binance extends Exchange {
|
|
|
5989
5989
|
type = 'limit';
|
|
5990
5990
|
}
|
|
5991
5991
|
const stopPriceString = this.safeString(order, 'stopPrice');
|
|
5992
|
-
const
|
|
5992
|
+
const triggerPrice = this.parseNumber(this.omitZero(stopPriceString));
|
|
5993
5993
|
const feeCost = this.safeNumber(order, 'fee');
|
|
5994
5994
|
let fee = undefined;
|
|
5995
5995
|
if (feeCost !== undefined) {
|
|
@@ -6014,7 +6014,7 @@ export default class binance extends Exchange {
|
|
|
6014
6014
|
'reduceOnly': this.safeBool(order, 'reduceOnly'),
|
|
6015
6015
|
'side': side,
|
|
6016
6016
|
'price': price,
|
|
6017
|
-
'triggerPrice':
|
|
6017
|
+
'triggerPrice': triggerPrice,
|
|
6018
6018
|
'amount': amount,
|
|
6019
6019
|
'cost': cost,
|
|
6020
6020
|
'average': average,
|
|
@@ -6333,7 +6333,7 @@ export default class binance extends Exchange {
|
|
|
6333
6333
|
const validOrderTypes = this.safeList(market['info'], 'orderTypes');
|
|
6334
6334
|
if (!this.inArray(uppercaseType, validOrderTypes)) {
|
|
6335
6335
|
if (initialUppercaseType !== uppercaseType) {
|
|
6336
|
-
throw new InvalidOrder(this.id + '
|
|
6336
|
+
throw new InvalidOrder(this.id + ' triggerPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
|
|
6337
6337
|
}
|
|
6338
6338
|
else {
|
|
6339
6339
|
throw new InvalidOrder(this.id + ' ' + type + ' is not a valid order type for the ' + symbol + ' market');
|
|
@@ -6388,7 +6388,7 @@ export default class binance extends Exchange {
|
|
|
6388
6388
|
const closePosition = this.safeBool(params, 'closePosition', false);
|
|
6389
6389
|
let timeInForceIsRequired = false;
|
|
6390
6390
|
let priceIsRequired = false;
|
|
6391
|
-
let
|
|
6391
|
+
let triggerPriceIsRequired = false;
|
|
6392
6392
|
let quantityIsRequired = false;
|
|
6393
6393
|
//
|
|
6394
6394
|
// spot/margin
|
|
@@ -6443,7 +6443,7 @@ export default class binance extends Exchange {
|
|
|
6443
6443
|
quantityIsRequired = true;
|
|
6444
6444
|
}
|
|
6445
6445
|
else if ((uppercaseType === 'STOP_LOSS') || (uppercaseType === 'TAKE_PROFIT')) {
|
|
6446
|
-
|
|
6446
|
+
triggerPriceIsRequired = true;
|
|
6447
6447
|
quantityIsRequired = true;
|
|
6448
6448
|
if (market['linear'] || market['inverse']) {
|
|
6449
6449
|
priceIsRequired = true;
|
|
@@ -6451,7 +6451,7 @@ export default class binance extends Exchange {
|
|
|
6451
6451
|
}
|
|
6452
6452
|
else if ((uppercaseType === 'STOP_LOSS_LIMIT') || (uppercaseType === 'TAKE_PROFIT_LIMIT')) {
|
|
6453
6453
|
quantityIsRequired = true;
|
|
6454
|
-
|
|
6454
|
+
triggerPriceIsRequired = true;
|
|
6455
6455
|
priceIsRequired = true;
|
|
6456
6456
|
timeInForceIsRequired = true;
|
|
6457
6457
|
}
|
|
@@ -6461,14 +6461,14 @@ export default class binance extends Exchange {
|
|
|
6461
6461
|
}
|
|
6462
6462
|
else if (uppercaseType === 'STOP') {
|
|
6463
6463
|
quantityIsRequired = true;
|
|
6464
|
-
|
|
6464
|
+
triggerPriceIsRequired = true;
|
|
6465
6465
|
priceIsRequired = true;
|
|
6466
6466
|
}
|
|
6467
6467
|
else if ((uppercaseType === 'STOP_MARKET') || (uppercaseType === 'TAKE_PROFIT_MARKET')) {
|
|
6468
6468
|
if (!closePosition) {
|
|
6469
6469
|
quantityIsRequired = true;
|
|
6470
6470
|
}
|
|
6471
|
-
|
|
6471
|
+
triggerPriceIsRequired = true;
|
|
6472
6472
|
}
|
|
6473
6473
|
else if (uppercaseType === 'TRAILING_STOP_MARKET') {
|
|
6474
6474
|
if (!closePosition) {
|
|
@@ -6507,16 +6507,16 @@ export default class binance extends Exchange {
|
|
|
6507
6507
|
request['price'] = this.parseToNumeric(price); // some options don't have the precision available
|
|
6508
6508
|
}
|
|
6509
6509
|
}
|
|
6510
|
-
if (
|
|
6510
|
+
if (triggerPriceIsRequired) {
|
|
6511
6511
|
if (market['contract']) {
|
|
6512
6512
|
if (stopPrice === undefined) {
|
|
6513
|
-
throw new InvalidOrder(this.id + ' createOrder() requires a
|
|
6513
|
+
throw new InvalidOrder(this.id + ' createOrder() requires a triggerPrice extra param for a ' + type + ' order');
|
|
6514
6514
|
}
|
|
6515
6515
|
}
|
|
6516
6516
|
else {
|
|
6517
6517
|
// check for delta price as well
|
|
6518
6518
|
if (trailingDelta === undefined && stopPrice === undefined && trailingPercent === undefined) {
|
|
6519
|
-
throw new InvalidOrder(this.id + ' createOrder() requires a
|
|
6519
|
+
throw new InvalidOrder(this.id + ' createOrder() requires a triggerPrice, trailingDelta or trailingPercent param for a ' + type + ' order');
|
|
6520
6520
|
}
|
|
6521
6521
|
}
|
|
6522
6522
|
if (stopPrice !== undefined) {
|
|
@@ -11640,7 +11640,7 @@ export default class binance extends Exchange {
|
|
|
11640
11640
|
let paginate = false;
|
|
11641
11641
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
11642
11642
|
if (paginate) {
|
|
11643
|
-
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
11643
|
+
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, undefined, false);
|
|
11644
11644
|
}
|
|
11645
11645
|
let type = undefined;
|
|
11646
11646
|
let subType = undefined;
|
|
@@ -12822,7 +12822,7 @@ export default class binance extends Exchange {
|
|
|
12822
12822
|
// ...
|
|
12823
12823
|
// ]
|
|
12824
12824
|
//
|
|
12825
|
-
return this.
|
|
12825
|
+
return this.parseOpenInterestsHistory(response, market, since, limit);
|
|
12826
12826
|
}
|
|
12827
12827
|
/**
|
|
12828
12828
|
* @method
|
|
@@ -12891,7 +12891,7 @@ export default class binance extends Exchange {
|
|
|
12891
12891
|
//
|
|
12892
12892
|
if (market['option']) {
|
|
12893
12893
|
symbol = market['symbol'];
|
|
12894
|
-
const result = this.
|
|
12894
|
+
const result = this.parseOpenInterestsHistory(response, market);
|
|
12895
12895
|
for (let i = 0; i < result.length; i++) {
|
|
12896
12896
|
const item = result[i];
|
|
12897
12897
|
if (item['symbol'] === symbol) {
|
package/js/src/bingx.js
CHANGED
|
@@ -51,6 +51,7 @@ export default class bingx extends Exchange {
|
|
|
51
51
|
'createTrailingAmountOrder': true,
|
|
52
52
|
'createTrailingPercentOrder': true,
|
|
53
53
|
'createTriggerOrder': true,
|
|
54
|
+
'editOrder': true,
|
|
54
55
|
'fetchBalance': true,
|
|
55
56
|
'fetchCanceledOrders': true,
|
|
56
57
|
'fetchClosedOrders': true,
|
|
@@ -73,6 +74,7 @@ export default class bingx extends Exchange {
|
|
|
73
74
|
'fetchMarkPrice': true,
|
|
74
75
|
'fetchMarkPrices': true,
|
|
75
76
|
'fetchMyLiquidations': true,
|
|
77
|
+
'fetchMyTrades': true,
|
|
76
78
|
'fetchOHLCV': true,
|
|
77
79
|
'fetchOpenInterest': true,
|
|
78
80
|
'fetchOpenOrders': true,
|
|
@@ -1040,7 +1042,7 @@ export default class bingx extends Exchange {
|
|
|
1040
1042
|
};
|
|
1041
1043
|
request['interval'] = this.safeString(this.timeframes, timeframe, timeframe);
|
|
1042
1044
|
if (since !== undefined) {
|
|
1043
|
-
request['startTime'] = since;
|
|
1045
|
+
request['startTime'] = Math.max(since - 1, 0);
|
|
1044
1046
|
}
|
|
1045
1047
|
if (limit !== undefined) {
|
|
1046
1048
|
request['limit'] = limit;
|
package/js/src/bitfinex.js
CHANGED
|
@@ -3359,7 +3359,7 @@ export default class bitfinex extends Exchange {
|
|
|
3359
3359
|
// ],
|
|
3360
3360
|
// ]
|
|
3361
3361
|
//
|
|
3362
|
-
return this.
|
|
3362
|
+
return this.parseOpenInterestsHistory(response, market, since, limit);
|
|
3363
3363
|
}
|
|
3364
3364
|
parseOpenInterest(interest, market = undefined) {
|
|
3365
3365
|
//
|
package/js/src/bitget.js
CHANGED
|
@@ -1246,6 +1246,7 @@ export default class bitget extends Exchange {
|
|
|
1246
1246
|
'41103': InvalidOrder,
|
|
1247
1247
|
'41114': OnMaintenance,
|
|
1248
1248
|
'43011': InvalidOrder,
|
|
1249
|
+
'43001': OrderNotFound,
|
|
1249
1250
|
'43012': InsufficientFunds,
|
|
1250
1251
|
'43025': InvalidOrder,
|
|
1251
1252
|
'43115': OnMaintenance,
|
package/js/src/bitmart.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bitmart.js';
|
|
2
|
-
import type { Int, OrderSide, Balances, OrderType, OHLCV, Order, Str, Trade, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, TransferEntry, Num, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, Dict, OrderRequest, int, FundingRate, DepositAddress, BorrowInterest } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, Balances, OrderType, OHLCV, Order, Str, Trade, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, TransferEntry, Num, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, Dict, OrderRequest, int, FundingRate, DepositAddress, BorrowInterest, FundingRateHistory, LedgerEntry, FundingHistory } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bitmart
|
|
5
5
|
* @augments Exchange
|
|
@@ -572,6 +572,18 @@ export default class bitmart extends Exchange {
|
|
|
572
572
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
573
573
|
*/
|
|
574
574
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
575
|
+
/**
|
|
576
|
+
* @method
|
|
577
|
+
* @name bitmart#fetchFundingRateHistory
|
|
578
|
+
* @description fetches historical funding rate prices
|
|
579
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-funding-rate-history
|
|
580
|
+
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
581
|
+
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
582
|
+
* @param {int} [limit] the maximum amount of funding rate structures to fetch
|
|
583
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
584
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
585
|
+
*/
|
|
586
|
+
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
575
587
|
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
576
588
|
/**
|
|
577
589
|
* @method
|
|
@@ -635,6 +647,45 @@ export default class bitmart extends Exchange {
|
|
|
635
647
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
636
648
|
*/
|
|
637
649
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
650
|
+
/**
|
|
651
|
+
* @method
|
|
652
|
+
* @name bitmart#fetchLedger
|
|
653
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
654
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
|
|
655
|
+
* @param {string} [code] unified currency code
|
|
656
|
+
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
657
|
+
* @param {int} [limit] max number of ledger entries to return
|
|
658
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
659
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
660
|
+
* @returns {object[]} a list of [ledger structures]{@link https://docs.ccxt.com/#/?id=ledger}
|
|
661
|
+
*/
|
|
662
|
+
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
|
|
663
|
+
parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
|
|
664
|
+
parseLedgerEntryType(type: any): string;
|
|
665
|
+
fetchTransactionsRequest(flowType?: Int, symbol?: Str, since?: Int, limit?: Int, params?: {}): any;
|
|
666
|
+
/**
|
|
667
|
+
* @method
|
|
668
|
+
* @name bitmart#fetchFundingHistory
|
|
669
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
670
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
|
|
671
|
+
* @param {string} [symbol] unified market symbol
|
|
672
|
+
* @param {int} [since] the starting timestamp in milliseconds
|
|
673
|
+
* @param {int} [limit] the number of entries to return
|
|
674
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
675
|
+
* @param {int} [params.until] the latest time in ms to fetch funding history for
|
|
676
|
+
* @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
677
|
+
*/
|
|
678
|
+
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
679
|
+
parseFundingHistory(contract: any, market?: Market): {
|
|
680
|
+
info: any;
|
|
681
|
+
symbol: string;
|
|
682
|
+
code: string;
|
|
683
|
+
timestamp: number;
|
|
684
|
+
datetime: string;
|
|
685
|
+
id: string;
|
|
686
|
+
amount: number;
|
|
687
|
+
};
|
|
688
|
+
parseFundingHistories(contracts: any, market?: any, since?: Int, limit?: Int): FundingHistory[];
|
|
638
689
|
nonce(): number;
|
|
639
690
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
640
691
|
url: string;
|