ccxt 4.3.79 → 4.3.81
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 +40 -47
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitmart.js +4 -3
- package/dist/cjs/src/bybit.js +93 -52
- package/dist/cjs/src/poloniex.js +4 -2
- package/dist/cjs/src/yobit.js +1 -0
- 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 +40 -47
- package/js/src/binance.js +1 -1
- package/js/src/bitmart.js +4 -3
- package/js/src/bybit.d.ts +3 -0
- package/js/src/bybit.js +93 -52
- package/js/src/coinbaseexchange.d.ts +1 -1
- package/js/src/poloniex.js +4 -2
- package/js/src/static_dependencies/starknet/index.d.ts +0 -4
- package/js/src/static_dependencies/starknet/index.js +0 -41
- package/js/src/static_dependencies/starknet/utils/hash/classHash.js +4 -5
- package/js/src/yobit.js +1 -0
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
194
194
|
|
|
195
195
|
//-----------------------------------------------------------------------------
|
|
196
196
|
// this is updated by vss.js when building
|
|
197
|
-
const version = '4.3.
|
|
197
|
+
const version = '4.3.81';
|
|
198
198
|
Exchange["default"].ccxtVersion = version;
|
|
199
199
|
const exchanges = {
|
|
200
200
|
'ace': ace,
|
|
@@ -398,16 +398,6 @@ class Exchange {
|
|
|
398
398
|
}
|
|
399
399
|
return result;
|
|
400
400
|
}
|
|
401
|
-
checkAddress(address) {
|
|
402
|
-
if (address === undefined) {
|
|
403
|
-
throw new errors.InvalidAddress(this.id + ' address is undefined');
|
|
404
|
-
}
|
|
405
|
-
// check the address is not the same letter like 'aaaaa' nor too short nor has a space
|
|
406
|
-
if ((this.unique(address).length === 1) || address.length < this.minFundingAddressLength || address.includes(' ')) {
|
|
407
|
-
throw new errors.InvalidAddress(this.id + ' address is invalid or has less than ' + this.minFundingAddressLength.toString() + ' characters: "' + this.json(address) + '"');
|
|
408
|
-
}
|
|
409
|
-
return address;
|
|
410
|
-
}
|
|
411
401
|
initRestRateLimiter() {
|
|
412
402
|
if (this.rateLimit === undefined) {
|
|
413
403
|
throw new Error(this.id + '.rateLimit property is not configured');
|
|
@@ -1775,55 +1765,43 @@ class Exchange {
|
|
|
1775
1765
|
let httpsProxy = undefined;
|
|
1776
1766
|
let socksProxy = undefined;
|
|
1777
1767
|
// httpProxy
|
|
1778
|
-
|
|
1768
|
+
const isHttpProxyDefined = this.valueIsDefined(this.httpProxy);
|
|
1769
|
+
const isHttp_proxy_defined = this.valueIsDefined(this.http_proxy);
|
|
1770
|
+
if (isHttpProxyDefined || isHttp_proxy_defined) {
|
|
1779
1771
|
usedProxies.push('httpProxy');
|
|
1780
|
-
httpProxy = this.httpProxy;
|
|
1781
|
-
}
|
|
1782
|
-
if (this.valueIsDefined(this.http_proxy)) {
|
|
1783
|
-
usedProxies.push('http_proxy');
|
|
1784
|
-
httpProxy = this.http_proxy;
|
|
1772
|
+
httpProxy = isHttpProxyDefined ? this.httpProxy : this.http_proxy;
|
|
1785
1773
|
}
|
|
1786
|
-
|
|
1774
|
+
const ishttpProxyCallbackDefined = this.valueIsDefined(this.httpProxyCallback);
|
|
1775
|
+
const ishttp_proxy_callback_defined = this.valueIsDefined(this.http_proxy_callback);
|
|
1776
|
+
if (ishttpProxyCallbackDefined || ishttp_proxy_callback_defined) {
|
|
1787
1777
|
usedProxies.push('httpProxyCallback');
|
|
1788
|
-
httpProxy = this.httpProxyCallback(url, method, headers, body);
|
|
1789
|
-
}
|
|
1790
|
-
if (this.http_proxy_callback !== undefined) {
|
|
1791
|
-
usedProxies.push('http_proxy_callback');
|
|
1792
|
-
httpProxy = this.http_proxy_callback(url, method, headers, body);
|
|
1778
|
+
httpProxy = ishttpProxyCallbackDefined ? this.httpProxyCallback(url, method, headers, body) : this.http_proxy_callback(url, method, headers, body);
|
|
1793
1779
|
}
|
|
1794
1780
|
// httpsProxy
|
|
1795
|
-
|
|
1781
|
+
const isHttpsProxyDefined = this.valueIsDefined(this.httpsProxy);
|
|
1782
|
+
const isHttps_proxy_defined = this.valueIsDefined(this.https_proxy);
|
|
1783
|
+
if (isHttpsProxyDefined || isHttps_proxy_defined) {
|
|
1796
1784
|
usedProxies.push('httpsProxy');
|
|
1797
|
-
httpsProxy = this.httpsProxy;
|
|
1785
|
+
httpsProxy = isHttpsProxyDefined ? this.httpsProxy : this.https_proxy;
|
|
1798
1786
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
}
|
|
1803
|
-
if (this.httpsProxyCallback !== undefined) {
|
|
1787
|
+
const ishttpsProxyCallbackDefined = this.valueIsDefined(this.httpsProxyCallback);
|
|
1788
|
+
const ishttps_proxy_callback_defined = this.valueIsDefined(this.https_proxy_callback);
|
|
1789
|
+
if (ishttpsProxyCallbackDefined || ishttps_proxy_callback_defined) {
|
|
1804
1790
|
usedProxies.push('httpsProxyCallback');
|
|
1805
|
-
httpsProxy = this.httpsProxyCallback(url, method, headers, body);
|
|
1806
|
-
}
|
|
1807
|
-
if (this.https_proxy_callback !== undefined) {
|
|
1808
|
-
usedProxies.push('https_proxy_callback');
|
|
1809
|
-
httpsProxy = this.https_proxy_callback(url, method, headers, body);
|
|
1791
|
+
httpsProxy = ishttpsProxyCallbackDefined ? this.httpsProxyCallback(url, method, headers, body) : this.https_proxy_callback(url, method, headers, body);
|
|
1810
1792
|
}
|
|
1811
1793
|
// socksProxy
|
|
1812
|
-
|
|
1794
|
+
const isSocksProxyDefined = this.valueIsDefined(this.socksProxy);
|
|
1795
|
+
const isSocks_proxy_defined = this.valueIsDefined(this.socks_proxy);
|
|
1796
|
+
if (isSocksProxyDefined || isSocks_proxy_defined) {
|
|
1813
1797
|
usedProxies.push('socksProxy');
|
|
1814
|
-
socksProxy = this.socksProxy;
|
|
1798
|
+
socksProxy = isSocksProxyDefined ? this.socksProxy : this.socks_proxy;
|
|
1815
1799
|
}
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
}
|
|
1820
|
-
if (this.socksProxyCallback !== undefined) {
|
|
1800
|
+
const issocksProxyCallbackDefined = this.valueIsDefined(this.socksProxyCallback);
|
|
1801
|
+
const issocks_proxy_callback_defined = this.valueIsDefined(this.socks_proxy_callback);
|
|
1802
|
+
if (issocksProxyCallbackDefined || issocks_proxy_callback_defined) {
|
|
1821
1803
|
usedProxies.push('socksProxyCallback');
|
|
1822
|
-
socksProxy = this.socksProxyCallback(url, method, headers, body);
|
|
1823
|
-
}
|
|
1824
|
-
if (this.socks_proxy_callback !== undefined) {
|
|
1825
|
-
usedProxies.push('socks_proxy_callback');
|
|
1826
|
-
socksProxy = this.socks_proxy_callback(url, method, headers, body);
|
|
1804
|
+
socksProxy = issocksProxyCallbackDefined ? this.socksProxyCallback(url, method, headers, body) : this.socks_proxy_callback(url, method, headers, body);
|
|
1827
1805
|
}
|
|
1828
1806
|
// check
|
|
1829
1807
|
const length = usedProxies.length;
|
|
@@ -1878,6 +1856,18 @@ class Exchange {
|
|
|
1878
1856
|
throw new errors.InvalidProxySettings(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy');
|
|
1879
1857
|
}
|
|
1880
1858
|
}
|
|
1859
|
+
checkAddress(address = undefined) {
|
|
1860
|
+
if (address === undefined) {
|
|
1861
|
+
throw new errors.InvalidAddress(this.id + ' address is undefined');
|
|
1862
|
+
}
|
|
1863
|
+
// check the address is not the same letter like 'aaaaa' nor too short nor has a space
|
|
1864
|
+
const uniqChars = (this.unique(this.stringToCharsArray(address)));
|
|
1865
|
+
const length = uniqChars.length; // py transpiler trick
|
|
1866
|
+
if (length === 1 || address.length < this.minFundingAddressLength || address.indexOf(' ') > -1) {
|
|
1867
|
+
throw new errors.InvalidAddress(this.id + ' address is invalid or has less than ' + this.minFundingAddressLength.toString() + ' characters: "' + address.toString() + '"');
|
|
1868
|
+
}
|
|
1869
|
+
return address;
|
|
1870
|
+
}
|
|
1881
1871
|
findMessageHashes(client, element) {
|
|
1882
1872
|
const result = [];
|
|
1883
1873
|
const messageHashes = Object.keys(client.futures);
|
|
@@ -3844,7 +3834,10 @@ class Exchange {
|
|
|
3844
3834
|
];
|
|
3845
3835
|
}
|
|
3846
3836
|
getListFromObjectValues(objects, key) {
|
|
3847
|
-
|
|
3837
|
+
let newArray = objects;
|
|
3838
|
+
if (!Array.isArray(objects)) {
|
|
3839
|
+
newArray = this.toArray(objects);
|
|
3840
|
+
}
|
|
3848
3841
|
const results = [];
|
|
3849
3842
|
for (let i = 0; i < newArray.length; i++) {
|
|
3850
3843
|
results.push(newArray[i][key]);
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -51,7 +51,7 @@ class binance extends binance$1 {
|
|
|
51
51
|
'createMarketSellOrderWithCost': true,
|
|
52
52
|
'createOrder': true,
|
|
53
53
|
'createOrders': true,
|
|
54
|
-
'createOrderWithTakeProfitAndStopLoss':
|
|
54
|
+
'createOrderWithTakeProfitAndStopLoss': false,
|
|
55
55
|
'createPostOnlyOrder': true,
|
|
56
56
|
'createReduceOnlyOrder': true,
|
|
57
57
|
'createStopLimitOrder': true,
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -2461,8 +2461,6 @@ class bitmart extends bitmart$1 {
|
|
|
2461
2461
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
2462
2462
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2463
2463
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2464
|
-
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2465
|
-
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2466
2464
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2467
2465
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2468
2466
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
@@ -2609,6 +2607,7 @@ class bitmart extends bitmart$1 {
|
|
|
2609
2607
|
* @description create a trade order
|
|
2610
2608
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2611
2609
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2610
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2612
2611
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2613
2612
|
* @param {string} type 'market', 'limit' or 'trailing'
|
|
2614
2613
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2668,7 +2667,9 @@ class bitmart extends bitmart$1 {
|
|
|
2668
2667
|
request['activation_price_type'] = this.safeInteger(params, 'activation_price_type', 1);
|
|
2669
2668
|
}
|
|
2670
2669
|
if (isTriggerOrder) {
|
|
2671
|
-
|
|
2670
|
+
if (isLimitOrder || price !== undefined) {
|
|
2671
|
+
request['executive_price'] = this.priceToPrecision(symbol, price);
|
|
2672
|
+
}
|
|
2672
2673
|
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
2673
2674
|
request['price_type'] = this.safeInteger(params, 'price_type', 1);
|
|
2674
2675
|
if (side === 'buy') {
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -1209,6 +1209,21 @@ class bybit extends bybit$1 {
|
|
|
1209
1209
|
const optionType = this.safeString(optionParts, 3);
|
|
1210
1210
|
const datetime = this.convertExpireDate(expiry);
|
|
1211
1211
|
const timestamp = this.parse8601(datetime);
|
|
1212
|
+
let amountPrecision = undefined;
|
|
1213
|
+
let pricePrecision = undefined;
|
|
1214
|
+
// hard coded amount and price precisions from fetchOptionMarkets
|
|
1215
|
+
if (base === 'BTC') {
|
|
1216
|
+
amountPrecision = this.parseNumber('0.01');
|
|
1217
|
+
pricePrecision = this.parseNumber('5');
|
|
1218
|
+
}
|
|
1219
|
+
else if (base === 'ETH') {
|
|
1220
|
+
amountPrecision = this.parseNumber('0.1');
|
|
1221
|
+
pricePrecision = this.parseNumber('0.1');
|
|
1222
|
+
}
|
|
1223
|
+
else if (base === 'SOL') {
|
|
1224
|
+
amountPrecision = this.parseNumber('1');
|
|
1225
|
+
pricePrecision = this.parseNumber('0.01');
|
|
1226
|
+
}
|
|
1212
1227
|
return {
|
|
1213
1228
|
'id': base + '-' + this.convertExpireDateToMarketIdDate(expiry) + '-' + strike + '-' + optionType,
|
|
1214
1229
|
'symbol': base + '/' + quote + ':' + settle + '-' + expiry + '-' + strike + '-' + optionType,
|
|
@@ -1228,14 +1243,14 @@ class bybit extends bybit$1 {
|
|
|
1228
1243
|
'option': true,
|
|
1229
1244
|
'margin': false,
|
|
1230
1245
|
'contract': true,
|
|
1231
|
-
'contractSize':
|
|
1246
|
+
'contractSize': this.parseNumber('1'),
|
|
1232
1247
|
'expiry': timestamp,
|
|
1233
1248
|
'expiryDatetime': datetime,
|
|
1234
1249
|
'optionType': (optionType === 'C') ? 'call' : 'put',
|
|
1235
1250
|
'strike': this.parseNumber(strike),
|
|
1236
1251
|
'precision': {
|
|
1237
|
-
'amount':
|
|
1238
|
-
'price':
|
|
1252
|
+
'amount': amountPrecision,
|
|
1253
|
+
'price': pricePrecision,
|
|
1239
1254
|
},
|
|
1240
1255
|
'limits': {
|
|
1241
1256
|
'amount': {
|
|
@@ -1272,6 +1287,33 @@ class bybit extends bybit$1 {
|
|
|
1272
1287
|
}
|
|
1273
1288
|
return [subType, params];
|
|
1274
1289
|
}
|
|
1290
|
+
getAmount(symbol, amount) {
|
|
1291
|
+
// some markets like options might not have the precision available
|
|
1292
|
+
// and we shouldn't crash in those cases
|
|
1293
|
+
const market = this.market(symbol);
|
|
1294
|
+
const emptyPrecisionAmount = (market['precision']['amount'] === undefined);
|
|
1295
|
+
const amountString = this.numberToString(amount);
|
|
1296
|
+
if (!emptyPrecisionAmount && (amountString !== '0')) {
|
|
1297
|
+
return this.amountToPrecision(symbol, amount);
|
|
1298
|
+
}
|
|
1299
|
+
return amountString;
|
|
1300
|
+
}
|
|
1301
|
+
getPrice(symbol, price) {
|
|
1302
|
+
const market = this.market(symbol);
|
|
1303
|
+
const emptyPrecisionPrice = (market['precision']['price'] === undefined);
|
|
1304
|
+
if (!emptyPrecisionPrice) {
|
|
1305
|
+
return this.priceToPrecision(symbol, price);
|
|
1306
|
+
}
|
|
1307
|
+
return price;
|
|
1308
|
+
}
|
|
1309
|
+
getCost(symbol, cost) {
|
|
1310
|
+
const market = this.market(symbol);
|
|
1311
|
+
const emptyPrecisionPrice = (market['precision']['price'] === undefined);
|
|
1312
|
+
if (!emptyPrecisionPrice) {
|
|
1313
|
+
return this.costToPrecision(symbol, cost);
|
|
1314
|
+
}
|
|
1315
|
+
return cost;
|
|
1316
|
+
}
|
|
1275
1317
|
async fetchTime(params = {}) {
|
|
1276
1318
|
/**
|
|
1277
1319
|
* @method
|
|
@@ -1896,7 +1938,7 @@ class bybit extends bybit$1 {
|
|
|
1896
1938
|
'inverse': undefined,
|
|
1897
1939
|
'taker': this.safeNumber(market, 'takerFee', this.parseNumber('0.0006')),
|
|
1898
1940
|
'maker': this.safeNumber(market, 'makerFee', this.parseNumber('0.0001')),
|
|
1899
|
-
'contractSize': this.
|
|
1941
|
+
'contractSize': this.parseNumber('1'),
|
|
1900
1942
|
'expiry': expiry,
|
|
1901
1943
|
'expiryDatetime': this.iso8601(expiry),
|
|
1902
1944
|
'strike': this.parseNumber(strike),
|
|
@@ -3662,27 +3704,29 @@ class bybit extends bybit$1 {
|
|
|
3662
3704
|
const isLimit = lowerCaseType === 'limit';
|
|
3663
3705
|
const isBuy = side === 'buy';
|
|
3664
3706
|
const isAlternativeEndpoint = defaultMethod === 'privatePostV5PositionTradingStop';
|
|
3707
|
+
const amountString = this.getAmount(symbol, amount);
|
|
3708
|
+
const priceString = (price !== undefined) ? this.getPrice(symbol, this.numberToString(price)) : undefined;
|
|
3665
3709
|
if (isTrailingAmountOrder || isAlternativeEndpoint) {
|
|
3666
3710
|
if (isStopLoss || isTakeProfit || isTriggerOrder || market['spot']) {
|
|
3667
3711
|
throw new errors.InvalidOrder(this.id + ' the API endpoint used only supports contract trailingAmount, stopLossPrice and takeProfitPrice orders');
|
|
3668
3712
|
}
|
|
3669
3713
|
if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
3670
3714
|
if (isStopLossTriggerOrder) {
|
|
3671
|
-
request['stopLoss'] = this.
|
|
3715
|
+
request['stopLoss'] = this.getPrice(symbol, stopLossTriggerPrice);
|
|
3672
3716
|
if (isLimit) {
|
|
3673
3717
|
request['tpslMode'] = 'Partial';
|
|
3674
3718
|
request['slOrderType'] = 'Limit';
|
|
3675
|
-
request['slLimitPrice'] =
|
|
3676
|
-
request['slSize'] =
|
|
3719
|
+
request['slLimitPrice'] = priceString;
|
|
3720
|
+
request['slSize'] = amountString;
|
|
3677
3721
|
}
|
|
3678
3722
|
}
|
|
3679
3723
|
else if (isTakeProfitTriggerOrder) {
|
|
3680
|
-
request['takeProfit'] = this.
|
|
3724
|
+
request['takeProfit'] = this.getPrice(symbol, takeProfitTriggerPrice);
|
|
3681
3725
|
if (isLimit) {
|
|
3682
3726
|
request['tpslMode'] = 'Partial';
|
|
3683
3727
|
request['tpOrderType'] = 'Limit';
|
|
3684
|
-
request['tpLimitPrice'] =
|
|
3685
|
-
request['tpSize'] =
|
|
3728
|
+
request['tpLimitPrice'] = priceString;
|
|
3729
|
+
request['tpSize'] = amountString;
|
|
3686
3730
|
}
|
|
3687
3731
|
}
|
|
3688
3732
|
}
|
|
@@ -3723,7 +3767,7 @@ class bybit extends bybit$1 {
|
|
|
3723
3767
|
request['orderLinkId'] = this.uuid16();
|
|
3724
3768
|
}
|
|
3725
3769
|
if (isLimit) {
|
|
3726
|
-
request['price'] =
|
|
3770
|
+
request['price'] = priceString;
|
|
3727
3771
|
}
|
|
3728
3772
|
}
|
|
3729
3773
|
if (market['spot']) {
|
|
@@ -3751,16 +3795,14 @@ class bybit extends bybit$1 {
|
|
|
3751
3795
|
orderCost = cost;
|
|
3752
3796
|
}
|
|
3753
3797
|
else {
|
|
3754
|
-
const amountString = this.numberToString(amount);
|
|
3755
|
-
const priceString = this.numberToString(price);
|
|
3756
3798
|
const quoteAmount = Precise["default"].stringMul(amountString, priceString);
|
|
3757
3799
|
orderCost = quoteAmount;
|
|
3758
3800
|
}
|
|
3759
|
-
request['qty'] = this.
|
|
3801
|
+
request['qty'] = this.getCost(symbol, orderCost);
|
|
3760
3802
|
}
|
|
3761
3803
|
else {
|
|
3762
3804
|
request['marketUnit'] = 'baseCoin';
|
|
3763
|
-
request['qty'] =
|
|
3805
|
+
request['qty'] = amountString;
|
|
3764
3806
|
}
|
|
3765
3807
|
}
|
|
3766
3808
|
else if (market['spot'] && (type === 'market') && (side === 'buy')) {
|
|
@@ -3773,30 +3815,23 @@ class bybit extends bybit$1 {
|
|
|
3773
3815
|
throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
3774
3816
|
}
|
|
3775
3817
|
else {
|
|
3776
|
-
const amountString = this.numberToString(amount);
|
|
3777
|
-
const priceString = this.numberToString(price);
|
|
3778
3818
|
const quoteAmount = Precise["default"].stringMul(amountString, priceString);
|
|
3779
3819
|
const costRequest = (cost !== undefined) ? cost : quoteAmount;
|
|
3780
|
-
request['qty'] = this.
|
|
3820
|
+
request['qty'] = this.getCost(symbol, costRequest);
|
|
3781
3821
|
}
|
|
3782
3822
|
}
|
|
3783
3823
|
else {
|
|
3784
|
-
request['qty'] = this.
|
|
3824
|
+
request['qty'] = this.getCost(symbol, this.numberToString(amount));
|
|
3785
3825
|
}
|
|
3786
3826
|
}
|
|
3787
3827
|
else {
|
|
3788
3828
|
if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
|
|
3789
|
-
|
|
3790
|
-
request['qty'] = this.numberToString(amount);
|
|
3791
|
-
}
|
|
3792
|
-
else {
|
|
3793
|
-
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
3794
|
-
}
|
|
3829
|
+
request['qty'] = amountString;
|
|
3795
3830
|
}
|
|
3796
3831
|
}
|
|
3797
3832
|
if (isTrailingAmountOrder) {
|
|
3798
3833
|
if (trailingTriggerPrice !== undefined) {
|
|
3799
|
-
request['activePrice'] = this.
|
|
3834
|
+
request['activePrice'] = this.getPrice(symbol, trailingTriggerPrice);
|
|
3800
3835
|
}
|
|
3801
3836
|
request['trailingStop'] = trailingAmount;
|
|
3802
3837
|
}
|
|
@@ -3815,7 +3850,7 @@ class bybit extends bybit$1 {
|
|
|
3815
3850
|
const isAsending = ((triggerDirection === 'above') || (triggerDirection === '1'));
|
|
3816
3851
|
request['triggerDirection'] = isAsending ? 1 : 2;
|
|
3817
3852
|
}
|
|
3818
|
-
request['triggerPrice'] = this.
|
|
3853
|
+
request['triggerPrice'] = this.getPrice(symbol, triggerPrice);
|
|
3819
3854
|
}
|
|
3820
3855
|
else if ((isStopLossTriggerOrder || isTakeProfitTriggerOrder) && !isAlternativeEndpoint) {
|
|
3821
3856
|
if (isBuy) {
|
|
@@ -3825,28 +3860,28 @@ class bybit extends bybit$1 {
|
|
|
3825
3860
|
request['triggerDirection'] = isStopLossTriggerOrder ? 2 : 1;
|
|
3826
3861
|
}
|
|
3827
3862
|
triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
|
|
3828
|
-
request['triggerPrice'] = this.
|
|
3863
|
+
request['triggerPrice'] = this.getPrice(symbol, triggerPrice);
|
|
3829
3864
|
request['reduceOnly'] = true;
|
|
3830
3865
|
}
|
|
3831
3866
|
if ((isStopLoss || isTakeProfit) && !isAlternativeEndpoint) {
|
|
3832
3867
|
if (isStopLoss) {
|
|
3833
3868
|
const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
3834
|
-
request['stopLoss'] = this.
|
|
3869
|
+
request['stopLoss'] = this.getPrice(symbol, slTriggerPrice);
|
|
3835
3870
|
const slLimitPrice = this.safeValue(stopLoss, 'price');
|
|
3836
3871
|
if (slLimitPrice !== undefined) {
|
|
3837
3872
|
request['tpslMode'] = 'Partial';
|
|
3838
3873
|
request['slOrderType'] = 'Limit';
|
|
3839
|
-
request['slLimitPrice'] = this.
|
|
3874
|
+
request['slLimitPrice'] = this.getPrice(symbol, slLimitPrice);
|
|
3840
3875
|
}
|
|
3841
3876
|
}
|
|
3842
3877
|
if (isTakeProfit) {
|
|
3843
3878
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
3844
|
-
request['takeProfit'] = this.
|
|
3879
|
+
request['takeProfit'] = this.getPrice(symbol, tpTriggerPrice);
|
|
3845
3880
|
const tpLimitPrice = this.safeValue(takeProfit, 'price');
|
|
3846
3881
|
if (tpLimitPrice !== undefined) {
|
|
3847
3882
|
request['tpslMode'] = 'Partial';
|
|
3848
3883
|
request['tpOrderType'] = 'Limit';
|
|
3849
|
-
request['tpLimitPrice'] = this.
|
|
3884
|
+
request['tpLimitPrice'] = this.getPrice(symbol, tpLimitPrice);
|
|
3850
3885
|
}
|
|
3851
3886
|
}
|
|
3852
3887
|
}
|
|
@@ -3957,7 +3992,7 @@ class bybit extends bybit$1 {
|
|
|
3957
3992
|
'side': this.capitalize(side),
|
|
3958
3993
|
'orderType': this.capitalize(lowerCaseType),
|
|
3959
3994
|
'timeInForce': 'GoodTillCancel',
|
|
3960
|
-
'orderQty': this.
|
|
3995
|
+
'orderQty': this.getAmount(symbol, amount),
|
|
3961
3996
|
// 'takeProfit': 123.45, // take profit price, only take effect upon opening the position
|
|
3962
3997
|
// 'stopLoss': 123.45, // stop loss price, only take effect upon opening the position
|
|
3963
3998
|
// 'reduceOnly': false, // reduce only, required for linear orders
|
|
@@ -3975,7 +4010,7 @@ class bybit extends bybit$1 {
|
|
|
3975
4010
|
const isMarket = lowerCaseType === 'market';
|
|
3976
4011
|
const isLimit = lowerCaseType === 'limit';
|
|
3977
4012
|
if (isLimit !== undefined) {
|
|
3978
|
-
request['orderPrice'] = this.
|
|
4013
|
+
request['orderPrice'] = this.getPrice(symbol, this.numberToString(price));
|
|
3979
4014
|
}
|
|
3980
4015
|
const exchangeSpecificParam = this.safeString(params, 'time_in_force');
|
|
3981
4016
|
const timeInForce = this.safeStringLower(params, 'timeInForce');
|
|
@@ -4007,7 +4042,7 @@ class bybit extends bybit$1 {
|
|
|
4007
4042
|
request['orderFilter'] = 'StopOrder';
|
|
4008
4043
|
request['trigger_by'] = 'LastPrice';
|
|
4009
4044
|
const stopPx = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
|
|
4010
|
-
const preciseStopPrice = this.
|
|
4045
|
+
const preciseStopPrice = this.getPrice(symbol, stopPx);
|
|
4011
4046
|
request['triggerPrice'] = preciseStopPrice;
|
|
4012
4047
|
const delta = this.numberToString(market['precision']['price']);
|
|
4013
4048
|
request['basePrice'] = isStopLossTriggerOrder ? Precise["default"].stringSub(preciseStopPrice, delta) : Precise["default"].stringAdd(preciseStopPrice, delta);
|
|
@@ -4015,11 +4050,11 @@ class bybit extends bybit$1 {
|
|
|
4015
4050
|
else if (isStopLoss || isTakeProfit) {
|
|
4016
4051
|
if (isStopLoss) {
|
|
4017
4052
|
const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4018
|
-
request['stopLoss'] = this.
|
|
4053
|
+
request['stopLoss'] = this.getPrice(symbol, slTriggerPrice);
|
|
4019
4054
|
}
|
|
4020
4055
|
if (isTakeProfit) {
|
|
4021
4056
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4022
|
-
request['takeProfit'] = this.
|
|
4057
|
+
request['takeProfit'] = this.getPrice(symbol, tpTriggerPrice);
|
|
4023
4058
|
}
|
|
4024
4059
|
}
|
|
4025
4060
|
else {
|
|
@@ -4078,10 +4113,10 @@ class bybit extends bybit$1 {
|
|
|
4078
4113
|
'orderId': id,
|
|
4079
4114
|
};
|
|
4080
4115
|
if (amount !== undefined) {
|
|
4081
|
-
request['orderQty'] = this.
|
|
4116
|
+
request['orderQty'] = this.getAmount(symbol, amount);
|
|
4082
4117
|
}
|
|
4083
4118
|
if (price !== undefined) {
|
|
4084
|
-
request['orderPrice'] = this.
|
|
4119
|
+
request['orderPrice'] = this.getPrice(symbol, price);
|
|
4085
4120
|
}
|
|
4086
4121
|
let response = undefined;
|
|
4087
4122
|
if (market['option']) {
|
|
@@ -4098,13 +4133,13 @@ class bybit extends bybit$1 {
|
|
|
4098
4133
|
if (isStopOrder) {
|
|
4099
4134
|
request['orderFilter'] = isStop ? 'StopOrder' : 'Order';
|
|
4100
4135
|
if (triggerPrice !== undefined) {
|
|
4101
|
-
request['triggerPrice'] = this.
|
|
4136
|
+
request['triggerPrice'] = this.getPrice(symbol, triggerPrice);
|
|
4102
4137
|
}
|
|
4103
4138
|
if (stopLossPrice !== undefined) {
|
|
4104
|
-
request['stopLoss'] = this.
|
|
4139
|
+
request['stopLoss'] = this.getPrice(symbol, stopLossPrice);
|
|
4105
4140
|
}
|
|
4106
4141
|
if (takeProfitPrice !== undefined) {
|
|
4107
|
-
request['takeProfit'] = this.
|
|
4142
|
+
request['takeProfit'] = this.getPrice(symbol, takeProfitPrice);
|
|
4108
4143
|
}
|
|
4109
4144
|
}
|
|
4110
4145
|
params = this.omit(params, ['stop', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
@@ -4154,13 +4189,10 @@ class bybit extends bybit$1 {
|
|
|
4154
4189
|
request['category'] = 'option';
|
|
4155
4190
|
}
|
|
4156
4191
|
if (amount !== undefined) {
|
|
4157
|
-
request['qty'] = this.
|
|
4192
|
+
request['qty'] = this.getAmount(symbol, amount);
|
|
4158
4193
|
}
|
|
4159
4194
|
if (price !== undefined) {
|
|
4160
|
-
request['price'] = this.
|
|
4161
|
-
}
|
|
4162
|
-
if (amount !== undefined) {
|
|
4163
|
-
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
4195
|
+
request['price'] = this.getPrice(symbol, this.numberToString(price));
|
|
4164
4196
|
}
|
|
4165
4197
|
let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
4166
4198
|
const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
|
|
@@ -4175,7 +4207,7 @@ class bybit extends bybit$1 {
|
|
|
4175
4207
|
triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
|
|
4176
4208
|
}
|
|
4177
4209
|
if (triggerPrice !== undefined) {
|
|
4178
|
-
const triggerPriceRequest = (triggerPrice === '0') ? triggerPrice : this.
|
|
4210
|
+
const triggerPriceRequest = (triggerPrice === '0') ? triggerPrice : this.getPrice(symbol, triggerPrice);
|
|
4179
4211
|
request['triggerPrice'] = triggerPriceRequest;
|
|
4180
4212
|
const triggerBy = this.safeString(params, 'triggerBy', 'LastPrice');
|
|
4181
4213
|
request['triggerBy'] = triggerBy;
|
|
@@ -4183,14 +4215,14 @@ class bybit extends bybit$1 {
|
|
|
4183
4215
|
if (isStopLoss || isTakeProfit) {
|
|
4184
4216
|
if (isStopLoss) {
|
|
4185
4217
|
const slTriggerPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4186
|
-
const stopLossRequest = (slTriggerPrice === '0') ? slTriggerPrice : this.
|
|
4218
|
+
const stopLossRequest = (slTriggerPrice === '0') ? slTriggerPrice : this.getPrice(symbol, slTriggerPrice);
|
|
4187
4219
|
request['stopLoss'] = stopLossRequest;
|
|
4188
4220
|
const slTriggerBy = this.safeString(params, 'slTriggerBy', 'LastPrice');
|
|
4189
4221
|
request['slTriggerBy'] = slTriggerBy;
|
|
4190
4222
|
}
|
|
4191
4223
|
if (isTakeProfit) {
|
|
4192
4224
|
const tpTriggerPrice = this.safeString2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4193
|
-
const takeProfitRequest = (tpTriggerPrice === '0') ? tpTriggerPrice : this.
|
|
4225
|
+
const takeProfitRequest = (tpTriggerPrice === '0') ? tpTriggerPrice : this.getPrice(symbol, tpTriggerPrice);
|
|
4194
4226
|
request['takeProfit'] = takeProfitRequest;
|
|
4195
4227
|
const tpTriggerBy = this.safeString(params, 'tpTriggerBy', 'LastPrice');
|
|
4196
4228
|
request['tpTriggerBy'] = tpTriggerBy;
|
|
@@ -4231,10 +4263,10 @@ class bybit extends bybit$1 {
|
|
|
4231
4263
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4232
4264
|
*/
|
|
4233
4265
|
await this.loadMarkets();
|
|
4266
|
+
const market = this.market(symbol);
|
|
4234
4267
|
if (symbol === undefined) {
|
|
4235
4268
|
throw new errors.ArgumentsRequired(this.id + ' editOrder() requires a symbol argument');
|
|
4236
4269
|
}
|
|
4237
|
-
const market = this.market(symbol);
|
|
4238
4270
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
4239
4271
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
4240
4272
|
const isUsdcSettled = market['settle'] === 'USDC';
|
|
@@ -5889,10 +5921,12 @@ class bybit extends bybit$1 {
|
|
|
5889
5921
|
* @name bybit#fetchLedger
|
|
5890
5922
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
5891
5923
|
* @see https://bybit-exchange.github.io/docs/v5/account/transaction-log
|
|
5924
|
+
* @see https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
|
|
5892
5925
|
* @param {string} code unified currency code, default is undefined
|
|
5893
5926
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
5894
5927
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
5895
5928
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5929
|
+
* @param {string} [params.subType] if inverse will use v5/account/contract-transaction-log
|
|
5896
5930
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
5897
5931
|
*/
|
|
5898
5932
|
await this.loadMarkets();
|
|
@@ -5936,9 +5970,16 @@ class bybit extends bybit$1 {
|
|
|
5936
5970
|
if (limit !== undefined) {
|
|
5937
5971
|
request['limit'] = limit;
|
|
5938
5972
|
}
|
|
5973
|
+
let subType = undefined;
|
|
5974
|
+
[subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
|
|
5939
5975
|
let response = undefined;
|
|
5940
5976
|
if (enableUnified[1]) {
|
|
5941
|
-
|
|
5977
|
+
if (subType === 'inverse') {
|
|
5978
|
+
response = await this.privateGetV5AccountContractTransactionLog(this.extend(request, params));
|
|
5979
|
+
}
|
|
5980
|
+
else {
|
|
5981
|
+
response = await this.privateGetV5AccountTransactionLog(this.extend(request, params));
|
|
5982
|
+
}
|
|
5942
5983
|
}
|
|
5943
5984
|
else {
|
|
5944
5985
|
response = await this.privateGetV2PrivateWalletFundRecords(this.extend(request, params));
|
package/dist/cjs/src/poloniex.js
CHANGED
|
@@ -1105,8 +1105,10 @@ class poloniex extends poloniex$1 {
|
|
|
1105
1105
|
market = this.safeMarket(marketId, market, '_');
|
|
1106
1106
|
const symbol = market['symbol'];
|
|
1107
1107
|
let resultingTrades = this.safeValue(order, 'resultingTrades');
|
|
1108
|
-
if (
|
|
1109
|
-
|
|
1108
|
+
if (resultingTrades !== undefined) {
|
|
1109
|
+
if (!Array.isArray(resultingTrades)) {
|
|
1110
|
+
resultingTrades = this.safeValue(resultingTrades, this.safeString(market, 'id', marketId));
|
|
1111
|
+
}
|
|
1110
1112
|
}
|
|
1111
1113
|
const price = this.safeString2(order, 'price', 'rate');
|
|
1112
1114
|
const amount = this.safeString(order, 'quantity');
|
package/dist/cjs/src/yobit.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 type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.80";
|
|
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, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } 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.81';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -311,7 +311,6 @@ export default class Exchange {
|
|
|
311
311
|
constructor(userConfig?: {});
|
|
312
312
|
encodeURIComponent(...args: any[]): string;
|
|
313
313
|
checkRequiredVersion(requiredVersion: any, error?: boolean): boolean;
|
|
314
|
-
checkAddress(address: any): any;
|
|
315
314
|
initRestRateLimiter(): void;
|
|
316
315
|
throttle(cost?: any): any;
|
|
317
316
|
defineRestApiEndpoint(methodName: any, uppercaseMethod: any, lowercaseMethod: any, camelcaseMethod: any, path: any, paths: any, config?: {}): void;
|
|
@@ -722,6 +721,7 @@ export default class Exchange {
|
|
|
722
721
|
checkProxySettings(url?: Str, method?: Str, headers?: any, body?: any): any[];
|
|
723
722
|
checkWsProxySettings(): any[];
|
|
724
723
|
checkConflictingProxies(proxyAgentSet: any, proxyUrlSet: any): void;
|
|
724
|
+
checkAddress(address?: Str): Str;
|
|
725
725
|
findMessageHashes(client: any, element: string): string[];
|
|
726
726
|
filterByLimit(array: object[], limit?: Int, key?: IndexType, fromStart?: boolean): any;
|
|
727
727
|
filterBySinceLimit(array: object[], since?: Int, limit?: Int, key?: IndexType, tail?: boolean): any;
|