ccxt 4.4.25 → 4.4.27
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 +133 -132
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +1 -1
- package/dist/cjs/src/alpaca.js +451 -16
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Exchange.js +32 -1
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/bigone.js +1 -1
- package/dist/cjs/src/binance.js +3 -4
- package/dist/cjs/src/binancecoinm.js +1 -1
- package/dist/cjs/src/binanceus.js +1 -1
- package/dist/cjs/src/binanceusdm.js +1 -1
- package/dist/cjs/src/bingx.js +32 -37
- package/dist/cjs/src/bit2c.js +1 -1
- package/dist/cjs/src/bitbank.js +1 -1
- package/dist/cjs/src/bitbns.js +1 -1
- package/dist/cjs/src/bitfinex.js +1 -1
- package/dist/cjs/src/bitfinex2.js +1 -1
- package/dist/cjs/src/bitflyer.js +1 -1
- package/dist/cjs/src/bitget.js +3 -3
- package/dist/cjs/src/bithumb.js +1 -1
- package/dist/cjs/src/bitmart.js +4 -4
- package/dist/cjs/src/bitmex.js +1 -1
- package/dist/cjs/src/bitopro.js +1 -1
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitstamp.js +1 -1
- package/dist/cjs/src/bitteam.js +1 -1
- package/dist/cjs/src/bitvavo.js +1 -1
- package/dist/cjs/src/bl3p.js +1 -1
- package/dist/cjs/src/blockchaincom.js +1 -1
- package/dist/cjs/src/blofin.js +1 -1
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/btcbox.js +1 -1
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +1 -1
- package/dist/cjs/src/bybit.js +8 -15
- package/dist/cjs/src/cex.js +40 -0
- package/dist/cjs/src/coinbase.js +97 -11
- package/dist/cjs/src/coinex.js +3 -5
- package/dist/cjs/src/digifinex.js +2 -2
- package/dist/cjs/src/exmo.js +1 -0
- package/dist/cjs/src/gate.js +25 -19
- package/dist/cjs/src/htx.js +2 -3
- package/dist/cjs/src/hyperliquid.js +35 -5
- package/dist/cjs/src/kucoin.js +2 -2
- package/dist/cjs/src/lbank.js +100 -1
- package/dist/cjs/src/okx.js +3 -2
- package/dist/cjs/src/phemex.js +4 -2
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/exmo.js +216 -3
- package/dist/cjs/src/pro/lbank.js +9 -4
- package/dist/cjs/src/wavesexchange.js +13 -2
- package/dist/cjs/src/whitebit.js +2 -2
- package/dist/cjs/src/xt.js +39 -27
- package/examples/js/cli.js +23 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/alpaca.d.ts +3 -0
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/ace.js +1 -1
- package/js/src/alpaca.d.ts +14 -1
- package/js/src/alpaca.js +452 -17
- package/js/src/ascendex.js +1 -1
- package/js/src/base/Exchange.d.ts +13 -6
- package/js/src/base/Exchange.js +32 -1
- package/js/src/base/types.d.ts +3 -3
- package/js/src/bequant.js +1 -1
- package/js/src/bigone.js +1 -1
- package/js/src/binance.d.ts +3 -14
- package/js/src/binance.js +3 -4
- package/js/src/binancecoinm.js +1 -1
- package/js/src/binanceus.js +1 -1
- package/js/src/binanceusdm.js +1 -1
- package/js/src/bingx.js +32 -37
- package/js/src/bit2c.js +1 -1
- package/js/src/bitbank.js +1 -1
- package/js/src/bitbns.js +1 -1
- package/js/src/bitfinex.js +1 -1
- package/js/src/bitfinex2.js +1 -1
- package/js/src/bitflyer.js +1 -1
- package/js/src/bitget.d.ts +3 -13
- package/js/src/bitget.js +3 -3
- package/js/src/bithumb.js +1 -1
- package/js/src/bitmart.d.ts +3 -13
- package/js/src/bitmart.js +4 -4
- package/js/src/bitmex.js +1 -1
- package/js/src/bitopro.js +1 -1
- package/js/src/bitrue.js +1 -1
- package/js/src/bitso.js +1 -1
- package/js/src/bitstamp.js +1 -1
- package/js/src/bitteam.js +1 -1
- package/js/src/bitvavo.js +1 -1
- package/js/src/bl3p.js +1 -1
- package/js/src/blockchaincom.js +1 -1
- package/js/src/blofin.js +1 -1
- package/js/src/btcalpha.js +1 -1
- package/js/src/btcbox.js +1 -1
- package/js/src/btcmarkets.js +1 -1
- package/js/src/btcturk.js +1 -1
- package/js/src/bybit.d.ts +3 -14
- package/js/src/bybit.js +8 -15
- package/js/src/cex.d.ts +2 -0
- package/js/src/cex.js +40 -0
- package/js/src/coinbase.d.ts +1 -0
- package/js/src/coinbase.js +97 -11
- package/js/src/coinex.d.ts +3 -15
- package/js/src/coinex.js +3 -5
- package/js/src/digifinex.d.ts +3 -13
- package/js/src/digifinex.js +2 -2
- package/js/src/exmo.js +1 -0
- package/js/src/gate.d.ts +3 -13
- package/js/src/gate.js +25 -19
- package/js/src/htx.d.ts +3 -14
- package/js/src/htx.js +2 -3
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +35 -5
- package/js/src/kucoin.d.ts +3 -13
- package/js/src/kucoin.js +2 -2
- package/js/src/lbank.d.ts +4 -1
- package/js/src/lbank.js +100 -1
- package/js/src/okx.d.ts +3 -13
- package/js/src/okx.js +3 -2
- package/js/src/phemex.js +4 -2
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/exmo.d.ts +5 -1
- package/js/src/pro/exmo.js +216 -3
- package/js/src/pro/lbank.js +9 -4
- package/js/src/wavesexchange.js +13 -2
- package/js/src/whitebit.d.ts +3 -13
- package/js/src/whitebit.js +2 -2
- package/js/src/woo.d.ts +1 -1
- package/js/src/xt.js +39 -27
- package/package.json +1 -1
package/dist/cjs/src/lbank.js
CHANGED
|
@@ -57,7 +57,7 @@ class lbank extends lbank$1 {
|
|
|
57
57
|
'fetchFundingHistory': false,
|
|
58
58
|
'fetchFundingRate': false,
|
|
59
59
|
'fetchFundingRateHistory': false,
|
|
60
|
-
'fetchFundingRates':
|
|
60
|
+
'fetchFundingRates': true,
|
|
61
61
|
'fetchIndexOHLCV': false,
|
|
62
62
|
'fetchIsolatedBorrowRate': false,
|
|
63
63
|
'fetchIsolatedBorrowRates': false,
|
|
@@ -1171,6 +1171,105 @@ class lbank extends lbank$1 {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
return undefined;
|
|
1173
1173
|
}
|
|
1174
|
+
parseFundingRate(ticker, market = undefined) {
|
|
1175
|
+
// {
|
|
1176
|
+
// "symbol": "BTCUSDT",
|
|
1177
|
+
// "highestPrice": "69495.5",
|
|
1178
|
+
// "underlyingPrice": "68455.904",
|
|
1179
|
+
// "lowestPrice": "68182.1",
|
|
1180
|
+
// "openPrice": "68762.4",
|
|
1181
|
+
// "positionFeeRate": "0.0001",
|
|
1182
|
+
// "volume": "33534.2858",
|
|
1183
|
+
// "markedPrice": "68434.1",
|
|
1184
|
+
// "turnover": "1200636218.210558",
|
|
1185
|
+
// "positionFeeTime": "28800",
|
|
1186
|
+
// "lastPrice": "68427.3",
|
|
1187
|
+
// "nextFeeTime": "1730736000000",
|
|
1188
|
+
// "fundingRate": "0.0001",
|
|
1189
|
+
// }
|
|
1190
|
+
const marketId = this.safeString(ticker, 'symbol');
|
|
1191
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
1192
|
+
const markPrice = this.safeNumber(ticker, 'markedPrice');
|
|
1193
|
+
const indexPrice = this.safeNumber(ticker, 'underlyingPrice');
|
|
1194
|
+
const fundingRate = this.safeNumber(ticker, 'fundingRate');
|
|
1195
|
+
const fundingTime = this.safeInteger(ticker, 'nextFeeTime');
|
|
1196
|
+
return {
|
|
1197
|
+
'info': ticker,
|
|
1198
|
+
'symbol': symbol,
|
|
1199
|
+
'markPrice': markPrice,
|
|
1200
|
+
'indexPrice': indexPrice,
|
|
1201
|
+
'fundingRate': fundingRate,
|
|
1202
|
+
'fundingTimestamp': fundingTime,
|
|
1203
|
+
'fundingDatetime': this.iso8601(fundingTime),
|
|
1204
|
+
'timestamp': undefined,
|
|
1205
|
+
'datetime': undefined,
|
|
1206
|
+
'nextFundingRate': undefined,
|
|
1207
|
+
'nextFundingTimestamp': undefined,
|
|
1208
|
+
'nextFundingDatetime': undefined,
|
|
1209
|
+
'previousFundingRate': undefined,
|
|
1210
|
+
'previousFundingTimestamp': undefined,
|
|
1211
|
+
'previousFundingDatetime': undefined,
|
|
1212
|
+
'interval': undefined,
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
async fetchFundingRate(symbol, params = {}) {
|
|
1216
|
+
/**
|
|
1217
|
+
* @method
|
|
1218
|
+
* @name lbank#fetchFundingRate
|
|
1219
|
+
* @description fetch the current funding rate
|
|
1220
|
+
* @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
|
|
1221
|
+
* @param {string} symbol unified market symbol
|
|
1222
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1223
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
1224
|
+
*/
|
|
1225
|
+
await this.loadMarkets();
|
|
1226
|
+
const market = this.market(symbol);
|
|
1227
|
+
const responseForSwap = await this.fetchFundingRates([market['symbol']], params);
|
|
1228
|
+
return this.safeValue(responseForSwap, market['symbol']);
|
|
1229
|
+
}
|
|
1230
|
+
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
1231
|
+
/**
|
|
1232
|
+
* @method
|
|
1233
|
+
* @name lbank#fetchFundingRates
|
|
1234
|
+
* @description fetch the funding rate for multiple markets
|
|
1235
|
+
* @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
|
|
1236
|
+
* @param {string[]|undefined} symbols list of unified market symbols
|
|
1237
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1238
|
+
* @returns {object} a dictionary of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
1239
|
+
*/
|
|
1240
|
+
await this.loadMarkets();
|
|
1241
|
+
symbols = this.marketSymbols(symbols);
|
|
1242
|
+
const request = {
|
|
1243
|
+
'productGroup': 'SwapU',
|
|
1244
|
+
};
|
|
1245
|
+
const response = await this.contractPublicGetCfdOpenApiV1PubMarketData(this.extend(request, params));
|
|
1246
|
+
// {
|
|
1247
|
+
// "data": [
|
|
1248
|
+
// {
|
|
1249
|
+
// "symbol": "BTCUSDT",
|
|
1250
|
+
// "highestPrice": "69495.5",
|
|
1251
|
+
// "underlyingPrice": "68455.904",
|
|
1252
|
+
// "lowestPrice": "68182.1",
|
|
1253
|
+
// "openPrice": "68762.4",
|
|
1254
|
+
// "positionFeeRate": "0.0001",
|
|
1255
|
+
// "volume": "33534.2858",
|
|
1256
|
+
// "markedPrice": "68434.1",
|
|
1257
|
+
// "turnover": "1200636218.210558",
|
|
1258
|
+
// "positionFeeTime": "28800",
|
|
1259
|
+
// "lastPrice": "68427.3",
|
|
1260
|
+
// "nextFeeTime": "1730736000000",
|
|
1261
|
+
// "fundingRate": "0.0001",
|
|
1262
|
+
// }
|
|
1263
|
+
// ],
|
|
1264
|
+
// "error_code": "0",
|
|
1265
|
+
// "msg": "Success",
|
|
1266
|
+
// "result": "true",
|
|
1267
|
+
// "success": True,
|
|
1268
|
+
// }
|
|
1269
|
+
const data = this.safeList(response, 'data', []);
|
|
1270
|
+
const result = this.parseFundingRates(data);
|
|
1271
|
+
return this.filterByArray(result, 'symbol', symbols);
|
|
1272
|
+
}
|
|
1174
1273
|
async fetchBalance(params = {}) {
|
|
1175
1274
|
/**
|
|
1176
1275
|
* @method
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -395,6 +395,7 @@ class okx extends okx$1 {
|
|
|
395
395
|
// eth staking
|
|
396
396
|
'finance/staking-defi/eth/balance': 5 / 3,
|
|
397
397
|
'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
|
|
398
|
+
'finance/staking-defi/eth/product-info': 3,
|
|
398
399
|
// copytrading
|
|
399
400
|
'copytrading/current-subpositions': 1,
|
|
400
401
|
'copytrading/subpositions-history': 1,
|
|
@@ -7073,15 +7074,15 @@ class okx extends okx$1 {
|
|
|
7073
7074
|
}
|
|
7074
7075
|
const timestamp = this.safeInteger(info, 'ts');
|
|
7075
7076
|
return {
|
|
7077
|
+
'info': info,
|
|
7076
7078
|
'symbol': this.safeString(market, 'symbol'),
|
|
7077
|
-
'marginMode': this.safeString(info, 'mgnMode'),
|
|
7078
7079
|
'currency': this.safeCurrencyCode(this.safeString(info, 'ccy')),
|
|
7079
7080
|
'interest': this.safeNumber(info, 'interest'),
|
|
7080
7081
|
'interestRate': this.safeNumber(info, 'interestRate'),
|
|
7081
7082
|
'amountBorrowed': this.safeNumber(info, 'liab'),
|
|
7083
|
+
'marginMode': this.safeString(info, 'mgnMode'),
|
|
7082
7084
|
'timestamp': timestamp,
|
|
7083
7085
|
'datetime': this.iso8601(timestamp),
|
|
7084
|
-
'info': info,
|
|
7085
7086
|
};
|
|
7086
7087
|
}
|
|
7087
7088
|
async borrowCrossMargin(code, amount, params = {}) {
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -105,7 +105,7 @@ class phemex extends phemex$1 {
|
|
|
105
105
|
'private': 'https://{hostname}',
|
|
106
106
|
},
|
|
107
107
|
'www': 'https://phemex.com',
|
|
108
|
-
'doc': 'https://
|
|
108
|
+
'doc': 'https://phemex-docs.github.io/#overview',
|
|
109
109
|
'fees': 'https://phemex.com/fees-conditions',
|
|
110
110
|
'referral': {
|
|
111
111
|
'url': 'https://phemex.com/register?referralCode=EDNVJ',
|
|
@@ -163,6 +163,7 @@ class phemex extends phemex$1 {
|
|
|
163
163
|
'v2': {
|
|
164
164
|
'get': {
|
|
165
165
|
'public/products': 5,
|
|
166
|
+
'public/products-plus': 5,
|
|
166
167
|
'md/v2/orderbook': 5,
|
|
167
168
|
'md/v2/trade': 5,
|
|
168
169
|
'md/v2/ticker/24hr': 5,
|
|
@@ -735,7 +736,7 @@ class phemex extends phemex$1 {
|
|
|
735
736
|
'max': this.parseSafeNumber(this.safeString(market, 'maxOrderValue')),
|
|
736
737
|
},
|
|
737
738
|
},
|
|
738
|
-
'created':
|
|
739
|
+
'created': this.safeInteger(market, 'listTime'),
|
|
739
740
|
'info': market,
|
|
740
741
|
});
|
|
741
742
|
}
|
|
@@ -744,6 +745,7 @@ class phemex extends phemex$1 {
|
|
|
744
745
|
* @method
|
|
745
746
|
* @name phemex#fetchMarkets
|
|
746
747
|
* @description retrieves data on all markets for phemex
|
|
748
|
+
* @see https://phemex-docs.github.io/#query-product-information-3
|
|
747
749
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
748
750
|
* @returns {object[]} an array of objects representing market data
|
|
749
751
|
*/
|
|
@@ -1972,7 +1972,7 @@ class binance extends binance$1 {
|
|
|
1972
1972
|
if (symbolsDefined) {
|
|
1973
1973
|
firstMarket = this.market(symbols[0]);
|
|
1974
1974
|
}
|
|
1975
|
-
const defaultMarket = (isMarkPrice) ? 'swap' :
|
|
1975
|
+
const defaultMarket = (isMarkPrice) ? 'swap' : undefined;
|
|
1976
1976
|
[marketType, params] = this.handleMarketTypeAndParams(methodName, firstMarket, params, defaultMarket);
|
|
1977
1977
|
let subType = undefined;
|
|
1978
1978
|
[subType, params] = this.handleSubTypeAndParams(methodName, firstMarket, params);
|
package/dist/cjs/src/pro/exmo.js
CHANGED
|
@@ -17,7 +17,7 @@ class exmo extends exmo$1 {
|
|
|
17
17
|
'watchTickers': true,
|
|
18
18
|
'watchTrades': true,
|
|
19
19
|
'watchMyTrades': true,
|
|
20
|
-
'watchOrders':
|
|
20
|
+
'watchOrders': true,
|
|
21
21
|
'watchOrderBook': true,
|
|
22
22
|
'watchOHLCV': false,
|
|
23
23
|
},
|
|
@@ -570,6 +570,219 @@ class exmo extends exmo$1 {
|
|
|
570
570
|
this.handleDelta(bookside, deltas[i]);
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
+
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
574
|
+
/**
|
|
575
|
+
* @method
|
|
576
|
+
* @name exmo#watchOrders
|
|
577
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#85f7bc03-b1c9-4cd2-bd22-8fd422272825
|
|
578
|
+
* @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#95e4ed18-1791-4e6d-83ad-cbfe9be1051c
|
|
579
|
+
* @description watches information on multiple orders made by the user
|
|
580
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
581
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
582
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
583
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
584
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
585
|
+
*/
|
|
586
|
+
await this.loadMarkets();
|
|
587
|
+
await this.authenticate(params);
|
|
588
|
+
const [type, query] = this.handleMarketTypeAndParams('watchOrders', undefined, params);
|
|
589
|
+
const url = this.urls['api']['ws'][type];
|
|
590
|
+
let messageHash = undefined;
|
|
591
|
+
if (symbol === undefined) {
|
|
592
|
+
messageHash = 'orders:' + type;
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
const market = this.market(symbol);
|
|
596
|
+
symbol = market['symbol'];
|
|
597
|
+
messageHash = 'orders:' + market['symbol'];
|
|
598
|
+
}
|
|
599
|
+
const message = {
|
|
600
|
+
'method': 'subscribe',
|
|
601
|
+
'topics': [
|
|
602
|
+
type + '/orders',
|
|
603
|
+
],
|
|
604
|
+
'id': this.requestId(),
|
|
605
|
+
};
|
|
606
|
+
const request = this.deepExtend(message, query);
|
|
607
|
+
const orders = await this.watch(url, messageHash, request, messageHash, request);
|
|
608
|
+
return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
|
|
609
|
+
}
|
|
610
|
+
handleOrders(client, message) {
|
|
611
|
+
//
|
|
612
|
+
// spot
|
|
613
|
+
// {
|
|
614
|
+
// "ts": 1574427585174,
|
|
615
|
+
// "event": "snapshot",
|
|
616
|
+
// "topic": "spot/orders",
|
|
617
|
+
// "data": [
|
|
618
|
+
// {
|
|
619
|
+
// "order_id": "14",
|
|
620
|
+
// "client_id":"100500",
|
|
621
|
+
// "created": "1574427585",
|
|
622
|
+
// "pair": "BTC_USD",
|
|
623
|
+
// "price": "7750",
|
|
624
|
+
// "quantity": "0.1",
|
|
625
|
+
// "amount": "775",
|
|
626
|
+
// "original_quantity": "0.1",
|
|
627
|
+
// "original_amount": "775",
|
|
628
|
+
// "type": "sell",
|
|
629
|
+
// "status": "open"
|
|
630
|
+
// }
|
|
631
|
+
// ]
|
|
632
|
+
// }
|
|
633
|
+
//
|
|
634
|
+
// margin
|
|
635
|
+
// {
|
|
636
|
+
// "ts":1624371281773,
|
|
637
|
+
// "event":"snapshot",
|
|
638
|
+
// "topic":"margin/orders",
|
|
639
|
+
// "data":[
|
|
640
|
+
// {
|
|
641
|
+
// "order_id":"692844278081168665",
|
|
642
|
+
// "created":"1624371250919761600",
|
|
643
|
+
// "type":"limit_buy",
|
|
644
|
+
// "previous_type":"limit_buy",
|
|
645
|
+
// "pair":"BTC_USD",
|
|
646
|
+
// "leverage":"2",
|
|
647
|
+
// "price":"10000",
|
|
648
|
+
// "stop_price":"0",
|
|
649
|
+
// "distance":"0",
|
|
650
|
+
// "trigger_price":"10000",
|
|
651
|
+
// "init_quantity":"0.1",
|
|
652
|
+
// "quantity":"0.1",
|
|
653
|
+
// "funding_currency":"USD",
|
|
654
|
+
// "funding_quantity":"1000",
|
|
655
|
+
// "funding_rate":"0",
|
|
656
|
+
// "client_id":"111111",
|
|
657
|
+
// "expire":0,
|
|
658
|
+
// "src":1,
|
|
659
|
+
// "comment":"comment1",
|
|
660
|
+
// "updated":1624371250938136600,
|
|
661
|
+
// "status":"active"
|
|
662
|
+
// }
|
|
663
|
+
// ]
|
|
664
|
+
// }
|
|
665
|
+
//
|
|
666
|
+
const topic = this.safeString(message, 'topic');
|
|
667
|
+
const parts = topic.split('/');
|
|
668
|
+
const type = this.safeString(parts, 0);
|
|
669
|
+
const messageHash = 'orders:' + type;
|
|
670
|
+
const event = this.safeString(message, 'event');
|
|
671
|
+
if (this.orders === undefined) {
|
|
672
|
+
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
|
673
|
+
this.orders = new Cache.ArrayCacheBySymbolById(limit);
|
|
674
|
+
}
|
|
675
|
+
const cachedOrders = this.orders;
|
|
676
|
+
let rawOrders = [];
|
|
677
|
+
if (event === 'snapshot') {
|
|
678
|
+
rawOrders = this.safeValue(message, 'data', []);
|
|
679
|
+
}
|
|
680
|
+
else if (event === 'update') {
|
|
681
|
+
const rawOrder = this.safeDict(message, 'data', {});
|
|
682
|
+
rawOrders.push(rawOrder);
|
|
683
|
+
}
|
|
684
|
+
const symbols = {};
|
|
685
|
+
for (let j = 0; j < rawOrders.length; j++) {
|
|
686
|
+
const order = this.parseWsOrder(rawOrders[j]);
|
|
687
|
+
cachedOrders.append(order);
|
|
688
|
+
symbols[order['symbol']] = true;
|
|
689
|
+
}
|
|
690
|
+
const symbolKeys = Object.keys(symbols);
|
|
691
|
+
for (let i = 0; i < symbolKeys.length; i++) {
|
|
692
|
+
const symbol = symbolKeys[i];
|
|
693
|
+
const symbolSpecificMessageHash = 'orders:' + symbol;
|
|
694
|
+
client.resolve(cachedOrders, symbolSpecificMessageHash);
|
|
695
|
+
}
|
|
696
|
+
client.resolve(cachedOrders, messageHash);
|
|
697
|
+
}
|
|
698
|
+
parseWsOrder(order, market = undefined) {
|
|
699
|
+
//
|
|
700
|
+
// {
|
|
701
|
+
// order_id: '43226756791',
|
|
702
|
+
// client_id: 0,
|
|
703
|
+
// created: '1730371416',
|
|
704
|
+
// type: 'market_buy',
|
|
705
|
+
// pair: 'TRX_USD',
|
|
706
|
+
// quantity: '0',
|
|
707
|
+
// original_quantity: '30',
|
|
708
|
+
// status: 'cancelled',
|
|
709
|
+
// last_trade_id: '726480870',
|
|
710
|
+
// last_trade_price: '0.17',
|
|
711
|
+
// last_trade_quantity: '30'
|
|
712
|
+
// }
|
|
713
|
+
//
|
|
714
|
+
const id = this.safeString(order, 'order_id');
|
|
715
|
+
const timestamp = this.safeTimestamp(order, 'created');
|
|
716
|
+
const orderType = this.safeString(order, 'type');
|
|
717
|
+
const side = this.parseSide(orderType);
|
|
718
|
+
const marketId = this.safeString(order, 'pair');
|
|
719
|
+
market = this.safeMarket(marketId, market);
|
|
720
|
+
const symbol = market['symbol'];
|
|
721
|
+
let amount = this.safeString(order, 'quantity');
|
|
722
|
+
if (amount === undefined) {
|
|
723
|
+
const amountField = (side === 'buy') ? 'in_amount' : 'out_amount';
|
|
724
|
+
amount = this.safeString(order, amountField);
|
|
725
|
+
}
|
|
726
|
+
const price = this.safeString(order, 'price');
|
|
727
|
+
const clientOrderId = this.omitZero(this.safeString(order, 'client_id'));
|
|
728
|
+
const triggerPrice = this.omitZero(this.safeString(order, 'stop_price'));
|
|
729
|
+
let type = undefined;
|
|
730
|
+
if ((orderType !== 'buy') && (orderType !== 'sell')) {
|
|
731
|
+
type = orderType;
|
|
732
|
+
}
|
|
733
|
+
let trades = undefined;
|
|
734
|
+
if ('last_trade_id' in order) {
|
|
735
|
+
const trade = this.parseWsTrade(order, market);
|
|
736
|
+
trades = [trade];
|
|
737
|
+
}
|
|
738
|
+
return this.safeOrder({
|
|
739
|
+
'id': id,
|
|
740
|
+
'clientOrderId': clientOrderId,
|
|
741
|
+
'datetime': this.iso8601(timestamp),
|
|
742
|
+
'timestamp': timestamp,
|
|
743
|
+
'lastTradeTimestamp': undefined,
|
|
744
|
+
'status': this.parseStatus(this.safeString(order, 'status')),
|
|
745
|
+
'symbol': symbol,
|
|
746
|
+
'type': type,
|
|
747
|
+
'timeInForce': undefined,
|
|
748
|
+
'postOnly': undefined,
|
|
749
|
+
'side': side,
|
|
750
|
+
'price': price,
|
|
751
|
+
'stopPrice': triggerPrice,
|
|
752
|
+
'triggerPrice': triggerPrice,
|
|
753
|
+
'cost': undefined,
|
|
754
|
+
'amount': this.safeString(order, 'original_quantity'),
|
|
755
|
+
'filled': undefined,
|
|
756
|
+
'remaining': this.safeString(order, 'quantity'),
|
|
757
|
+
'average': undefined,
|
|
758
|
+
'trades': trades,
|
|
759
|
+
'fee': undefined,
|
|
760
|
+
'info': order,
|
|
761
|
+
}, market);
|
|
762
|
+
}
|
|
763
|
+
parseWsTrade(trade, market = undefined) {
|
|
764
|
+
const id = this.safeString(trade, 'order_id');
|
|
765
|
+
const orderType = this.safeString(trade, 'type');
|
|
766
|
+
const side = this.parseSide(orderType);
|
|
767
|
+
const marketId = this.safeString(trade, 'pair');
|
|
768
|
+
market = this.safeMarket(marketId, market);
|
|
769
|
+
const symbol = market['symbol'];
|
|
770
|
+
let type = undefined;
|
|
771
|
+
if ((orderType !== 'buy') && (orderType !== 'sell')) {
|
|
772
|
+
type = orderType;
|
|
773
|
+
}
|
|
774
|
+
return this.safeTrade({
|
|
775
|
+
'id': this.safeString(trade, 'last_trade_id'),
|
|
776
|
+
'symbol': symbol,
|
|
777
|
+
'order': id,
|
|
778
|
+
'type': type,
|
|
779
|
+
'side': side,
|
|
780
|
+
'price': this.safeString(trade, 'last_trade_price'),
|
|
781
|
+
'amount': this.safeString(trade, 'last_trade_quantity'),
|
|
782
|
+
'cost': undefined,
|
|
783
|
+
'fee': undefined,
|
|
784
|
+
}, market);
|
|
785
|
+
}
|
|
573
786
|
handleMessage(client, message) {
|
|
574
787
|
//
|
|
575
788
|
// {
|
|
@@ -610,8 +823,8 @@ class exmo extends exmo$1 {
|
|
|
610
823
|
'spot/trades': this.handleTrades,
|
|
611
824
|
'margin/trades': this.handleTrades,
|
|
612
825
|
'spot/order_book_updates': this.handleOrderBook,
|
|
613
|
-
|
|
614
|
-
|
|
826
|
+
'spot/orders': this.handleOrders,
|
|
827
|
+
'margin/orders': this.handleOrders,
|
|
615
828
|
'spot/user_trades': this.handleMyTrades,
|
|
616
829
|
'margin/user_trades': this.handleMyTrades,
|
|
617
830
|
};
|
|
@@ -808,10 +808,15 @@ class lbank extends lbank$1 {
|
|
|
808
808
|
// { ping: 'a13a939c-5f25-4e06-9981-93cb3b890707', action: 'ping' }
|
|
809
809
|
//
|
|
810
810
|
const pingId = this.safeString(message, 'ping');
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
811
|
+
try {
|
|
812
|
+
await client.send({
|
|
813
|
+
'action': 'pong',
|
|
814
|
+
'pong': pingId,
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
catch (e) {
|
|
818
|
+
this.onError(client, e);
|
|
819
|
+
}
|
|
815
820
|
}
|
|
816
821
|
handleMessage(client, message) {
|
|
817
822
|
const status = this.safeString(message, 'status');
|
|
@@ -124,7 +124,13 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
124
124
|
'forward': 'https://wx.network/api/v1/forward/matcher',
|
|
125
125
|
'market': 'https://wx.network/api/v1/forward/marketdata/api/v1',
|
|
126
126
|
},
|
|
127
|
-
'doc':
|
|
127
|
+
'doc': [
|
|
128
|
+
'https://docs.wx.network',
|
|
129
|
+
'https://docs.waves.tech',
|
|
130
|
+
'https://api.wavesplatform.com/v0/docs/',
|
|
131
|
+
'https://nodes.wavesnodes.com/api-docs/index.html',
|
|
132
|
+
'https://matcher.waves.exchange/api-docs/index.html',
|
|
133
|
+
],
|
|
128
134
|
'www': 'https://wx.network',
|
|
129
135
|
},
|
|
130
136
|
'api': {
|
|
@@ -598,6 +604,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
598
604
|
* @method
|
|
599
605
|
* @name wavesexchange#fetchOrderBook
|
|
600
606
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
607
|
+
* @see https://matcher.waves.exchange/api-docs/index.html#/markets/getOrderBook
|
|
601
608
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
602
609
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
603
610
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -745,6 +752,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
745
752
|
* @method
|
|
746
753
|
* @name wavesexchange#signIn
|
|
747
754
|
* @description sign in, must be called prior to using other authenticated methods
|
|
755
|
+
* @see https://docs.wx.network/en/api/auth/oauth2-token
|
|
748
756
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
749
757
|
* @returns response from exchange
|
|
750
758
|
*/
|
|
@@ -858,6 +866,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
858
866
|
* @method
|
|
859
867
|
* @name wavesexchange#fetchTicker
|
|
860
868
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
869
|
+
* @see https://api.wavesplatform.com/v0/docs/#/pairs/getPairsListAll
|
|
861
870
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
862
871
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
863
872
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -901,7 +910,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
901
910
|
* @method
|
|
902
911
|
* @name wavesexchange#fetchTickers
|
|
903
912
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
904
|
-
* @param {string[]
|
|
913
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
905
914
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
906
915
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
907
916
|
*/
|
|
@@ -942,6 +951,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
942
951
|
* @method
|
|
943
952
|
* @name wavesexchange#fetchOHLCV
|
|
944
953
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
954
|
+
* @see https://api.wavesplatform.com/v0/docs/#/candles/getCandles
|
|
945
955
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
946
956
|
* @param {string} timeframe the length of time each candle represents
|
|
947
957
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -1276,6 +1286,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1276
1286
|
* @method
|
|
1277
1287
|
* @name wavesexchange#createOrder
|
|
1278
1288
|
* @description create a trade order
|
|
1289
|
+
* @see https://matcher.waves.exchange/api-docs/index.html#/serialize/serializeOrder
|
|
1279
1290
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1280
1291
|
* @param {string} type 'market' or 'limit'
|
|
1281
1292
|
* @param {string} side 'buy' or 'sell'
|
package/dist/cjs/src/whitebit.js
CHANGED
|
@@ -2357,15 +2357,15 @@ class whitebit extends whitebit$1 {
|
|
|
2357
2357
|
const symbol = this.safeSymbol(marketId, market, '_');
|
|
2358
2358
|
const timestamp = this.safeTimestamp(info, 'modifyDate');
|
|
2359
2359
|
return {
|
|
2360
|
+
'info': info,
|
|
2360
2361
|
'symbol': symbol,
|
|
2361
|
-
'marginMode': 'cross',
|
|
2362
2362
|
'currency': 'USDT',
|
|
2363
2363
|
'interest': this.safeNumber(info, 'unrealizedFunding'),
|
|
2364
2364
|
'interestRate': 0.00098,
|
|
2365
2365
|
'amountBorrowed': this.safeNumber(info, 'amount'),
|
|
2366
|
+
'marginMode': 'cross',
|
|
2366
2367
|
'timestamp': timestamp,
|
|
2367
2368
|
'datetime': this.iso8601(timestamp),
|
|
2368
|
-
'info': info,
|
|
2369
2369
|
};
|
|
2370
2370
|
}
|
|
2371
2371
|
async fetchFundingRate(symbol, params = {}) {
|
package/dist/cjs/src/xt.js
CHANGED
|
@@ -1970,6 +1970,17 @@ class xt extends xt$1 {
|
|
|
1970
1970
|
// "b": true
|
|
1971
1971
|
// }
|
|
1972
1972
|
//
|
|
1973
|
+
// spot: watchTrades
|
|
1974
|
+
//
|
|
1975
|
+
// {
|
|
1976
|
+
// s: 'btc_usdt',
|
|
1977
|
+
// i: '228825383103928709',
|
|
1978
|
+
// t: 1684258222702,
|
|
1979
|
+
// p: '27003.65',
|
|
1980
|
+
// q: '0.000796',
|
|
1981
|
+
// b: true
|
|
1982
|
+
// }
|
|
1983
|
+
//
|
|
1973
1984
|
// spot: watchMyTrades
|
|
1974
1985
|
//
|
|
1975
1986
|
// {
|
|
@@ -1982,17 +1993,6 @@ class xt extends xt$1 {
|
|
|
1982
1993
|
// "v": "90000" // volume trade amount
|
|
1983
1994
|
// }
|
|
1984
1995
|
//
|
|
1985
|
-
// spot: watchTrades
|
|
1986
|
-
//
|
|
1987
|
-
// {
|
|
1988
|
-
// s: 'btc_usdt',
|
|
1989
|
-
// i: '228825383103928709',
|
|
1990
|
-
// t: 1684258222702,
|
|
1991
|
-
// p: '27003.65',
|
|
1992
|
-
// q: '0.000796',
|
|
1993
|
-
// b: true
|
|
1994
|
-
// }
|
|
1995
|
-
//
|
|
1996
1996
|
// swap and future: fetchTrades
|
|
1997
1997
|
//
|
|
1998
1998
|
// {
|
|
@@ -2072,22 +2072,34 @@ class xt extends xt$1 {
|
|
|
2072
2072
|
marketType = hasSpotKeys ? 'spot' : 'contract';
|
|
2073
2073
|
}
|
|
2074
2074
|
market = this.safeMarket(marketId, market, '_', marketType);
|
|
2075
|
-
|
|
2076
|
-
let
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2075
|
+
let side = undefined;
|
|
2076
|
+
let takerOrMaker = undefined;
|
|
2077
|
+
const isBuyerMaker = this.safeBool(trade, 'b');
|
|
2078
|
+
if (isBuyerMaker !== undefined) {
|
|
2079
|
+
side = isBuyerMaker ? 'sell' : 'buy';
|
|
2080
|
+
takerOrMaker = 'taker'; // public trades always taker
|
|
2081
|
+
}
|
|
2082
|
+
else {
|
|
2083
|
+
const takerMaker = this.safeStringLower(trade, 'takerMaker');
|
|
2084
|
+
if (takerMaker !== undefined) {
|
|
2085
|
+
takerOrMaker = takerMaker;
|
|
2086
|
+
}
|
|
2087
|
+
else {
|
|
2088
|
+
const isMaker = this.safeBool(trade, 'isMaker');
|
|
2089
|
+
if (isMaker !== undefined) {
|
|
2090
|
+
takerOrMaker = isMaker ? 'maker' : 'taker';
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
const orderSide = this.safeStringLower(trade, 'orderSide');
|
|
2094
|
+
if (orderSide !== undefined) {
|
|
2095
|
+
side = orderSide;
|
|
2096
|
+
}
|
|
2097
|
+
else {
|
|
2098
|
+
const bidOrAsk = this.safeString(trade, 'm');
|
|
2099
|
+
if (bidOrAsk !== undefined) {
|
|
2100
|
+
side = (bidOrAsk === 'BID') ? 'buy' : 'sell';
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2091
2103
|
}
|
|
2092
2104
|
const timestamp = this.safeIntegerN(trade, ['t', 'time', 'timestamp']);
|
|
2093
2105
|
const quantity = this.safeString2(trade, 'q', 'quantity');
|