ccxt 4.3.17 → 4.3.18
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/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/binance.js +32 -8
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/pro/bybit.js +4 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +1 -1
- package/js/src/binance.js +32 -8
- package/js/src/htx.d.ts +2 -2
- package/js/src/htx.js +1 -1
- package/js/src/pro/bybit.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
213
213
|
|
|
214
214
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
215
215
|
|
|
216
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
|
217
|
-
* unpkg: https://unpkg.com/ccxt@4.3.
|
|
216
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.18/dist/ccxt.browser.js
|
|
217
|
+
* unpkg: https://unpkg.com/ccxt@4.3.18/dist/ccxt.browser.js
|
|
218
218
|
|
|
219
219
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
220
220
|
|
|
221
221
|
```HTML
|
|
222
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
|
222
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.18/dist/ccxt.browser.js"></script>
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
Creates a global `ccxt` object:
|
package/dist/cjs/ccxt.js
CHANGED
|
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
182
182
|
|
|
183
183
|
//-----------------------------------------------------------------------------
|
|
184
184
|
// this is updated by vss.js when building
|
|
185
|
-
const version = '4.3.
|
|
185
|
+
const version = '4.3.18';
|
|
186
186
|
Exchange["default"].ccxtVersion = version;
|
|
187
187
|
const exchanges = {
|
|
188
188
|
'ace': ace,
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -5747,6 +5747,7 @@ class binance extends binance$1 {
|
|
|
5747
5747
|
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
5748
5748
|
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
5749
5749
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
|
|
5750
|
+
* @param {string} [params.stopLossOrTakeProfit] 'stopLoss' or 'takeProfit', required for spot trailing orders
|
|
5750
5751
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5751
5752
|
*/
|
|
5752
5753
|
await this.loadMarkets();
|
|
@@ -5872,8 +5873,8 @@ class binance extends binance$1 {
|
|
|
5872
5873
|
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
|
|
5873
5874
|
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
5874
5875
|
const trailingDelta = this.safeString(params, 'trailingDelta');
|
|
5875
|
-
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice'
|
|
5876
|
-
const trailingPercent = this.
|
|
5876
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice');
|
|
5877
|
+
const trailingPercent = this.safeStringN(params, ['trailingPercent', 'callbackRate', 'trailingDelta']);
|
|
5877
5878
|
const priceMatch = this.safeString(params, 'priceMatch');
|
|
5878
5879
|
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
5879
5880
|
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
@@ -5885,10 +5886,33 @@ class binance extends binance$1 {
|
|
|
5885
5886
|
let uppercaseType = type.toUpperCase();
|
|
5886
5887
|
let stopPrice = undefined;
|
|
5887
5888
|
if (isTrailingPercentOrder) {
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5889
|
+
if (market['swap']) {
|
|
5890
|
+
uppercaseType = 'TRAILING_STOP_MARKET';
|
|
5891
|
+
request['callbackRate'] = trailingPercent;
|
|
5892
|
+
if (trailingTriggerPrice !== undefined) {
|
|
5893
|
+
request['activationPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
5894
|
+
}
|
|
5895
|
+
}
|
|
5896
|
+
else {
|
|
5897
|
+
if (isMarketOrder) {
|
|
5898
|
+
throw new errors.InvalidOrder(this.id + ' trailingPercent orders are not supported for ' + symbol + ' ' + type + ' orders');
|
|
5899
|
+
}
|
|
5900
|
+
const stopLossOrTakeProfit = this.safeString(params, 'stopLossOrTakeProfit');
|
|
5901
|
+
params = this.omit(params, 'stopLossOrTakeProfit');
|
|
5902
|
+
if (stopLossOrTakeProfit !== 'stopLoss' && stopLossOrTakeProfit !== 'takeProfit') {
|
|
5903
|
+
throw new errors.InvalidOrder(this.id + symbol + ' trailingPercent orders require a stopLossOrTakeProfit parameter of either stopLoss or takeProfit');
|
|
5904
|
+
}
|
|
5905
|
+
if (stopLossOrTakeProfit === 'stopLoss') {
|
|
5906
|
+
uppercaseType = 'STOP_LOSS_LIMIT';
|
|
5907
|
+
}
|
|
5908
|
+
else if (stopLossOrTakeProfit === 'takeProfit') {
|
|
5909
|
+
uppercaseType = 'TAKE_PROFIT_LIMIT';
|
|
5910
|
+
}
|
|
5911
|
+
if (trailingTriggerPrice !== undefined) {
|
|
5912
|
+
stopPrice = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
5913
|
+
}
|
|
5914
|
+
const trailingPercentConverted = Precise["default"].stringMul(trailingPercent, '100');
|
|
5915
|
+
request['trailingDelta'] = trailingPercentConverted;
|
|
5892
5916
|
}
|
|
5893
5917
|
}
|
|
5894
5918
|
else if (isStopLoss) {
|
|
@@ -6075,8 +6099,8 @@ class binance extends binance$1 {
|
|
|
6075
6099
|
}
|
|
6076
6100
|
else {
|
|
6077
6101
|
// check for delta price as well
|
|
6078
|
-
if (trailingDelta === undefined && stopPrice === undefined) {
|
|
6079
|
-
throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice or
|
|
6102
|
+
if (trailingDelta === undefined && stopPrice === undefined && trailingPercent === undefined) {
|
|
6103
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice, trailingDelta or trailingPercent param for a ' + type + ' order');
|
|
6080
6104
|
}
|
|
6081
6105
|
}
|
|
6082
6106
|
if (stopPrice !== undefined) {
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -3303,7 +3303,7 @@ class htx extends htx$1 {
|
|
|
3303
3303
|
}
|
|
3304
3304
|
return result;
|
|
3305
3305
|
}
|
|
3306
|
-
networkIdToCode(networkId, currencyCode = undefined) {
|
|
3306
|
+
networkIdToCode(networkId = undefined, currencyCode = undefined) {
|
|
3307
3307
|
// here network-id is provided as a pair of currency & chain (i.e. trc20usdt)
|
|
3308
3308
|
const keys = Object.keys(this.options['networkNamesByChainIds']);
|
|
3309
3309
|
const keysLength = keys.length;
|
|
@@ -50,7 +50,7 @@ class bybit extends bybit$1 {
|
|
|
50
50
|
},
|
|
51
51
|
'contract': 'wss://stream.{hostname}/v5/private',
|
|
52
52
|
'usdc': 'wss://stream.{hostname}/trade/option/usdc/private/v1',
|
|
53
|
-
'trade': 'wss://stream
|
|
53
|
+
'trade': 'wss://stream.bybit.com/v5/trade',
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
},
|
|
@@ -284,7 +284,9 @@ class bybit extends bybit$1 {
|
|
|
284
284
|
const url = this.urls['api']['ws']['private']['trade'];
|
|
285
285
|
await this.authenticate(url);
|
|
286
286
|
const requestId = this.requestId().toString();
|
|
287
|
-
|
|
287
|
+
if ('orderFilter' in orderRequest) {
|
|
288
|
+
delete orderRequest['orderFilter'];
|
|
289
|
+
}
|
|
288
290
|
const request = {
|
|
289
291
|
'op': 'order.cancel',
|
|
290
292
|
'reqId': requestId,
|
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 type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.17";
|
|
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.18';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -816,7 +816,7 @@ export default class Exchange {
|
|
|
816
816
|
filterBySymbol(objects: any, symbol?: Str): any;
|
|
817
817
|
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
818
818
|
networkCodeToId(networkCode: string, currencyCode?: Str): string;
|
|
819
|
-
networkIdToCode(networkId
|
|
819
|
+
networkIdToCode(networkId?: Str, currencyCode?: Str): string;
|
|
820
820
|
handleNetworkCodeAndParams(params: any): any[];
|
|
821
821
|
defaultNetworkCode(currencyCode: string): any;
|
|
822
822
|
selectNetworkCodeFromUnifiedNetworks(currencyCode: any, networkCode: any, indexedNetworkEntries: any): any;
|
package/js/src/base/Exchange.js
CHANGED
package/js/src/binance.js
CHANGED
|
@@ -5750,6 +5750,7 @@ export default class binance extends Exchange {
|
|
|
5750
5750
|
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
5751
5751
|
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
5752
5752
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
|
|
5753
|
+
* @param {string} [params.stopLossOrTakeProfit] 'stopLoss' or 'takeProfit', required for spot trailing orders
|
|
5753
5754
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5754
5755
|
*/
|
|
5755
5756
|
await this.loadMarkets();
|
|
@@ -5875,8 +5876,8 @@ export default class binance extends Exchange {
|
|
|
5875
5876
|
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
|
|
5876
5877
|
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
5877
5878
|
const trailingDelta = this.safeString(params, 'trailingDelta');
|
|
5878
|
-
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice'
|
|
5879
|
-
const trailingPercent = this.
|
|
5879
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice');
|
|
5880
|
+
const trailingPercent = this.safeStringN(params, ['trailingPercent', 'callbackRate', 'trailingDelta']);
|
|
5880
5881
|
const priceMatch = this.safeString(params, 'priceMatch');
|
|
5881
5882
|
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
5882
5883
|
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
@@ -5888,10 +5889,33 @@ export default class binance extends Exchange {
|
|
|
5888
5889
|
let uppercaseType = type.toUpperCase();
|
|
5889
5890
|
let stopPrice = undefined;
|
|
5890
5891
|
if (isTrailingPercentOrder) {
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5892
|
+
if (market['swap']) {
|
|
5893
|
+
uppercaseType = 'TRAILING_STOP_MARKET';
|
|
5894
|
+
request['callbackRate'] = trailingPercent;
|
|
5895
|
+
if (trailingTriggerPrice !== undefined) {
|
|
5896
|
+
request['activationPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
5897
|
+
}
|
|
5898
|
+
}
|
|
5899
|
+
else {
|
|
5900
|
+
if (isMarketOrder) {
|
|
5901
|
+
throw new InvalidOrder(this.id + ' trailingPercent orders are not supported for ' + symbol + ' ' + type + ' orders');
|
|
5902
|
+
}
|
|
5903
|
+
const stopLossOrTakeProfit = this.safeString(params, 'stopLossOrTakeProfit');
|
|
5904
|
+
params = this.omit(params, 'stopLossOrTakeProfit');
|
|
5905
|
+
if (stopLossOrTakeProfit !== 'stopLoss' && stopLossOrTakeProfit !== 'takeProfit') {
|
|
5906
|
+
throw new InvalidOrder(this.id + symbol + ' trailingPercent orders require a stopLossOrTakeProfit parameter of either stopLoss or takeProfit');
|
|
5907
|
+
}
|
|
5908
|
+
if (stopLossOrTakeProfit === 'stopLoss') {
|
|
5909
|
+
uppercaseType = 'STOP_LOSS_LIMIT';
|
|
5910
|
+
}
|
|
5911
|
+
else if (stopLossOrTakeProfit === 'takeProfit') {
|
|
5912
|
+
uppercaseType = 'TAKE_PROFIT_LIMIT';
|
|
5913
|
+
}
|
|
5914
|
+
if (trailingTriggerPrice !== undefined) {
|
|
5915
|
+
stopPrice = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
5916
|
+
}
|
|
5917
|
+
const trailingPercentConverted = Precise.stringMul(trailingPercent, '100');
|
|
5918
|
+
request['trailingDelta'] = trailingPercentConverted;
|
|
5895
5919
|
}
|
|
5896
5920
|
}
|
|
5897
5921
|
else if (isStopLoss) {
|
|
@@ -6078,8 +6102,8 @@ export default class binance extends Exchange {
|
|
|
6078
6102
|
}
|
|
6079
6103
|
else {
|
|
6080
6104
|
// check for delta price as well
|
|
6081
|
-
if (trailingDelta === undefined && stopPrice === undefined) {
|
|
6082
|
-
throw new InvalidOrder(this.id + ' createOrder() requires a stopPrice or
|
|
6105
|
+
if (trailingDelta === undefined && stopPrice === undefined && trailingPercent === undefined) {
|
|
6106
|
+
throw new InvalidOrder(this.id + ' createOrder() requires a stopPrice, trailingDelta or trailingPercent param for a ' + type + ' order');
|
|
6083
6107
|
}
|
|
6084
6108
|
}
|
|
6085
6109
|
if (stopPrice !== undefined) {
|
package/js/src/htx.d.ts
CHANGED
|
@@ -68,8 +68,8 @@ export default class htx extends Exchange {
|
|
|
68
68
|
};
|
|
69
69
|
fetchAccountIdByType(type: any, marginMode?: any, symbol?: any, params?: {}): Promise<any>;
|
|
70
70
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
71
|
-
networkIdToCode(networkId
|
|
72
|
-
networkCodeToId(networkCode:
|
|
71
|
+
networkIdToCode(networkId?: Str, currencyCode?: Str): string;
|
|
72
|
+
networkCodeToId(networkCode: string, currencyCode?: Str): any;
|
|
73
73
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
74
74
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
75
75
|
parseMarginBalanceHelper(balance: any, code: any, result: any): any;
|
package/js/src/htx.js
CHANGED
|
@@ -3306,7 +3306,7 @@ export default class htx extends Exchange {
|
|
|
3306
3306
|
}
|
|
3307
3307
|
return result;
|
|
3308
3308
|
}
|
|
3309
|
-
networkIdToCode(networkId, currencyCode = undefined) {
|
|
3309
|
+
networkIdToCode(networkId = undefined, currencyCode = undefined) {
|
|
3310
3310
|
// here network-id is provided as a pair of currency & chain (i.e. trc20usdt)
|
|
3311
3311
|
const keys = Object.keys(this.options['networkNamesByChainIds']);
|
|
3312
3312
|
const keysLength = keys.length;
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -53,7 +53,7 @@ export default class bybit extends bybitRest {
|
|
|
53
53
|
},
|
|
54
54
|
'contract': 'wss://stream.{hostname}/v5/private',
|
|
55
55
|
'usdc': 'wss://stream.{hostname}/trade/option/usdc/private/v1',
|
|
56
|
-
'trade': 'wss://stream
|
|
56
|
+
'trade': 'wss://stream.bybit.com/v5/trade',
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
},
|
|
@@ -287,7 +287,9 @@ export default class bybit extends bybitRest {
|
|
|
287
287
|
const url = this.urls['api']['ws']['private']['trade'];
|
|
288
288
|
await this.authenticate(url);
|
|
289
289
|
const requestId = this.requestId().toString();
|
|
290
|
-
|
|
290
|
+
if ('orderFilter' in orderRequest) {
|
|
291
|
+
delete orderRequest['orderFilter'];
|
|
292
|
+
}
|
|
291
293
|
const request = {
|
|
292
294
|
'op': 'order.cancel',
|
|
293
295
|
'reqId': requestId,
|
package/package.json
CHANGED