ccxt 4.3.80 → 4.3.82
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 +16 -11
- package/dist/cjs/src/bybit.js +86 -51
- package/dist/cjs/src/wavesexchange.js +4 -3
- 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 +16 -11
- package/js/src/bybit.d.ts +3 -0
- package/js/src/bybit.js +86 -51
- package/js/src/coinbaseexchange.d.ts +1 -1
- 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/wavesexchange.js +4 -3
- 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.82';
|
|
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');
|
|
@@ -1866,6 +1856,18 @@ class Exchange {
|
|
|
1866
1856
|
throw new errors.InvalidProxySettings(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy');
|
|
1867
1857
|
}
|
|
1868
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
|
+
}
|
|
1869
1871
|
findMessageHashes(client, element) {
|
|
1870
1872
|
const result = [];
|
|
1871
1873
|
const messageHashes = Object.keys(client.futures);
|
|
@@ -3832,7 +3834,10 @@ class Exchange {
|
|
|
3832
3834
|
];
|
|
3833
3835
|
}
|
|
3834
3836
|
getListFromObjectValues(objects, key) {
|
|
3835
|
-
|
|
3837
|
+
let newArray = objects;
|
|
3838
|
+
if (!Array.isArray(objects)) {
|
|
3839
|
+
newArray = this.toArray(objects);
|
|
3840
|
+
}
|
|
3836
3841
|
const results = [];
|
|
3837
3842
|
for (let i = 0; i < newArray.length; i++) {
|
|
3838
3843
|
results.push(newArray[i][key]);
|
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';
|
|
@@ -6169,6 +6201,8 @@ class bybit extends bybit$1 {
|
|
|
6169
6201
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
6170
6202
|
*/
|
|
6171
6203
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
6204
|
+
let accountType = undefined;
|
|
6205
|
+
[accountType, params] = this.handleOptionAndParams(params, 'withdraw', 'accountType', 'SPOT');
|
|
6172
6206
|
await this.loadMarkets();
|
|
6173
6207
|
this.checkAddress(address);
|
|
6174
6208
|
const currency = this.currency(code);
|
|
@@ -6177,6 +6211,7 @@ class bybit extends bybit$1 {
|
|
|
6177
6211
|
'amount': this.numberToString(amount),
|
|
6178
6212
|
'address': address,
|
|
6179
6213
|
'timestamp': this.milliseconds(),
|
|
6214
|
+
'accountType': accountType,
|
|
6180
6215
|
};
|
|
6181
6216
|
if (tag !== undefined) {
|
|
6182
6217
|
request['tag'] = tag;
|
|
@@ -1299,7 +1299,8 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1299
1299
|
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for ' + type + ' orders to determine the max price for buy and the min price for sell');
|
|
1300
1300
|
}
|
|
1301
1301
|
const timestamp = this.milliseconds();
|
|
1302
|
-
|
|
1302
|
+
let defaultExpiryDelta = undefined;
|
|
1303
|
+
[defaultExpiryDelta, params] = this.handleOptionAndParams(params, 'createOrder', 'defaultExpiry', this.safeInteger(this.options, 'createOrderDefaultExpiry', 2419200000));
|
|
1303
1304
|
const expiration = this.sum(timestamp, defaultExpiryDelta);
|
|
1304
1305
|
const matcherFees = await this.getFeesForAsset(symbol, side, amount, price);
|
|
1305
1306
|
// {
|
|
@@ -1447,12 +1448,12 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1447
1448
|
// }
|
|
1448
1449
|
//
|
|
1449
1450
|
if (isMarketOrder) {
|
|
1450
|
-
const response = await this.matcherPostMatcherOrderbookMarket(body);
|
|
1451
|
+
const response = await this.matcherPostMatcherOrderbookMarket(this.extend(body, params));
|
|
1451
1452
|
const value = this.safeDict(response, 'message');
|
|
1452
1453
|
return this.parseOrder(value, market);
|
|
1453
1454
|
}
|
|
1454
1455
|
else {
|
|
1455
|
-
const response = await this.matcherPostMatcherOrderbook(body);
|
|
1456
|
+
const response = await this.matcherPostMatcherOrderbook(this.extend(body, params));
|
|
1456
1457
|
const value = this.safeDict(response, 'message');
|
|
1457
1458
|
return this.parseOrder(value, market);
|
|
1458
1459
|
}
|
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.81";
|
|
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.82';
|
|
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;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -379,16 +379,6 @@ export default class Exchange {
|
|
|
379
379
|
}
|
|
380
380
|
return result;
|
|
381
381
|
}
|
|
382
|
-
checkAddress(address) {
|
|
383
|
-
if (address === undefined) {
|
|
384
|
-
throw new InvalidAddress(this.id + ' address is undefined');
|
|
385
|
-
}
|
|
386
|
-
// check the address is not the same letter like 'aaaaa' nor too short nor has a space
|
|
387
|
-
if ((this.unique(address).length === 1) || address.length < this.minFundingAddressLength || address.includes(' ')) {
|
|
388
|
-
throw new InvalidAddress(this.id + ' address is invalid or has less than ' + this.minFundingAddressLength.toString() + ' characters: "' + this.json(address) + '"');
|
|
389
|
-
}
|
|
390
|
-
return address;
|
|
391
|
-
}
|
|
392
382
|
initRestRateLimiter() {
|
|
393
383
|
if (this.rateLimit === undefined) {
|
|
394
384
|
throw new Error(this.id + '.rateLimit property is not configured');
|
|
@@ -1849,6 +1839,18 @@ export default class Exchange {
|
|
|
1849
1839
|
throw new InvalidProxySettings(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy');
|
|
1850
1840
|
}
|
|
1851
1841
|
}
|
|
1842
|
+
checkAddress(address = undefined) {
|
|
1843
|
+
if (address === undefined) {
|
|
1844
|
+
throw new InvalidAddress(this.id + ' address is undefined');
|
|
1845
|
+
}
|
|
1846
|
+
// check the address is not the same letter like 'aaaaa' nor too short nor has a space
|
|
1847
|
+
const uniqChars = (this.unique(this.stringToCharsArray(address)));
|
|
1848
|
+
const length = uniqChars.length; // py transpiler trick
|
|
1849
|
+
if (length === 1 || address.length < this.minFundingAddressLength || address.indexOf(' ') > -1) {
|
|
1850
|
+
throw new InvalidAddress(this.id + ' address is invalid or has less than ' + this.minFundingAddressLength.toString() + ' characters: "' + address.toString() + '"');
|
|
1851
|
+
}
|
|
1852
|
+
return address;
|
|
1853
|
+
}
|
|
1852
1854
|
findMessageHashes(client, element) {
|
|
1853
1855
|
const result = [];
|
|
1854
1856
|
const messageHashes = Object.keys(client.futures);
|
|
@@ -3815,7 +3817,10 @@ export default class Exchange {
|
|
|
3815
3817
|
];
|
|
3816
3818
|
}
|
|
3817
3819
|
getListFromObjectValues(objects, key) {
|
|
3818
|
-
|
|
3820
|
+
let newArray = objects;
|
|
3821
|
+
if (!Array.isArray(objects)) {
|
|
3822
|
+
newArray = this.toArray(objects);
|
|
3823
|
+
}
|
|
3819
3824
|
const results = [];
|
|
3820
3825
|
for (let i = 0; i < newArray.length; i++) {
|
|
3821
3826
|
results.push(newArray[i][key]);
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export default class bybit extends Exchange {
|
|
|
15
15
|
createExpiredOptionMarket(symbol: string): MarketInterface;
|
|
16
16
|
safeMarket(marketId?: Str, market?: Market, delimiter?: Str, marketType?: Str): MarketInterface;
|
|
17
17
|
getBybitType(method: any, market: any, params?: {}): any[];
|
|
18
|
+
getAmount(symbol: string, amount: number): string;
|
|
19
|
+
getPrice(symbol: string, price: string): string;
|
|
20
|
+
getCost(symbol: string, cost: string): string;
|
|
18
21
|
fetchTime(params?: {}): Promise<number>;
|
|
19
22
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
20
23
|
fetchMarkets(params?: {}): Promise<Market[]>;
|