ccxt 4.3.85 → 4.3.87
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 +8 -5
- package/dist/ccxt.browser.min.js +15 -15
- package/dist/cjs/ccxt.js +7 -1
- package/dist/cjs/src/abstract/hashkey.js +9 -0
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/base/errors.js +8 -1
- package/dist/cjs/src/binance.js +4 -2
- package/dist/cjs/src/bingx.js +7 -1
- package/dist/cjs/src/bitfinex.js +2 -2
- package/dist/cjs/src/hashkey.js +4327 -0
- package/dist/cjs/src/hyperliquid.js +85 -65
- package/dist/cjs/src/indodax.js +37 -9
- package/dist/cjs/src/kraken.js +37 -6
- package/dist/cjs/src/krakenfutures.js +12 -10
- package/dist/cjs/src/pro/ascendex.js +45 -5
- package/dist/cjs/src/pro/bingx.js +13 -12
- package/dist/cjs/src/pro/bitget.js +164 -19
- package/dist/cjs/src/pro/hashkey.js +839 -0
- package/dist/cjs/src/pro/hyperliquid.js +123 -0
- package/dist/cjs/src/pro/mexc.js +13 -7
- package/dist/cjs/src/pro/p2b.js +34 -7
- package/dist/cjs/src/pro/poloniex.js +36 -3
- package/dist/cjs/src/pro/poloniexfutures.js +1 -0
- package/dist/cjs/src/pro/probit.js +2 -0
- package/dist/cjs/src/pro/upbit.js +48 -3
- package/dist/cjs/src/pro/vertex.js +1 -0
- package/dist/cjs/src/pro/wazirx.js +3 -0
- package/dist/cjs/src/pro/whitebit.js +9 -0
- package/dist/cjs/src/pro/woo.js +1 -0
- package/dist/cjs/src/pro/woofipro.js +1 -0
- package/dist/cjs/src/pro/xt.js +1 -0
- package/dist/cjs/src/upbit.js +1 -1
- package/js/ccxt.d.ts +9 -3
- package/js/ccxt.js +7 -3
- package/js/src/abstract/hashkey.d.ts +70 -0
- package/js/src/abstract/hashkey.js +11 -0
- package/js/src/base/Exchange.js +1 -1
- package/js/src/base/errorHierarchy.d.ts +1 -0
- package/js/src/base/errorHierarchy.js +1 -0
- package/js/src/base/errors.d.ts +5 -1
- package/js/src/base/errors.js +8 -2
- package/js/src/binance.js +4 -2
- package/js/src/bingx.js +7 -1
- package/js/src/bitfinex.js +2 -2
- package/js/src/hashkey.d.ts +178 -0
- package/js/src/hashkey.js +4328 -0
- package/js/src/hyperliquid.d.ts +3 -0
- package/js/src/hyperliquid.js +85 -65
- package/js/src/indodax.js +37 -9
- package/js/src/kraken.js +37 -6
- package/js/src/krakenfutures.js +12 -10
- package/js/src/pro/ascendex.d.ts +2 -0
- package/js/src/pro/ascendex.js +45 -5
- package/js/src/pro/bingx.js +13 -12
- package/js/src/pro/bitget.d.ts +8 -0
- package/js/src/pro/bitget.js +165 -20
- package/js/src/pro/hashkey.d.ts +34 -0
- package/js/src/pro/hashkey.js +840 -0
- package/js/src/pro/hyperliquid.d.ts +7 -1
- package/js/src/pro/hyperliquid.js +123 -0
- package/js/src/pro/mexc.js +13 -7
- package/js/src/pro/p2b.d.ts +1 -0
- package/js/src/pro/p2b.js +34 -7
- package/js/src/pro/poloniex.d.ts +1 -0
- package/js/src/pro/poloniex.js +36 -3
- package/js/src/pro/poloniexfutures.js +1 -0
- package/js/src/pro/probit.js +2 -0
- package/js/src/pro/upbit.d.ts +1 -0
- package/js/src/pro/upbit.js +48 -3
- package/js/src/pro/vertex.js +1 -0
- package/js/src/pro/wazirx.js +3 -0
- package/js/src/pro/whitebit.js +9 -0
- package/js/src/pro/woo.js +1 -0
- package/js/src/pro/woofipro.js +1 -0
- package/js/src/pro/xt.js +1 -0
- package/js/src/upbit.js +1 -1
- package/package.json +1 -1
|
@@ -1089,25 +1089,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1089
1089
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1090
1090
|
*/
|
|
1091
1091
|
await this.loadMarkets();
|
|
1092
|
-
const
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
symbol = market['symbol'];
|
|
1096
|
-
const order = {
|
|
1097
|
-
'symbol': symbol,
|
|
1098
|
-
'type': type,
|
|
1099
|
-
'side': side,
|
|
1100
|
-
'amount': amount,
|
|
1101
|
-
'price': price,
|
|
1102
|
-
'params': params,
|
|
1103
|
-
};
|
|
1104
|
-
const globalParams = {};
|
|
1105
|
-
if (vaultAddress !== undefined) {
|
|
1106
|
-
globalParams['vaultAddress'] = vaultAddress;
|
|
1107
|
-
}
|
|
1108
|
-
const response = await this.createOrders([order], globalParams);
|
|
1109
|
-
const first = this.safeDict(response, 0);
|
|
1110
|
-
return first;
|
|
1092
|
+
const [order, globalParams] = this.parseCreateOrderArgs(symbol, type, side, amount, price, params);
|
|
1093
|
+
const orders = await this.createOrders([order], globalParams);
|
|
1094
|
+
return orders[0];
|
|
1111
1095
|
}
|
|
1112
1096
|
async createOrders(orders, params = {}) {
|
|
1113
1097
|
/**
|
|
@@ -1118,8 +1102,41 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1118
1102
|
* @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
1119
1103
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1120
1104
|
*/
|
|
1121
|
-
this.checkRequiredCredentials();
|
|
1122
1105
|
await this.loadMarkets();
|
|
1106
|
+
const request = this.createOrdersRequest(orders, params);
|
|
1107
|
+
const response = await this.privatePostExchange(request);
|
|
1108
|
+
//
|
|
1109
|
+
// {
|
|
1110
|
+
// "status": "ok",
|
|
1111
|
+
// "response": {
|
|
1112
|
+
// "type": "order",
|
|
1113
|
+
// "data": {
|
|
1114
|
+
// "statuses": [
|
|
1115
|
+
// {
|
|
1116
|
+
// "resting": {
|
|
1117
|
+
// "oid": 5063830287
|
|
1118
|
+
// }
|
|
1119
|
+
// }
|
|
1120
|
+
// ]
|
|
1121
|
+
// }
|
|
1122
|
+
// }
|
|
1123
|
+
// }
|
|
1124
|
+
//
|
|
1125
|
+
const responseObj = this.safeDict(response, 'response', {});
|
|
1126
|
+
const data = this.safeDict(responseObj, 'data', {});
|
|
1127
|
+
const statuses = this.safeList(data, 'statuses', []);
|
|
1128
|
+
return this.parseOrders(statuses, undefined);
|
|
1129
|
+
}
|
|
1130
|
+
createOrdersRequest(orders, params = {}) {
|
|
1131
|
+
/**
|
|
1132
|
+
* @method
|
|
1133
|
+
* @name hyperliquid#createOrders
|
|
1134
|
+
* @description create a list of trade orders
|
|
1135
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
|
1136
|
+
* @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
1137
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1138
|
+
*/
|
|
1139
|
+
this.checkRequiredCredentials();
|
|
1123
1140
|
let defaultSlippage = this.safeString(this.options, 'defaultSlippage');
|
|
1124
1141
|
defaultSlippage = this.safeString(params, 'slippage', defaultSlippage);
|
|
1125
1142
|
let hasClientOrderId = false;
|
|
@@ -1239,28 +1256,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1239
1256
|
params = this.omit(params, 'vaultAddress');
|
|
1240
1257
|
request['vaultAddress'] = vaultAddress;
|
|
1241
1258
|
}
|
|
1242
|
-
|
|
1243
|
-
//
|
|
1244
|
-
// {
|
|
1245
|
-
// "status": "ok",
|
|
1246
|
-
// "response": {
|
|
1247
|
-
// "type": "order",
|
|
1248
|
-
// "data": {
|
|
1249
|
-
// "statuses": [
|
|
1250
|
-
// {
|
|
1251
|
-
// "resting": {
|
|
1252
|
-
// "oid": 5063830287
|
|
1253
|
-
// }
|
|
1254
|
-
// }
|
|
1255
|
-
// ]
|
|
1256
|
-
// }
|
|
1257
|
-
// }
|
|
1258
|
-
// }
|
|
1259
|
-
//
|
|
1260
|
-
const responseObj = this.safeDict(response, 'response', {});
|
|
1261
|
-
const data = this.safeDict(responseObj, 'data', {});
|
|
1262
|
-
const statuses = this.safeList(data, 'statuses', []);
|
|
1263
|
-
return this.parseOrders(statuses, undefined);
|
|
1259
|
+
return request;
|
|
1264
1260
|
}
|
|
1265
1261
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1266
1262
|
/**
|
|
@@ -1481,33 +1477,11 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1481
1477
|
//
|
|
1482
1478
|
return response;
|
|
1483
1479
|
}
|
|
1484
|
-
|
|
1485
|
-
/**
|
|
1486
|
-
* @method
|
|
1487
|
-
* @name hyperliquid#editOrder
|
|
1488
|
-
* @description edit a trade order
|
|
1489
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
1490
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
1491
|
-
* @param {string} id cancel order id
|
|
1492
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
1493
|
-
* @param {string} type 'market' or 'limit'
|
|
1494
|
-
* @param {string} side 'buy' or 'sell'
|
|
1495
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1496
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1497
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1498
|
-
* @param {string} [params.timeInForce] 'Gtc', 'Ioc', 'Alo'
|
|
1499
|
-
* @param {bool} [params.postOnly] true or false whether the order is post-only
|
|
1500
|
-
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
1501
|
-
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1502
|
-
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
1503
|
-
* @param {string} [params.vaultAddress] the vault address for order
|
|
1504
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1505
|
-
*/
|
|
1480
|
+
editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1506
1481
|
this.checkRequiredCredentials();
|
|
1507
1482
|
if (id === undefined) {
|
|
1508
1483
|
throw new errors.ArgumentsRequired(this.id + ' editOrder() requires an id argument');
|
|
1509
1484
|
}
|
|
1510
|
-
await this.loadMarkets();
|
|
1511
1485
|
const market = this.market(symbol);
|
|
1512
1486
|
type = type.toUpperCase();
|
|
1513
1487
|
const isMarket = (type === 'MARKET');
|
|
@@ -1594,6 +1568,33 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1594
1568
|
params = this.omit(params, 'vaultAddress');
|
|
1595
1569
|
request['vaultAddress'] = vaultAddress;
|
|
1596
1570
|
}
|
|
1571
|
+
return request;
|
|
1572
|
+
}
|
|
1573
|
+
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1574
|
+
/**
|
|
1575
|
+
* @method
|
|
1576
|
+
* @name hyperliquid#editOrder
|
|
1577
|
+
* @description edit a trade order
|
|
1578
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
1579
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
1580
|
+
* @param {string} id cancel order id
|
|
1581
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1582
|
+
* @param {string} type 'market' or 'limit'
|
|
1583
|
+
* @param {string} side 'buy' or 'sell'
|
|
1584
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1585
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1586
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1587
|
+
* @param {string} [params.timeInForce] 'Gtc', 'Ioc', 'Alo'
|
|
1588
|
+
* @param {bool} [params.postOnly] true or false whether the order is post-only
|
|
1589
|
+
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
1590
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1591
|
+
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
1592
|
+
* @param {string} [params.vaultAddress] the vault address for order
|
|
1593
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1594
|
+
*/
|
|
1595
|
+
await this.loadMarkets();
|
|
1596
|
+
const market = this.market(symbol);
|
|
1597
|
+
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
1597
1598
|
const response = await this.privatePostExchange(request);
|
|
1598
1599
|
//
|
|
1599
1600
|
// {
|
|
@@ -2755,6 +2756,25 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2755
2756
|
}
|
|
2756
2757
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
2757
2758
|
}
|
|
2759
|
+
parseCreateOrderArgs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
2760
|
+
const market = this.market(symbol);
|
|
2761
|
+
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
2762
|
+
params = this.omit(params, 'vaultAddress');
|
|
2763
|
+
symbol = market['symbol'];
|
|
2764
|
+
const order = {
|
|
2765
|
+
'symbol': symbol,
|
|
2766
|
+
'type': type,
|
|
2767
|
+
'side': side,
|
|
2768
|
+
'amount': amount,
|
|
2769
|
+
'price': price,
|
|
2770
|
+
'params': params,
|
|
2771
|
+
};
|
|
2772
|
+
const globalParams = {};
|
|
2773
|
+
if (vaultAddress !== undefined) {
|
|
2774
|
+
globalParams['vaultAddress'] = vaultAddress;
|
|
2775
|
+
}
|
|
2776
|
+
return [order, globalParams];
|
|
2777
|
+
}
|
|
2758
2778
|
}
|
|
2759
2779
|
|
|
2760
2780
|
module.exports = hyperliquid;
|
package/dist/cjs/src/indodax.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var indodax$1 = require('./abstract/indodax.js');
|
|
4
4
|
var errors = require('./base/errors.js');
|
|
5
5
|
var number = require('./base/functions/number.js');
|
|
6
|
+
var Precise = require('./base/Precise.js');
|
|
6
7
|
var sha512 = require('./static_dependencies/noble-hashes/sha512.js');
|
|
7
8
|
|
|
8
9
|
// ---------------------------------------------------------------------------
|
|
@@ -832,9 +833,6 @@ class indodax extends indodax$1 {
|
|
|
832
833
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
833
834
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
834
835
|
*/
|
|
835
|
-
if (type !== 'limit') {
|
|
836
|
-
throw new errors.ExchangeError(this.id + ' createOrder() allows limit orders only');
|
|
837
|
-
}
|
|
838
836
|
await this.loadMarkets();
|
|
839
837
|
const market = this.market(symbol);
|
|
840
838
|
const request = {
|
|
@@ -842,14 +840,44 @@ class indodax extends indodax$1 {
|
|
|
842
840
|
'type': side,
|
|
843
841
|
'price': price,
|
|
844
842
|
};
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
843
|
+
let priceIsRequired = false;
|
|
844
|
+
let quantityIsRequired = false;
|
|
845
|
+
if (type === 'market') {
|
|
846
|
+
if (side === 'buy') {
|
|
847
|
+
let quoteAmount = undefined;
|
|
848
|
+
const cost = this.safeNumber(params, 'cost');
|
|
849
|
+
params = this.omit(params, 'cost');
|
|
850
|
+
if (cost !== undefined) {
|
|
851
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
if (price === undefined) {
|
|
855
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price).');
|
|
856
|
+
}
|
|
857
|
+
const amountString = this.numberToString(amount);
|
|
858
|
+
const priceString = this.numberToString(price);
|
|
859
|
+
const costRequest = Precise["default"].stringMul(amountString, priceString);
|
|
860
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
861
|
+
}
|
|
862
|
+
request[market['quoteId']] = quoteAmount;
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
quantityIsRequired = true;
|
|
866
|
+
}
|
|
848
867
|
}
|
|
849
|
-
else {
|
|
850
|
-
|
|
868
|
+
else if (type === 'limit') {
|
|
869
|
+
priceIsRequired = true;
|
|
870
|
+
quantityIsRequired = true;
|
|
871
|
+
}
|
|
872
|
+
if (priceIsRequired) {
|
|
873
|
+
if (price === undefined) {
|
|
874
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for a ' + type + ' order');
|
|
875
|
+
}
|
|
876
|
+
request['price'] = price;
|
|
877
|
+
}
|
|
878
|
+
if (quantityIsRequired) {
|
|
879
|
+
request[market['baseId']] = this.amountToPrecision(symbol, amount);
|
|
851
880
|
}
|
|
852
|
-
request[currency] = amount;
|
|
853
881
|
const result = await this.privatePostTrade(this.extend(request, params));
|
|
854
882
|
const data = this.safeValue(result, 'return', {});
|
|
855
883
|
const id = this.safeString(data, 'order_id');
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -1109,11 +1109,12 @@ class kraken extends kraken$1 {
|
|
|
1109
1109
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
1110
1110
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1111
1111
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
1112
|
+
* @param {int} [params.end] timestamp in seconds of the latest ledger entry
|
|
1112
1113
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
1113
1114
|
*/
|
|
1114
1115
|
// https://www.kraken.com/features/api#get-ledgers-info
|
|
1115
1116
|
await this.loadMarkets();
|
|
1116
|
-
|
|
1117
|
+
const request = {};
|
|
1117
1118
|
let currency = undefined;
|
|
1118
1119
|
if (code !== undefined) {
|
|
1119
1120
|
currency = this.currency(code);
|
|
@@ -1122,7 +1123,12 @@ class kraken extends kraken$1 {
|
|
|
1122
1123
|
if (since !== undefined) {
|
|
1123
1124
|
request['start'] = this.parseToInt(since / 1000);
|
|
1124
1125
|
}
|
|
1125
|
-
|
|
1126
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
1127
|
+
if (until !== undefined) {
|
|
1128
|
+
params = this.omit(params, ['until', 'till']);
|
|
1129
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
1130
|
+
request['end'] = this.parseToInt(Precise["default"].stringAdd(untilDivided, '1'));
|
|
1131
|
+
}
|
|
1126
1132
|
const response = await this.privatePostLedgers(this.extend(request, params));
|
|
1127
1133
|
// { error: [],
|
|
1128
1134
|
// "result": { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
|
|
@@ -2122,6 +2128,8 @@ class kraken extends kraken$1 {
|
|
|
2122
2128
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2123
2129
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
2124
2130
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2131
|
+
* @param {int} [params.until] timestamp in ms of the latest trade entry
|
|
2132
|
+
* @param {int} [params.end] timestamp in seconds of the latest trade entry
|
|
2125
2133
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2126
2134
|
*/
|
|
2127
2135
|
await this.loadMarkets();
|
|
@@ -2135,6 +2143,12 @@ class kraken extends kraken$1 {
|
|
|
2135
2143
|
if (since !== undefined) {
|
|
2136
2144
|
request['start'] = this.parseToInt(since / 1000);
|
|
2137
2145
|
}
|
|
2146
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2147
|
+
if (until !== undefined) {
|
|
2148
|
+
params = this.omit(params, ['until', 'till']);
|
|
2149
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
2150
|
+
request['end'] = this.parseToInt(Precise["default"].stringAdd(untilDivided, '1'));
|
|
2151
|
+
}
|
|
2138
2152
|
const response = await this.privatePostTradesHistory(this.extend(request, params));
|
|
2139
2153
|
//
|
|
2140
2154
|
// {
|
|
@@ -2550,6 +2564,8 @@ class kraken extends kraken$1 {
|
|
|
2550
2564
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
2551
2565
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
2552
2566
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2567
|
+
* @param {int} [params.until] timestamp in ms of the latest transaction entry
|
|
2568
|
+
* @param {int} [params.end] timestamp in seconds of the latest transaction entry
|
|
2553
2569
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2554
2570
|
*/
|
|
2555
2571
|
// https://www.kraken.com/en-us/help/api#deposit-status
|
|
@@ -2560,7 +2576,14 @@ class kraken extends kraken$1 {
|
|
|
2560
2576
|
request['asset'] = currency['id'];
|
|
2561
2577
|
}
|
|
2562
2578
|
if (since !== undefined) {
|
|
2563
|
-
|
|
2579
|
+
const sinceString = this.numberToString(since);
|
|
2580
|
+
request['start'] = Precise["default"].stringDiv(sinceString, '1000');
|
|
2581
|
+
}
|
|
2582
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2583
|
+
if (until !== undefined) {
|
|
2584
|
+
params = this.omit(params, ['until', 'till']);
|
|
2585
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
2586
|
+
request['end'] = Precise["default"].stringAdd(untilDivided, '1');
|
|
2564
2587
|
}
|
|
2565
2588
|
const response = await this.privatePostDepositStatus(this.extend(request, params));
|
|
2566
2589
|
//
|
|
@@ -2611,8 +2634,9 @@ class kraken extends kraken$1 {
|
|
|
2611
2634
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
2612
2635
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
2613
2636
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2614
|
-
* @param {
|
|
2615
|
-
* @param {
|
|
2637
|
+
* @param {int} [params.until] timestamp in ms of the latest transaction entry
|
|
2638
|
+
* @param {int} [params.end] timestamp in seconds of the latest transaction entry
|
|
2639
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2616
2640
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2617
2641
|
*/
|
|
2618
2642
|
await this.loadMarkets();
|
|
@@ -2628,7 +2652,14 @@ class kraken extends kraken$1 {
|
|
|
2628
2652
|
request['asset'] = currency['id'];
|
|
2629
2653
|
}
|
|
2630
2654
|
if (since !== undefined) {
|
|
2631
|
-
|
|
2655
|
+
const sinceString = this.numberToString(since);
|
|
2656
|
+
request['start'] = Precise["default"].stringDiv(sinceString, '1000');
|
|
2657
|
+
}
|
|
2658
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2659
|
+
if (until !== undefined) {
|
|
2660
|
+
params = this.omit(params, ['until', 'till']);
|
|
2661
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
2662
|
+
request['end'] = Precise["default"].stringAdd(untilDivided, '1');
|
|
2632
2663
|
}
|
|
2633
2664
|
const response = await this.privatePostWithdrawStatus(this.extend(request, params));
|
|
2634
2665
|
//
|
|
@@ -1767,17 +1767,19 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1767
1767
|
}
|
|
1768
1768
|
// Final order (after placement / editing / execution / canceling)
|
|
1769
1769
|
const orderTrigger = this.safeValue(item, 'orderTrigger');
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
isPrior = false;
|
|
1773
|
-
fixed = true;
|
|
1774
|
-
}
|
|
1775
|
-
else if (!fixed) {
|
|
1776
|
-
const orderPriorExecution = this.safeValue(item, 'orderPriorExecution');
|
|
1777
|
-
details = this.safeValue2(item, 'orderPriorExecution', 'orderPriorEdit');
|
|
1778
|
-
price = this.safeString(orderPriorExecution, 'limitPrice');
|
|
1770
|
+
if (details === undefined) {
|
|
1771
|
+
details = this.safeValue2(item, 'new', 'order', orderTrigger);
|
|
1779
1772
|
if (details !== undefined) {
|
|
1780
|
-
isPrior =
|
|
1773
|
+
isPrior = false;
|
|
1774
|
+
fixed = true;
|
|
1775
|
+
}
|
|
1776
|
+
else if (!fixed) {
|
|
1777
|
+
const orderPriorExecution = this.safeValue(item, 'orderPriorExecution');
|
|
1778
|
+
details = this.safeValue2(item, 'orderPriorExecution', 'orderPriorEdit');
|
|
1779
|
+
price = this.safeString(orderPriorExecution, 'limitPrice');
|
|
1780
|
+
if (details !== undefined) {
|
|
1781
|
+
isPrior = true;
|
|
1782
|
+
}
|
|
1781
1783
|
}
|
|
1782
1784
|
}
|
|
1783
1785
|
}
|
|
@@ -18,6 +18,7 @@ class ascendex extends ascendex$1 {
|
|
|
18
18
|
'watchOrders': true,
|
|
19
19
|
'watchTicker': false,
|
|
20
20
|
'watchTrades': true,
|
|
21
|
+
'watchTradesForSymbols': true,
|
|
21
22
|
},
|
|
22
23
|
'urls': {
|
|
23
24
|
'api': {
|
|
@@ -55,6 +56,16 @@ class ascendex extends ascendex$1 {
|
|
|
55
56
|
const message = this.extend(request, params);
|
|
56
57
|
return await this.watch(url, messageHash, message, messageHash);
|
|
57
58
|
}
|
|
59
|
+
async watchPublicMultiple(messageHashes, params = {}) {
|
|
60
|
+
const url = this.urls['api']['ws']['public'];
|
|
61
|
+
const id = this.nonce();
|
|
62
|
+
const request = {
|
|
63
|
+
'id': id.toString(),
|
|
64
|
+
'op': 'sub',
|
|
65
|
+
};
|
|
66
|
+
const message = this.extend(request, params);
|
|
67
|
+
return await this.watchMultiple(url, messageHashes, message, messageHashes);
|
|
68
|
+
}
|
|
58
69
|
async watchPrivate(channel, messageHash, params = {}) {
|
|
59
70
|
await this.loadAccounts();
|
|
60
71
|
const accountGroup = this.safeString(this.options, 'account-group');
|
|
@@ -75,6 +86,7 @@ class ascendex extends ascendex$1 {
|
|
|
75
86
|
* @method
|
|
76
87
|
* @name ascendex#watchOHLCV
|
|
77
88
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
89
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#channel-bar-data
|
|
78
90
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
79
91
|
* @param {string} timeframe the length of time each candle represents
|
|
80
92
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -140,22 +152,48 @@ class ascendex extends ascendex$1 {
|
|
|
140
152
|
* @method
|
|
141
153
|
* @name ascendex#watchTrades
|
|
142
154
|
* @description get the list of most recent trades for a particular symbol
|
|
155
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#channel-market-trades
|
|
143
156
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
144
157
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
145
158
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
146
159
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
147
160
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
148
161
|
*/
|
|
162
|
+
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
163
|
+
}
|
|
164
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
165
|
+
/**
|
|
166
|
+
* @method
|
|
167
|
+
* @name ascendex#watchTradesForSymbols
|
|
168
|
+
* @description get the list of most recent trades for a list of symbols
|
|
169
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#channel-market-trades
|
|
170
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
171
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
172
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
173
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
174
|
+
* @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
|
|
175
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
176
|
+
*/
|
|
149
177
|
await this.loadMarkets();
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
178
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
179
|
+
const marketIds = [];
|
|
180
|
+
const messageHashes = [];
|
|
181
|
+
if (symbols !== undefined) {
|
|
182
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
183
|
+
const market = this.market(symbols[i]);
|
|
184
|
+
marketIds.push(market['id']);
|
|
185
|
+
messageHashes.push('trades:' + market['id']);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const channel = 'trades:' + marketIds.join(',');
|
|
153
189
|
params = this.extend(params, {
|
|
154
190
|
'ch': channel,
|
|
155
191
|
});
|
|
156
|
-
const trades = await this.
|
|
192
|
+
const trades = await this.watchPublicMultiple(messageHashes, params);
|
|
157
193
|
if (this.newUpdates) {
|
|
158
|
-
|
|
194
|
+
const first = this.safeValue(trades, 0);
|
|
195
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
196
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
159
197
|
}
|
|
160
198
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
161
199
|
}
|
|
@@ -201,6 +239,7 @@ class ascendex extends ascendex$1 {
|
|
|
201
239
|
* @method
|
|
202
240
|
* @name ascendex#watchOrderBook
|
|
203
241
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
242
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#channel-level-2-order-book-updates
|
|
204
243
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
205
244
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
206
245
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -357,6 +396,7 @@ class ascendex extends ascendex$1 {
|
|
|
357
396
|
* @method
|
|
358
397
|
* @name ascendex#watchBalance
|
|
359
398
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
399
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#channel-order-and-balance
|
|
360
400
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
361
401
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
362
402
|
*/
|
|
@@ -13,6 +13,7 @@ class bingx extends bingx$1 {
|
|
|
13
13
|
'has': {
|
|
14
14
|
'ws': true,
|
|
15
15
|
'watchTrades': true,
|
|
16
|
+
'watchTradesForSymbols': false,
|
|
16
17
|
'watchOrderBook': true,
|
|
17
18
|
'watchOrderBookForSymbols': true,
|
|
18
19
|
'watchOHLCV': true,
|
|
@@ -435,8 +436,8 @@ class bingx extends bingx$1 {
|
|
|
435
436
|
* @method
|
|
436
437
|
* @name bingx#watchTrades
|
|
437
438
|
* @description watches information on multiple trades made in a market
|
|
438
|
-
* @see https://bingx-api.github.io/docs/#/spot/socket/market.html#
|
|
439
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/socket/market.html#Subscribe%20the%20Latest%20Trade%20Detail
|
|
439
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscription%20transaction%20by%20transaction
|
|
440
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20the%20Latest%20Trade%20Detail
|
|
440
441
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
441
442
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
442
443
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -558,8 +559,8 @@ class bingx extends bingx$1 {
|
|
|
558
559
|
* @method
|
|
559
560
|
* @name bingx#watchOrderBook
|
|
560
561
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
561
|
-
* @see https://bingx-api.github.io/docs/#/spot/socket/market.html#Subscribe%20Market%20Depth%20Data
|
|
562
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/socket/market.html#Subscribe%20Market%20Depth%20Data
|
|
562
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscribe%20Market%20Depth%20Data
|
|
563
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20Market%20Depth%20Data
|
|
563
564
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
564
565
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
565
566
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -790,8 +791,8 @@ class bingx extends bingx$1 {
|
|
|
790
791
|
* @method
|
|
791
792
|
* @name bingx#watchOHLCV
|
|
792
793
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
793
|
-
* @see https://bingx-api.github.io/docs/#/spot/socket/market.html#K%
|
|
794
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/socket/market.html#Subscribe%20K-Line%20Data
|
|
794
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#K-line%20Streams
|
|
795
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20K-Line%20Data
|
|
795
796
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
796
797
|
* @param {string} timeframe the length of time each candle represents
|
|
797
798
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -834,8 +835,8 @@ class bingx extends bingx$1 {
|
|
|
834
835
|
/**
|
|
835
836
|
* @method
|
|
836
837
|
* @name bingx#watchOrders
|
|
837
|
-
* @see https://bingx-api.github.io/docs/#/spot/socket/account.html#Subscription%20order%20update%20data
|
|
838
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
838
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20order%20update%20data
|
|
839
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
839
840
|
* @description watches information on multiple orders made by the user
|
|
840
841
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
841
842
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -881,8 +882,8 @@ class bingx extends bingx$1 {
|
|
|
881
882
|
/**
|
|
882
883
|
* @method
|
|
883
884
|
* @name bingx#watchMyTrades
|
|
884
|
-
* @see https://bingx-api.github.io/docs/#/spot/socket/account.html#Subscription%20order%20update%20data
|
|
885
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
885
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20order%20update%20data
|
|
886
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
886
887
|
* @description watches information on multiple trades made by the user
|
|
887
888
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
888
889
|
* @param {int} [since] the earliest time in ms to trades orders for
|
|
@@ -928,8 +929,8 @@ class bingx extends bingx$1 {
|
|
|
928
929
|
/**
|
|
929
930
|
* @method
|
|
930
931
|
* @name bingx#watchBalance
|
|
931
|
-
* @see https://bingx-api.github.io/docs/#/spot/socket/account.html#Subscription%
|
|
932
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
932
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20account%20balance%20push
|
|
933
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
933
934
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
934
935
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
935
936
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|