ccxt 4.3.23 → 4.3.27
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 +5 -5
- package/dist/cjs/ccxt.js +9 -6
- package/dist/cjs/src/base/Exchange.js +26 -27
- package/dist/cjs/src/base/functions/number.js +10 -5
- package/dist/cjs/src/bitrue.js +6 -1
- package/dist/cjs/src/coinbaseadvanced.js +17 -0
- package/dist/cjs/src/{coinbasepro.js → coinbaseexchange.js} +40 -40
- package/dist/cjs/src/coinex.js +81 -147
- package/dist/cjs/src/kraken.js +60 -7
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/phemex.js +18 -2
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bitget.js +12 -3
- package/dist/cjs/src/pro/{coinbasepro.js → coinbaseexchange.js} +13 -13
- package/dist/cjs/src/pro/cryptocom.js +9 -7
- package/dist/cjs/src/pro/kraken.js +6 -4
- package/dist/cjs/src/pro/okx.js +1 -1
- package/js/ccxt.d.ts +11 -8
- package/js/ccxt.js +8 -6
- package/js/src/abstract/coinbaseadvanced.d.ts +97 -0
- package/js/src/abstract/coinbaseadvanced.js +11 -0
- package/js/src/base/Exchange.d.ts +4 -2
- package/js/src/base/Exchange.js +26 -27
- package/js/src/base/functions/number.js +10 -5
- package/js/src/bitrue.js +6 -1
- package/js/src/coinbaseadvanced.d.ts +4 -0
- package/js/src/coinbaseadvanced.js +18 -0
- package/js/src/{coinbasepro.d.ts → coinbaseexchange.d.ts} +3 -3
- package/js/src/{coinbasepro.js → coinbaseexchange.js} +39 -39
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +81 -147
- package/js/src/kraken.d.ts +3 -1
- package/js/src/kraken.js +60 -7
- package/js/src/kucoin.js +1 -0
- package/js/src/phemex.js +18 -2
- package/js/src/pro/binance.d.ts +1 -1
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bitget.js +12 -3
- package/js/src/pro/{coinbasepro.d.ts → coinbaseexchange.d.ts} +2 -2
- package/js/src/pro/{coinbasepro.js → coinbaseexchange.js} +12 -12
- package/js/src/pro/cryptocom.js +9 -7
- package/js/src/pro/kraken.d.ts +1 -1
- package/js/src/pro/kraken.js +6 -4
- package/js/src/pro/okx.d.ts +1 -1
- package/js/src/pro/okx.js +1 -1
- package/package.json +1 -1
- /package/dist/cjs/src/abstract/{coinbasepro.js → coinbaseexchange.js} +0 -0
- /package/js/src/abstract/{coinbasepro.d.ts → coinbaseexchange.d.ts} +0 -0
- /package/js/src/abstract/{coinbasepro.js → coinbaseexchange.js} +0 -0
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -444,8 +444,15 @@ class coinex extends coinex$1 {
|
|
|
444
444
|
'fetchDepositAddress': {
|
|
445
445
|
'fillResponseFromRequest': true,
|
|
446
446
|
},
|
|
447
|
+
'accountsByType': {
|
|
448
|
+
'spot': 'SPOT',
|
|
449
|
+
'margin': 'MARGIN',
|
|
450
|
+
'swap': 'FUTURES',
|
|
451
|
+
},
|
|
447
452
|
'accountsById': {
|
|
448
|
-
'
|
|
453
|
+
'SPOT': 'spot',
|
|
454
|
+
'MARGIN': 'margin',
|
|
455
|
+
'FUTURES': 'swap',
|
|
449
456
|
},
|
|
450
457
|
'networks': {
|
|
451
458
|
'BEP20': 'BSC',
|
|
@@ -3651,7 +3658,11 @@ class coinex extends coinex$1 {
|
|
|
3651
3658
|
* @param {string} [params.marginMode] 'cross' or 'isolated' for fetching spot margin orders
|
|
3652
3659
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3653
3660
|
*/
|
|
3654
|
-
|
|
3661
|
+
const openOrders = await this.fetchOrdersByStatus('pending', symbol, since, limit, params);
|
|
3662
|
+
for (let i = 0; i < openOrders.length; i++) {
|
|
3663
|
+
openOrders[i]['status'] = 'open';
|
|
3664
|
+
}
|
|
3665
|
+
return openOrders;
|
|
3655
3666
|
}
|
|
3656
3667
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3657
3668
|
/**
|
|
@@ -4883,43 +4894,45 @@ class coinex extends coinex$1 {
|
|
|
4883
4894
|
* @method
|
|
4884
4895
|
* @name coinex#transfer
|
|
4885
4896
|
* @description transfer currency internally between wallets on the same account
|
|
4886
|
-
* @see https://
|
|
4887
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account013_margin_transfer
|
|
4897
|
+
* @see https://docs.coinex.com/api/v2/assets/transfer/http/transfer
|
|
4888
4898
|
* @param {string} code unified currency code
|
|
4889
4899
|
* @param {float} amount amount to transfer
|
|
4890
4900
|
* @param {string} fromAccount account to transfer from
|
|
4891
4901
|
* @param {string} toAccount account to transfer to
|
|
4892
4902
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4903
|
+
* @param {string} [params.symbol] unified ccxt symbol, required when either the fromAccount or toAccount is margin
|
|
4893
4904
|
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
4894
4905
|
*/
|
|
4895
4906
|
await this.loadMarkets();
|
|
4896
4907
|
const currency = this.currency(code);
|
|
4897
4908
|
const amountToPrecision = this.currencyToPrecision(code, amount);
|
|
4909
|
+
const accountsByType = this.safeDict(this.options, 'accountsById', {});
|
|
4910
|
+
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
4911
|
+
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
4898
4912
|
const request = {
|
|
4913
|
+
'ccy': currency['id'],
|
|
4899
4914
|
'amount': amountToPrecision,
|
|
4900
|
-
'
|
|
4915
|
+
'from_account_type': fromId,
|
|
4916
|
+
'to_account_type': toId,
|
|
4901
4917
|
};
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4918
|
+
if ((fromAccount === 'margin') || (toAccount === 'margin')) {
|
|
4919
|
+
const symbol = this.safeString(params, 'symbol');
|
|
4920
|
+
if (symbol === undefined) {
|
|
4921
|
+
throw new errors.ArgumentsRequired(this.id + ' transfer() the symbol parameter must be defined for a margin account');
|
|
4922
|
+
}
|
|
4923
|
+
params = this.omit(params, 'symbol');
|
|
4924
|
+
request['market'] = this.marketId(symbol);
|
|
4906
4925
|
}
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
response = await this.v1PrivatePostContractBalanceTransfer(this.extend(request, params));
|
|
4910
|
-
}
|
|
4911
|
-
else {
|
|
4912
|
-
const accountsById = this.safeValue(this.options, 'accountsById', {});
|
|
4913
|
-
const fromId = this.safeString(accountsById, fromAccount, fromAccount);
|
|
4914
|
-
const toId = this.safeString(accountsById, toAccount, toAccount);
|
|
4915
|
-
// fromAccount and toAccount must be integers for margin transfers
|
|
4916
|
-
// spot is 0, use fetchBalance() to find the margin account id
|
|
4917
|
-
request['from_account'] = parseInt(fromId);
|
|
4918
|
-
request['to_account'] = parseInt(toId);
|
|
4919
|
-
response = await this.v1PrivatePostMarginTransfer(this.extend(request, params));
|
|
4926
|
+
if ((fromAccount !== 'spot') && (toAccount !== 'spot')) {
|
|
4927
|
+
throw new errors.BadRequest(this.id + ' transfer() can only be between spot and swap, or spot and margin, either the fromAccount or toAccount must be spot');
|
|
4920
4928
|
}
|
|
4929
|
+
const response = await this.v2PrivatePostAssetsTransfer(this.extend(request, params));
|
|
4921
4930
|
//
|
|
4922
|
-
// {
|
|
4931
|
+
// {
|
|
4932
|
+
// "code": 0,
|
|
4933
|
+
// "data": {},
|
|
4934
|
+
// "message": "OK"
|
|
4935
|
+
// }
|
|
4923
4936
|
//
|
|
4924
4937
|
return this.extend(this.parseTransfer(response, currency), {
|
|
4925
4938
|
'amount': this.parseNumber(amountToPrecision),
|
|
@@ -4931,67 +4944,26 @@ class coinex extends coinex$1 {
|
|
|
4931
4944
|
const statuses = {
|
|
4932
4945
|
'0': 'ok',
|
|
4933
4946
|
'SUCCESS': 'ok',
|
|
4947
|
+
'OK': 'ok',
|
|
4948
|
+
'finished': 'ok',
|
|
4949
|
+
'FINISHED': 'ok',
|
|
4934
4950
|
};
|
|
4935
4951
|
return this.safeString(statuses, status, status);
|
|
4936
4952
|
}
|
|
4937
4953
|
parseTransfer(transfer, currency = undefined) {
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
// "asset": "USDT",
|
|
4944
|
-
// "transfer_type": "transfer_out", // from swap to spot
|
|
4945
|
-
// "created_at": 1651633422
|
|
4946
|
-
// },
|
|
4947
|
-
//
|
|
4948
|
-
// fetchTransfers Margin
|
|
4949
|
-
//
|
|
4950
|
-
// {
|
|
4951
|
-
// "id": 7580062,
|
|
4952
|
-
// "updated_at": 1653684379,
|
|
4953
|
-
// "user_id": 3620173,
|
|
4954
|
-
// "from_account_id": 0,
|
|
4955
|
-
// "to_account_id": 1,
|
|
4956
|
-
// "asset": "BTC",
|
|
4957
|
-
// "amount": "0.00160829",
|
|
4958
|
-
// "balance": "0.00160829",
|
|
4959
|
-
// "transfer_type": "IN",
|
|
4960
|
-
// "status": "SUCCESS",
|
|
4961
|
-
// "created_at": 1653684379
|
|
4962
|
-
// },
|
|
4963
|
-
//
|
|
4964
|
-
const timestamp = this.safeTimestamp(transfer, 'created_at');
|
|
4965
|
-
const transferType = this.safeString(transfer, 'transfer_type');
|
|
4966
|
-
let fromAccount = undefined;
|
|
4967
|
-
let toAccount = undefined;
|
|
4968
|
-
if (transferType === 'transfer_out') {
|
|
4969
|
-
fromAccount = 'swap';
|
|
4970
|
-
toAccount = 'spot';
|
|
4971
|
-
}
|
|
4972
|
-
else if (transferType === 'transfer_in') {
|
|
4973
|
-
fromAccount = 'spot';
|
|
4974
|
-
toAccount = 'swap';
|
|
4975
|
-
}
|
|
4976
|
-
else if (transferType === 'IN') {
|
|
4977
|
-
fromAccount = 'spot';
|
|
4978
|
-
toAccount = 'margin';
|
|
4979
|
-
}
|
|
4980
|
-
else if (transferType === 'OUT') {
|
|
4981
|
-
fromAccount = 'margin';
|
|
4982
|
-
toAccount = 'spot';
|
|
4983
|
-
}
|
|
4984
|
-
const currencyId = this.safeString(transfer, 'asset');
|
|
4985
|
-
const currencyCode = this.safeCurrencyCode(currencyId, currency);
|
|
4954
|
+
const timestamp = this.safeInteger(transfer, 'created_at');
|
|
4955
|
+
const currencyId = this.safeString(transfer, 'ccy');
|
|
4956
|
+
const fromId = this.safeString(transfer, 'from_account_type');
|
|
4957
|
+
const toId = this.safeString(transfer, 'to_account_type');
|
|
4958
|
+
const accountsById = this.safeValue(this.options, 'accountsById', {});
|
|
4986
4959
|
return {
|
|
4987
|
-
'
|
|
4988
|
-
'id': this.safeString(transfer, 'id'),
|
|
4960
|
+
'id': undefined,
|
|
4989
4961
|
'timestamp': timestamp,
|
|
4990
4962
|
'datetime': this.iso8601(timestamp),
|
|
4991
|
-
'currency':
|
|
4963
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
4992
4964
|
'amount': this.safeNumber(transfer, 'amount'),
|
|
4993
|
-
'fromAccount':
|
|
4994
|
-
'toAccount':
|
|
4965
|
+
'fromAccount': this.safeString(accountsById, fromId, fromId),
|
|
4966
|
+
'toAccount': this.safeString(accountsById, toId, toId),
|
|
4995
4967
|
'status': this.parseTransferStatus(this.safeString2(transfer, 'code', 'status')),
|
|
4996
4968
|
};
|
|
4997
4969
|
}
|
|
@@ -5000,31 +4972,29 @@ class coinex extends coinex$1 {
|
|
|
5000
4972
|
* @method
|
|
5001
4973
|
* @name coinex#fetchTransfers
|
|
5002
4974
|
* @description fetch a history of internal transfers made on an account
|
|
5003
|
-
* @see https://
|
|
5004
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account024_contract_transfer_history
|
|
4975
|
+
* @see https://docs.coinex.com/api/v2/assets/transfer/http/list-transfer-history
|
|
5005
4976
|
* @param {string} code unified currency code of the currency transferred
|
|
5006
4977
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5007
|
-
* @param {int} [limit] the maximum number of
|
|
4978
|
+
* @param {int} [limit] the maximum number of transfer structures to retrieve
|
|
5008
4979
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4980
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated' for fetching transfers to and from your margin account
|
|
5009
4981
|
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5010
4982
|
*/
|
|
5011
4983
|
await this.loadMarkets();
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
// 'end_time': 1515806440,
|
|
5019
|
-
// 'transfer_type': 'transfer_in', // transfer_in: from Spot to Swap Account, transfer_out: from Swap to Spot Account
|
|
4984
|
+
if (code === undefined) {
|
|
4985
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchTransfers() requires a code argument');
|
|
4986
|
+
}
|
|
4987
|
+
const currency = this.currency(code);
|
|
4988
|
+
let request = {
|
|
4989
|
+
'ccy': currency['id'],
|
|
5020
4990
|
};
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
4991
|
+
let marginMode = undefined;
|
|
4992
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
|
|
4993
|
+
if (marginMode !== undefined) {
|
|
4994
|
+
request['transfer_type'] = 'MARGIN';
|
|
5024
4995
|
}
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
request['asset'] = currency['id'];
|
|
4996
|
+
else {
|
|
4997
|
+
request['transfer_type'] = 'FUTURES';
|
|
5028
4998
|
}
|
|
5029
4999
|
if (since !== undefined) {
|
|
5030
5000
|
request['start_time'] = since;
|
|
@@ -5032,66 +5002,30 @@ class coinex extends coinex$1 {
|
|
|
5032
5002
|
if (limit !== undefined) {
|
|
5033
5003
|
request['limit'] = limit;
|
|
5034
5004
|
}
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
}
|
|
5038
|
-
params = this.omit(params, 'page');
|
|
5039
|
-
let marginMode = undefined;
|
|
5040
|
-
[marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
|
|
5041
|
-
let response = undefined;
|
|
5042
|
-
if (marginMode !== undefined) {
|
|
5043
|
-
response = await this.v1PrivateGetMarginTransferHistory(this.extend(request, params));
|
|
5044
|
-
}
|
|
5045
|
-
else {
|
|
5046
|
-
response = await this.v1PrivateGetContractTransferHistory(this.extend(request, params));
|
|
5047
|
-
}
|
|
5048
|
-
//
|
|
5049
|
-
// Swap
|
|
5005
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
5006
|
+
const response = await this.v2PrivateGetAssetsTransferHistory(this.extend(request, params));
|
|
5050
5007
|
//
|
|
5051
5008
|
// {
|
|
5052
|
-
// "
|
|
5053
|
-
//
|
|
5054
|
-
//
|
|
5055
|
-
//
|
|
5056
|
-
//
|
|
5057
|
-
//
|
|
5058
|
-
//
|
|
5059
|
-
//
|
|
5060
|
-
//
|
|
5061
|
-
//
|
|
5062
|
-
//
|
|
5009
|
+
// "data": [
|
|
5010
|
+
// {
|
|
5011
|
+
// "created_at": 1715848480646,
|
|
5012
|
+
// "from_account_type": "SPOT",
|
|
5013
|
+
// "to_account_type": "FUTURES",
|
|
5014
|
+
// "ccy": "USDT",
|
|
5015
|
+
// "amount": "10",
|
|
5016
|
+
// "status": "finished"
|
|
5017
|
+
// },
|
|
5018
|
+
// ],
|
|
5019
|
+
// "pagination": {
|
|
5020
|
+
// "total": 8,
|
|
5021
|
+
// "has_next": false
|
|
5063
5022
|
// },
|
|
5064
|
-
// "message": "Success"
|
|
5065
|
-
// }
|
|
5066
|
-
//
|
|
5067
|
-
// Margin
|
|
5068
|
-
//
|
|
5069
|
-
// {
|
|
5070
5023
|
// "code": 0,
|
|
5071
|
-
// "
|
|
5072
|
-
// "records": [
|
|
5073
|
-
// {
|
|
5074
|
-
// "id": 7580062,
|
|
5075
|
-
// "updated_at": 1653684379,
|
|
5076
|
-
// "user_id": 3620173,
|
|
5077
|
-
// "from_account_id": 0,
|
|
5078
|
-
// "to_account_id": 1,
|
|
5079
|
-
// "asset": "BTC",
|
|
5080
|
-
// "amount": "0.00160829",
|
|
5081
|
-
// "balance": "0.00160829",
|
|
5082
|
-
// "transfer_type": "IN",
|
|
5083
|
-
// "status": "SUCCESS",
|
|
5084
|
-
// "created_at": 1653684379
|
|
5085
|
-
// }
|
|
5086
|
-
// ],
|
|
5087
|
-
// "total": 1
|
|
5088
|
-
// },
|
|
5089
|
-
// "message": "Success"
|
|
5024
|
+
// "message": "OK"
|
|
5090
5025
|
// }
|
|
5091
5026
|
//
|
|
5092
|
-
const data = this.
|
|
5093
|
-
|
|
5094
|
-
return this.parseTransfers(transfers, currency, since, limit);
|
|
5027
|
+
const data = this.safeList(response, 'data', []);
|
|
5028
|
+
return this.parseTransfers(data, currency, since, limit);
|
|
5095
5029
|
}
|
|
5096
5030
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5097
5031
|
/**
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -40,6 +40,9 @@ class kraken extends kraken$1 {
|
|
|
40
40
|
'cancelOrder': true,
|
|
41
41
|
'cancelOrders': true,
|
|
42
42
|
'createDepositAddress': true,
|
|
43
|
+
'createMarketBuyOrderWithCost': true,
|
|
44
|
+
'createMarketOrderWithCost': false,
|
|
45
|
+
'createMarketSellOrderWithCost': false,
|
|
43
46
|
'createOrder': true,
|
|
44
47
|
'createStopLimitOrder': true,
|
|
45
48
|
'createStopMarketOrder': true,
|
|
@@ -1350,6 +1353,37 @@ class kraken extends kraken$1 {
|
|
|
1350
1353
|
//
|
|
1351
1354
|
return this.parseBalance(response);
|
|
1352
1355
|
}
|
|
1356
|
+
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
1357
|
+
/**
|
|
1358
|
+
* @method
|
|
1359
|
+
* @name kraken#createMarketOrderWithCost
|
|
1360
|
+
* @description create a market order by providing the symbol, side and cost
|
|
1361
|
+
* @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
|
|
1362
|
+
* @param {string} symbol unified symbol of the market to create an order in (only USD markets are supported)
|
|
1363
|
+
* @param {string} side 'buy' or 'sell'
|
|
1364
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1365
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1366
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1367
|
+
*/
|
|
1368
|
+
await this.loadMarkets();
|
|
1369
|
+
// only buy orders are supported by the endpoint
|
|
1370
|
+
params['cost'] = cost;
|
|
1371
|
+
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
1372
|
+
}
|
|
1373
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1374
|
+
/**
|
|
1375
|
+
* @method
|
|
1376
|
+
* @name kraken#createMarketBuyOrderWithCost
|
|
1377
|
+
* @description create a market buy order by providing the symbol, side and cost
|
|
1378
|
+
* @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
|
|
1379
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1380
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1381
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1382
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1383
|
+
*/
|
|
1384
|
+
await this.loadMarkets();
|
|
1385
|
+
return await this.createMarketOrderWithCost(symbol, 'buy', cost, params);
|
|
1386
|
+
}
|
|
1353
1387
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1354
1388
|
/**
|
|
1355
1389
|
* @method
|
|
@@ -1380,7 +1414,7 @@ class kraken extends kraken$1 {
|
|
|
1380
1414
|
'ordertype': type,
|
|
1381
1415
|
'volume': this.amountToPrecision(symbol, amount),
|
|
1382
1416
|
};
|
|
1383
|
-
const orderRequest = this.orderRequest('createOrder', symbol, type, request, price, params);
|
|
1417
|
+
const orderRequest = this.orderRequest('createOrder', symbol, type, request, amount, price, params);
|
|
1384
1418
|
const response = await this.privatePostAddOrder(this.extend(orderRequest[0], orderRequest[1]));
|
|
1385
1419
|
//
|
|
1386
1420
|
// {
|
|
@@ -1686,7 +1720,7 @@ class kraken extends kraken$1 {
|
|
|
1686
1720
|
'trades': trades,
|
|
1687
1721
|
}, market);
|
|
1688
1722
|
}
|
|
1689
|
-
orderRequest(method, symbol, type, request, price = undefined, params = {}) {
|
|
1723
|
+
orderRequest(method, symbol, type, request, amount, price = undefined, params = {}) {
|
|
1690
1724
|
const clientOrderId = this.safeString2(params, 'userref', 'clientOrderId');
|
|
1691
1725
|
params = this.omit(params, ['userref', 'clientOrderId']);
|
|
1692
1726
|
if (clientOrderId !== undefined) {
|
|
@@ -1701,10 +1735,25 @@ class kraken extends kraken$1 {
|
|
|
1701
1735
|
const trailingLimitAmount = this.safeString(params, 'trailingLimitAmount');
|
|
1702
1736
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
1703
1737
|
const isLimitOrder = type.endsWith('limit'); // supporting limit, stop-loss-limit, take-profit-limit, etc
|
|
1704
|
-
|
|
1738
|
+
const isMarketOrder = type === 'market';
|
|
1739
|
+
const cost = this.safeString(params, 'cost');
|
|
1740
|
+
const flags = this.safeString(params, 'oflags');
|
|
1741
|
+
params = this.omit(params, ['cost', 'oflags']);
|
|
1742
|
+
const isViqcOrder = (flags !== undefined) && (flags.indexOf('viqc') > -1); // volume in quote currency
|
|
1743
|
+
if (isMarketOrder && (cost !== undefined || isViqcOrder)) {
|
|
1744
|
+
if (cost === undefined && (amount !== undefined)) {
|
|
1745
|
+
request['volume'] = this.costToPrecision(symbol, this.numberToString(amount));
|
|
1746
|
+
}
|
|
1747
|
+
else {
|
|
1748
|
+
request['volume'] = this.costToPrecision(symbol, cost);
|
|
1749
|
+
}
|
|
1750
|
+
const extendedOflags = (flags !== undefined) ? flags + ',viqc' : 'viqc';
|
|
1751
|
+
request['oflags'] = extendedOflags;
|
|
1752
|
+
}
|
|
1753
|
+
else if (isLimitOrder && !isTrailingAmountOrder) {
|
|
1705
1754
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1706
1755
|
}
|
|
1707
|
-
const reduceOnly = this.
|
|
1756
|
+
const reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
|
|
1708
1757
|
if (isStopLossOrTakeProfitTrigger) {
|
|
1709
1758
|
if (isStopLossTriggerOrder) {
|
|
1710
1759
|
request['price'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
@@ -1752,7 +1801,7 @@ class kraken extends kraken$1 {
|
|
|
1752
1801
|
request['reduce_only'] = 'true'; // not using boolean in this case, because the urlencodedNested transforms it into 'True' string
|
|
1753
1802
|
}
|
|
1754
1803
|
}
|
|
1755
|
-
let close = this.
|
|
1804
|
+
let close = this.safeDict(params, 'close');
|
|
1756
1805
|
if (close !== undefined) {
|
|
1757
1806
|
close = this.extend({}, close);
|
|
1758
1807
|
const closePrice = this.safeValue(close, 'price');
|
|
@@ -1773,7 +1822,8 @@ class kraken extends kraken$1 {
|
|
|
1773
1822
|
let postOnly = undefined;
|
|
1774
1823
|
[postOnly, params] = this.handlePostOnly(isMarket, false, params);
|
|
1775
1824
|
if (postOnly) {
|
|
1776
|
-
|
|
1825
|
+
const extendedPostFlags = (flags !== undefined) ? flags + ',post' : 'post';
|
|
1826
|
+
request['oflags'] = extendedPostFlags;
|
|
1777
1827
|
}
|
|
1778
1828
|
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
|
|
1779
1829
|
return [request, params];
|
|
@@ -1811,7 +1861,7 @@ class kraken extends kraken$1 {
|
|
|
1811
1861
|
if (amount !== undefined) {
|
|
1812
1862
|
request['volume'] = this.amountToPrecision(symbol, amount);
|
|
1813
1863
|
}
|
|
1814
|
-
const orderRequest = this.orderRequest('editOrder', symbol, type, request, price, params);
|
|
1864
|
+
const orderRequest = this.orderRequest('editOrder', symbol, type, request, amount, price, params);
|
|
1815
1865
|
const response = await this.privatePostEditOrder(this.extend(orderRequest[0], orderRequest[1]));
|
|
1816
1866
|
//
|
|
1817
1867
|
// {
|
|
@@ -3004,6 +3054,9 @@ class kraken extends kraken$1 {
|
|
|
3004
3054
|
if (body.indexOf('Invalid arguments:volume') >= 0) {
|
|
3005
3055
|
throw new errors.InvalidOrder(this.id + ' ' + body);
|
|
3006
3056
|
}
|
|
3057
|
+
if (body.indexOf('Invalid arguments:viqc') >= 0) {
|
|
3058
|
+
throw new errors.InvalidOrder(this.id + ' ' + body);
|
|
3059
|
+
}
|
|
3007
3060
|
if (body.indexOf('Rate limit exceeded') >= 0) {
|
|
3008
3061
|
throw new errors.RateLimitExceeded(this.id + ' ' + body);
|
|
3009
3062
|
}
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -4783,6 +4783,7 @@ class kucoin extends kucoin$1 {
|
|
|
4783
4783
|
const partnerSignature = this.hmac(this.encode(partnerPayload), this.encode(partnerSecret), sha256.sha256, 'base64');
|
|
4784
4784
|
headers['KC-API-PARTNER-SIGN'] = partnerSignature;
|
|
4785
4785
|
headers['KC-API-PARTNER'] = partnerId;
|
|
4786
|
+
headers['KC-API-PARTNER-VERIFY'] = 'true';
|
|
4786
4787
|
}
|
|
4787
4788
|
if (isBroker) {
|
|
4788
4789
|
const brokerName = this.safeString(partner, 'name');
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -2249,7 +2249,7 @@ class phemex extends phemex$1 {
|
|
|
2249
2249
|
if (feeCost !== undefined) {
|
|
2250
2250
|
fee = {
|
|
2251
2251
|
'cost': feeCost,
|
|
2252
|
-
'currency':
|
|
2252
|
+
'currency': this.safeCurrencyCode(this.safeString(order, 'feeCurrency')),
|
|
2253
2253
|
};
|
|
2254
2254
|
}
|
|
2255
2255
|
const timeInForce = this.parseTimeInForce(this.safeString(order, 'timeInForce'));
|
|
@@ -2396,6 +2396,7 @@ class phemex extends phemex$1 {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
const marketId = this.safeString(order, 'symbol');
|
|
2398
2398
|
const symbol = this.safeSymbol(marketId, market);
|
|
2399
|
+
market = this.safeMarket(marketId, market);
|
|
2399
2400
|
const status = this.parseOrderStatus(this.safeString(order, 'ordStatus'));
|
|
2400
2401
|
const side = this.parseOrderSide(this.safeStringLower(order, 'side'));
|
|
2401
2402
|
const type = this.parseOrderType(this.safeString(order, 'orderType'));
|
|
@@ -2425,6 +2426,21 @@ class phemex extends phemex$1 {
|
|
|
2425
2426
|
}
|
|
2426
2427
|
const takeProfit = this.safeString(order, 'takeProfitRp');
|
|
2427
2428
|
const stopLoss = this.safeString(order, 'stopLossRp');
|
|
2429
|
+
const feeValue = this.omitZero(this.safeString(order, 'execFeeRv'));
|
|
2430
|
+
const ptFeeRv = this.omitZero(this.safeString(order, 'ptFeeRv'));
|
|
2431
|
+
let fee = undefined;
|
|
2432
|
+
if (feeValue !== undefined) {
|
|
2433
|
+
fee = {
|
|
2434
|
+
'cost': feeValue,
|
|
2435
|
+
'currency': market['quote'],
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
else if (ptFeeRv !== undefined) {
|
|
2439
|
+
fee = {
|
|
2440
|
+
'cost': ptFeeRv,
|
|
2441
|
+
'currency': 'PT',
|
|
2442
|
+
};
|
|
2443
|
+
}
|
|
2428
2444
|
return this.safeOrder({
|
|
2429
2445
|
'info': order,
|
|
2430
2446
|
'id': id,
|
|
@@ -2449,7 +2465,7 @@ class phemex extends phemex$1 {
|
|
|
2449
2465
|
'cost': cost,
|
|
2450
2466
|
'average': undefined,
|
|
2451
2467
|
'status': status,
|
|
2452
|
-
'fee':
|
|
2468
|
+
'fee': fee,
|
|
2453
2469
|
'trades': undefined,
|
|
2454
2470
|
});
|
|
2455
2471
|
}
|
|
@@ -2131,7 +2131,7 @@ class binance extends binance$1 {
|
|
|
2131
2131
|
const orders = this.parseOrders(result);
|
|
2132
2132
|
client.resolve(orders, messageHash);
|
|
2133
2133
|
}
|
|
2134
|
-
async editOrderWs(id, symbol, type, side, amount, price = undefined, params = {}) {
|
|
2134
|
+
async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
2135
2135
|
/**
|
|
2136
2136
|
* @method
|
|
2137
2137
|
* @name binance#editOrderWs
|
|
@@ -1123,7 +1123,7 @@ class bitget extends bitget$1 {
|
|
|
1123
1123
|
// "executePrice": "35123", // this is limit price
|
|
1124
1124
|
// "triggerType": "fill_price",
|
|
1125
1125
|
// "planType": "amount",
|
|
1126
|
-
// #### in case order had fill: ####
|
|
1126
|
+
// #### in case order had a partial fill: ####
|
|
1127
1127
|
// fillPrice: '35123',
|
|
1128
1128
|
// tradeId: '1171775539946528779',
|
|
1129
1129
|
// baseVolume: '7', // field present in market order
|
|
@@ -1243,6 +1243,8 @@ class bitget extends bitget$1 {
|
|
|
1243
1243
|
let totalAmount = undefined;
|
|
1244
1244
|
let filledAmount = undefined;
|
|
1245
1245
|
let cost = undefined;
|
|
1246
|
+
let remaining = undefined;
|
|
1247
|
+
const totalFilled = this.safeString(order, 'accBaseVolume');
|
|
1246
1248
|
if (isSpot) {
|
|
1247
1249
|
if (isMargin) {
|
|
1248
1250
|
filledAmount = this.omitZero(this.safeString(order, 'fillTotalAmount'));
|
|
@@ -1250,7 +1252,13 @@ class bitget extends bitget$1 {
|
|
|
1250
1252
|
cost = this.safeString(order, 'quoteSize');
|
|
1251
1253
|
}
|
|
1252
1254
|
else {
|
|
1253
|
-
|
|
1255
|
+
const partialFillAmount = this.safeString(order, 'baseVolume');
|
|
1256
|
+
if (partialFillAmount !== undefined) {
|
|
1257
|
+
filledAmount = partialFillAmount;
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
filledAmount = totalFilled;
|
|
1261
|
+
}
|
|
1254
1262
|
if (isMarketOrder) {
|
|
1255
1263
|
if (isBuy) {
|
|
1256
1264
|
totalAmount = accBaseVolume;
|
|
@@ -1273,6 +1281,7 @@ class bitget extends bitget$1 {
|
|
|
1273
1281
|
totalAmount = this.safeString(order, 'size');
|
|
1274
1282
|
cost = this.safeString(order, 'fillNotionalUsd');
|
|
1275
1283
|
}
|
|
1284
|
+
remaining = this.omitZero(Precise["default"].stringSub(totalAmount, totalFilled));
|
|
1276
1285
|
return this.safeOrder({
|
|
1277
1286
|
'info': order,
|
|
1278
1287
|
'symbol': symbol,
|
|
@@ -1291,7 +1300,7 @@ class bitget extends bitget$1 {
|
|
|
1291
1300
|
'cost': cost,
|
|
1292
1301
|
'average': avgPrice,
|
|
1293
1302
|
'filled': filledAmount,
|
|
1294
|
-
'remaining':
|
|
1303
|
+
'remaining': remaining,
|
|
1295
1304
|
'status': this.parseWsOrderStatus(rawStatus),
|
|
1296
1305
|
'fee': feeObject,
|
|
1297
1306
|
'trades': undefined,
|