ccxt 4.1.41 → 4.1.43
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 +6 -5
- package/dist/ccxt.browser.js +2891 -370
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/coinlist.js +9 -0
- package/dist/cjs/src/ascendex.js +162 -32
- package/dist/cjs/src/coinlist.js +2327 -0
- package/dist/cjs/src/probit.js +35 -1
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/coinlist.d.ts +49 -0
- package/js/src/abstract/coinlist.js +11 -0
- package/js/src/ascendex.d.ts +3 -1
- package/js/src/ascendex.js +163 -33
- package/js/src/coinlist.d.ts +142 -0
- package/js/src/coinlist.js +2328 -0
- package/js/src/probit.d.ts +2 -2
- package/js/src/probit.js +35 -1
- package/package.json +1 -1
- package/skip-tests.json +11 -0
package/dist/cjs/ccxt.js
CHANGED
|
@@ -58,6 +58,7 @@ var coinbasepro = require('./src/coinbasepro.js');
|
|
|
58
58
|
var coincheck = require('./src/coincheck.js');
|
|
59
59
|
var coinex = require('./src/coinex.js');
|
|
60
60
|
var coinfalcon = require('./src/coinfalcon.js');
|
|
61
|
+
var coinlist = require('./src/coinlist.js');
|
|
61
62
|
var coinmate = require('./src/coinmate.js');
|
|
62
63
|
var coinone = require('./src/coinone.js');
|
|
63
64
|
var coinsph = require('./src/coinsph.js');
|
|
@@ -180,7 +181,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
180
181
|
|
|
181
182
|
//-----------------------------------------------------------------------------
|
|
182
183
|
// this is updated by vss.js when building
|
|
183
|
-
const version = '4.1.
|
|
184
|
+
const version = '4.1.43';
|
|
184
185
|
Exchange["default"].ccxtVersion = version;
|
|
185
186
|
const exchanges = {
|
|
186
187
|
'ace': ace,
|
|
@@ -229,6 +230,7 @@ const exchanges = {
|
|
|
229
230
|
'coincheck': coincheck,
|
|
230
231
|
'coinex': coinex,
|
|
231
232
|
'coinfalcon': coinfalcon,
|
|
233
|
+
'coinlist': coinlist,
|
|
232
234
|
'coinmate': coinmate,
|
|
233
235
|
'coinone': coinone,
|
|
234
236
|
'coinsph': coinsph,
|
|
@@ -438,6 +440,7 @@ exports.coinbasepro = coinbasepro;
|
|
|
438
440
|
exports.coincheck = coincheck;
|
|
439
441
|
exports.coinex = coinex;
|
|
440
442
|
exports.coinfalcon = coinfalcon;
|
|
443
|
+
exports.coinlist = coinlist;
|
|
441
444
|
exports.coinmate = coinmate;
|
|
442
445
|
exports.coinone = coinone;
|
|
443
446
|
exports.coinsph = coinsph;
|
package/dist/cjs/src/ascendex.js
CHANGED
|
@@ -35,6 +35,7 @@ class ascendex extends ascendex$1 {
|
|
|
35
35
|
'cancelAllOrders': true,
|
|
36
36
|
'cancelOrder': true,
|
|
37
37
|
'createOrder': true,
|
|
38
|
+
'createOrders': true,
|
|
38
39
|
'createPostOnlyOrder': true,
|
|
39
40
|
'createReduceOnlyOrder': true,
|
|
40
41
|
'createStopLimitOrder': true,
|
|
@@ -1460,30 +1461,33 @@ class ascendex extends ascendex$1 {
|
|
|
1460
1461
|
}
|
|
1461
1462
|
return result;
|
|
1462
1463
|
}
|
|
1463
|
-
|
|
1464
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1464
1465
|
/**
|
|
1465
1466
|
* @method
|
|
1466
|
-
* @
|
|
1467
|
-
* @
|
|
1468
|
-
* @
|
|
1469
|
-
* @param {string}
|
|
1470
|
-
* @param {string}
|
|
1471
|
-
* @param {
|
|
1472
|
-
* @param {float}
|
|
1473
|
-
* @param {
|
|
1467
|
+
* @ignore
|
|
1468
|
+
* @name ascendex#createOrderRequest
|
|
1469
|
+
* @description helper function to build request
|
|
1470
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1471
|
+
* @param {string} type 'market' or 'limit'
|
|
1472
|
+
* @param {string} side 'buy' or 'sell'
|
|
1473
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
1474
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1475
|
+
* @param {object} [params] extra parameters specific to the ascendex api endpoint
|
|
1474
1476
|
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
1475
1477
|
* @param {bool} [params.postOnly] true or false
|
|
1476
|
-
* @param {float} [params.stopPrice]
|
|
1477
|
-
* @returns
|
|
1478
|
+
* @param {float} [params.stopPrice] the price at which a trigger order is triggered at
|
|
1479
|
+
* @returns {object} request to be sent to the exchange
|
|
1478
1480
|
*/
|
|
1479
|
-
await this.loadMarkets();
|
|
1480
|
-
await this.loadAccounts();
|
|
1481
1481
|
const market = this.market(symbol);
|
|
1482
|
+
let marginMode = undefined;
|
|
1482
1483
|
let marketType = undefined;
|
|
1483
|
-
[
|
|
1484
|
-
|
|
1484
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrderRequest', params);
|
|
1485
|
+
[marketType, params] = this.handleMarketTypeAndParams('createOrderRequest', market, params);
|
|
1485
1486
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
1486
|
-
|
|
1487
|
+
let accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
1488
|
+
if (marginMode !== undefined) {
|
|
1489
|
+
accountCategory = 'margin';
|
|
1490
|
+
}
|
|
1487
1491
|
const account = this.safeValue(this.accounts, 0, {});
|
|
1488
1492
|
const accountGroup = this.safeValue(account, 'id');
|
|
1489
1493
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'id');
|
|
@@ -1504,13 +1508,6 @@ class ascendex extends ascendex$1 {
|
|
|
1504
1508
|
const postOnly = this.isPostOnly(isMarketOrder, false, params);
|
|
1505
1509
|
const reduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
1506
1510
|
const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
1507
|
-
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'stopPrice', 'triggerPrice']);
|
|
1508
|
-
if (reduceOnly) {
|
|
1509
|
-
if (marketType !== 'swap') {
|
|
1510
|
-
throw new errors.InvalidOrder(this.id + ' createOrder() does not support reduceOnly for ' + marketType + ' orders, reduceOnly orders are supported for perpetuals only');
|
|
1511
|
-
}
|
|
1512
|
-
request['execInst'] = 'ReduceOnly';
|
|
1513
|
-
}
|
|
1514
1511
|
if (isLimitOrder) {
|
|
1515
1512
|
request['orderPrice'] = this.priceToPrecision(symbol, price);
|
|
1516
1513
|
}
|
|
@@ -1535,21 +1532,56 @@ class ascendex extends ascendex$1 {
|
|
|
1535
1532
|
if (clientOrderId !== undefined) {
|
|
1536
1533
|
request['id'] = clientOrderId;
|
|
1537
1534
|
}
|
|
1538
|
-
|
|
1539
|
-
const method = this.getSupportedMapping(marketType, {
|
|
1540
|
-
'spot': defaultMethod,
|
|
1541
|
-
'margin': defaultMethod,
|
|
1542
|
-
'swap': 'v2PrivateAccountGroupPostFuturesOrder',
|
|
1543
|
-
});
|
|
1544
|
-
if (method === 'v1PrivateAccountCategoryPostOrder') {
|
|
1535
|
+
if (market['spot']) {
|
|
1545
1536
|
if (accountCategory !== undefined) {
|
|
1546
1537
|
request['category'] = accountCategory;
|
|
1547
1538
|
}
|
|
1548
1539
|
}
|
|
1549
1540
|
else {
|
|
1550
1541
|
request['account-category'] = accountCategory;
|
|
1542
|
+
if (reduceOnly) {
|
|
1543
|
+
request['execInst'] = 'ReduceOnly';
|
|
1544
|
+
}
|
|
1545
|
+
if (postOnly) {
|
|
1546
|
+
request['execInst'] = 'Post';
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice']);
|
|
1550
|
+
return this.extend(request, params);
|
|
1551
|
+
}
|
|
1552
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1553
|
+
/**
|
|
1554
|
+
* @method
|
|
1555
|
+
* @name ascendex#createOrder
|
|
1556
|
+
* @description create a trade order on the exchange
|
|
1557
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#place-order
|
|
1558
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#new-order
|
|
1559
|
+
* @param {string} symbol unified CCXT market symbol
|
|
1560
|
+
* @param {string} type "limit" or "market"
|
|
1561
|
+
* @param {string} side "buy" or "sell"
|
|
1562
|
+
* @param {float} amount the amount of currency to trade
|
|
1563
|
+
* @param {float} [price] *ignored in "market" orders* the price at which the order is to be fullfilled at in units of the quote currency
|
|
1564
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1565
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
1566
|
+
* @param {bool} [params.postOnly] true or false
|
|
1567
|
+
* @param {float} [params.stopPrice] the price at which a trigger order is triggered at
|
|
1568
|
+
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered (perpetual swap markets only)
|
|
1569
|
+
* @param {float} [params.takeProfit.triggerPrice] *swap only* take profit trigger price
|
|
1570
|
+
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered (perpetual swap markets only)
|
|
1571
|
+
* @param {float} [params.stopLoss.triggerPrice] *swap only* stop loss trigger price
|
|
1572
|
+
* @returns [An order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1573
|
+
*/
|
|
1574
|
+
await this.loadMarkets();
|
|
1575
|
+
await this.loadAccounts();
|
|
1576
|
+
const market = this.market(symbol);
|
|
1577
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
1578
|
+
let response = undefined;
|
|
1579
|
+
if (market['swap']) {
|
|
1580
|
+
response = await this.v2PrivateAccountGroupPostFuturesOrder(request);
|
|
1581
|
+
}
|
|
1582
|
+
else {
|
|
1583
|
+
response = await this.v1PrivateAccountCategoryPostOrder(request);
|
|
1551
1584
|
}
|
|
1552
|
-
const response = await this[method](this.extend(request, params));
|
|
1553
1585
|
//
|
|
1554
1586
|
// spot
|
|
1555
1587
|
//
|
|
@@ -1570,7 +1602,6 @@ class ascendex extends ascendex$1 {
|
|
|
1570
1602
|
// }
|
|
1571
1603
|
// }
|
|
1572
1604
|
//
|
|
1573
|
-
//
|
|
1574
1605
|
// swap
|
|
1575
1606
|
//
|
|
1576
1607
|
// {
|
|
@@ -1618,6 +1649,105 @@ class ascendex extends ascendex$1 {
|
|
|
1618
1649
|
const order = this.safeValue2(data, 'order', 'info', {});
|
|
1619
1650
|
return this.parseOrder(order, market);
|
|
1620
1651
|
}
|
|
1652
|
+
async createOrders(orders, params = {}) {
|
|
1653
|
+
/**
|
|
1654
|
+
* @method
|
|
1655
|
+
* @name ascendex#createOrders
|
|
1656
|
+
* @description create a list of trade orders
|
|
1657
|
+
* @see https://ascendex.github.io/ascendex-pro-api/#place-batch-orders
|
|
1658
|
+
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#place-batch-orders
|
|
1659
|
+
* @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
|
|
1660
|
+
* @param {object} [params] extra parameters specific to the ascendex api endpoint
|
|
1661
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
1662
|
+
* @param {bool} [params.postOnly] true or false
|
|
1663
|
+
* @param {float} [params.stopPrice] the price at which a trigger order is triggered at
|
|
1664
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1665
|
+
*/
|
|
1666
|
+
await this.loadMarkets();
|
|
1667
|
+
await this.loadAccounts();
|
|
1668
|
+
const ordersRequests = [];
|
|
1669
|
+
let symbol = undefined;
|
|
1670
|
+
let marginMode = undefined;
|
|
1671
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1672
|
+
const rawOrder = orders[i];
|
|
1673
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
1674
|
+
if (symbol === undefined) {
|
|
1675
|
+
symbol = marketId;
|
|
1676
|
+
}
|
|
1677
|
+
else {
|
|
1678
|
+
if (symbol !== marketId) {
|
|
1679
|
+
throw new errors.BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
const type = this.safeString(rawOrder, 'type');
|
|
1683
|
+
const side = this.safeString(rawOrder, 'side');
|
|
1684
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
1685
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
1686
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
1687
|
+
const marginResult = this.handleMarginModeAndParams('createOrders', orderParams);
|
|
1688
|
+
const currentMarginMode = marginResult[0];
|
|
1689
|
+
if (currentMarginMode !== undefined) {
|
|
1690
|
+
if (marginMode === undefined) {
|
|
1691
|
+
marginMode = currentMarginMode;
|
|
1692
|
+
}
|
|
1693
|
+
else {
|
|
1694
|
+
if (marginMode !== currentMarginMode) {
|
|
1695
|
+
throw new errors.BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
1700
|
+
ordersRequests.push(orderRequest);
|
|
1701
|
+
}
|
|
1702
|
+
const market = this.market(symbol);
|
|
1703
|
+
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
1704
|
+
let accountCategory = this.safeString(accountsByType, market['type'], 'cash');
|
|
1705
|
+
if (marginMode !== undefined) {
|
|
1706
|
+
accountCategory = 'margin';
|
|
1707
|
+
}
|
|
1708
|
+
const account = this.safeValue(this.accounts, 0, {});
|
|
1709
|
+
const accountGroup = this.safeValue(account, 'id');
|
|
1710
|
+
const request = {};
|
|
1711
|
+
let response = undefined;
|
|
1712
|
+
if (market['swap']) {
|
|
1713
|
+
throw new errors.NotSupported(this.id + ' createOrders() is not currently supported for swap markets on ascendex');
|
|
1714
|
+
// request['account-group'] = accountGroup;
|
|
1715
|
+
// request['category'] = accountCategory;
|
|
1716
|
+
// request['orders'] = ordersRequests;
|
|
1717
|
+
// response = await this.v2PrivateAccountGroupPostFuturesOrderBatch (request);
|
|
1718
|
+
}
|
|
1719
|
+
else {
|
|
1720
|
+
request['account-group'] = accountGroup;
|
|
1721
|
+
request['account-category'] = accountCategory;
|
|
1722
|
+
request['orders'] = ordersRequests;
|
|
1723
|
+
response = await this.v1PrivateAccountCategoryPostOrderBatch(request);
|
|
1724
|
+
}
|
|
1725
|
+
//
|
|
1726
|
+
// spot
|
|
1727
|
+
//
|
|
1728
|
+
// {
|
|
1729
|
+
// "code": 0,
|
|
1730
|
+
// "data": {
|
|
1731
|
+
// "accountId": "cshdAKBO43TKIh2kJtq7FVVb42KIePyS",
|
|
1732
|
+
// "ac": "CASH",
|
|
1733
|
+
// "action": "batch-place-order",
|
|
1734
|
+
// "status": "Ack",
|
|
1735
|
+
// "info": [
|
|
1736
|
+
// {
|
|
1737
|
+
// "symbol": "BTC/USDT",
|
|
1738
|
+
// "orderType": "Limit",
|
|
1739
|
+
// "timestamp": 1699326589344,
|
|
1740
|
+
// "id": "",
|
|
1741
|
+
// "orderId": "a18ba7c1f6efU0711043490p3HvjjN5x"
|
|
1742
|
+
// }
|
|
1743
|
+
// ]
|
|
1744
|
+
// }
|
|
1745
|
+
// }
|
|
1746
|
+
//
|
|
1747
|
+
const data = this.safeValue(response, 'data', {});
|
|
1748
|
+
const info = this.safeValue(data, 'info', []);
|
|
1749
|
+
return this.parseOrders(info, market);
|
|
1750
|
+
}
|
|
1621
1751
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
1622
1752
|
/**
|
|
1623
1753
|
* @method
|