ccxt 4.1.40 → 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 +3125 -420
- 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/base/Exchange.js +18 -1
- package/dist/cjs/src/bingx.js +146 -29
- package/dist/cjs/src/bittrex.js +1 -0
- package/dist/cjs/src/coinbase.js +29 -2
- package/dist/cjs/src/coinlist.js +2327 -0
- package/dist/cjs/src/okx.js +9 -1
- package/dist/cjs/src/pro/binance.js +31 -17
- 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/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +18 -1
- package/js/src/bingx.d.ts +4 -2
- package/js/src/bingx.js +146 -29
- package/js/src/bittrex.js +1 -0
- package/js/src/coinbase.d.ts +3 -3
- package/js/src/coinbase.js +29 -2
- package/js/src/coinlist.d.ts +142 -0
- package/js/src/coinlist.js +2328 -0
- package/js/src/okx.js +9 -1
- package/js/src/pro/binance.js +31 -17
- package/js/src/probit.d.ts +2 -2
- package/js/src/probit.js +35 -1
- package/package.json +1 -1
- package/skip-tests.json +12 -0
|
@@ -576,6 +576,7 @@ export default class Exchange {
|
|
|
576
576
|
createDepositAddress(code: string, params?: {}): Promise<DepositAddressResponse>;
|
|
577
577
|
setLeverage(leverage: any, symbol?: string, params?: {}): Promise<any>;
|
|
578
578
|
parseToInt(number: any): number;
|
|
579
|
+
parseToNumeric(number: any): number;
|
|
579
580
|
afterConstruct(): void;
|
|
580
581
|
createNetworksByIdObject(): void;
|
|
581
582
|
getDefaultOptions(): {
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1446,6 +1446,17 @@ export default class Exchange {
|
|
|
1446
1446
|
const convertedNumber = parseFloat(stringifiedNumber);
|
|
1447
1447
|
return parseInt(convertedNumber);
|
|
1448
1448
|
}
|
|
1449
|
+
parseToNumeric(number) {
|
|
1450
|
+
const stringVersion = this.numberToString(number); // this will convert 1.0 and 1 to "1" and 1.1 to "1.1"
|
|
1451
|
+
// keep this in mind:
|
|
1452
|
+
// in JS: 1 == 1.0 is true
|
|
1453
|
+
// in Python: 1 == 1.0 is true
|
|
1454
|
+
// in PHP 1 == 1.0 is false
|
|
1455
|
+
if (stringVersion.indexOf('.') > 0) {
|
|
1456
|
+
return parseFloat(stringVersion);
|
|
1457
|
+
}
|
|
1458
|
+
return parseInt(stringVersion);
|
|
1459
|
+
}
|
|
1449
1460
|
afterConstruct() {
|
|
1450
1461
|
this.createNetworksByIdObject();
|
|
1451
1462
|
}
|
|
@@ -4427,7 +4438,13 @@ export default class Exchange {
|
|
|
4427
4438
|
}
|
|
4428
4439
|
params[cursorSent] = cursorValue;
|
|
4429
4440
|
}
|
|
4430
|
-
|
|
4441
|
+
let response = undefined;
|
|
4442
|
+
if (method === 'fetchAccounts') {
|
|
4443
|
+
response = await this[method](params);
|
|
4444
|
+
}
|
|
4445
|
+
else {
|
|
4446
|
+
response = await this[method](symbol, since, maxEntriesPerRequest, params);
|
|
4447
|
+
}
|
|
4431
4448
|
errors = 0;
|
|
4432
4449
|
const responseLength = response.length;
|
|
4433
4450
|
if (this.verbose) {
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bingx.js';
|
|
2
|
-
import { Int, OrderSide, OHLCV, FundingRateHistory, Order } from './base/types.js';
|
|
2
|
+
import { Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest } from './base/types.js';
|
|
3
3
|
export default class bingx extends Exchange {
|
|
4
4
|
describe(): any;
|
|
5
5
|
fetchTime(params?: {}): Promise<number>;
|
|
@@ -113,7 +113,9 @@ export default class bingx extends Exchange {
|
|
|
113
113
|
parseBalance(response: any): import("./base/types.js").Balances;
|
|
114
114
|
fetchPositions(symbols?: string[], params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
115
115
|
parsePosition(position: any, market?: any): import("./base/types.js").Position;
|
|
116
|
-
|
|
116
|
+
createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
|
|
117
|
+
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
118
|
+
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
117
119
|
parseOrderSide(side: any): string;
|
|
118
120
|
parseOrder(order: any, market?: any): Order;
|
|
119
121
|
parseOrderStatus(status: any): string;
|
package/js/src/bingx.js
CHANGED
|
@@ -33,6 +33,7 @@ export default class bingx extends Exchange {
|
|
|
33
33
|
'cancelOrder': true,
|
|
34
34
|
'cancelOrders': true,
|
|
35
35
|
'createOrder': true,
|
|
36
|
+
'createOrders': true,
|
|
36
37
|
'fetchBalance': true,
|
|
37
38
|
'fetchClosedOrders': true,
|
|
38
39
|
'fetchCurrencies': true,
|
|
@@ -1591,31 +1592,22 @@ export default class bingx extends Exchange {
|
|
|
1591
1592
|
'takeProfitPrice': undefined,
|
|
1592
1593
|
});
|
|
1593
1594
|
}
|
|
1594
|
-
|
|
1595
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1595
1596
|
/**
|
|
1596
1597
|
* @method
|
|
1597
|
-
* @
|
|
1598
|
-
* @
|
|
1599
|
-
* @
|
|
1600
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Trade%20order
|
|
1598
|
+
* @ignore
|
|
1599
|
+
* @name bingx#createOrderRequest
|
|
1600
|
+
* @description helper function to build request
|
|
1601
1601
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1602
1602
|
* @param {string} type 'market' or 'limit'
|
|
1603
1603
|
* @param {string} side 'buy' or 'sell'
|
|
1604
|
-
* @param {float} amount how much
|
|
1604
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
1605
1605
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1606
1606
|
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
1607
|
-
* @
|
|
1608
|
-
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
1609
|
-
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
1610
|
-
* @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
|
|
1611
|
-
* @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
|
|
1612
|
-
* @param {float} [params.takeProfitPrice] *swap only* take profit trigger price
|
|
1613
|
-
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1607
|
+
* @returns {object} request to be sent to the exchange
|
|
1614
1608
|
*/
|
|
1615
|
-
await this.loadMarkets();
|
|
1616
1609
|
const market = this.market(symbol);
|
|
1617
1610
|
let postOnly = undefined;
|
|
1618
|
-
let response = undefined;
|
|
1619
1611
|
let marketType = undefined;
|
|
1620
1612
|
[marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
|
|
1621
1613
|
type = type.toUpperCase();
|
|
@@ -1645,20 +1637,19 @@ export default class bingx extends Exchange {
|
|
|
1645
1637
|
const amountString = this.numberToString(amount);
|
|
1646
1638
|
const priceString = this.numberToString(price);
|
|
1647
1639
|
const cost = this.parseNumber(Precise.stringMul(amountString, priceString));
|
|
1648
|
-
request['quoteOrderQty'] = this.priceToPrecision(symbol, cost);
|
|
1640
|
+
request['quoteOrderQty'] = this.parseToNumeric(this.priceToPrecision(symbol, cost));
|
|
1649
1641
|
}
|
|
1650
1642
|
}
|
|
1651
1643
|
else {
|
|
1652
|
-
request['quoteOrderQty'] = this.priceToPrecision(symbol, amount);
|
|
1644
|
+
request['quoteOrderQty'] = this.parseToNumeric(this.priceToPrecision(symbol, amount));
|
|
1653
1645
|
}
|
|
1654
1646
|
}
|
|
1655
1647
|
else {
|
|
1656
|
-
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
1648
|
+
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1657
1649
|
}
|
|
1658
1650
|
if (!isMarketOrder) {
|
|
1659
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
1651
|
+
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
1660
1652
|
}
|
|
1661
|
-
response = await this.spotV1PrivatePostTradeOrder(this.extend(request, params));
|
|
1662
1653
|
}
|
|
1663
1654
|
else {
|
|
1664
1655
|
[postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
|
|
@@ -1672,7 +1663,7 @@ export default class bingx extends Exchange {
|
|
|
1672
1663
|
request['timeInForce'] = 'FOK';
|
|
1673
1664
|
}
|
|
1674
1665
|
if ((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) {
|
|
1675
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
1666
|
+
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
1676
1667
|
}
|
|
1677
1668
|
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
|
|
1678
1669
|
const stopLossPrice = this.safeNumber(params, 'stopLossPrice');
|
|
@@ -1680,8 +1671,9 @@ export default class bingx extends Exchange {
|
|
|
1680
1671
|
const isTriggerOrder = triggerPrice !== undefined;
|
|
1681
1672
|
const isStopLossPriceOrder = stopLossPrice !== undefined;
|
|
1682
1673
|
const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
|
|
1674
|
+
let reduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
1683
1675
|
if (isTriggerOrder) {
|
|
1684
|
-
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1676
|
+
request['stopPrice'] = this.parseToNumeric(this.priceToPrecision(symbol, triggerPrice));
|
|
1685
1677
|
if (isMarketOrder || (type === 'TRIGGER_MARKET')) {
|
|
1686
1678
|
request['type'] = 'TRIGGER_MARKET';
|
|
1687
1679
|
}
|
|
@@ -1691,8 +1683,9 @@ export default class bingx extends Exchange {
|
|
|
1691
1683
|
}
|
|
1692
1684
|
else if (isStopLossPriceOrder || isTakeProfitPriceOrder) {
|
|
1693
1685
|
// This can be used to set the stop loss and take profit, but the position needs to be opened first
|
|
1686
|
+
reduceOnly = true;
|
|
1694
1687
|
if (isStopLossPriceOrder) {
|
|
1695
|
-
request['stopPrice'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
1688
|
+
request['stopPrice'] = this.parseToNumeric(this.priceToPrecision(symbol, stopLossPrice));
|
|
1696
1689
|
if (isMarketOrder || (type === 'STOP_MARKET')) {
|
|
1697
1690
|
request['type'] = 'STOP_MARKET';
|
|
1698
1691
|
}
|
|
@@ -1701,7 +1694,7 @@ export default class bingx extends Exchange {
|
|
|
1701
1694
|
}
|
|
1702
1695
|
}
|
|
1703
1696
|
else if (isTakeProfitPriceOrder) {
|
|
1704
|
-
request['stopPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1697
|
+
request['stopPrice'] = this.parseToNumeric(this.priceToPrecision(symbol, takeProfitPrice));
|
|
1705
1698
|
if (isMarketOrder || (type === 'TAKE_PROFIT_MARKET')) {
|
|
1706
1699
|
request['type'] = 'TAKE_PROFIT_MARKET';
|
|
1707
1700
|
}
|
|
@@ -1710,7 +1703,6 @@ export default class bingx extends Exchange {
|
|
|
1710
1703
|
}
|
|
1711
1704
|
}
|
|
1712
1705
|
}
|
|
1713
|
-
const reduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
1714
1706
|
let positionSide = undefined;
|
|
1715
1707
|
if (reduceOnly) {
|
|
1716
1708
|
positionSide = (side === 'buy') ? 'SHORT' : 'LONG';
|
|
@@ -1719,9 +1711,41 @@ export default class bingx extends Exchange {
|
|
|
1719
1711
|
positionSide = (side === 'buy') ? 'LONG' : 'SHORT';
|
|
1720
1712
|
}
|
|
1721
1713
|
request['positionSide'] = positionSide;
|
|
1722
|
-
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
1714
|
+
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1723
1715
|
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
1724
|
-
|
|
1716
|
+
}
|
|
1717
|
+
return this.extend(request, params);
|
|
1718
|
+
}
|
|
1719
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1720
|
+
/**
|
|
1721
|
+
* @method
|
|
1722
|
+
* @name bingx#createOrder
|
|
1723
|
+
* @description create a trade order
|
|
1724
|
+
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Create%20an%20Order
|
|
1725
|
+
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Trade%20order
|
|
1726
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1727
|
+
* @param {string} type 'market' or 'limit'
|
|
1728
|
+
* @param {string} side 'buy' or 'sell'
|
|
1729
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
1730
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1731
|
+
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
1732
|
+
* @param {bool} [params.postOnly] true to place a post only order
|
|
1733
|
+
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
1734
|
+
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
1735
|
+
* @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
|
|
1736
|
+
* @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
|
|
1737
|
+
* @param {float} [params.takeProfitPrice] *swap only* take profit trigger price
|
|
1738
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1739
|
+
*/
|
|
1740
|
+
await this.loadMarkets();
|
|
1741
|
+
const market = this.market(symbol);
|
|
1742
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
1743
|
+
let response = undefined;
|
|
1744
|
+
if (market['swap']) {
|
|
1745
|
+
response = await this.swapV2PrivatePostTradeOrder(request);
|
|
1746
|
+
}
|
|
1747
|
+
else {
|
|
1748
|
+
response = await this.spotV1PrivatePostTradeOrder(request);
|
|
1725
1749
|
}
|
|
1726
1750
|
//
|
|
1727
1751
|
// spot
|
|
@@ -1765,6 +1789,99 @@ export default class bingx extends Exchange {
|
|
|
1765
1789
|
const order = this.safeValue(data, 'order', data);
|
|
1766
1790
|
return this.parseOrder(order, market);
|
|
1767
1791
|
}
|
|
1792
|
+
async createOrders(orders, params = {}) {
|
|
1793
|
+
/**
|
|
1794
|
+
* @method
|
|
1795
|
+
* @name bingx#createOrders
|
|
1796
|
+
* @description create a list of trade orders
|
|
1797
|
+
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Batch%20Placing%20Orders
|
|
1798
|
+
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Bulk%20order
|
|
1799
|
+
* @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
|
|
1800
|
+
* @param {object} [params] extra parameters specific to the bingx api endpoint
|
|
1801
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1802
|
+
*/
|
|
1803
|
+
await this.loadMarkets();
|
|
1804
|
+
const ordersRequests = [];
|
|
1805
|
+
let symbol = undefined;
|
|
1806
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1807
|
+
const rawOrder = orders[i];
|
|
1808
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
1809
|
+
if (symbol === undefined) {
|
|
1810
|
+
symbol = marketId;
|
|
1811
|
+
}
|
|
1812
|
+
else {
|
|
1813
|
+
if (symbol !== marketId) {
|
|
1814
|
+
throw new BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
const type = this.safeString(rawOrder, 'type');
|
|
1818
|
+
const side = this.safeString(rawOrder, 'side');
|
|
1819
|
+
const amount = this.safeNumber(rawOrder, 'amount');
|
|
1820
|
+
const price = this.safeNumber(rawOrder, 'price');
|
|
1821
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
1822
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
1823
|
+
ordersRequests.push(orderRequest);
|
|
1824
|
+
}
|
|
1825
|
+
const market = this.market(symbol);
|
|
1826
|
+
const request = {};
|
|
1827
|
+
let response = undefined;
|
|
1828
|
+
if (market['swap']) {
|
|
1829
|
+
request['batchOrders'] = this.json(ordersRequests);
|
|
1830
|
+
response = await this.swapV2PrivatePostTradeBatchOrders(request);
|
|
1831
|
+
}
|
|
1832
|
+
else {
|
|
1833
|
+
request['data'] = this.json(ordersRequests);
|
|
1834
|
+
response = await this.spotV1PrivatePostTradeBatchOrders(request);
|
|
1835
|
+
}
|
|
1836
|
+
//
|
|
1837
|
+
// spot
|
|
1838
|
+
//
|
|
1839
|
+
// {
|
|
1840
|
+
// "code": 0,
|
|
1841
|
+
// "msg": "",
|
|
1842
|
+
// "debugMsg": "",
|
|
1843
|
+
// "data": {
|
|
1844
|
+
// "orders": [
|
|
1845
|
+
// {
|
|
1846
|
+
// "symbol": "BTC-USDT",
|
|
1847
|
+
// "orderId": 1720661389564968960,
|
|
1848
|
+
// "transactTime": 1699072618272,
|
|
1849
|
+
// "price": "25000",
|
|
1850
|
+
// "origQty": "0.0002",
|
|
1851
|
+
// "executedQty": "0",
|
|
1852
|
+
// "cummulativeQuoteQty": "0",
|
|
1853
|
+
// "status": "PENDING",
|
|
1854
|
+
// "type": "LIMIT",
|
|
1855
|
+
// "side": "BUY"
|
|
1856
|
+
// },
|
|
1857
|
+
// ]
|
|
1858
|
+
// }
|
|
1859
|
+
// }
|
|
1860
|
+
//
|
|
1861
|
+
// swap
|
|
1862
|
+
//
|
|
1863
|
+
// {
|
|
1864
|
+
// "code": 0,
|
|
1865
|
+
// "msg": "",
|
|
1866
|
+
// "data": {
|
|
1867
|
+
// "orders": [
|
|
1868
|
+
// {
|
|
1869
|
+
// "symbol": "BTC-USDT",
|
|
1870
|
+
// "orderId": 1720657081994006528,
|
|
1871
|
+
// "side": "BUY",
|
|
1872
|
+
// "positionSide": "LONG",
|
|
1873
|
+
// "type": "LIMIT",
|
|
1874
|
+
// "clientOrderID": "",
|
|
1875
|
+
// "workingType": ""
|
|
1876
|
+
// },
|
|
1877
|
+
// ]
|
|
1878
|
+
// }
|
|
1879
|
+
// }
|
|
1880
|
+
//
|
|
1881
|
+
const data = this.safeValue(response, 'data', {});
|
|
1882
|
+
const result = this.safeValue(data, 'orders', []);
|
|
1883
|
+
return this.parseOrders(result, market);
|
|
1884
|
+
}
|
|
1768
1885
|
parseOrderSide(side) {
|
|
1769
1886
|
const sides = {
|
|
1770
1887
|
'BUY': 'buy',
|
|
@@ -1777,7 +1894,7 @@ export default class bingx extends Exchange {
|
|
|
1777
1894
|
parseOrder(order, market = undefined) {
|
|
1778
1895
|
//
|
|
1779
1896
|
// spot
|
|
1780
|
-
// createOrder, cancelOrder
|
|
1897
|
+
// createOrder, createOrders, cancelOrder
|
|
1781
1898
|
//
|
|
1782
1899
|
// {
|
|
1783
1900
|
// "symbol": "XRP-USDT",
|
|
@@ -1830,7 +1947,7 @@ export default class bingx extends Exchange {
|
|
|
1830
1947
|
//
|
|
1831
1948
|
//
|
|
1832
1949
|
// swap
|
|
1833
|
-
// createOrder
|
|
1950
|
+
// createOrder, createOrders
|
|
1834
1951
|
//
|
|
1835
1952
|
// {
|
|
1836
1953
|
// "symbol": "BTC-USDT",
|
package/js/src/bittrex.js
CHANGED
package/js/src/coinbase.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ import { Int, OrderSide, OrderType, Order, Trade, OHLCV } from './base/types.js'
|
|
|
7
7
|
export default class coinbase extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
9
|
fetchTime(params?: {}): Promise<number>;
|
|
10
|
-
fetchAccounts(params?: {}): Promise<any
|
|
11
|
-
fetchAccountsV2(params?: {}): Promise<any
|
|
12
|
-
fetchAccountsV3(params?: {}): Promise<any
|
|
10
|
+
fetchAccounts(params?: {}): Promise<any>;
|
|
11
|
+
fetchAccountsV2(params?: {}): Promise<any>;
|
|
12
|
+
fetchAccountsV3(params?: {}): Promise<any>;
|
|
13
13
|
parseAccount(account: any): {
|
|
14
14
|
id: string;
|
|
15
15
|
type: string;
|
package/js/src/coinbase.js
CHANGED
|
@@ -322,6 +322,7 @@ export default class coinbase extends Exchange {
|
|
|
322
322
|
* @name coinbase#fetchAccounts
|
|
323
323
|
* @description fetch all the accounts associated with a profile
|
|
324
324
|
* @param {object} [params] extra parameters specific to the coinbase api endpoint
|
|
325
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
325
326
|
* @returns {object} a dictionary of [account structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#account-structure} indexed by the account type
|
|
326
327
|
*/
|
|
327
328
|
const method = this.safeString(this.options, 'fetchAccounts', 'fetchAccountsV3');
|
|
@@ -332,6 +333,11 @@ export default class coinbase extends Exchange {
|
|
|
332
333
|
}
|
|
333
334
|
async fetchAccountsV2(params = {}) {
|
|
334
335
|
await this.loadMarkets();
|
|
336
|
+
let paginate = false;
|
|
337
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchAccounts', 'paginate');
|
|
338
|
+
if (paginate) {
|
|
339
|
+
return await this.fetchPaginatedCallCursor('fetchAccounts', undefined, undefined, undefined, params, 'next_starting_after', 'starting_after', undefined, 100);
|
|
340
|
+
}
|
|
335
341
|
const request = {
|
|
336
342
|
'limit': 100,
|
|
337
343
|
};
|
|
@@ -381,10 +387,24 @@ export default class coinbase extends Exchange {
|
|
|
381
387
|
// }
|
|
382
388
|
//
|
|
383
389
|
const data = this.safeValue(response, 'data', []);
|
|
390
|
+
const pagination = this.safeValue(response, 'pagination', {});
|
|
391
|
+
const cursor = this.safeString(pagination, 'next_starting_after');
|
|
392
|
+
const accounts = this.safeValue(response, 'data', []);
|
|
393
|
+
const lastIndex = accounts.length - 1;
|
|
394
|
+
const last = this.safeValue(accounts, lastIndex);
|
|
395
|
+
if ((cursor !== undefined) && (cursor !== '')) {
|
|
396
|
+
last['next_starting_after'] = cursor;
|
|
397
|
+
accounts[lastIndex] = last;
|
|
398
|
+
}
|
|
384
399
|
return this.parseAccounts(data, params);
|
|
385
400
|
}
|
|
386
401
|
async fetchAccountsV3(params = {}) {
|
|
387
402
|
await this.loadMarkets();
|
|
403
|
+
let paginate = false;
|
|
404
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchAccounts', 'paginate');
|
|
405
|
+
if (paginate) {
|
|
406
|
+
return await this.fetchPaginatedCallCursor('fetchAccounts', undefined, undefined, undefined, params, 'cursor', 'cursor', undefined, 100);
|
|
407
|
+
}
|
|
388
408
|
const request = {
|
|
389
409
|
'limit': 100,
|
|
390
410
|
};
|
|
@@ -419,8 +439,15 @@ export default class coinbase extends Exchange {
|
|
|
419
439
|
// "size": 9
|
|
420
440
|
// }
|
|
421
441
|
//
|
|
422
|
-
const
|
|
423
|
-
|
|
442
|
+
const accounts = this.safeValue(response, 'accounts', []);
|
|
443
|
+
const lastIndex = accounts.length - 1;
|
|
444
|
+
const last = this.safeValue(accounts, lastIndex);
|
|
445
|
+
const cursor = this.safeString(response, 'cursor');
|
|
446
|
+
if ((cursor !== undefined) && (cursor !== '')) {
|
|
447
|
+
last['cursor'] = cursor;
|
|
448
|
+
accounts[lastIndex] = last;
|
|
449
|
+
}
|
|
450
|
+
return this.parseAccounts(accounts, params);
|
|
424
451
|
}
|
|
425
452
|
parseAccount(account) {
|
|
426
453
|
//
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import Exchange from './abstract/coinlist.js';
|
|
2
|
+
import { Int, OHLCV, OrderSide, OrderType } from './base/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @class coinlist
|
|
5
|
+
* @extends Exchange
|
|
6
|
+
*/
|
|
7
|
+
export default class coinlist extends Exchange {
|
|
8
|
+
describe(): any;
|
|
9
|
+
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): number;
|
|
10
|
+
fetchTime(params?: {}): Promise<number>;
|
|
11
|
+
fetchCurrencies(params?: {}): Promise<{}>;
|
|
12
|
+
fetchMarkets(params?: {}): Promise<any[]>;
|
|
13
|
+
fetchTickers(symbols?: string[], params?: {}): Promise<import("./base/types.js").Dictionary<import("./base/types.js").Ticker>>;
|
|
14
|
+
fetchTicker(symbol: string, params?: {}): Promise<import("./base/types.js").Ticker>;
|
|
15
|
+
parseTicker(ticker: any, market?: any): import("./base/types.js").Ticker;
|
|
16
|
+
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<import("./base/types.js").OrderBook>;
|
|
17
|
+
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
18
|
+
parseOHLCV(ohlcv: any, market?: any): OHLCV;
|
|
19
|
+
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
|
|
20
|
+
parseTrade(trade: any, market?: any): import("./base/types.js").Trade;
|
|
21
|
+
fetchTradingFees(params?: {}): Promise<{}>;
|
|
22
|
+
parseFeeTiers(feeTiers: any, market?: any): {
|
|
23
|
+
maker: any[];
|
|
24
|
+
taker: any[];
|
|
25
|
+
};
|
|
26
|
+
fetchAccounts(params?: {}): Promise<any[]>;
|
|
27
|
+
parseAccount(account: any): {
|
|
28
|
+
id: string;
|
|
29
|
+
type: string;
|
|
30
|
+
code: any;
|
|
31
|
+
info: any;
|
|
32
|
+
};
|
|
33
|
+
fetchBalance(params?: {}): Promise<import("./base/types.js").Balances>;
|
|
34
|
+
parseBalance(response: any): import("./base/types.js").Balances;
|
|
35
|
+
fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
|
|
36
|
+
fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
|
|
37
|
+
fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
|
|
38
|
+
fetchOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
|
|
39
|
+
fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
|
|
40
|
+
fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
|
|
41
|
+
fetchCanceledOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
|
|
42
|
+
cancelAllOrders(symbol?: string, params?: {}): Promise<import("./base/types.js").Order[]>;
|
|
43
|
+
cancelOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
|
|
44
|
+
cancelOrders(ids: any, symbol?: string, params?: {}): Promise<any>;
|
|
45
|
+
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
|
|
46
|
+
editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
|
|
47
|
+
parseOrder(order: any, market?: any): import("./base/types.js").Order;
|
|
48
|
+
parseOrderStatus(status: any): string;
|
|
49
|
+
parseOrderType(status: any): string;
|
|
50
|
+
transfer(code: string, amount: any, fromAccount: any, toAccount: any, params?: {}): Promise<{
|
|
51
|
+
info: any;
|
|
52
|
+
id: string;
|
|
53
|
+
timestamp: number;
|
|
54
|
+
datetime: string;
|
|
55
|
+
currency: any;
|
|
56
|
+
amount: any;
|
|
57
|
+
fromAccount: any;
|
|
58
|
+
toAccount: any;
|
|
59
|
+
status: string;
|
|
60
|
+
}>;
|
|
61
|
+
fetchTransfers(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
62
|
+
parseTransfer(transfer: any, currency?: any): {
|
|
63
|
+
info: any;
|
|
64
|
+
id: string;
|
|
65
|
+
timestamp: number;
|
|
66
|
+
datetime: string;
|
|
67
|
+
currency: any;
|
|
68
|
+
amount: any;
|
|
69
|
+
fromAccount: any;
|
|
70
|
+
toAccount: any;
|
|
71
|
+
status: string;
|
|
72
|
+
};
|
|
73
|
+
parseTransferStatus(status: any): string;
|
|
74
|
+
fetchDepositsWithdrawals(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
75
|
+
withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<{
|
|
76
|
+
info: any;
|
|
77
|
+
id: string;
|
|
78
|
+
txid: any;
|
|
79
|
+
timestamp: number;
|
|
80
|
+
datetime: string;
|
|
81
|
+
network: any;
|
|
82
|
+
addressFrom: any;
|
|
83
|
+
address: any;
|
|
84
|
+
addressTo: any;
|
|
85
|
+
tagFrom: any;
|
|
86
|
+
tag: any;
|
|
87
|
+
tagTo: any;
|
|
88
|
+
type: string;
|
|
89
|
+
amount: number;
|
|
90
|
+
currency: any;
|
|
91
|
+
status: any;
|
|
92
|
+
updated: any;
|
|
93
|
+
fee: any;
|
|
94
|
+
}>;
|
|
95
|
+
parseTransaction(transaction: any, currency?: any): {
|
|
96
|
+
info: any;
|
|
97
|
+
id: string;
|
|
98
|
+
txid: any;
|
|
99
|
+
timestamp: number;
|
|
100
|
+
datetime: string;
|
|
101
|
+
network: any;
|
|
102
|
+
addressFrom: any;
|
|
103
|
+
address: any;
|
|
104
|
+
addressTo: any;
|
|
105
|
+
tagFrom: any;
|
|
106
|
+
tag: any;
|
|
107
|
+
tagTo: any;
|
|
108
|
+
type: string;
|
|
109
|
+
amount: number;
|
|
110
|
+
currency: any;
|
|
111
|
+
status: any;
|
|
112
|
+
updated: any;
|
|
113
|
+
fee: any;
|
|
114
|
+
};
|
|
115
|
+
parseTransactionType(type: any): string;
|
|
116
|
+
fetchLedger(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
117
|
+
parseLedgerEntry(item: any, currency?: any): {
|
|
118
|
+
info: any;
|
|
119
|
+
id: string;
|
|
120
|
+
timestamp: number;
|
|
121
|
+
datetime: string;
|
|
122
|
+
direction: any;
|
|
123
|
+
account: string;
|
|
124
|
+
referenceId: any;
|
|
125
|
+
referenceAccount: any;
|
|
126
|
+
type: string;
|
|
127
|
+
currency: any;
|
|
128
|
+
amount: number;
|
|
129
|
+
before: any;
|
|
130
|
+
after: any;
|
|
131
|
+
status: string;
|
|
132
|
+
fee: any;
|
|
133
|
+
};
|
|
134
|
+
parseLedgerEntryType(type: any): string;
|
|
135
|
+
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
136
|
+
url: string;
|
|
137
|
+
method: string;
|
|
138
|
+
body: any;
|
|
139
|
+
headers: any;
|
|
140
|
+
};
|
|
141
|
+
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
142
|
+
}
|