ccxt 4.0.85 → 4.0.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 +3 -3
- package/dist/ccxt.browser.js +130 -47
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitget.js +32 -7
- package/dist/cjs/src/exmo.js +75 -27
- package/dist/cjs/src/hitbtc.js +3 -0
- package/dist/cjs/src/kucoinfutures.js +9 -2
- package/dist/cjs/src/pro/bitfinex2.js +5 -5
- package/dist/cjs/src/pro/blockchaincom.js +2 -2
- package/dist/cjs/src/pro/luno.js +3 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitget.d.ts +2 -0
- package/js/src/bitget.js +32 -7
- package/js/src/exmo.js +75 -27
- package/js/src/hitbtc.js +3 -0
- package/js/src/kucoinfutures.js +9 -2
- package/js/src/pro/bitfinex2.js +5 -5
- package/js/src/pro/blockchaincom.js +2 -2
- package/js/src/pro/luno.js +3 -3
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
180
180
|
|
|
181
181
|
//-----------------------------------------------------------------------------
|
|
182
182
|
// this is updated by vss.js when building
|
|
183
|
-
const version = '4.0.
|
|
183
|
+
const version = '4.0.87';
|
|
184
184
|
Exchange["default"].ccxtVersion = version;
|
|
185
185
|
const exchanges = {
|
|
186
186
|
'ace': ace,
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -147,6 +147,7 @@ class bitget extends bitget$1 {
|
|
|
147
147
|
'market/candles': 1,
|
|
148
148
|
'market/depth': 1,
|
|
149
149
|
'market/spot-vip-level': 2,
|
|
150
|
+
'market/merge-depth': 1,
|
|
150
151
|
'market/history-candles': 1,
|
|
151
152
|
'public/loan/coinInfos': 2,
|
|
152
153
|
'public/loan/hour-interest': 2, // 10 times/1s (IP) => 20/10 = 2
|
|
@@ -174,6 +175,7 @@ class bitget extends bitget$1 {
|
|
|
174
175
|
'market/history-candles': 1,
|
|
175
176
|
'market/history-index-candles': 1,
|
|
176
177
|
'market/history-mark-candles': 1,
|
|
178
|
+
'market/merge-depth': 1,
|
|
177
179
|
},
|
|
178
180
|
},
|
|
179
181
|
'margin': {
|
|
@@ -2562,6 +2564,8 @@ class bitget extends bitget$1 {
|
|
|
2562
2564
|
/**
|
|
2563
2565
|
* @method
|
|
2564
2566
|
* @name bitget#fetchBalance
|
|
2567
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-account-assets
|
|
2568
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list
|
|
2565
2569
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2566
2570
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
2567
2571
|
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
@@ -2626,13 +2630,32 @@ class bitget extends bitget$1 {
|
|
|
2626
2630
|
parseBalance(balance) {
|
|
2627
2631
|
const result = { 'info': balance };
|
|
2628
2632
|
//
|
|
2633
|
+
// spot
|
|
2634
|
+
//
|
|
2635
|
+
// {
|
|
2636
|
+
// coinId: '1',
|
|
2637
|
+
// coinName: 'BTC',
|
|
2638
|
+
// available: '0.00099900',
|
|
2639
|
+
// frozen: '0.00000000',
|
|
2640
|
+
// lock: '0.00000000',
|
|
2641
|
+
// uTime: '1661595535000'
|
|
2642
|
+
// }
|
|
2643
|
+
//
|
|
2644
|
+
// swap
|
|
2645
|
+
//
|
|
2629
2646
|
// {
|
|
2630
|
-
//
|
|
2631
|
-
//
|
|
2632
|
-
//
|
|
2633
|
-
//
|
|
2634
|
-
//
|
|
2635
|
-
//
|
|
2647
|
+
// marginCoin: 'BTC',
|
|
2648
|
+
// locked: '0.00001948',
|
|
2649
|
+
// available: '0.00006622',
|
|
2650
|
+
// crossMaxAvailable: '0.00004674',
|
|
2651
|
+
// fixedMaxAvailable: '0.00004674',
|
|
2652
|
+
// maxTransferOut: '0.00004674',
|
|
2653
|
+
// equity: '0.00006622',
|
|
2654
|
+
// usdtEquity: '1.734307497491',
|
|
2655
|
+
// btcEquity: '0.000066229058',
|
|
2656
|
+
// crossRiskRate: '0.066308887072',
|
|
2657
|
+
// unrealizedPL: '0',
|
|
2658
|
+
// bonus: '0'
|
|
2636
2659
|
// }
|
|
2637
2660
|
//
|
|
2638
2661
|
for (let i = 0; i < balance.length; i++) {
|
|
@@ -2640,10 +2663,12 @@ class bitget extends bitget$1 {
|
|
|
2640
2663
|
const currencyId = this.safeString2(entry, 'coinName', 'marginCoin');
|
|
2641
2664
|
const code = this.safeCurrencyCode(currencyId);
|
|
2642
2665
|
const account = this.account();
|
|
2666
|
+
const spotAccountFree = this.safeString(entry, 'available');
|
|
2667
|
+
const contractAccountFree = this.safeString(entry, 'maxTransferOut');
|
|
2668
|
+
account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
|
|
2643
2669
|
const frozen = this.safeString(entry, 'frozen');
|
|
2644
2670
|
const locked = this.safeString2(entry, 'lock', 'locked');
|
|
2645
2671
|
account['used'] = Precise["default"].stringAdd(frozen, locked);
|
|
2646
|
-
account['free'] = this.safeString(entry, 'available');
|
|
2647
2672
|
result[code] = account;
|
|
2648
2673
|
}
|
|
2649
2674
|
return this.safeBalance(result);
|
package/dist/cjs/src/exmo.js
CHANGED
|
@@ -1173,6 +1173,19 @@ class exmo extends exmo$1 {
|
|
|
1173
1173
|
// "commission_percent": "0.2"
|
|
1174
1174
|
// }
|
|
1175
1175
|
//
|
|
1176
|
+
// margin
|
|
1177
|
+
//
|
|
1178
|
+
// {
|
|
1179
|
+
// "is_maker": false,
|
|
1180
|
+
// "order_id": "123",
|
|
1181
|
+
// "pair": "BTC_USD",
|
|
1182
|
+
// "price": "54122.25",
|
|
1183
|
+
// "quantity": "0.00069994",
|
|
1184
|
+
// "trade_dt": "1619069561718824428",
|
|
1185
|
+
// "trade_id": "692842802860135010",
|
|
1186
|
+
// "type": "sell"
|
|
1187
|
+
// }
|
|
1188
|
+
//
|
|
1176
1189
|
const timestamp = this.safeTimestamp(trade, 'date');
|
|
1177
1190
|
const id = this.safeString(trade, 'trade_id');
|
|
1178
1191
|
const orderId = this.safeString(trade, 'order_id');
|
|
@@ -1184,7 +1197,12 @@ class exmo extends exmo$1 {
|
|
|
1184
1197
|
const marketId = this.safeString(trade, 'pair');
|
|
1185
1198
|
market = this.safeMarket(marketId, market, '_');
|
|
1186
1199
|
const symbol = market['symbol'];
|
|
1187
|
-
const
|
|
1200
|
+
const isMaker = this.safeValue(trade, 'is_maker');
|
|
1201
|
+
let takerOrMakerDefault = undefined;
|
|
1202
|
+
if (isMaker !== undefined) {
|
|
1203
|
+
takerOrMakerDefault = isMaker ? 'maker' : 'taker';
|
|
1204
|
+
}
|
|
1205
|
+
const takerOrMaker = this.safeString(trade, 'exec_type', takerOrMakerDefault);
|
|
1188
1206
|
let fee = undefined;
|
|
1189
1207
|
const feeCostString = this.safeString(trade, 'commission_amount');
|
|
1190
1208
|
if (feeCostString !== undefined) {
|
|
@@ -1424,13 +1442,21 @@ class exmo extends exmo$1 {
|
|
|
1424
1442
|
* @method
|
|
1425
1443
|
* @name exmo#fetchOrderTrades
|
|
1426
1444
|
* @description fetch all the trades made from a single order
|
|
1445
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#cf27781e-28e5-4b39-a52d-3110f5d22459 // spot
|
|
1446
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#00810661-9119-46c5-aec5-55abe9cb42c7 // margin
|
|
1427
1447
|
* @param {string} id order id
|
|
1428
1448
|
* @param {string} symbol unified market symbol
|
|
1429
1449
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1430
1450
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
1431
1451
|
* @param {object} [params] extra parameters specific to the exmo api endpoint
|
|
1452
|
+
* @param {string} [params.marginMode] set to "isolated" to fetch trades for a margin order
|
|
1432
1453
|
* @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
1433
1454
|
*/
|
|
1455
|
+
let marginMode = undefined;
|
|
1456
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrderTrades', params);
|
|
1457
|
+
if (marginMode === 'cross') {
|
|
1458
|
+
throw new errors.BadRequest(this.id + ' only supports isolated margin');
|
|
1459
|
+
}
|
|
1434
1460
|
let market = undefined;
|
|
1435
1461
|
if (symbol !== undefined) {
|
|
1436
1462
|
market = this.market(symbol);
|
|
@@ -1438,32 +1464,54 @@ class exmo extends exmo$1 {
|
|
|
1438
1464
|
const request = {
|
|
1439
1465
|
'order_id': id.toString(),
|
|
1440
1466
|
};
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
+
let response = undefined;
|
|
1468
|
+
if (marginMode === 'isolated') {
|
|
1469
|
+
response = await this.privatePostMarginUserOrderTrades(this.extend(request, params));
|
|
1470
|
+
//
|
|
1471
|
+
// {
|
|
1472
|
+
// "trades": [
|
|
1473
|
+
// {
|
|
1474
|
+
// "is_maker": false,
|
|
1475
|
+
// "order_id": "123",
|
|
1476
|
+
// "pair": "BTC_USD",
|
|
1477
|
+
// "price": "54122.25",
|
|
1478
|
+
// "quantity": "0.00069994",
|
|
1479
|
+
// "trade_dt": "1619069561718824428",
|
|
1480
|
+
// "trade_id": "692842802860135010",
|
|
1481
|
+
// "type": "sell"
|
|
1482
|
+
// }
|
|
1483
|
+
// ]
|
|
1484
|
+
// }
|
|
1485
|
+
//
|
|
1486
|
+
}
|
|
1487
|
+
else {
|
|
1488
|
+
response = await this.privatePostOrderTrades(this.extend(request, params));
|
|
1489
|
+
//
|
|
1490
|
+
// {
|
|
1491
|
+
// "type": "buy",
|
|
1492
|
+
// "in_currency": "BTC",
|
|
1493
|
+
// "in_amount": "1",
|
|
1494
|
+
// "out_currency": "USD",
|
|
1495
|
+
// "out_amount": "100",
|
|
1496
|
+
// "trades": [
|
|
1497
|
+
// {
|
|
1498
|
+
// "trade_id": 3,
|
|
1499
|
+
// "date": 1435488248,
|
|
1500
|
+
// "type": "buy",
|
|
1501
|
+
// "pair": "BTC_USD",
|
|
1502
|
+
// "order_id": 12345,
|
|
1503
|
+
// "quantity": 1,
|
|
1504
|
+
// "price": 100,
|
|
1505
|
+
// "amount": 100,
|
|
1506
|
+
// "exec_type": "taker",
|
|
1507
|
+
// "commission_amount": "0.02",
|
|
1508
|
+
// "commission_currency": "BTC",
|
|
1509
|
+
// "commission_percent": "0.2"
|
|
1510
|
+
// }
|
|
1511
|
+
// ]
|
|
1512
|
+
// }
|
|
1513
|
+
//
|
|
1514
|
+
}
|
|
1467
1515
|
const trades = this.safeValue(response, 'trades');
|
|
1468
1516
|
return this.parseTrades(trades, market, since, limit);
|
|
1469
1517
|
}
|
package/dist/cjs/src/hitbtc.js
CHANGED
|
@@ -1232,6 +1232,9 @@ class hitbtc extends hitbtc$1 {
|
|
|
1232
1232
|
if (taker !== undefined) {
|
|
1233
1233
|
takerOrMaker = taker ? 'taker' : 'maker';
|
|
1234
1234
|
}
|
|
1235
|
+
else {
|
|
1236
|
+
takerOrMaker = 'taker'; // the only case when `taker` field is missing, is public fetchTrades and it must be taker
|
|
1237
|
+
}
|
|
1235
1238
|
if (feeCostString !== undefined) {
|
|
1236
1239
|
const info = this.safeValue(market, 'info', {});
|
|
1237
1240
|
const feeCurrency = this.safeString(info, 'fee_currency');
|
|
@@ -1125,11 +1125,18 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1125
1125
|
'leverage': 1,
|
|
1126
1126
|
};
|
|
1127
1127
|
const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
|
|
1128
|
+
const triggerPriceTypes = {
|
|
1129
|
+
'mark': 'MP',
|
|
1130
|
+
'last': 'TP',
|
|
1131
|
+
'index': 'IP',
|
|
1132
|
+
};
|
|
1133
|
+
const triggerPriceType = this.safeString(params, 'triggerPriceType', 'mark');
|
|
1134
|
+
const triggerPriceTypeValue = this.safeString(triggerPriceTypes, triggerPriceType, triggerPriceType);
|
|
1128
1135
|
params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice']);
|
|
1129
1136
|
if (triggerPrice) {
|
|
1130
1137
|
request['stop'] = (side === 'buy') ? 'up' : 'down';
|
|
1131
1138
|
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1132
|
-
request['stopPriceType'] =
|
|
1139
|
+
request['stopPriceType'] = triggerPriceTypeValue;
|
|
1133
1140
|
}
|
|
1134
1141
|
else if (stopLossPrice || takeProfitPrice) {
|
|
1135
1142
|
if (stopLossPrice) {
|
|
@@ -1141,7 +1148,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1141
1148
|
request['stopPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1142
1149
|
}
|
|
1143
1150
|
request['reduceOnly'] = true;
|
|
1144
|
-
request['stopPriceType'] =
|
|
1151
|
+
request['stopPriceType'] = triggerPriceTypeValue;
|
|
1145
1152
|
}
|
|
1146
1153
|
const uppercaseType = type.toUpperCase();
|
|
1147
1154
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
@@ -267,13 +267,13 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
267
267
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
268
268
|
this.myTrades = new Cache.ArrayCacheBySymbolById(limit);
|
|
269
269
|
}
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
this.myTrades =
|
|
270
|
+
const tradesArray = this.myTrades;
|
|
271
|
+
tradesArray.append(trade);
|
|
272
|
+
this.myTrades = tradesArray;
|
|
273
273
|
// generic subscription
|
|
274
|
-
client.resolve(
|
|
274
|
+
client.resolve(tradesArray, name);
|
|
275
275
|
// specific subscription
|
|
276
|
-
client.resolve(
|
|
276
|
+
client.resolve(tradesArray, messageHash);
|
|
277
277
|
}
|
|
278
278
|
handleTrades(client, message, subscription) {
|
|
279
279
|
//
|
|
@@ -738,8 +738,8 @@ class blockchaincom extends blockchaincom$1 {
|
|
|
738
738
|
};
|
|
739
739
|
}
|
|
740
740
|
handleDelta(bookside, delta) {
|
|
741
|
-
const
|
|
742
|
-
bookside.storeArray(
|
|
741
|
+
const bookArray = this.parseCountedBidAsk(delta, 'px', 'qty', 'num');
|
|
742
|
+
bookside.storeArray(bookArray);
|
|
743
743
|
}
|
|
744
744
|
handleDeltas(bookside, deltas) {
|
|
745
745
|
for (let i = 0; i < deltas.length; i++) {
|
package/dist/cjs/src/pro/luno.js
CHANGED
|
@@ -288,13 +288,13 @@ class luno extends luno$1 {
|
|
|
288
288
|
const asksOrderSide = orderbook['asks'];
|
|
289
289
|
const bidsOrderSide = orderbook['bids'];
|
|
290
290
|
if (createUpdate !== undefined) {
|
|
291
|
-
const
|
|
291
|
+
const bidAskArray = this.customParseBidAsk(createUpdate, 'price', 'volume', 'order_id');
|
|
292
292
|
const type = this.safeString(createUpdate, 'type');
|
|
293
293
|
if (type === 'ASK') {
|
|
294
|
-
asksOrderSide.storeArray(
|
|
294
|
+
asksOrderSide.storeArray(bidAskArray);
|
|
295
295
|
}
|
|
296
296
|
else if (type === 'BID') {
|
|
297
|
-
bidsOrderSide.storeArray(
|
|
297
|
+
bidsOrderSide.storeArray(bidAskArray);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
const deleteUpdate = this.safeValue(message, 'delete_update');
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.0.
|
|
7
|
+
declare const version = "4.0.86";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.0.
|
|
41
|
+
const version = '4.0.87';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -13,6 +13,7 @@ interface Exchange {
|
|
|
13
13
|
publicSpotGetMarketCandles(params?: {}): Promise<implicitReturnType>;
|
|
14
14
|
publicSpotGetMarketDepth(params?: {}): Promise<implicitReturnType>;
|
|
15
15
|
publicSpotGetMarketSpotVipLevel(params?: {}): Promise<implicitReturnType>;
|
|
16
|
+
publicSpotGetMarketMergeDepth(params?: {}): Promise<implicitReturnType>;
|
|
16
17
|
publicSpotGetMarketHistoryCandles(params?: {}): Promise<implicitReturnType>;
|
|
17
18
|
publicSpotGetPublicLoanCoinInfos(params?: {}): Promise<implicitReturnType>;
|
|
18
19
|
publicSpotGetPublicLoanHourInterest(params?: {}): Promise<implicitReturnType>;
|
|
@@ -36,6 +37,7 @@ interface Exchange {
|
|
|
36
37
|
publicMixGetMarketHistoryCandles(params?: {}): Promise<implicitReturnType>;
|
|
37
38
|
publicMixGetMarketHistoryIndexCandles(params?: {}): Promise<implicitReturnType>;
|
|
38
39
|
publicMixGetMarketHistoryMarkCandles(params?: {}): Promise<implicitReturnType>;
|
|
40
|
+
publicMixGetMarketMergeDepth(params?: {}): Promise<implicitReturnType>;
|
|
39
41
|
publicMarginGetCrossPublicInterestRateAndLimit(params?: {}): Promise<implicitReturnType>;
|
|
40
42
|
publicMarginGetIsolatedPublicInterestRateAndLimit(params?: {}): Promise<implicitReturnType>;
|
|
41
43
|
publicMarginGetCrossPublicTierData(params?: {}): Promise<implicitReturnType>;
|
package/js/src/bitget.js
CHANGED
|
@@ -150,6 +150,7 @@ export default class bitget extends Exchange {
|
|
|
150
150
|
'market/candles': 1,
|
|
151
151
|
'market/depth': 1,
|
|
152
152
|
'market/spot-vip-level': 2,
|
|
153
|
+
'market/merge-depth': 1,
|
|
153
154
|
'market/history-candles': 1,
|
|
154
155
|
'public/loan/coinInfos': 2,
|
|
155
156
|
'public/loan/hour-interest': 2, // 10 times/1s (IP) => 20/10 = 2
|
|
@@ -177,6 +178,7 @@ export default class bitget extends Exchange {
|
|
|
177
178
|
'market/history-candles': 1,
|
|
178
179
|
'market/history-index-candles': 1,
|
|
179
180
|
'market/history-mark-candles': 1,
|
|
181
|
+
'market/merge-depth': 1,
|
|
180
182
|
},
|
|
181
183
|
},
|
|
182
184
|
'margin': {
|
|
@@ -2565,6 +2567,8 @@ export default class bitget extends Exchange {
|
|
|
2565
2567
|
/**
|
|
2566
2568
|
* @method
|
|
2567
2569
|
* @name bitget#fetchBalance
|
|
2570
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#get-account-assets
|
|
2571
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list
|
|
2568
2572
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2569
2573
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
2570
2574
|
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
@@ -2629,13 +2633,32 @@ export default class bitget extends Exchange {
|
|
|
2629
2633
|
parseBalance(balance) {
|
|
2630
2634
|
const result = { 'info': balance };
|
|
2631
2635
|
//
|
|
2636
|
+
// spot
|
|
2637
|
+
//
|
|
2638
|
+
// {
|
|
2639
|
+
// coinId: '1',
|
|
2640
|
+
// coinName: 'BTC',
|
|
2641
|
+
// available: '0.00099900',
|
|
2642
|
+
// frozen: '0.00000000',
|
|
2643
|
+
// lock: '0.00000000',
|
|
2644
|
+
// uTime: '1661595535000'
|
|
2645
|
+
// }
|
|
2646
|
+
//
|
|
2647
|
+
// swap
|
|
2648
|
+
//
|
|
2632
2649
|
// {
|
|
2633
|
-
//
|
|
2634
|
-
//
|
|
2635
|
-
//
|
|
2636
|
-
//
|
|
2637
|
-
//
|
|
2638
|
-
//
|
|
2650
|
+
// marginCoin: 'BTC',
|
|
2651
|
+
// locked: '0.00001948',
|
|
2652
|
+
// available: '0.00006622',
|
|
2653
|
+
// crossMaxAvailable: '0.00004674',
|
|
2654
|
+
// fixedMaxAvailable: '0.00004674',
|
|
2655
|
+
// maxTransferOut: '0.00004674',
|
|
2656
|
+
// equity: '0.00006622',
|
|
2657
|
+
// usdtEquity: '1.734307497491',
|
|
2658
|
+
// btcEquity: '0.000066229058',
|
|
2659
|
+
// crossRiskRate: '0.066308887072',
|
|
2660
|
+
// unrealizedPL: '0',
|
|
2661
|
+
// bonus: '0'
|
|
2639
2662
|
// }
|
|
2640
2663
|
//
|
|
2641
2664
|
for (let i = 0; i < balance.length; i++) {
|
|
@@ -2643,10 +2666,12 @@ export default class bitget extends Exchange {
|
|
|
2643
2666
|
const currencyId = this.safeString2(entry, 'coinName', 'marginCoin');
|
|
2644
2667
|
const code = this.safeCurrencyCode(currencyId);
|
|
2645
2668
|
const account = this.account();
|
|
2669
|
+
const spotAccountFree = this.safeString(entry, 'available');
|
|
2670
|
+
const contractAccountFree = this.safeString(entry, 'maxTransferOut');
|
|
2671
|
+
account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
|
|
2646
2672
|
const frozen = this.safeString(entry, 'frozen');
|
|
2647
2673
|
const locked = this.safeString2(entry, 'lock', 'locked');
|
|
2648
2674
|
account['used'] = Precise.stringAdd(frozen, locked);
|
|
2649
|
-
account['free'] = this.safeString(entry, 'available');
|
|
2650
2675
|
result[code] = account;
|
|
2651
2676
|
}
|
|
2652
2677
|
return this.safeBalance(result);
|
package/js/src/exmo.js
CHANGED
|
@@ -1176,6 +1176,19 @@ export default class exmo extends Exchange {
|
|
|
1176
1176
|
// "commission_percent": "0.2"
|
|
1177
1177
|
// }
|
|
1178
1178
|
//
|
|
1179
|
+
// margin
|
|
1180
|
+
//
|
|
1181
|
+
// {
|
|
1182
|
+
// "is_maker": false,
|
|
1183
|
+
// "order_id": "123",
|
|
1184
|
+
// "pair": "BTC_USD",
|
|
1185
|
+
// "price": "54122.25",
|
|
1186
|
+
// "quantity": "0.00069994",
|
|
1187
|
+
// "trade_dt": "1619069561718824428",
|
|
1188
|
+
// "trade_id": "692842802860135010",
|
|
1189
|
+
// "type": "sell"
|
|
1190
|
+
// }
|
|
1191
|
+
//
|
|
1179
1192
|
const timestamp = this.safeTimestamp(trade, 'date');
|
|
1180
1193
|
const id = this.safeString(trade, 'trade_id');
|
|
1181
1194
|
const orderId = this.safeString(trade, 'order_id');
|
|
@@ -1187,7 +1200,12 @@ export default class exmo extends Exchange {
|
|
|
1187
1200
|
const marketId = this.safeString(trade, 'pair');
|
|
1188
1201
|
market = this.safeMarket(marketId, market, '_');
|
|
1189
1202
|
const symbol = market['symbol'];
|
|
1190
|
-
const
|
|
1203
|
+
const isMaker = this.safeValue(trade, 'is_maker');
|
|
1204
|
+
let takerOrMakerDefault = undefined;
|
|
1205
|
+
if (isMaker !== undefined) {
|
|
1206
|
+
takerOrMakerDefault = isMaker ? 'maker' : 'taker';
|
|
1207
|
+
}
|
|
1208
|
+
const takerOrMaker = this.safeString(trade, 'exec_type', takerOrMakerDefault);
|
|
1191
1209
|
let fee = undefined;
|
|
1192
1210
|
const feeCostString = this.safeString(trade, 'commission_amount');
|
|
1193
1211
|
if (feeCostString !== undefined) {
|
|
@@ -1427,13 +1445,21 @@ export default class exmo extends Exchange {
|
|
|
1427
1445
|
* @method
|
|
1428
1446
|
* @name exmo#fetchOrderTrades
|
|
1429
1447
|
* @description fetch all the trades made from a single order
|
|
1448
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#cf27781e-28e5-4b39-a52d-3110f5d22459 // spot
|
|
1449
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#00810661-9119-46c5-aec5-55abe9cb42c7 // margin
|
|
1430
1450
|
* @param {string} id order id
|
|
1431
1451
|
* @param {string} symbol unified market symbol
|
|
1432
1452
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1433
1453
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
1434
1454
|
* @param {object} [params] extra parameters specific to the exmo api endpoint
|
|
1455
|
+
* @param {string} [params.marginMode] set to "isolated" to fetch trades for a margin order
|
|
1435
1456
|
* @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
1436
1457
|
*/
|
|
1458
|
+
let marginMode = undefined;
|
|
1459
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrderTrades', params);
|
|
1460
|
+
if (marginMode === 'cross') {
|
|
1461
|
+
throw new BadRequest(this.id + ' only supports isolated margin');
|
|
1462
|
+
}
|
|
1437
1463
|
let market = undefined;
|
|
1438
1464
|
if (symbol !== undefined) {
|
|
1439
1465
|
market = this.market(symbol);
|
|
@@ -1441,32 +1467,54 @@ export default class exmo extends Exchange {
|
|
|
1441
1467
|
const request = {
|
|
1442
1468
|
'order_id': id.toString(),
|
|
1443
1469
|
};
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
+
let response = undefined;
|
|
1471
|
+
if (marginMode === 'isolated') {
|
|
1472
|
+
response = await this.privatePostMarginUserOrderTrades(this.extend(request, params));
|
|
1473
|
+
//
|
|
1474
|
+
// {
|
|
1475
|
+
// "trades": [
|
|
1476
|
+
// {
|
|
1477
|
+
// "is_maker": false,
|
|
1478
|
+
// "order_id": "123",
|
|
1479
|
+
// "pair": "BTC_USD",
|
|
1480
|
+
// "price": "54122.25",
|
|
1481
|
+
// "quantity": "0.00069994",
|
|
1482
|
+
// "trade_dt": "1619069561718824428",
|
|
1483
|
+
// "trade_id": "692842802860135010",
|
|
1484
|
+
// "type": "sell"
|
|
1485
|
+
// }
|
|
1486
|
+
// ]
|
|
1487
|
+
// }
|
|
1488
|
+
//
|
|
1489
|
+
}
|
|
1490
|
+
else {
|
|
1491
|
+
response = await this.privatePostOrderTrades(this.extend(request, params));
|
|
1492
|
+
//
|
|
1493
|
+
// {
|
|
1494
|
+
// "type": "buy",
|
|
1495
|
+
// "in_currency": "BTC",
|
|
1496
|
+
// "in_amount": "1",
|
|
1497
|
+
// "out_currency": "USD",
|
|
1498
|
+
// "out_amount": "100",
|
|
1499
|
+
// "trades": [
|
|
1500
|
+
// {
|
|
1501
|
+
// "trade_id": 3,
|
|
1502
|
+
// "date": 1435488248,
|
|
1503
|
+
// "type": "buy",
|
|
1504
|
+
// "pair": "BTC_USD",
|
|
1505
|
+
// "order_id": 12345,
|
|
1506
|
+
// "quantity": 1,
|
|
1507
|
+
// "price": 100,
|
|
1508
|
+
// "amount": 100,
|
|
1509
|
+
// "exec_type": "taker",
|
|
1510
|
+
// "commission_amount": "0.02",
|
|
1511
|
+
// "commission_currency": "BTC",
|
|
1512
|
+
// "commission_percent": "0.2"
|
|
1513
|
+
// }
|
|
1514
|
+
// ]
|
|
1515
|
+
// }
|
|
1516
|
+
//
|
|
1517
|
+
}
|
|
1470
1518
|
const trades = this.safeValue(response, 'trades');
|
|
1471
1519
|
return this.parseTrades(trades, market, since, limit);
|
|
1472
1520
|
}
|
package/js/src/hitbtc.js
CHANGED
|
@@ -1235,6 +1235,9 @@ export default class hitbtc extends Exchange {
|
|
|
1235
1235
|
if (taker !== undefined) {
|
|
1236
1236
|
takerOrMaker = taker ? 'taker' : 'maker';
|
|
1237
1237
|
}
|
|
1238
|
+
else {
|
|
1239
|
+
takerOrMaker = 'taker'; // the only case when `taker` field is missing, is public fetchTrades and it must be taker
|
|
1240
|
+
}
|
|
1238
1241
|
if (feeCostString !== undefined) {
|
|
1239
1242
|
const info = this.safeValue(market, 'info', {});
|
|
1240
1243
|
const feeCurrency = this.safeString(info, 'fee_currency');
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -1128,11 +1128,18 @@ export default class kucoinfutures extends kucoin {
|
|
|
1128
1128
|
'leverage': 1,
|
|
1129
1129
|
};
|
|
1130
1130
|
const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
|
|
1131
|
+
const triggerPriceTypes = {
|
|
1132
|
+
'mark': 'MP',
|
|
1133
|
+
'last': 'TP',
|
|
1134
|
+
'index': 'IP',
|
|
1135
|
+
};
|
|
1136
|
+
const triggerPriceType = this.safeString(params, 'triggerPriceType', 'mark');
|
|
1137
|
+
const triggerPriceTypeValue = this.safeString(triggerPriceTypes, triggerPriceType, triggerPriceType);
|
|
1131
1138
|
params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice']);
|
|
1132
1139
|
if (triggerPrice) {
|
|
1133
1140
|
request['stop'] = (side === 'buy') ? 'up' : 'down';
|
|
1134
1141
|
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1135
|
-
request['stopPriceType'] =
|
|
1142
|
+
request['stopPriceType'] = triggerPriceTypeValue;
|
|
1136
1143
|
}
|
|
1137
1144
|
else if (stopLossPrice || takeProfitPrice) {
|
|
1138
1145
|
if (stopLossPrice) {
|
|
@@ -1144,7 +1151,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
1144
1151
|
request['stopPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
1145
1152
|
}
|
|
1146
1153
|
request['reduceOnly'] = true;
|
|
1147
|
-
request['stopPriceType'] =
|
|
1154
|
+
request['stopPriceType'] = triggerPriceTypeValue;
|
|
1148
1155
|
}
|
|
1149
1156
|
const uppercaseType = type.toUpperCase();
|
|
1150
1157
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
package/js/src/pro/bitfinex2.js
CHANGED
|
@@ -270,13 +270,13 @@ export default class bitfinex2 extends bitfinex2Rest {
|
|
|
270
270
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
271
271
|
this.myTrades = new ArrayCacheBySymbolById(limit);
|
|
272
272
|
}
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
this.myTrades =
|
|
273
|
+
const tradesArray = this.myTrades;
|
|
274
|
+
tradesArray.append(trade);
|
|
275
|
+
this.myTrades = tradesArray;
|
|
276
276
|
// generic subscription
|
|
277
|
-
client.resolve(
|
|
277
|
+
client.resolve(tradesArray, name);
|
|
278
278
|
// specific subscription
|
|
279
|
-
client.resolve(
|
|
279
|
+
client.resolve(tradesArray, messageHash);
|
|
280
280
|
}
|
|
281
281
|
handleTrades(client, message, subscription) {
|
|
282
282
|
//
|