ccxt 4.1.95 → 4.1.96
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/build.sh +16 -16
- package/dist/ccxt.browser.js +385 -251
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +145 -135
- package/dist/cjs/src/bingx.js +8 -7
- package/dist/cjs/src/bit2c.js +2 -3
- package/dist/cjs/src/bitfinex2.js +2 -3
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/btcbox.js +2 -3
- package/dist/cjs/src/coinbase.js +11 -5
- package/dist/cjs/src/cryptocom.js +2 -1
- package/dist/cjs/src/delta.js +25 -0
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/kraken.js +46 -45
- package/dist/cjs/src/krakenfutures.js +53 -26
- package/dist/cjs/src/kucoin.js +73 -3
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/binance.js +2 -3
- package/dist/cjs/src/pro/bitfinex.js +2 -3
- package/dist/cjs/src/pro/cex.js +1 -1
- package/dist/cjs/src/pro/gate.js +2 -2
- package/dist/cjs/src/pro/kraken.js +2 -3
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +2 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kucoin.d.ts +12 -0
- package/js/src/abstract/kucoinfutures.d.ts +12 -1
- package/js/src/binance.js +145 -135
- package/js/src/bingx.js +8 -7
- package/js/src/bit2c.js +2 -3
- package/js/src/bitfinex2.js +2 -3
- package/js/src/bitmart.js +1 -1
- package/js/src/btcbox.js +2 -3
- package/js/src/coinbase.js +11 -5
- package/js/src/cryptocom.js +2 -1
- package/js/src/delta.d.ts +5 -4
- package/js/src/delta.js +25 -0
- package/js/src/gate.js +2 -2
- package/js/src/kraken.js +46 -45
- package/js/src/krakenfutures.js +53 -26
- package/js/src/kucoin.d.ts +3 -0
- package/js/src/kucoin.js +73 -3
- package/js/src/kucoinfutures.js +1 -1
- package/js/src/pro/binance.js +2 -3
- package/js/src/pro/bitfinex.js +2 -3
- package/js/src/pro/cex.js +1 -1
- package/js/src/pro/gate.js +2 -2
- package/js/src/pro/kraken.js +2 -3
- package/js/src/pro/okx.js +1 -1
- package/js/src/pro/woo.js +2 -3
- package/package.json +2 -2
package/dist/ccxt.browser.js
CHANGED
|
@@ -19647,24 +19647,23 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19647
19647
|
let type = this.safeString(params, 'type', defaultType);
|
|
19648
19648
|
let subType = undefined;
|
|
19649
19649
|
[subType, params] = this.handleSubTypeAndParams('fetchBalance', undefined, params);
|
|
19650
|
-
|
|
19651
|
-
let
|
|
19650
|
+
let marginMode = undefined;
|
|
19651
|
+
let query = undefined;
|
|
19652
|
+
[marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
19653
|
+
query = this.omit(query, 'type');
|
|
19654
|
+
let response = undefined;
|
|
19652
19655
|
const request = {};
|
|
19653
19656
|
if (this.isLinear(type, subType)) {
|
|
19654
|
-
const options = this.safeValue(this.options, type, {});
|
|
19655
|
-
const fetchBalanceOptions = this.safeValue(options, 'fetchBalance', {});
|
|
19656
|
-
method = this.safeString(fetchBalanceOptions, 'method', 'fapiPrivateV2GetAccount');
|
|
19657
19657
|
type = 'linear';
|
|
19658
|
+
response = await this.fapiPrivateV2GetAccount(this.extend(request, query));
|
|
19658
19659
|
}
|
|
19659
19660
|
else if (this.isInverse(type, subType)) {
|
|
19660
|
-
const options = this.safeValue(this.options, type, {});
|
|
19661
|
-
const fetchBalanceOptions = this.safeValue(options, 'fetchBalance', {});
|
|
19662
|
-
method = this.safeString(fetchBalanceOptions, 'method', 'dapiPrivateGetAccount');
|
|
19663
19661
|
type = 'inverse';
|
|
19662
|
+
response = await this.dapiPrivateGetAccount(this.extend(request, query));
|
|
19664
19663
|
}
|
|
19665
19664
|
else if (marginMode === 'isolated') {
|
|
19666
|
-
method = 'sapiGetMarginIsolatedAccount';
|
|
19667
19665
|
const paramSymbols = this.safeValue(params, 'symbols');
|
|
19666
|
+
query = this.omit(query, 'symbols');
|
|
19668
19667
|
if (paramSymbols !== undefined) {
|
|
19669
19668
|
let symbols = '';
|
|
19670
19669
|
if (Array.isArray(paramSymbols)) {
|
|
@@ -19680,18 +19679,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19680
19679
|
}
|
|
19681
19680
|
request['symbols'] = symbols;
|
|
19682
19681
|
}
|
|
19682
|
+
response = await this.sapiGetMarginIsolatedAccount(this.extend(request, query));
|
|
19683
19683
|
}
|
|
19684
19684
|
else if ((type === 'margin') || (marginMode === 'cross')) {
|
|
19685
|
-
|
|
19685
|
+
response = await this.sapiGetMarginAccount(this.extend(request, query));
|
|
19686
19686
|
}
|
|
19687
19687
|
else if (type === 'savings') {
|
|
19688
|
-
|
|
19688
|
+
response = await this.sapiGetLendingUnionAccount(this.extend(request, query));
|
|
19689
19689
|
}
|
|
19690
19690
|
else if (type === 'funding') {
|
|
19691
|
-
|
|
19691
|
+
response = await this.sapiPostAssetGetFundingAsset(this.extend(request, query));
|
|
19692
|
+
}
|
|
19693
|
+
else {
|
|
19694
|
+
response = await this.privateGetAccount(this.extend(request, query));
|
|
19692
19695
|
}
|
|
19693
|
-
const requestParams = this.omit(query, ['type', 'symbols']);
|
|
19694
|
-
const response = await this[method](this.extend(request, requestParams));
|
|
19695
19696
|
//
|
|
19696
19697
|
// spot
|
|
19697
19698
|
//
|
|
@@ -20383,33 +20384,35 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20383
20384
|
if (until !== undefined) {
|
|
20384
20385
|
request['endTime'] = until;
|
|
20385
20386
|
}
|
|
20386
|
-
let
|
|
20387
|
+
let response = undefined;
|
|
20387
20388
|
if (market['option']) {
|
|
20388
|
-
|
|
20389
|
+
response = await this.eapiPublicGetKlines(this.extend(request, params));
|
|
20389
20390
|
}
|
|
20390
20391
|
else if (price === 'mark') {
|
|
20391
20392
|
if (market['inverse']) {
|
|
20392
|
-
|
|
20393
|
+
response = await this.dapiPublicGetMarkPriceKlines(this.extend(request, params));
|
|
20393
20394
|
}
|
|
20394
20395
|
else {
|
|
20395
|
-
|
|
20396
|
+
response = await this.fapiPublicGetMarkPriceKlines(this.extend(request, params));
|
|
20396
20397
|
}
|
|
20397
20398
|
}
|
|
20398
20399
|
else if (price === 'index') {
|
|
20399
20400
|
if (market['inverse']) {
|
|
20400
|
-
|
|
20401
|
+
response = await this.dapiPublicGetIndexPriceKlines(this.extend(request, params));
|
|
20401
20402
|
}
|
|
20402
20403
|
else {
|
|
20403
|
-
|
|
20404
|
+
response = await this.fapiPublicGetIndexPriceKlines(this.extend(request, params));
|
|
20404
20405
|
}
|
|
20405
20406
|
}
|
|
20406
20407
|
else if (market['linear']) {
|
|
20407
|
-
|
|
20408
|
+
response = await this.fapiPublicGetKlines(this.extend(request, params));
|
|
20408
20409
|
}
|
|
20409
20410
|
else if (market['inverse']) {
|
|
20410
|
-
|
|
20411
|
+
response = await this.dapiPublicGetKlines(this.extend(request, params));
|
|
20412
|
+
}
|
|
20413
|
+
else {
|
|
20414
|
+
response = await this.publicGetKlines(this.extend(request, params));
|
|
20411
20415
|
}
|
|
20412
|
-
const response = await this[method](this.extend(request, params));
|
|
20413
20416
|
//
|
|
20414
20417
|
// [
|
|
20415
20418
|
// [1591478520000,"0.02501300","0.02501800","0.02500000","0.02500000","22.19000000",1591478579999,"0.55490906",40,"10.92900000","0.27336462","0"],
|
|
@@ -21825,22 +21828,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21825
21828
|
const request = {
|
|
21826
21829
|
'symbol': market['id'],
|
|
21827
21830
|
};
|
|
21828
|
-
let method = 'privateGetOrder';
|
|
21829
|
-
if (market['option']) {
|
|
21830
|
-
method = 'eapiPrivateGetOrder';
|
|
21831
|
-
}
|
|
21832
|
-
else if (market['linear']) {
|
|
21833
|
-
method = 'fapiPrivateGetOrder';
|
|
21834
|
-
}
|
|
21835
|
-
else if (market['inverse']) {
|
|
21836
|
-
method = 'dapiPrivateGetOrder';
|
|
21837
|
-
}
|
|
21838
|
-
else if (type === 'margin' || marginMode !== undefined) {
|
|
21839
|
-
method = 'sapiGetMarginOrder';
|
|
21840
|
-
if (marginMode === 'isolated') {
|
|
21841
|
-
request['isIsolated'] = true;
|
|
21842
|
-
}
|
|
21843
|
-
}
|
|
21844
21831
|
const clientOrderId = this.safeValue2(params, 'origClientOrderId', 'clientOrderId');
|
|
21845
21832
|
if (clientOrderId !== undefined) {
|
|
21846
21833
|
if (market['option']) {
|
|
@@ -21854,7 +21841,25 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21854
21841
|
request['orderId'] = id;
|
|
21855
21842
|
}
|
|
21856
21843
|
const requestParams = this.omit(query, ['type', 'clientOrderId', 'origClientOrderId']);
|
|
21857
|
-
|
|
21844
|
+
let response = undefined;
|
|
21845
|
+
if (market['option']) {
|
|
21846
|
+
response = await this.eapiPrivateGetOrder(this.extend(request, requestParams));
|
|
21847
|
+
}
|
|
21848
|
+
else if (market['linear']) {
|
|
21849
|
+
response = await this.fapiPrivateGetOrder(this.extend(request, requestParams));
|
|
21850
|
+
}
|
|
21851
|
+
else if (market['inverse']) {
|
|
21852
|
+
response = await this.dapiPrivateGetOrder(this.extend(request, requestParams));
|
|
21853
|
+
}
|
|
21854
|
+
else if (type === 'margin' || marginMode !== undefined) {
|
|
21855
|
+
if (marginMode === 'isolated') {
|
|
21856
|
+
request['isIsolated'] = true;
|
|
21857
|
+
}
|
|
21858
|
+
response = await this.sapiGetMarginOrder(this.extend(request, requestParams));
|
|
21859
|
+
}
|
|
21860
|
+
else {
|
|
21861
|
+
response = await this.privateGetOrder(this.extend(request, requestParams));
|
|
21862
|
+
}
|
|
21858
21863
|
return this.parseOrder(response, market);
|
|
21859
21864
|
}
|
|
21860
21865
|
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -21892,34 +21897,36 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21892
21897
|
const request = {
|
|
21893
21898
|
'symbol': market['id'],
|
|
21894
21899
|
};
|
|
21895
|
-
|
|
21900
|
+
const until = this.safeInteger(params, 'until');
|
|
21901
|
+
if (until !== undefined) {
|
|
21902
|
+
params = this.omit(params, 'until');
|
|
21903
|
+
request['endTime'] = until;
|
|
21904
|
+
}
|
|
21905
|
+
if (since !== undefined) {
|
|
21906
|
+
request['startTime'] = since;
|
|
21907
|
+
}
|
|
21908
|
+
if (limit !== undefined) {
|
|
21909
|
+
request['limit'] = limit;
|
|
21910
|
+
}
|
|
21911
|
+
let response = undefined;
|
|
21896
21912
|
if (market['option']) {
|
|
21897
|
-
|
|
21913
|
+
response = await this.eapiPrivateGetHistoryOrders(this.extend(request, query));
|
|
21898
21914
|
}
|
|
21899
21915
|
else if (market['linear']) {
|
|
21900
|
-
|
|
21916
|
+
response = await this.fapiPrivateGetAllOrders(this.extend(request, query));
|
|
21901
21917
|
}
|
|
21902
21918
|
else if (market['inverse']) {
|
|
21903
|
-
|
|
21919
|
+
response = await this.dapiPrivateGetAllOrders(this.extend(request, query));
|
|
21904
21920
|
}
|
|
21905
21921
|
else if (type === 'margin' || marginMode !== undefined) {
|
|
21906
|
-
method = 'sapiGetMarginAllOrders';
|
|
21907
21922
|
if (marginMode === 'isolated') {
|
|
21908
21923
|
request['isIsolated'] = true;
|
|
21909
21924
|
}
|
|
21925
|
+
response = await this.sapiGetMarginAllOrders(this.extend(request, query));
|
|
21910
21926
|
}
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
params = this.omit(params, 'until');
|
|
21914
|
-
request['endTime'] = until;
|
|
21915
|
-
}
|
|
21916
|
-
if (since !== undefined) {
|
|
21917
|
-
request['startTime'] = since;
|
|
21918
|
-
}
|
|
21919
|
-
if (limit !== undefined) {
|
|
21920
|
-
request['limit'] = limit;
|
|
21927
|
+
else {
|
|
21928
|
+
response = await this.privateGetAllOrders(this.extend(request, query));
|
|
21921
21929
|
}
|
|
21922
|
-
const response = await this[method](this.extend(request, query));
|
|
21923
21930
|
//
|
|
21924
21931
|
// spot
|
|
21925
21932
|
//
|
|
@@ -22044,32 +22051,34 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22044
22051
|
let subType = undefined;
|
|
22045
22052
|
[subType, query] = this.handleSubTypeAndParams('fetchOpenOrders', market, query);
|
|
22046
22053
|
const requestParams = this.omit(query, 'type');
|
|
22047
|
-
let
|
|
22054
|
+
let response = undefined;
|
|
22048
22055
|
if (type === 'option') {
|
|
22049
|
-
method = 'eapiPrivateGetOpenOrders';
|
|
22050
22056
|
if (since !== undefined) {
|
|
22051
22057
|
request['startTime'] = since;
|
|
22052
22058
|
}
|
|
22053
22059
|
if (limit !== undefined) {
|
|
22054
22060
|
request['limit'] = limit;
|
|
22055
22061
|
}
|
|
22062
|
+
response = await this.eapiPrivateGetOpenOrders(this.extend(request, requestParams));
|
|
22056
22063
|
}
|
|
22057
22064
|
else if (this.isLinear(type, subType)) {
|
|
22058
|
-
|
|
22065
|
+
response = await this.fapiPrivateGetOpenOrders(this.extend(request, requestParams));
|
|
22059
22066
|
}
|
|
22060
22067
|
else if (this.isInverse(type, subType)) {
|
|
22061
|
-
|
|
22068
|
+
response = await this.dapiPrivateGetOpenOrders(this.extend(request, requestParams));
|
|
22062
22069
|
}
|
|
22063
22070
|
else if (type === 'margin' || marginMode !== undefined) {
|
|
22064
|
-
method = 'sapiGetMarginOpenOrders';
|
|
22065
22071
|
if (marginMode === 'isolated') {
|
|
22066
22072
|
request['isIsolated'] = true;
|
|
22067
22073
|
if (symbol === undefined) {
|
|
22068
22074
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument for isolated markets');
|
|
22069
22075
|
}
|
|
22070
22076
|
}
|
|
22077
|
+
response = await this.sapiGetMarginOpenOrders(this.extend(request, requestParams));
|
|
22078
|
+
}
|
|
22079
|
+
else {
|
|
22080
|
+
response = await this.privateGetOpenOrders(this.extend(request, requestParams));
|
|
22071
22081
|
}
|
|
22072
|
-
const response = await this[method](this.extend(request, requestParams));
|
|
22073
22082
|
return this.parseOrders(response, market, since, limit);
|
|
22074
22083
|
}
|
|
22075
22084
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -22160,24 +22169,26 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22160
22169
|
else {
|
|
22161
22170
|
request['orderId'] = id;
|
|
22162
22171
|
}
|
|
22163
|
-
|
|
22172
|
+
const requestParams = this.omit(query, ['type', 'origClientOrderId', 'clientOrderId']);
|
|
22173
|
+
let response = undefined;
|
|
22164
22174
|
if (market['option']) {
|
|
22165
|
-
|
|
22175
|
+
response = await this.eapiPrivateDeleteOrder(this.extend(request, requestParams));
|
|
22166
22176
|
}
|
|
22167
22177
|
else if (market['linear']) {
|
|
22168
|
-
|
|
22178
|
+
response = await this.fapiPrivateDeleteOrder(this.extend(request, requestParams));
|
|
22169
22179
|
}
|
|
22170
22180
|
else if (market['inverse']) {
|
|
22171
|
-
|
|
22181
|
+
response = await this.dapiPrivateDeleteOrder(this.extend(request, requestParams));
|
|
22172
22182
|
}
|
|
22173
22183
|
else if (type === 'margin' || marginMode !== undefined) {
|
|
22174
|
-
method = 'sapiDeleteMarginOrder';
|
|
22175
22184
|
if (marginMode === 'isolated') {
|
|
22176
22185
|
request['isIsolated'] = true;
|
|
22177
22186
|
}
|
|
22187
|
+
response = await this.sapiDeleteMarginOrder(this.extend(request, requestParams));
|
|
22188
|
+
}
|
|
22189
|
+
else {
|
|
22190
|
+
response = await this.privateDeleteOrder(this.extend(request, requestParams));
|
|
22178
22191
|
}
|
|
22179
|
-
const requestParams = this.omit(query, ['type', 'origClientOrderId', 'clientOrderId']);
|
|
22180
|
-
const response = await this[method](this.extend(request, requestParams));
|
|
22181
22192
|
return this.parseOrder(response, market);
|
|
22182
22193
|
}
|
|
22183
22194
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -22206,23 +22217,25 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22206
22217
|
const type = this.safeString(params, 'type', market['type']);
|
|
22207
22218
|
params = this.omit(params, ['type']);
|
|
22208
22219
|
const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
22209
|
-
let
|
|
22220
|
+
let response = undefined;
|
|
22210
22221
|
if (market['option']) {
|
|
22211
|
-
|
|
22222
|
+
response = await this.eapiPrivateDeleteAllOpenOrders(this.extend(request, query));
|
|
22212
22223
|
}
|
|
22213
22224
|
else if (market['linear']) {
|
|
22214
|
-
|
|
22225
|
+
response = await this.fapiPrivateDeleteAllOpenOrders(this.extend(request, query));
|
|
22215
22226
|
}
|
|
22216
22227
|
else if (market['inverse']) {
|
|
22217
|
-
|
|
22228
|
+
response = await this.dapiPrivateDeleteAllOpenOrders(this.extend(request, query));
|
|
22218
22229
|
}
|
|
22219
22230
|
else if ((type === 'margin') || (marginMode !== undefined)) {
|
|
22220
|
-
method = 'sapiDeleteMarginOpenOrders';
|
|
22221
22231
|
if (marginMode === 'isolated') {
|
|
22222
22232
|
request['isIsolated'] = true;
|
|
22223
22233
|
}
|
|
22234
|
+
response = await this.sapiDeleteMarginOpenOrders(this.extend(request, query));
|
|
22235
|
+
}
|
|
22236
|
+
else {
|
|
22237
|
+
response = await this.privateDeleteOpenOrders(this.extend(request, query));
|
|
22224
22238
|
}
|
|
22225
|
-
const response = await this[method](this.extend(request, query));
|
|
22226
22239
|
if (Array.isArray(response)) {
|
|
22227
22240
|
return this.parseOrders(response, market);
|
|
22228
22241
|
}
|
|
@@ -22359,37 +22372,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22359
22372
|
const request = {};
|
|
22360
22373
|
let market = undefined;
|
|
22361
22374
|
let type = undefined;
|
|
22362
|
-
let method = undefined;
|
|
22363
22375
|
let marginMode = undefined;
|
|
22364
22376
|
if (symbol !== undefined) {
|
|
22365
22377
|
market = this.market(symbol);
|
|
22366
22378
|
request['symbol'] = market['id'];
|
|
22367
22379
|
}
|
|
22368
22380
|
[type, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
22369
|
-
if (type === 'option') {
|
|
22370
|
-
method = 'eapiPrivateGetUserTrades';
|
|
22371
|
-
}
|
|
22372
|
-
else {
|
|
22373
|
-
if (symbol === undefined) {
|
|
22374
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
22375
|
-
}
|
|
22376
|
-
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
22377
|
-
if (type === 'spot' || type === 'margin') {
|
|
22378
|
-
method = 'privateGetMyTrades';
|
|
22379
|
-
if ((type === 'margin') || (marginMode !== undefined)) {
|
|
22380
|
-
method = 'sapiGetMarginMyTrades';
|
|
22381
|
-
if (marginMode === 'isolated') {
|
|
22382
|
-
request['isIsolated'] = true;
|
|
22383
|
-
}
|
|
22384
|
-
}
|
|
22385
|
-
}
|
|
22386
|
-
else if (market['linear']) {
|
|
22387
|
-
method = 'fapiPrivateGetUserTrades';
|
|
22388
|
-
}
|
|
22389
|
-
else if (market['inverse']) {
|
|
22390
|
-
method = 'dapiPrivateGetUserTrades';
|
|
22391
|
-
}
|
|
22392
|
-
}
|
|
22393
22381
|
let endTime = this.safeInteger2(params, 'until', 'endTime');
|
|
22394
22382
|
if (since !== undefined) {
|
|
22395
22383
|
const startTime = since;
|
|
@@ -22417,7 +22405,33 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22417
22405
|
}
|
|
22418
22406
|
request['limit'] = limit;
|
|
22419
22407
|
}
|
|
22420
|
-
|
|
22408
|
+
let response = undefined;
|
|
22409
|
+
if (type === 'option') {
|
|
22410
|
+
response = await this.eapiPrivateGetUserTrades(this.extend(request, params));
|
|
22411
|
+
}
|
|
22412
|
+
else {
|
|
22413
|
+
if (symbol === undefined) {
|
|
22414
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
22415
|
+
}
|
|
22416
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
22417
|
+
if (type === 'spot' || type === 'margin') {
|
|
22418
|
+
if ((type === 'margin') || (marginMode !== undefined)) {
|
|
22419
|
+
if (marginMode === 'isolated') {
|
|
22420
|
+
request['isIsolated'] = true;
|
|
22421
|
+
}
|
|
22422
|
+
response = await this.sapiGetMarginMyTrades(this.extend(request, params));
|
|
22423
|
+
}
|
|
22424
|
+
else {
|
|
22425
|
+
response = await this.privateGetMyTrades(this.extend(request, params));
|
|
22426
|
+
}
|
|
22427
|
+
}
|
|
22428
|
+
else if (market['linear']) {
|
|
22429
|
+
response = await this.fapiPrivateGetUserTrades(this.extend(request, params));
|
|
22430
|
+
}
|
|
22431
|
+
else if (market['inverse']) {
|
|
22432
|
+
response = await this.dapiPrivateGetUserTrades(this.extend(request, params));
|
|
22433
|
+
}
|
|
22434
|
+
}
|
|
22421
22435
|
//
|
|
22422
22436
|
// spot trade
|
|
22423
22437
|
//
|
|
@@ -23747,7 +23761,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23747
23761
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
23748
23762
|
*/
|
|
23749
23763
|
await this.loadMarkets();
|
|
23750
|
-
let method = undefined;
|
|
23751
23764
|
let type = undefined;
|
|
23752
23765
|
[type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
23753
23766
|
let subType = undefined;
|
|
@@ -23755,16 +23768,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23755
23768
|
const isSpotOrMargin = (type === 'spot') || (type === 'margin');
|
|
23756
23769
|
const isLinear = this.isLinear(type, subType);
|
|
23757
23770
|
const isInverse = this.isInverse(type, subType);
|
|
23771
|
+
let response = undefined;
|
|
23758
23772
|
if (isSpotOrMargin) {
|
|
23759
|
-
|
|
23773
|
+
response = await this.sapiGetAssetTradeFee(params);
|
|
23760
23774
|
}
|
|
23761
23775
|
else if (isLinear) {
|
|
23762
|
-
|
|
23776
|
+
response = await this.fapiPrivateV2GetAccount(params);
|
|
23763
23777
|
}
|
|
23764
23778
|
else if (isInverse) {
|
|
23765
|
-
|
|
23779
|
+
response = await this.dapiPrivateGetAccount(params);
|
|
23766
23780
|
}
|
|
23767
|
-
const response = await this[method](params);
|
|
23768
23781
|
//
|
|
23769
23782
|
// sapi / spot
|
|
23770
23783
|
//
|
|
@@ -23962,17 +23975,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23962
23975
|
const request = {
|
|
23963
23976
|
'symbol': market['id'],
|
|
23964
23977
|
};
|
|
23965
|
-
let
|
|
23978
|
+
let response = undefined;
|
|
23966
23979
|
if (market['linear']) {
|
|
23967
|
-
|
|
23980
|
+
response = await this.fapiPublicGetPremiumIndex(this.extend(request, params));
|
|
23968
23981
|
}
|
|
23969
23982
|
else if (market['inverse']) {
|
|
23970
|
-
|
|
23983
|
+
response = await this.dapiPublicGetPremiumIndex(this.extend(request, params));
|
|
23971
23984
|
}
|
|
23972
23985
|
else {
|
|
23973
23986
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchFundingRate() supports linear and inverse contracts only');
|
|
23974
23987
|
}
|
|
23975
|
-
let response = await this[method](this.extend(request, params));
|
|
23976
23988
|
if (market['inverse']) {
|
|
23977
23989
|
response = response[0];
|
|
23978
23990
|
}
|
|
@@ -24610,20 +24622,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24610
24622
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
24611
24623
|
*/
|
|
24612
24624
|
await this.loadMarkets();
|
|
24613
|
-
|
|
24625
|
+
let type = undefined;
|
|
24626
|
+
[type, params] = this.handleMarketTypeAndParams('fetchLeverageTiers', undefined, params);
|
|
24614
24627
|
let subType = undefined;
|
|
24615
|
-
[subType, params] = this.handleSubTypeAndParams('fetchLeverageTiers', undefined,
|
|
24616
|
-
let
|
|
24628
|
+
[subType, params] = this.handleSubTypeAndParams('fetchLeverageTiers', undefined, params, 'linear');
|
|
24629
|
+
let response = undefined;
|
|
24617
24630
|
if (this.isLinear(type, subType)) {
|
|
24618
|
-
|
|
24631
|
+
response = await this.fapiPrivateGetLeverageBracket(params);
|
|
24619
24632
|
}
|
|
24620
24633
|
else if (this.isInverse(type, subType)) {
|
|
24621
|
-
|
|
24634
|
+
response = await this.dapiPrivateV2GetLeverageBracket(params);
|
|
24622
24635
|
}
|
|
24623
24636
|
else {
|
|
24624
24637
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverageTiers() supports linear and inverse contracts only');
|
|
24625
24638
|
}
|
|
24626
|
-
const response = await this[method](query);
|
|
24627
24639
|
//
|
|
24628
24640
|
// usdm
|
|
24629
24641
|
//
|
|
@@ -25097,21 +25109,21 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25097
25109
|
}
|
|
25098
25110
|
await this.loadMarkets();
|
|
25099
25111
|
const market = this.market(symbol);
|
|
25100
|
-
|
|
25112
|
+
const request = {
|
|
25113
|
+
'symbol': market['id'],
|
|
25114
|
+
'leverage': leverage,
|
|
25115
|
+
};
|
|
25116
|
+
let response = undefined;
|
|
25101
25117
|
if (market['linear']) {
|
|
25102
|
-
|
|
25118
|
+
response = await this.fapiPrivatePostLeverage(this.extend(request, params));
|
|
25103
25119
|
}
|
|
25104
25120
|
else if (market['inverse']) {
|
|
25105
|
-
|
|
25121
|
+
response = await this.dapiPrivatePostLeverage(this.extend(request, params));
|
|
25106
25122
|
}
|
|
25107
25123
|
else {
|
|
25108
25124
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setLeverage() supports linear and inverse contracts only');
|
|
25109
25125
|
}
|
|
25110
|
-
|
|
25111
|
-
'symbol': market['id'],
|
|
25112
|
-
'leverage': leverage,
|
|
25113
|
-
};
|
|
25114
|
-
return await this[method](this.extend(request, params));
|
|
25126
|
+
return response;
|
|
25115
25127
|
}
|
|
25116
25128
|
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
25117
25129
|
/**
|
|
@@ -25144,23 +25156,21 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25144
25156
|
}
|
|
25145
25157
|
await this.loadMarkets();
|
|
25146
25158
|
const market = this.market(symbol);
|
|
25147
|
-
let method = undefined;
|
|
25148
|
-
if (market['linear']) {
|
|
25149
|
-
method = 'fapiPrivatePostMarginType';
|
|
25150
|
-
}
|
|
25151
|
-
else if (market['inverse']) {
|
|
25152
|
-
method = 'dapiPrivatePostMarginType';
|
|
25153
|
-
}
|
|
25154
|
-
else {
|
|
25155
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setMarginMode() supports linear and inverse contracts only');
|
|
25156
|
-
}
|
|
25157
25159
|
const request = {
|
|
25158
25160
|
'symbol': market['id'],
|
|
25159
25161
|
'marginType': marginMode,
|
|
25160
25162
|
};
|
|
25161
25163
|
let response = undefined;
|
|
25162
25164
|
try {
|
|
25163
|
-
|
|
25165
|
+
if (market['linear']) {
|
|
25166
|
+
response = await this.fapiPrivatePostMarginType(this.extend(request, params));
|
|
25167
|
+
}
|
|
25168
|
+
else if (market['inverse']) {
|
|
25169
|
+
response = await this.dapiPrivatePostMarginType(this.extend(request, params));
|
|
25170
|
+
}
|
|
25171
|
+
else {
|
|
25172
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setMarginMode() supports linear and inverse contracts only');
|
|
25173
|
+
}
|
|
25164
25174
|
}
|
|
25165
25175
|
catch (e) {
|
|
25166
25176
|
// not an error
|
|
@@ -27297,6 +27307,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
27297
27307
|
'100202': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
27298
27308
|
'100204': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
27299
27309
|
'100400': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
27310
|
+
'100421': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol,
|
|
27300
27311
|
'100440': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
27301
27312
|
'100500': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
27302
27313
|
'100503': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
@@ -28272,7 +28283,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28272
28283
|
// }
|
|
28273
28284
|
//
|
|
28274
28285
|
const marketId = this.safeString(ticker, 'symbol');
|
|
28275
|
-
const change = this.safeString(ticker, 'priceChange');
|
|
28286
|
+
// const change = this.safeString (ticker, 'priceChange'); // this is not ccxt's change because it does high-low instead of last-open
|
|
28276
28287
|
const lastQty = this.safeString(ticker, 'lastQty');
|
|
28277
28288
|
// in spot markets, lastQty is not present
|
|
28278
28289
|
// it's (bad, but) the only way we can check the tickers origin
|
|
@@ -28284,10 +28295,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28284
28295
|
const close = this.safeString(ticker, 'lastPrice');
|
|
28285
28296
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
28286
28297
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
28287
|
-
let percentage = this.safeString(ticker, 'priceChangePercent');
|
|
28288
|
-
if (percentage !== undefined) {
|
|
28289
|
-
|
|
28290
|
-
}
|
|
28298
|
+
// let percentage = this.safeString (ticker, 'priceChangePercent');
|
|
28299
|
+
// if (percentage !== undefined) {
|
|
28300
|
+
// percentage = percentage.replace ('%', '');
|
|
28301
|
+
// } similarly to change, it's not ccxt's percentage because it does priceChange/open, and priceChange is high-low
|
|
28291
28302
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
28292
28303
|
const datetime = this.iso8601(ts);
|
|
28293
28304
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
@@ -28309,8 +28320,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28309
28320
|
'close': close,
|
|
28310
28321
|
'last': undefined,
|
|
28311
28322
|
'previousClose': undefined,
|
|
28312
|
-
'change':
|
|
28313
|
-
'percentage':
|
|
28323
|
+
'change': undefined,
|
|
28324
|
+
'percentage': undefined,
|
|
28314
28325
|
'average': undefined,
|
|
28315
28326
|
'baseVolume': baseVolume,
|
|
28316
28327
|
'quoteVolume': quoteVolume,
|
|
@@ -30741,14 +30752,13 @@ class bit2c extends _abstract_bit2c_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
30741
30752
|
}
|
|
30742
30753
|
parseTicker(ticker, market = undefined) {
|
|
30743
30754
|
const symbol = this.safeSymbol(undefined, market);
|
|
30744
|
-
const timestamp = this.milliseconds();
|
|
30745
30755
|
const averagePrice = this.safeString(ticker, 'av');
|
|
30746
30756
|
const baseVolume = this.safeString(ticker, 'a');
|
|
30747
30757
|
const last = this.safeString(ticker, 'll');
|
|
30748
30758
|
return this.safeTicker({
|
|
30749
30759
|
'symbol': symbol,
|
|
30750
|
-
'timestamp':
|
|
30751
|
-
'datetime':
|
|
30760
|
+
'timestamp': undefined,
|
|
30761
|
+
'datetime': undefined,
|
|
30752
30762
|
'high': undefined,
|
|
30753
30763
|
'low': undefined,
|
|
30754
30764
|
'bid': this.safeString(ticker, 'h'),
|
|
@@ -36421,15 +36431,14 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
36421
36431
|
// FRR_AMOUNT_AVAILABLE
|
|
36422
36432
|
// ]
|
|
36423
36433
|
//
|
|
36424
|
-
const timestamp = this.milliseconds();
|
|
36425
36434
|
const symbol = this.safeSymbol(undefined, market);
|
|
36426
36435
|
const length = ticker.length;
|
|
36427
36436
|
const last = this.safeString(ticker, length - 4);
|
|
36428
36437
|
const percentage = this.safeString(ticker, length - 5);
|
|
36429
36438
|
return this.safeTicker({
|
|
36430
36439
|
'symbol': symbol,
|
|
36431
|
-
'timestamp':
|
|
36432
|
-
'datetime':
|
|
36440
|
+
'timestamp': undefined,
|
|
36441
|
+
'datetime': undefined,
|
|
36433
36442
|
'high': this.safeString(ticker, length - 2),
|
|
36434
36443
|
'low': this.safeString(ticker, length - 1),
|
|
36435
36444
|
'bid': this.safeString(ticker, length - 10),
|
|
@@ -50659,7 +50668,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
50659
50668
|
// "legal_coin_price":"0.1302699"
|
|
50660
50669
|
// }
|
|
50661
50670
|
//
|
|
50662
|
-
const timestamp = this.safeInteger(ticker, 'timestamp'
|
|
50671
|
+
const timestamp = this.safeInteger(ticker, 'timestamp');
|
|
50663
50672
|
const marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
|
|
50664
50673
|
market = this.safeMarket(marketId, market);
|
|
50665
50674
|
const symbol = market['symbol'];
|
|
@@ -72357,13 +72366,12 @@ class btcbox extends _abstract_btcbox_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
72357
72366
|
return this.parseOrderBook(response, market['symbol']);
|
|
72358
72367
|
}
|
|
72359
72368
|
parseTicker(ticker, market = undefined) {
|
|
72360
|
-
const timestamp = this.milliseconds();
|
|
72361
72369
|
const symbol = this.safeSymbol(undefined, market);
|
|
72362
72370
|
const last = this.safeString(ticker, 'last');
|
|
72363
72371
|
return this.safeTicker({
|
|
72364
72372
|
'symbol': symbol,
|
|
72365
|
-
'timestamp':
|
|
72366
|
-
'datetime':
|
|
72373
|
+
'timestamp': undefined,
|
|
72374
|
+
'datetime': undefined,
|
|
72367
72375
|
'high': this.safeString(ticker, 'high'),
|
|
72368
72376
|
'low': this.safeString(ticker, 'low'),
|
|
72369
72377
|
'bid': this.safeString(ticker, 'buy'),
|
|
@@ -86645,6 +86653,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86645
86653
|
// "base_size": "0.2",
|
|
86646
86654
|
// "limit_price": "0.006",
|
|
86647
86655
|
// "post_only": false
|
|
86656
|
+
// },
|
|
86657
|
+
// "stop_limit_stop_limit_gtc": {
|
|
86658
|
+
// "base_size": "48.54",
|
|
86659
|
+
// "limit_price": "6.998",
|
|
86660
|
+
// "stop_price": "7.0687",
|
|
86661
|
+
// "stop_direction": "STOP_DIRECTION_STOP_DOWN"
|
|
86648
86662
|
// }
|
|
86649
86663
|
// },
|
|
86650
86664
|
// "side": "SELL",
|
|
@@ -86678,11 +86692,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86678
86692
|
market = this.market(symbol);
|
|
86679
86693
|
}
|
|
86680
86694
|
const orderConfiguration = this.safeValue(order, 'order_configuration', {});
|
|
86681
|
-
const limitGTC = this.safeValue(orderConfiguration, 'limit_limit_gtc'
|
|
86682
|
-
const limitGTD = this.safeValue(orderConfiguration, 'limit_limit_gtd'
|
|
86683
|
-
const stopLimitGTC = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtc'
|
|
86684
|
-
const stopLimitGTD = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtd'
|
|
86685
|
-
const marketIOC = this.safeValue(orderConfiguration, 'market_market_ioc'
|
|
86695
|
+
const limitGTC = this.safeValue(orderConfiguration, 'limit_limit_gtc');
|
|
86696
|
+
const limitGTD = this.safeValue(orderConfiguration, 'limit_limit_gtd');
|
|
86697
|
+
const stopLimitGTC = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtc');
|
|
86698
|
+
const stopLimitGTD = this.safeValue(orderConfiguration, 'stop_limit_stop_limit_gtd');
|
|
86699
|
+
const marketIOC = this.safeValue(orderConfiguration, 'market_market_ioc');
|
|
86686
86700
|
const isLimit = ((limitGTC !== undefined) || (limitGTD !== undefined));
|
|
86687
86701
|
const isStop = ((stopLimitGTC !== undefined) || (stopLimitGTD !== undefined));
|
|
86688
86702
|
let price = undefined;
|
|
@@ -104601,6 +104615,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
104601
104615
|
const timestamp = this.safeInteger(ticker, 't');
|
|
104602
104616
|
const marketId = this.safeString(ticker, 'i');
|
|
104603
104617
|
market = this.safeMarket(marketId, market, '_');
|
|
104618
|
+
const quote = this.safeString(market, 'quote');
|
|
104604
104619
|
const last = this.safeString(ticker, 'a');
|
|
104605
104620
|
return this.safeTicker({
|
|
104606
104621
|
'symbol': market['symbol'],
|
|
@@ -104621,7 +104636,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
104621
104636
|
'percentage': this.safeString(ticker, 'c'),
|
|
104622
104637
|
'average': undefined,
|
|
104623
104638
|
'baseVolume': this.safeString(ticker, 'v'),
|
|
104624
|
-
'quoteVolume': this.safeString(ticker, 'vv'),
|
|
104639
|
+
'quoteVolume': (quote === 'USD') ? this.safeString(ticker, 'vv') : undefined,
|
|
104625
104640
|
'info': ticker,
|
|
104626
104641
|
}, market);
|
|
104627
104642
|
}
|
|
@@ -107764,6 +107779,8 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
107764
107779
|
'addMargin': true,
|
|
107765
107780
|
'cancelAllOrders': true,
|
|
107766
107781
|
'cancelOrder': true,
|
|
107782
|
+
'closeAllPositions': true,
|
|
107783
|
+
'closePosition': false,
|
|
107767
107784
|
'createOrder': true,
|
|
107768
107785
|
'createReduceOnlyOrder': true,
|
|
107769
107786
|
'editOrder': true,
|
|
@@ -110908,6 +110925,29 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
110908
110925
|
'info': greeks,
|
|
110909
110926
|
};
|
|
110910
110927
|
}
|
|
110928
|
+
async closeAllPositions(params = {}) {
|
|
110929
|
+
/**
|
|
110930
|
+
* @method
|
|
110931
|
+
* @name delta#closeAllPositions
|
|
110932
|
+
* @description closes all open positions for a market type
|
|
110933
|
+
* @see https://docs.delta.exchange/#close-all-positions
|
|
110934
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
110935
|
+
* @param {int} [params.user_id] the users id
|
|
110936
|
+
* @returns {object[]} A list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
110937
|
+
*/
|
|
110938
|
+
await this.loadMarkets();
|
|
110939
|
+
const request = {
|
|
110940
|
+
'close_all_portfolio': true,
|
|
110941
|
+
'close_all_isolated': true,
|
|
110942
|
+
// 'user_id': 12345,
|
|
110943
|
+
};
|
|
110944
|
+
const response = await this.privatePostPositionsCloseAll(this.extend(request, params));
|
|
110945
|
+
//
|
|
110946
|
+
// {"result":{},"success":true}
|
|
110947
|
+
//
|
|
110948
|
+
const position = this.parsePosition(this.safeValue(response, 'result', {}));
|
|
110949
|
+
return [position];
|
|
110950
|
+
}
|
|
110911
110951
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
110912
110952
|
const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
|
|
110913
110953
|
let url = this.urls['api'][api] + requestPath;
|
|
@@ -128292,7 +128332,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
128292
128332
|
async closePosition(symbol, side = undefined, params = {}) {
|
|
128293
128333
|
/**
|
|
128294
128334
|
* @method
|
|
128295
|
-
* @name gate#
|
|
128335
|
+
* @name gate#closePosition
|
|
128296
128336
|
* @description closes open positions for a market
|
|
128297
128337
|
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
|
|
128298
128338
|
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
@@ -128300,7 +128340,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
128300
128340
|
* @param {string} symbol Unified CCXT market symbol
|
|
128301
128341
|
* @param {string} side 'buy' or 'sell'
|
|
128302
128342
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
128303
|
-
* @returns {[
|
|
128343
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
128304
128344
|
*/
|
|
128305
128345
|
const request = {
|
|
128306
128346
|
'close': true,
|
|
@@ -150989,7 +151029,6 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
150989
151029
|
// "o":"2571.56000"
|
|
150990
151030
|
// }
|
|
150991
151031
|
//
|
|
150992
|
-
const timestamp = this.milliseconds();
|
|
150993
151032
|
const symbol = this.safeSymbol(undefined, market);
|
|
150994
151033
|
const v = this.safeValue(ticker, 'v', []);
|
|
150995
151034
|
const baseVolume = this.safeString(v, 1);
|
|
@@ -151004,8 +151043,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151004
151043
|
const ask = this.safeValue(ticker, 'a', []);
|
|
151005
151044
|
return this.safeTicker({
|
|
151006
151045
|
'symbol': symbol,
|
|
151007
|
-
'timestamp':
|
|
151008
|
-
'datetime':
|
|
151046
|
+
'timestamp': undefined,
|
|
151047
|
+
'datetime': undefined,
|
|
151009
151048
|
'high': this.safeString(high, 1),
|
|
151010
151049
|
'low': this.safeString(low, 1),
|
|
151011
151050
|
'bid': this.safeString(bid, 0),
|
|
@@ -151519,8 +151558,12 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151519
151558
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
151520
151559
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
151521
151560
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
151522
|
-
* @param {bool} params.postOnly
|
|
151523
|
-
* @param {bool} params.reduceOnly
|
|
151561
|
+
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
151562
|
+
* @param {bool} [params.reduceOnly] *margin only* indicates if this order is to reduce the size of a position
|
|
151563
|
+
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
151564
|
+
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
151565
|
+
* @param {string} [params.trailingStopPrice] *margin only* the quote amount to trail away from the current market price
|
|
151566
|
+
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
151524
151567
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
151525
151568
|
*/
|
|
151526
151569
|
await this.loadMarkets();
|
|
@@ -151775,50 +151818,48 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151775
151818
|
if (clientOrderId !== undefined) {
|
|
151776
151819
|
request['userref'] = clientOrderId;
|
|
151777
151820
|
}
|
|
151778
|
-
|
|
151779
|
-
|
|
151780
|
-
|
|
151781
|
-
|
|
151782
|
-
|
|
151783
|
-
|
|
151784
|
-
|
|
151785
|
-
// settle-position
|
|
151786
|
-
//
|
|
151821
|
+
const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
|
|
151822
|
+
const takeProfitTriggerPrice = this.safeString(params, 'takeProfitPrice');
|
|
151823
|
+
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
151824
|
+
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
151825
|
+
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
151826
|
+
const trailingStopPrice = this.safeString(params, 'trailingStopPrice');
|
|
151827
|
+
const isTrailingStopPriceOrder = trailingStopPrice !== undefined;
|
|
151787
151828
|
if (type === 'limit') {
|
|
151788
151829
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
151789
151830
|
}
|
|
151790
|
-
|
|
151791
|
-
|
|
151792
|
-
if (
|
|
151793
|
-
|
|
151831
|
+
let reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
|
|
151832
|
+
if (isStopLossOrTakeProfitTrigger) {
|
|
151833
|
+
if (isStopLossTriggerOrder) {
|
|
151834
|
+
request['price'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
151835
|
+
request['ordertype'] = 'stop-loss-limit';
|
|
151794
151836
|
}
|
|
151795
|
-
else {
|
|
151796
|
-
request['price'] = this.priceToPrecision(symbol,
|
|
151837
|
+
else if (isTakeProfitTriggerOrder) {
|
|
151838
|
+
request['price'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
151839
|
+
request['ordertype'] = 'take-profit-limit';
|
|
151797
151840
|
}
|
|
151841
|
+
request['price2'] = this.priceToPrecision(symbol, price);
|
|
151842
|
+
reduceOnly = true;
|
|
151798
151843
|
}
|
|
151799
|
-
else if (
|
|
151800
|
-
const
|
|
151801
|
-
const
|
|
151802
|
-
|
|
151803
|
-
|
|
151804
|
-
if (
|
|
151805
|
-
|
|
151806
|
-
request['
|
|
151807
|
-
|
|
151808
|
-
|
|
151809
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + method + ' requires a price argument and/or price/stopPrice/price2 parameters for a ' + type + ' order');
|
|
151844
|
+
else if (isTrailingStopPriceOrder) {
|
|
151845
|
+
const trailingStopActivationPriceType = this.safeString(params, 'trigger', 'last');
|
|
151846
|
+
const trailingStopPriceString = '+' + trailingStopPrice;
|
|
151847
|
+
request['trigger'] = trailingStopActivationPriceType;
|
|
151848
|
+
reduceOnly = true;
|
|
151849
|
+
if (type === 'limit') {
|
|
151850
|
+
const trailingStopLimitPriceString = '+' + this.numberToString(price);
|
|
151851
|
+
request['price'] = trailingStopPriceString;
|
|
151852
|
+
request['price2'] = trailingStopLimitPriceString;
|
|
151853
|
+
request['ordertype'] = 'trailing-stop-limit';
|
|
151810
151854
|
}
|
|
151811
151855
|
else {
|
|
151812
|
-
|
|
151813
|
-
|
|
151814
|
-
request['price2'] = this.priceToPrecision(symbol, price);
|
|
151815
|
-
}
|
|
151816
|
-
else if (limitPriceDefined) {
|
|
151817
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
151818
|
-
request['price2'] = this.priceToPrecision(symbol, limitPrice);
|
|
151819
|
-
}
|
|
151856
|
+
request['price'] = trailingStopPriceString;
|
|
151857
|
+
request['ordertype'] = 'trailing-stop';
|
|
151820
151858
|
}
|
|
151821
151859
|
}
|
|
151860
|
+
if (reduceOnly) {
|
|
151861
|
+
request['reduce_only'] = 'true'; // not using boolean in this case, because the urlencodedNested transforms it into 'True' string
|
|
151862
|
+
}
|
|
151822
151863
|
let close = this.safeValue(params, 'close');
|
|
151823
151864
|
if (close !== undefined) {
|
|
151824
151865
|
close = this.extend({}, close);
|
|
@@ -151842,11 +151883,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151842
151883
|
if (postOnly) {
|
|
151843
151884
|
request['oflags'] = 'post';
|
|
151844
151885
|
}
|
|
151845
|
-
|
|
151846
|
-
if (reduceOnly) {
|
|
151847
|
-
request['reduce_only'] = true;
|
|
151848
|
-
}
|
|
151849
|
-
params = this.omit(params, ['price', 'stopPrice', 'price2', 'close', 'timeInForce', 'reduceOnly']);
|
|
151886
|
+
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingStopPrice']);
|
|
151850
151887
|
return [request, params];
|
|
151851
151888
|
}
|
|
151852
151889
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -151862,6 +151899,10 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
151862
151899
|
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
151863
151900
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
151864
151901
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
151902
|
+
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
151903
|
+
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
151904
|
+
* @param {string} [params.trailingStopPrice] *margin only* the quote price away from the current market price
|
|
151905
|
+
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
151865
151906
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
151866
151907
|
*/
|
|
151867
151908
|
await this.loadMarkets();
|
|
@@ -153871,20 +153912,12 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
153871
153912
|
});
|
|
153872
153913
|
}
|
|
153873
153914
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
153915
|
+
const market = this.market(symbol);
|
|
153874
153916
|
type = this.safeString(params, 'orderType', type);
|
|
153875
153917
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
153876
|
-
const stopPrice = this.safeString(params, 'stopPrice');
|
|
153877
153918
|
let postOnly = false;
|
|
153878
153919
|
[postOnly, params] = this.handlePostOnly(type === 'market', type === 'post', params);
|
|
153879
|
-
|
|
153880
|
-
params = this.omit(params, ['clientOrderId', 'cliOrdId']);
|
|
153881
|
-
if ((type === 'stp' || type === 'take_profit') && stopPrice === undefined) {
|
|
153882
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createOrder requires params.stopPrice when type is ' + type);
|
|
153883
|
-
}
|
|
153884
|
-
if (stopPrice !== undefined && type !== 'take_profit') {
|
|
153885
|
-
type = 'stp';
|
|
153886
|
-
}
|
|
153887
|
-
else if (postOnly) {
|
|
153920
|
+
if (postOnly) {
|
|
153888
153921
|
type = 'post';
|
|
153889
153922
|
}
|
|
153890
153923
|
else if (timeInForce === 'ioc') {
|
|
@@ -153897,17 +153930,49 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
153897
153930
|
type = 'mkt';
|
|
153898
153931
|
}
|
|
153899
153932
|
const request = {
|
|
153900
|
-
'
|
|
153901
|
-
'symbol': this.marketId(symbol),
|
|
153933
|
+
'symbol': market['id'],
|
|
153902
153934
|
'side': side,
|
|
153903
153935
|
'size': amount,
|
|
153904
153936
|
};
|
|
153905
|
-
|
|
153906
|
-
request['limitPrice'] = price;
|
|
153907
|
-
}
|
|
153937
|
+
const clientOrderId = this.safeString2(params, 'clientOrderId', 'cliOrdId');
|
|
153908
153938
|
if (clientOrderId !== undefined) {
|
|
153909
153939
|
request['cliOrdId'] = clientOrderId;
|
|
153910
153940
|
}
|
|
153941
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
153942
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
153943
|
+
const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
|
|
153944
|
+
const takeProfitTriggerPrice = this.safeString(params, 'takeProfitPrice');
|
|
153945
|
+
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
153946
|
+
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
153947
|
+
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
153948
|
+
const triggerSignal = this.safeString(params, 'triggerSignal', 'last');
|
|
153949
|
+
let reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
153950
|
+
if (isStopLossOrTakeProfitTrigger || isTriggerOrder) {
|
|
153951
|
+
request['triggerSignal'] = triggerSignal;
|
|
153952
|
+
}
|
|
153953
|
+
if (isTriggerOrder) {
|
|
153954
|
+
type = 'stp';
|
|
153955
|
+
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
153956
|
+
}
|
|
153957
|
+
else if (isStopLossOrTakeProfitTrigger) {
|
|
153958
|
+
reduceOnly = true;
|
|
153959
|
+
if (isStopLossTriggerOrder) {
|
|
153960
|
+
type = 'stp';
|
|
153961
|
+
request['stopPrice'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
153962
|
+
}
|
|
153963
|
+
else if (isTakeProfitTriggerOrder) {
|
|
153964
|
+
type = 'take_profit';
|
|
153965
|
+
request['stopPrice'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
153966
|
+
}
|
|
153967
|
+
}
|
|
153968
|
+
if (reduceOnly) {
|
|
153969
|
+
request['reduceOnly'] = true;
|
|
153970
|
+
}
|
|
153971
|
+
request['orderType'] = type;
|
|
153972
|
+
if (price !== undefined) {
|
|
153973
|
+
request['limitPrice'] = price;
|
|
153974
|
+
}
|
|
153975
|
+
params = this.omit(params, ['clientOrderId', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
153911
153976
|
return this.extend(request, params);
|
|
153912
153977
|
}
|
|
153913
153978
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -153915,19 +153980,22 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
153915
153980
|
* @method
|
|
153916
153981
|
* @name krakenfutures#createOrder
|
|
153917
153982
|
* @description Create an order on the exchange
|
|
153918
|
-
* @
|
|
153919
|
-
* @param {string}
|
|
153920
|
-
* @param {string}
|
|
153921
|
-
* @param {
|
|
153922
|
-
* @param {float}
|
|
153923
|
-
* @param {float} [
|
|
153924
|
-
* @param {bool} [params.reduceOnly]
|
|
153925
|
-
* @param {bool} [params.postOnly]
|
|
153926
|
-
* @param {string} [params.triggerSignal] If placing a stp or take_profit, the signal used for trigger, One of: 'mark', 'index', 'last', last is market price
|
|
153927
|
-
* @param {string} [params.cliOrdId] UUID The order identity that is specified from the user, It must be globally unique
|
|
153983
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-send-order
|
|
153984
|
+
* @param {string} symbol unified market symbol
|
|
153985
|
+
* @param {string} type 'limit' or 'market'
|
|
153986
|
+
* @param {string} side 'buy' or 'sell'
|
|
153987
|
+
* @param {float} amount number of contracts
|
|
153988
|
+
* @param {float} [price] limit order price
|
|
153989
|
+
* @param {bool} [params.reduceOnly] set as true if you wish the order to only reduce an existing position, any order which increases an existing position will be rejected, default is false
|
|
153990
|
+
* @param {bool} [params.postOnly] set as true if you wish to make a postOnly order, default is false
|
|
153928
153991
|
* @param {string} [params.clientOrderId] UUID The order identity that is specified from the user, It must be globally unique
|
|
153992
|
+
* @param {float} [params.triggerPrice] the price that a stop order is triggered at
|
|
153993
|
+
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
153994
|
+
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
153995
|
+
* @param {string} [params.triggerSignal] for triggerPrice, stopLossPrice and takeProfitPrice orders, the trigger price type, 'last', 'mark' or 'index', default is 'last'
|
|
153929
153996
|
*/
|
|
153930
153997
|
await this.loadMarkets();
|
|
153998
|
+
const market = this.market(symbol);
|
|
153931
153999
|
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
153932
154000
|
const response = await this.privatePostSendorder(orderRequest);
|
|
153933
154001
|
//
|
|
@@ -153963,7 +154031,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
153963
154031
|
const sendStatus = this.safeValue(response, 'sendStatus');
|
|
153964
154032
|
const status = this.safeString(sendStatus, 'status');
|
|
153965
154033
|
this.verifyOrderActionSuccess(status, 'createOrder', ['filled']);
|
|
153966
|
-
return this.parseOrder(sendStatus);
|
|
154034
|
+
return this.parseOrder(sendStatus, market);
|
|
153967
154035
|
}
|
|
153968
154036
|
async createOrders(orders, params = {}) {
|
|
153969
154037
|
/**
|
|
@@ -155464,6 +155532,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155464
155532
|
'createStopLimitOrder': true,
|
|
155465
155533
|
'createStopMarketOrder': true,
|
|
155466
155534
|
'createStopOrder': true,
|
|
155535
|
+
'createMarketBuyOrderWithCost': true,
|
|
155536
|
+
'createMarketOrderWithCost': true,
|
|
155537
|
+
'createMarketSellOrderWithCost': true,
|
|
155467
155538
|
'editOrder': true,
|
|
155468
155539
|
'fetchAccounts': true,
|
|
155469
155540
|
'fetchBalance': true,
|
|
@@ -155625,6 +155696,10 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155625
155696
|
'stop-order': 8,
|
|
155626
155697
|
'stop-order/{orderId}': 3,
|
|
155627
155698
|
'stop-order/queryOrderByClientOid': 3,
|
|
155699
|
+
'oco/order/{orderId}': 2,
|
|
155700
|
+
'oco/order/details/{orderId}': 2,
|
|
155701
|
+
'oco/client-order/{clientOid}': 2,
|
|
155702
|
+
'oco/orders': 2,
|
|
155628
155703
|
// margin trading
|
|
155629
155704
|
'hf/margin/orders/active': 4,
|
|
155630
155705
|
'hf/margin/orders/done': 10,
|
|
@@ -155632,6 +155707,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155632
155707
|
'hf/margin/orders/client-order/{clientOid}': 5,
|
|
155633
155708
|
'hf/margin/fills': 5,
|
|
155634
155709
|
'etf/info': 25,
|
|
155710
|
+
'margin/currencies': 20,
|
|
155635
155711
|
'risk/limit/strategy': 20,
|
|
155636
155712
|
'isolated/symbols': 20,
|
|
155637
155713
|
'isolated/account/{symbol}': 50,
|
|
@@ -155667,6 +155743,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155667
155743
|
'orders/test': 2,
|
|
155668
155744
|
'orders/multi': 3,
|
|
155669
155745
|
'stop-order': 2,
|
|
155746
|
+
'oco/order': 2,
|
|
155670
155747
|
// margin trading
|
|
155671
155748
|
'hf/margin/order': 5,
|
|
155672
155749
|
'hf/margin/order/test': 5,
|
|
@@ -155692,12 +155769,16 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155692
155769
|
'hf/orders/sync/client-order/{clientOid}': 1,
|
|
155693
155770
|
'hf/orders/cancel/{orderId}': 2,
|
|
155694
155771
|
'hf/orders': 2,
|
|
155772
|
+
'hf/orders/cancelAll': 30,
|
|
155695
155773
|
'orders/{orderId}': 3,
|
|
155696
155774
|
'order/client-order/{clientOid}': 5,
|
|
155697
155775
|
'orders': 20,
|
|
155698
155776
|
'stop-order/{orderId}': 3,
|
|
155699
155777
|
'stop-order/cancelOrderByClientOid': 5,
|
|
155700
155778
|
'stop-order/cancel': 3,
|
|
155779
|
+
'oco/order/{orderId}': 3,
|
|
155780
|
+
'oco/client-order/{clientOid}': 3,
|
|
155781
|
+
'oco/orders': 3,
|
|
155701
155782
|
// margin trading
|
|
155702
155783
|
'hf/margin/orders/{orderId}': 5,
|
|
155703
155784
|
'hf/margin/orders/client-order/{clientOid}': 5,
|
|
@@ -155718,6 +155799,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155718
155799
|
'index/query': 3,
|
|
155719
155800
|
'mark-price/{symbol}/current': 4.5,
|
|
155720
155801
|
'premium/query': 4.5,
|
|
155802
|
+
'trade-statistics': 4.5,
|
|
155721
155803
|
'funding-rate/{symbol}/current': 3,
|
|
155722
155804
|
'timestamp': 3,
|
|
155723
155805
|
'status': 6,
|
|
@@ -155766,6 +155848,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155766
155848
|
},
|
|
155767
155849
|
'delete': {
|
|
155768
155850
|
'orders/{orderId}': 1.5,
|
|
155851
|
+
'orders/client-order/{clientOid}': 1.5,
|
|
155769
155852
|
'orders': 45,
|
|
155770
155853
|
'stopOrders': 22.5, // 15FW
|
|
155771
155854
|
},
|
|
@@ -155953,6 +156036,10 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155953
156036
|
'market/orderbook/level2': 'v3',
|
|
155954
156037
|
'market/orderbook/level3': 'v3',
|
|
155955
156038
|
'market/orderbook/level{level}': 'v3',
|
|
156039
|
+
'oco/order/{orderId}': 'v3',
|
|
156040
|
+
'oco/order/details/{orderId}': 'v3',
|
|
156041
|
+
'oco/client-order/{clientOid}': 'v3',
|
|
156042
|
+
'oco/orders': 'v3',
|
|
155956
156043
|
// margin trading
|
|
155957
156044
|
'hf/margin/orders/active': 'v3',
|
|
155958
156045
|
'hf/margin/orders/done': 'v3',
|
|
@@ -155960,6 +156047,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155960
156047
|
'hf/margin/orders/client-order/{clientOid}': 'v3',
|
|
155961
156048
|
'hf/margin/fills': 'v3',
|
|
155962
156049
|
'etf/info': 'v3',
|
|
156050
|
+
'margin/currencies': 'v3',
|
|
155963
156051
|
'margin/borrow': 'v3',
|
|
155964
156052
|
'margin/repay': 'v3',
|
|
155965
156053
|
'project/list': 'v3',
|
|
@@ -155976,6 +156064,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155976
156064
|
'accounts/inner-transfer': 'v2',
|
|
155977
156065
|
'transfer-out': 'v3',
|
|
155978
156066
|
// spot trading
|
|
156067
|
+
'oco/order': 'v3',
|
|
155979
156068
|
// margin trading
|
|
155980
156069
|
'hf/margin/order': 'v3',
|
|
155981
156070
|
'hf/margin/order/test': 'v3',
|
|
@@ -155992,6 +156081,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155992
156081
|
'hf/margin/orders/{orderId}': 'v3',
|
|
155993
156082
|
'hf/margin/orders/client-order/{clientOid}': 'v3',
|
|
155994
156083
|
'hf/margin/orders': 'v3',
|
|
156084
|
+
'oco/order/{orderId}': 'v3',
|
|
156085
|
+
'oco/client-order/{clientOid}': 'v3',
|
|
156086
|
+
'oco/orders': 'v3',
|
|
155995
156087
|
// margin trading
|
|
155996
156088
|
},
|
|
155997
156089
|
},
|
|
@@ -157347,6 +157439,50 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
157347
157439
|
const data = this.safeValue(response, 'data', {});
|
|
157348
157440
|
return this.parseOrder(data, market);
|
|
157349
157441
|
}
|
|
157442
|
+
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
157443
|
+
/**
|
|
157444
|
+
* @method
|
|
157445
|
+
* @name kucoin#createMarketOrderWithCost
|
|
157446
|
+
* @description create a market order by providing the symbol, side and cost
|
|
157447
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
|
|
157448
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
157449
|
+
* @param {string} side 'buy' or 'sell'
|
|
157450
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
157451
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
157452
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
157453
|
+
*/
|
|
157454
|
+
await this.loadMarkets();
|
|
157455
|
+
params['cost'] = cost;
|
|
157456
|
+
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
157457
|
+
}
|
|
157458
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
157459
|
+
/**
|
|
157460
|
+
* @method
|
|
157461
|
+
* @name kucoin#createMarketBuyOrderWithCost
|
|
157462
|
+
* @description create a market buy order by providing the symbol and cost
|
|
157463
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
|
|
157464
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
157465
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
157466
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
157467
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
157468
|
+
*/
|
|
157469
|
+
await this.loadMarkets();
|
|
157470
|
+
return await this.createMarketOrderWithCost(symbol, 'buy', cost, params);
|
|
157471
|
+
}
|
|
157472
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
157473
|
+
/**
|
|
157474
|
+
* @method
|
|
157475
|
+
* @name kucoin#createMarketSellOrderWithCost
|
|
157476
|
+
* @description create a market sell order by providing the symbol and cost
|
|
157477
|
+
* @see https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
|
|
157478
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
157479
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
157480
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
157481
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
157482
|
+
*/
|
|
157483
|
+
await this.loadMarkets();
|
|
157484
|
+
return await this.createMarketOrderWithCost(symbol, 'sell', cost, params);
|
|
157485
|
+
}
|
|
157350
157486
|
async createOrders(orders, params = {}) {
|
|
157351
157487
|
/**
|
|
157352
157488
|
* @method
|
|
@@ -157645,9 +157781,11 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
157645
157781
|
}
|
|
157646
157782
|
else if (hf) {
|
|
157647
157783
|
if (symbol === undefined) {
|
|
157648
|
-
|
|
157784
|
+
response = await this.privateDeleteHfOrdersCancelAll(this.extend(request, query));
|
|
157785
|
+
}
|
|
157786
|
+
else {
|
|
157787
|
+
response = await this.privateDeleteHfOrders(this.extend(request, query));
|
|
157649
157788
|
}
|
|
157650
|
-
response = await this.privateDeleteHfOrders(this.extend(request, query));
|
|
157651
157789
|
}
|
|
157652
157790
|
else {
|
|
157653
157791
|
response = await this.privateDeleteOrders(this.extend(request, query));
|
|
@@ -157904,7 +158042,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
157904
158042
|
response = await this.privateGetOrdersOrderId(this.extend(request, params));
|
|
157905
158043
|
}
|
|
157906
158044
|
}
|
|
157907
|
-
let responseData = this.safeValue(response, 'data');
|
|
158045
|
+
let responseData = this.safeValue(response, 'data', {});
|
|
157908
158046
|
if (Array.isArray(responseData)) {
|
|
157909
158047
|
responseData = this.safeValue(responseData, 0);
|
|
157910
158048
|
}
|
|
@@ -162264,7 +162402,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
162264
162402
|
* @param {string} side not used by kucoinfutures closePositions
|
|
162265
162403
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
162266
162404
|
* @param {string} [params.clientOrderId] client order id of the order
|
|
162267
|
-
* @returns {[
|
|
162405
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
162268
162406
|
*/
|
|
162269
162407
|
await this.loadMarkets();
|
|
162270
162408
|
const market = this.market(symbol);
|
|
@@ -206347,14 +206485,13 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206347
206485
|
event = 'ticker';
|
|
206348
206486
|
}
|
|
206349
206487
|
let timestamp = undefined;
|
|
206350
|
-
const now = this.milliseconds();
|
|
206351
206488
|
if (event === 'bookTicker') {
|
|
206352
206489
|
// take the event timestamp, if available, for spot tickers it is not
|
|
206353
|
-
timestamp = this.safeInteger(message, 'E'
|
|
206490
|
+
timestamp = this.safeInteger(message, 'E');
|
|
206354
206491
|
}
|
|
206355
206492
|
else {
|
|
206356
206493
|
// take the timestamp of the closing price for candlestick streams
|
|
206357
|
-
timestamp = this.safeInteger(message, 'C'
|
|
206494
|
+
timestamp = this.safeInteger(message, 'C');
|
|
206358
206495
|
}
|
|
206359
206496
|
const marketId = this.safeString(message, 's');
|
|
206360
206497
|
const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
|
|
@@ -209472,7 +209609,6 @@ class bitfinex extends _bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
209472
209609
|
// 220.05, // 10 LOW float Daily low
|
|
209473
209610
|
// ]
|
|
209474
209611
|
//
|
|
209475
|
-
const timestamp = this.milliseconds();
|
|
209476
209612
|
const marketId = this.safeString(subscription, 'pair');
|
|
209477
209613
|
const symbol = this.safeSymbol(marketId);
|
|
209478
209614
|
const channel = 'ticker';
|
|
@@ -209485,8 +209621,8 @@ class bitfinex extends _bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
209485
209621
|
}
|
|
209486
209622
|
const result = {
|
|
209487
209623
|
'symbol': symbol,
|
|
209488
|
-
'timestamp':
|
|
209489
|
-
'datetime':
|
|
209624
|
+
'timestamp': undefined,
|
|
209625
|
+
'datetime': undefined,
|
|
209490
209626
|
'high': this.safeFloat(message, 9),
|
|
209491
209627
|
'low': this.safeFloat(message, 10),
|
|
209492
209628
|
'bid': this.safeFloat(message, 1),
|
|
@@ -222702,7 +222838,7 @@ class cex extends _cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
222702
222838
|
'rate': undefined,
|
|
222703
222839
|
};
|
|
222704
222840
|
}
|
|
222705
|
-
const timestamp = this.safeInteger(data, 'time'
|
|
222841
|
+
const timestamp = this.safeInteger(data, 'time');
|
|
222706
222842
|
order['timestamp'] = timestamp;
|
|
222707
222843
|
order['datetime'] = this.iso8601(timestamp);
|
|
222708
222844
|
order = this.safeOrder(order);
|
|
@@ -229883,7 +230019,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229883
230019
|
// }
|
|
229884
230020
|
//
|
|
229885
230021
|
const result = this.safeValue(message, 'result', []);
|
|
229886
|
-
const timestamp = this.safeInteger(message, '
|
|
230022
|
+
const timestamp = this.safeInteger(message, 'time_ms');
|
|
229887
230023
|
this.balance['info'] = result;
|
|
229888
230024
|
this.balance['timestamp'] = timestamp;
|
|
229889
230025
|
this.balance['datetime'] = this.iso8601(timestamp);
|
|
@@ -229959,7 +230095,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229959
230095
|
if (this.newUpdates) {
|
|
229960
230096
|
return positions;
|
|
229961
230097
|
}
|
|
229962
|
-
return this.filterBySymbolsSinceLimit(this.positions, symbols, since, limit, true);
|
|
230098
|
+
return this.filterBySymbolsSinceLimit(this.positions[type], symbols, since, limit, true);
|
|
229963
230099
|
}
|
|
229964
230100
|
setPositionsCache(client, type, symbols = undefined) {
|
|
229965
230101
|
if (this.positions === undefined) {
|
|
@@ -237437,11 +237573,10 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
237437
237573
|
quoteVolume = _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise */ .O.stringMul(baseVolume, vwap);
|
|
237438
237574
|
}
|
|
237439
237575
|
const last = this.safeString(ticker['c'], 0);
|
|
237440
|
-
const timestamp = this.milliseconds();
|
|
237441
237576
|
const result = this.safeTicker({
|
|
237442
237577
|
'symbol': symbol,
|
|
237443
|
-
'timestamp':
|
|
237444
|
-
'datetime':
|
|
237578
|
+
'timestamp': undefined,
|
|
237579
|
+
'datetime': undefined,
|
|
237445
237580
|
'high': this.safeString(ticker['h'], 0),
|
|
237446
237581
|
'low': this.safeString(ticker['l'], 0),
|
|
237447
237582
|
'bid': this.safeString(ticker['b'], 0),
|
|
@@ -245651,7 +245786,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
245651
245786
|
'side': this.safeString(order, 'side'),
|
|
245652
245787
|
'price': this.safeNumber(info, 'fillPx'),
|
|
245653
245788
|
'amount': this.safeNumber(info, 'fillSz'),
|
|
245654
|
-
'cost':
|
|
245789
|
+
'cost': this.safeNumber(order, 'cost'),
|
|
245655
245790
|
'fee': {
|
|
245656
245791
|
'cost': this.safeNumber(info, 'fillFee'),
|
|
245657
245792
|
'currency': this.safeCurrencyCode(feeMarketId),
|
|
@@ -252937,11 +253072,10 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
252937
253072
|
// "count": 3689
|
|
252938
253073
|
// }
|
|
252939
253074
|
//
|
|
252940
|
-
const timestamp = this.safeInteger(ticker, 'date', this.milliseconds());
|
|
252941
253075
|
return this.safeTicker({
|
|
252942
253076
|
'symbol': this.safeSymbol(undefined, market),
|
|
252943
|
-
'timestamp':
|
|
252944
|
-
'datetime':
|
|
253077
|
+
'timestamp': undefined,
|
|
253078
|
+
'datetime': undefined,
|
|
252945
253079
|
'high': this.safeString(ticker, 'high'),
|
|
252946
253080
|
'low': this.safeString(ticker, 'low'),
|
|
252947
253081
|
'bid': undefined,
|
|
@@ -288435,7 +288569,7 @@ SOFTWARE.
|
|
|
288435
288569
|
|
|
288436
288570
|
//-----------------------------------------------------------------------------
|
|
288437
288571
|
// this is updated by vss.js when building
|
|
288438
|
-
const version = '4.1.
|
|
288572
|
+
const version = '4.1.96';
|
|
288439
288573
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
288440
288574
|
//-----------------------------------------------------------------------------
|
|
288441
288575
|
|