ccxt 4.0.110 → 4.0.112
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/CHANGELOG.md +89 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +319 -106
- package/dist/ccxt.browser.min.js +9 -9
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +2 -1
- package/dist/cjs/src/bitmart.js +124 -47
- package/dist/cjs/src/bybit.js +7 -6
- package/dist/cjs/src/coinbasepro.js +52 -8
- package/dist/cjs/src/latoken.js +133 -43
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/binance.js +2 -1
- package/js/src/bitmart.js +124 -47
- package/js/src/bybit.js +7 -6
- package/js/src/coinbasepro.js +52 -8
- package/js/src/latoken.js +134 -44
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -179,7 +179,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
179
179
|
|
|
180
180
|
//-----------------------------------------------------------------------------
|
|
181
181
|
// this is updated by vss.js when building
|
|
182
|
-
const version = '4.0.
|
|
182
|
+
const version = '4.0.112';
|
|
183
183
|
Exchange["default"].ccxtVersion = version;
|
|
184
184
|
const exchanges = {
|
|
185
185
|
'ace': ace,
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -69,7 +69,7 @@ class binance extends binance$1 {
|
|
|
69
69
|
'fetchFundingRateHistory': true,
|
|
70
70
|
'fetchFundingRates': true,
|
|
71
71
|
'fetchIndexOHLCV': true,
|
|
72
|
-
'fetchL3OrderBook':
|
|
72
|
+
'fetchL3OrderBook': false,
|
|
73
73
|
'fetchLastPrices': true,
|
|
74
74
|
'fetchLedger': true,
|
|
75
75
|
'fetchLeverage': false,
|
|
@@ -108,6 +108,7 @@ class binance extends binance$1 {
|
|
|
108
108
|
'fetchTransfers': true,
|
|
109
109
|
'fetchUnderlyingAssets': false,
|
|
110
110
|
'fetchVolatilityHistory': false,
|
|
111
|
+
'fetchWithdrawAddresses': false,
|
|
111
112
|
'fetchWithdrawal': false,
|
|
112
113
|
'fetchWithdrawals': true,
|
|
113
114
|
'fetchWithdrawalWhitelist': false,
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -1312,7 +1312,7 @@ class bitmart extends bitmart$1 {
|
|
|
1312
1312
|
// "type": "buy"
|
|
1313
1313
|
// }
|
|
1314
1314
|
//
|
|
1315
|
-
//
|
|
1315
|
+
// spot: fetchMyTrades
|
|
1316
1316
|
//
|
|
1317
1317
|
// {
|
|
1318
1318
|
// "tradeId":"182342999769370687",
|
|
@@ -1331,28 +1331,42 @@ class bitmart extends bitmart$1 {
|
|
|
1331
1331
|
// "createTime":1695658457836,
|
|
1332
1332
|
// }
|
|
1333
1333
|
//
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1334
|
+
// swap: fetchMyTrades
|
|
1335
|
+
//
|
|
1336
|
+
// {
|
|
1337
|
+
// "order_id": "230930336848609",
|
|
1338
|
+
// "trade_id": "6212604014",
|
|
1339
|
+
// "symbol": "BTCUSDT",
|
|
1340
|
+
// "side": 3,
|
|
1341
|
+
// "price": "26910.4",
|
|
1342
|
+
// "vol": "1",
|
|
1343
|
+
// "exec_type": "Taker",
|
|
1344
|
+
// "profit": false,
|
|
1345
|
+
// "create_time": 1695961596692,
|
|
1346
|
+
// "realised_profit": "-0.0003",
|
|
1347
|
+
// "paid_fees": "0.01614624"
|
|
1348
|
+
// }
|
|
1349
|
+
//
|
|
1350
|
+
const timestamp = this.safeIntegerN(trade, ['order_time', 'createTime', 'create_time']);
|
|
1338
1351
|
const isPublicTrade = ('order_time' in trade);
|
|
1339
|
-
const price = this.safeString(trade, 'price');
|
|
1340
1352
|
let amount = undefined;
|
|
1341
1353
|
let cost = undefined;
|
|
1342
1354
|
let type = undefined;
|
|
1355
|
+
let side = undefined;
|
|
1343
1356
|
if (isPublicTrade) {
|
|
1344
1357
|
amount = this.safeString(trade, 'count');
|
|
1345
1358
|
cost = this.safeString(trade, 'amount');
|
|
1359
|
+
side = this.safeString(trade, 'type');
|
|
1346
1360
|
}
|
|
1347
1361
|
else {
|
|
1348
|
-
amount = this.
|
|
1362
|
+
amount = this.safeString2(trade, 'size', 'vol');
|
|
1349
1363
|
cost = this.safeString(trade, 'notional');
|
|
1350
1364
|
type = this.safeString(trade, 'type');
|
|
1365
|
+
side = this.parseOrderSide(this.safeString(trade, 'side'));
|
|
1351
1366
|
}
|
|
1352
|
-
const orderId = this.safeString(trade, 'orderId');
|
|
1353
1367
|
const marketId = this.safeString(trade, 'symbol');
|
|
1354
|
-
market = this.safeMarket(marketId, market
|
|
1355
|
-
const feeCostString = this.
|
|
1368
|
+
market = this.safeMarket(marketId, market);
|
|
1369
|
+
const feeCostString = this.safeString2(trade, 'fee', 'paid_fees');
|
|
1356
1370
|
let fee = undefined;
|
|
1357
1371
|
if (feeCostString !== undefined) {
|
|
1358
1372
|
const feeCurrencyId = this.safeString(trade, 'feeCoinName');
|
|
@@ -1367,17 +1381,17 @@ class bitmart extends bitmart$1 {
|
|
|
1367
1381
|
}
|
|
1368
1382
|
return this.safeTrade({
|
|
1369
1383
|
'info': trade,
|
|
1370
|
-
'id':
|
|
1371
|
-
'order': orderId,
|
|
1384
|
+
'id': this.safeString2(trade, 'tradeId', 'trade_id'),
|
|
1385
|
+
'order': this.safeString2(trade, 'orderId', 'order_id'),
|
|
1372
1386
|
'timestamp': timestamp,
|
|
1373
1387
|
'datetime': this.iso8601(timestamp),
|
|
1374
1388
|
'symbol': market['symbol'],
|
|
1375
1389
|
'type': type,
|
|
1376
1390
|
'side': side,
|
|
1377
|
-
'price': price,
|
|
1391
|
+
'price': this.safeString(trade, 'price'),
|
|
1378
1392
|
'amount': amount,
|
|
1379
1393
|
'cost': cost,
|
|
1380
|
-
'takerOrMaker':
|
|
1394
|
+
'takerOrMaker': this.safeStringLower2(trade, 'tradeRole', 'exec_type'),
|
|
1381
1395
|
'fee': fee,
|
|
1382
1396
|
}, market);
|
|
1383
1397
|
}
|
|
@@ -1580,6 +1594,7 @@ class bitmart extends bitmart$1 {
|
|
|
1580
1594
|
* @method
|
|
1581
1595
|
* @name bitmart#fetchMyTrades
|
|
1582
1596
|
* @see https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed
|
|
1597
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-order-trade-keyed
|
|
1583
1598
|
* @description fetch all trades made by the user
|
|
1584
1599
|
* @param {string} symbol unified market symbol
|
|
1585
1600
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -1594,32 +1609,46 @@ class bitmart extends bitmart$1 {
|
|
|
1594
1609
|
const request = {};
|
|
1595
1610
|
if (symbol !== undefined) {
|
|
1596
1611
|
market = this.market(symbol);
|
|
1612
|
+
request['symbol'] = market['id'];
|
|
1597
1613
|
}
|
|
1598
1614
|
let type = undefined;
|
|
1615
|
+
let response = undefined;
|
|
1599
1616
|
[type, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1617
|
+
const until = this.safeIntegerN(params, ['until', 'endTime', 'end_time']);
|
|
1618
|
+
params = this.omit(params, ['until']);
|
|
1619
|
+
if (type === 'spot') {
|
|
1620
|
+
let marginMode = undefined;
|
|
1621
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
1622
|
+
if (marginMode === 'isolated') {
|
|
1623
|
+
request['orderMode'] = 'iso_margin';
|
|
1624
|
+
}
|
|
1625
|
+
const options = this.safeValue(this.options, 'fetchMyTrades', {});
|
|
1626
|
+
const defaultLimit = this.safeInteger(options, 'limit', 200);
|
|
1627
|
+
if (limit === undefined) {
|
|
1628
|
+
limit = defaultLimit;
|
|
1629
|
+
}
|
|
1630
|
+
request['limit'] = limit;
|
|
1631
|
+
if (since !== undefined) {
|
|
1632
|
+
request['startTime'] = since;
|
|
1633
|
+
}
|
|
1634
|
+
if (until !== undefined) {
|
|
1635
|
+
request['endTime'] = until;
|
|
1636
|
+
}
|
|
1637
|
+
response = await this.privatePostSpotV4QueryTrades(this.extend(request, params));
|
|
1612
1638
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1639
|
+
else if (type === 'swap') {
|
|
1640
|
+
this.checkRequiredSymbol('fetchMyTrades', symbol);
|
|
1641
|
+
if (since !== undefined) {
|
|
1642
|
+
request['start_time'] = since;
|
|
1643
|
+
}
|
|
1644
|
+
if (until !== undefined) {
|
|
1645
|
+
request['end_time'] = until;
|
|
1646
|
+
}
|
|
1647
|
+
response = await this.privateGetContractPrivateTrades(this.extend(request, params));
|
|
1616
1648
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
params = this.omit(params, ['endTime']);
|
|
1620
|
-
request['endTime'] = until;
|
|
1649
|
+
else {
|
|
1650
|
+
throw new errors.NotSupported(this.id + ' fetchMyTrades() does not support ' + type + ' orders, only spot and swap orders are accepted');
|
|
1621
1651
|
}
|
|
1622
|
-
const response = await this.privatePostSpotV4QueryTrades(this.extend(request, params));
|
|
1623
1652
|
//
|
|
1624
1653
|
// spot
|
|
1625
1654
|
//
|
|
@@ -1648,7 +1677,30 @@ class bitmart extends bitmart$1 {
|
|
|
1648
1677
|
// "trace":"fbaee9e0e2f5442fba5b3262fc86b0ac.65.16956593456523085"
|
|
1649
1678
|
// }
|
|
1650
1679
|
//
|
|
1651
|
-
|
|
1680
|
+
// swap
|
|
1681
|
+
//
|
|
1682
|
+
// {
|
|
1683
|
+
// "code": 1000,
|
|
1684
|
+
// "message": "Ok",
|
|
1685
|
+
// "data": [
|
|
1686
|
+
// {
|
|
1687
|
+
// "order_id": "230930336848609",
|
|
1688
|
+
// "trade_id": "6212604014",
|
|
1689
|
+
// "symbol": "BTCUSDT",
|
|
1690
|
+
// "side": 3,
|
|
1691
|
+
// "price": "26910.4",
|
|
1692
|
+
// "vol": "1",
|
|
1693
|
+
// "exec_type": "Taker",
|
|
1694
|
+
// "profit": false,
|
|
1695
|
+
// "create_time": 1695961596692,
|
|
1696
|
+
// "realised_profit": "-0.0003",
|
|
1697
|
+
// "paid_fees": "0.01614624"
|
|
1698
|
+
// },
|
|
1699
|
+
// ],
|
|
1700
|
+
// "trace": "4cad855074634097ac6ba5257c47305d.62.16959616054873723"
|
|
1701
|
+
// }
|
|
1702
|
+
//
|
|
1703
|
+
const data = this.safeValue(response, 'data', []);
|
|
1652
1704
|
return this.parseTrades(data, market, since, limit);
|
|
1653
1705
|
}
|
|
1654
1706
|
async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -2017,10 +2069,10 @@ class bitmart extends bitmart$1 {
|
|
|
2017
2069
|
}
|
|
2018
2070
|
parseOrderSide(side) {
|
|
2019
2071
|
const sides = {
|
|
2020
|
-
'1': '
|
|
2021
|
-
'2': '
|
|
2022
|
-
'3': '
|
|
2023
|
-
'4': '
|
|
2072
|
+
'1': 'buy',
|
|
2073
|
+
'2': 'buy',
|
|
2074
|
+
'3': 'sell',
|
|
2075
|
+
'4': 'sell',
|
|
2024
2076
|
};
|
|
2025
2077
|
return this.safeString(sides, side, side);
|
|
2026
2078
|
}
|
|
@@ -2159,25 +2211,47 @@ class bitmart extends bitmart$1 {
|
|
|
2159
2211
|
/**
|
|
2160
2212
|
* @method
|
|
2161
2213
|
* @name bitmart#cancelOrder
|
|
2214
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
|
2215
|
+
* @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
|
2216
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2162
2217
|
* @description cancels an open order
|
|
2163
2218
|
* @param {string} id order id
|
|
2164
2219
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2165
2220
|
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
2221
|
+
* @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
|
|
2222
|
+
* @param {boolean} [params.stop] *swap only* whether the order is a stop order
|
|
2166
2223
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
2167
2224
|
*/
|
|
2168
|
-
|
|
2169
|
-
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
2170
|
-
}
|
|
2225
|
+
this.checkRequiredSymbol('cancelOrder', symbol);
|
|
2171
2226
|
await this.loadMarkets();
|
|
2172
2227
|
const market = this.market(symbol);
|
|
2173
|
-
if (!market['spot']) {
|
|
2174
|
-
throw new errors.NotSupported(this.id + ' cancelOrder() does not support ' + market['type'] + ' orders, only spot orders are accepted');
|
|
2175
|
-
}
|
|
2176
2228
|
const request = {
|
|
2177
|
-
'order_id': id.toString(),
|
|
2178
2229
|
'symbol': market['id'],
|
|
2179
2230
|
};
|
|
2180
|
-
const
|
|
2231
|
+
const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
|
|
2232
|
+
if (clientOrderId !== undefined) {
|
|
2233
|
+
request['client_order_id'] = clientOrderId;
|
|
2234
|
+
}
|
|
2235
|
+
else {
|
|
2236
|
+
request['order_id'] = id.toString();
|
|
2237
|
+
}
|
|
2238
|
+
params = this.omit(params, ['clientOrderId']);
|
|
2239
|
+
let response = undefined;
|
|
2240
|
+
if (market['spot']) {
|
|
2241
|
+
response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
|
|
2242
|
+
}
|
|
2243
|
+
else {
|
|
2244
|
+
const stop = this.safeValue(params, 'stop');
|
|
2245
|
+
params = this.omit(params, ['stop']);
|
|
2246
|
+
if (!stop) {
|
|
2247
|
+
response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
|
|
2248
|
+
}
|
|
2249
|
+
else {
|
|
2250
|
+
response = await this.privatePostContractPrivateCancelPlanOrder(this.extend(request, params));
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
// swap
|
|
2254
|
+
// {"code":1000,"message":"Ok","trace":"7f9c94e10f9d4513bc08a7bfc2a5559a.55.16959817848001851"}
|
|
2181
2255
|
//
|
|
2182
2256
|
// spot
|
|
2183
2257
|
//
|
|
@@ -2199,6 +2273,9 @@ class bitmart extends bitmart$1 {
|
|
|
2199
2273
|
// "data": true
|
|
2200
2274
|
// }
|
|
2201
2275
|
//
|
|
2276
|
+
if (market['swap']) {
|
|
2277
|
+
return response;
|
|
2278
|
+
}
|
|
2202
2279
|
const data = this.safeValue(response, 'data');
|
|
2203
2280
|
if (data === true) {
|
|
2204
2281
|
return this.parseOrder(id, market);
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -245,6 +245,7 @@ class bybit extends bybit$1 {
|
|
|
245
245
|
'v5/market/insurance': 2.5,
|
|
246
246
|
'v5/market/risk-limit': 2.5,
|
|
247
247
|
'v5/market/delivery-price': 2.5,
|
|
248
|
+
'v5/market/account-ratio': 2.5,
|
|
248
249
|
// spot leverage token
|
|
249
250
|
'v5/spot-lever-token/info': 2.5,
|
|
250
251
|
'v5/spot-lever-token/reference': 2.5,
|
|
@@ -646,6 +647,7 @@ class bybit extends bybit$1 {
|
|
|
646
647
|
// c2c lending
|
|
647
648
|
'v5/lending/purchase': 2.5,
|
|
648
649
|
'v5/lending/redeem': 2.5,
|
|
650
|
+
'v5/lending/redeem-cancel': 2.5,
|
|
649
651
|
},
|
|
650
652
|
'delete': {
|
|
651
653
|
// spot
|
|
@@ -4061,16 +4063,16 @@ class bybit extends bybit$1 {
|
|
|
4061
4063
|
triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
|
|
4062
4064
|
}
|
|
4063
4065
|
if (triggerPrice !== undefined) {
|
|
4064
|
-
request['triggerPrice'] =
|
|
4066
|
+
request['triggerPrice'] = triggerPrice;
|
|
4065
4067
|
}
|
|
4066
4068
|
if (isStopLoss || isTakeProfit) {
|
|
4067
4069
|
if (isStopLoss) {
|
|
4068
4070
|
const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4069
|
-
request['stopLoss'] =
|
|
4071
|
+
request['stopLoss'] = slTriggerPrice;
|
|
4070
4072
|
}
|
|
4071
4073
|
if (isTakeProfit) {
|
|
4072
4074
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4073
|
-
request['takeProfit'] =
|
|
4075
|
+
request['takeProfit'] = tpTriggerPrice;
|
|
4074
4076
|
}
|
|
4075
4077
|
}
|
|
4076
4078
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -6614,9 +6616,8 @@ class bybit extends bybit$1 {
|
|
|
6614
6616
|
// "time": 1670988271677
|
|
6615
6617
|
// }
|
|
6616
6618
|
//
|
|
6617
|
-
const data = this.
|
|
6618
|
-
|
|
6619
|
-
return this.parseTransfers(transfers, currency, since, limit);
|
|
6619
|
+
const data = this.addPaginationCursorToResult(response);
|
|
6620
|
+
return this.parseTransfers(data, currency, since, limit);
|
|
6620
6621
|
}
|
|
6621
6622
|
async borrowMargin(code, amount, symbol = undefined, params = {}) {
|
|
6622
6623
|
/**
|
|
@@ -495,6 +495,7 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
495
495
|
/**
|
|
496
496
|
* @method
|
|
497
497
|
* @name coinbasepro#fetchOrderBook
|
|
498
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductbook
|
|
498
499
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
499
500
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
500
501
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -660,6 +661,7 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
660
661
|
/**
|
|
661
662
|
* @method
|
|
662
663
|
* @name coinbasepro#fetchTicker
|
|
664
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductticker
|
|
663
665
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
664
666
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
665
667
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
@@ -773,17 +775,16 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
773
775
|
/**
|
|
774
776
|
* @method
|
|
775
777
|
* @name coinbasepro#fetchMyTrades
|
|
778
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfills
|
|
776
779
|
* @description fetch all trades made by the user
|
|
777
780
|
* @param {string} symbol unified market symbol
|
|
778
781
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
779
782
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
780
783
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
784
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
781
785
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
782
786
|
*/
|
|
783
|
-
|
|
784
|
-
if (symbol === undefined) {
|
|
785
|
-
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
786
|
-
}
|
|
787
|
+
this.checkRequiredSymbol('fetchMyTrades', symbol);
|
|
787
788
|
await this.loadMarkets();
|
|
788
789
|
const market = this.market(symbol);
|
|
789
790
|
const request = {
|
|
@@ -792,6 +793,14 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
792
793
|
if (limit !== undefined) {
|
|
793
794
|
request['limit'] = limit;
|
|
794
795
|
}
|
|
796
|
+
if (since !== undefined) {
|
|
797
|
+
request['start_date'] = this.iso8601(since);
|
|
798
|
+
}
|
|
799
|
+
const until = this.safeValue2(params, 'until', 'end_date');
|
|
800
|
+
if (until !== undefined) {
|
|
801
|
+
params = this.omit(params, ['until']);
|
|
802
|
+
request['end_date'] = this.iso8601(until);
|
|
803
|
+
}
|
|
795
804
|
const response = await this.privateGetFills(this.extend(request, params));
|
|
796
805
|
return this.parseTrades(response, market, since, limit);
|
|
797
806
|
}
|
|
@@ -799,6 +808,7 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
799
808
|
/**
|
|
800
809
|
* @method
|
|
801
810
|
* @name coinbasepro#fetchTrades
|
|
811
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducttrades
|
|
802
812
|
* @description get the list of most recent trades for a particular symbol
|
|
803
813
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
804
814
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -885,12 +895,14 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
885
895
|
/**
|
|
886
896
|
* @method
|
|
887
897
|
* @name coinbasepro#fetchOHLCV
|
|
898
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductcandles
|
|
888
899
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
889
900
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
890
901
|
* @param {string} timeframe the length of time each candle represents
|
|
891
902
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
892
903
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
893
904
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
905
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
894
906
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
895
907
|
*/
|
|
896
908
|
await this.loadMarkets();
|
|
@@ -905,6 +917,8 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
905
917
|
else {
|
|
906
918
|
request['granularity'] = timeframe;
|
|
907
919
|
}
|
|
920
|
+
const until = this.safeValue2(params, 'until', 'end');
|
|
921
|
+
params = this.omit(params, ['until']);
|
|
908
922
|
if (since !== undefined) {
|
|
909
923
|
request['start'] = this.iso8601(since);
|
|
910
924
|
if (limit === undefined) {
|
|
@@ -914,12 +928,17 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
914
928
|
else {
|
|
915
929
|
limit = Math.min(300, limit);
|
|
916
930
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
931
|
+
if (until === undefined) {
|
|
932
|
+
const parsedTimeframeMilliseconds = parsedTimeframe * 1000;
|
|
933
|
+
if (since % parsedTimeframeMilliseconds === 0) {
|
|
934
|
+
request['end'] = this.iso8601(this.sum((limit - 1) * parsedTimeframeMilliseconds, since));
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
request['end'] = this.iso8601(this.sum(limit * parsedTimeframeMilliseconds, since));
|
|
938
|
+
}
|
|
920
939
|
}
|
|
921
940
|
else {
|
|
922
|
-
request['end'] = this.iso8601(
|
|
941
|
+
request['end'] = this.iso8601(until);
|
|
923
942
|
}
|
|
924
943
|
}
|
|
925
944
|
const response = await this.publicGetProductsIdCandles(this.extend(request, params));
|
|
@@ -1039,6 +1058,7 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1039
1058
|
/**
|
|
1040
1059
|
* @method
|
|
1041
1060
|
* @name coinbasepro#fetchOrder
|
|
1061
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorder
|
|
1042
1062
|
* @description fetches information on an order made by the user
|
|
1043
1063
|
* @param {string} symbol not used by coinbasepro fetchOrder
|
|
1044
1064
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
@@ -1087,11 +1107,13 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1087
1107
|
/**
|
|
1088
1108
|
* @method
|
|
1089
1109
|
* @name coinbasepro#fetchOrders
|
|
1110
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
|
|
1090
1111
|
* @description fetches information on multiple orders made by the user
|
|
1091
1112
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1092
1113
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1093
1114
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
1094
1115
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
1116
|
+
* @param {int} [params.until] the latest time in ms to fetch open orders for
|
|
1095
1117
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1096
1118
|
*/
|
|
1097
1119
|
const request = {
|
|
@@ -1103,11 +1125,13 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1103
1125
|
/**
|
|
1104
1126
|
* @method
|
|
1105
1127
|
* @name coinbasepro#fetchOpenOrders
|
|
1128
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
|
|
1106
1129
|
* @description fetch all unfilled currently open orders
|
|
1107
1130
|
* @param {string} symbol unified market symbol
|
|
1108
1131
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1109
1132
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
1110
1133
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
1134
|
+
* @param {int} [params.until] the latest time in ms to fetch open orders for
|
|
1111
1135
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1112
1136
|
*/
|
|
1113
1137
|
await this.loadMarkets();
|
|
@@ -1120,6 +1144,14 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1120
1144
|
if (limit !== undefined) {
|
|
1121
1145
|
request['limit'] = limit; // default 100
|
|
1122
1146
|
}
|
|
1147
|
+
if (since !== undefined) {
|
|
1148
|
+
request['start_date'] = this.iso8601(since);
|
|
1149
|
+
}
|
|
1150
|
+
const until = this.safeValue2(params, 'until', 'end_date');
|
|
1151
|
+
if (until !== undefined) {
|
|
1152
|
+
params = this.omit(params, ['until']);
|
|
1153
|
+
request['end_date'] = this.iso8601(until);
|
|
1154
|
+
}
|
|
1123
1155
|
const response = await this.privateGetOrders(this.extend(request, params));
|
|
1124
1156
|
return this.parseOrders(response, market, since, limit);
|
|
1125
1157
|
}
|
|
@@ -1127,11 +1159,13 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1127
1159
|
/**
|
|
1128
1160
|
* @method
|
|
1129
1161
|
* @name coinbasepro#fetchClosedOrders
|
|
1162
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
|
|
1130
1163
|
* @description fetches information on multiple closed orders made by the user
|
|
1131
1164
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1132
1165
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1133
1166
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
1134
1167
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
1168
|
+
* @param {int} [params.until] the latest time in ms to fetch open orders for
|
|
1135
1169
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1136
1170
|
*/
|
|
1137
1171
|
const request = {
|
|
@@ -1143,6 +1177,7 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1143
1177
|
/**
|
|
1144
1178
|
* @method
|
|
1145
1179
|
* @name coinbasepro#createOrder
|
|
1180
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postorders
|
|
1146
1181
|
* @description create a trade order
|
|
1147
1182
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1148
1183
|
* @param {string} type 'market' or 'limit'
|
|
@@ -1238,6 +1273,7 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1238
1273
|
/**
|
|
1239
1274
|
* @method
|
|
1240
1275
|
* @name coinbasepro#cancelOrder
|
|
1276
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorder
|
|
1241
1277
|
* @description cancels an open order
|
|
1242
1278
|
* @param {string} id order id
|
|
1243
1279
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
@@ -1270,6 +1306,7 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1270
1306
|
/**
|
|
1271
1307
|
* @method
|
|
1272
1308
|
* @name coinbasepro#cancelAllOrders
|
|
1309
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorders
|
|
1273
1310
|
* @description cancel all open orders
|
|
1274
1311
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
1275
1312
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
@@ -1456,11 +1493,13 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1456
1493
|
/**
|
|
1457
1494
|
* @method
|
|
1458
1495
|
* @name coinbasepro#fetchLedger
|
|
1496
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
|
|
1459
1497
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
1460
1498
|
* @param {string} code unified currency code, default is undefined
|
|
1461
1499
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
1462
1500
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
1463
1501
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
1502
|
+
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
1464
1503
|
* @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
|
|
1465
1504
|
*/
|
|
1466
1505
|
// https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
|
|
@@ -1490,6 +1529,11 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1490
1529
|
if (limit !== undefined) {
|
|
1491
1530
|
request['limit'] = limit; // default 100
|
|
1492
1531
|
}
|
|
1532
|
+
const until = this.safeValue2(params, 'until', 'end_date');
|
|
1533
|
+
if (until !== undefined) {
|
|
1534
|
+
params = this.omit(params, ['until']);
|
|
1535
|
+
request['end_date'] = this.iso8601(until);
|
|
1536
|
+
}
|
|
1493
1537
|
const response = await this.privateGetAccountsIdLedger(this.extend(request, params));
|
|
1494
1538
|
for (let i = 0; i < response.length; i++) {
|
|
1495
1539
|
response[i]['currency'] = code;
|