ccxt 4.1.87 → 4.1.89
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 +8309 -5710
- package/README.md +10 -9
- package/changelog.js +101 -0
- package/dist/ccxt.browser.js +8628 -4849
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/base/Exchange.js +95 -27
- package/dist/cjs/src/base/ws/Client.js +3 -3
- package/dist/cjs/src/base/ws/Future.js +9 -2
- package/dist/cjs/src/base/ws/WsClient.js +1 -1
- package/dist/cjs/src/bigone.js +8 -1
- package/dist/cjs/src/binance.js +4 -105
- package/dist/cjs/src/bit2c.js +8 -2
- package/dist/cjs/src/bitget.js +3455 -2480
- package/dist/cjs/src/bitmart.js +35 -9
- package/dist/cjs/src/coinbase.js +2 -0
- package/dist/cjs/src/coinbasepro.js +0 -43
- package/dist/cjs/src/coinex.js +14 -1
- package/dist/cjs/src/coinsph.js +0 -29
- package/dist/cjs/src/cryptocom.js +22 -10
- package/dist/cjs/src/gate.js +37 -39
- package/dist/cjs/src/gemini.js +1 -0
- package/dist/cjs/src/novadax.js +28 -16
- package/dist/cjs/src/okcoin.js +80 -21
- package/dist/cjs/src/phemex.js +105 -29
- package/dist/cjs/src/pro/binance.js +18 -215
- package/dist/cjs/src/pro/bitget.js +780 -736
- package/dist/cjs/src/pro/bitmart.js +8 -10
- package/dist/cjs/src/pro/bitmex.js +9 -34
- package/dist/cjs/src/pro/bitpanda.js +4 -4
- package/dist/cjs/src/pro/bybit.js +21 -97
- package/dist/cjs/src/pro/coinbasepro.js +36 -40
- package/dist/cjs/src/pro/cryptocom.js +10 -26
- package/dist/cjs/src/pro/gate.js +20 -17
- package/dist/cjs/src/pro/kucoin.js +39 -39
- package/dist/cjs/src/pro/kucoinfutures.js +40 -36
- package/dist/cjs/src/pro/okx.js +16 -29
- package/dist/cjs/src/tokocrypto.js +28 -14
- package/dist/cjs/src/woo.js +41 -14
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/bitget.d.ts +1 -1
- package/js/src/abstract/coinbasepro.d.ts +69 -0
- package/js/src/abstract/coinbasepro.js +11 -0
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +2 -3
- package/js/src/base/Exchange.js +96 -28
- package/js/src/base/ws/Client.d.ts +2 -2
- package/js/src/base/ws/Client.js +4 -4
- package/js/src/base/ws/Future.d.ts +5 -2
- package/js/src/base/ws/Future.js +8 -2
- package/js/src/base/ws/WsClient.d.ts +1 -1
- package/js/src/base/ws/WsClient.js +2 -2
- package/js/src/bigone.js +9 -2
- package/js/src/binance.d.ts +0 -9
- package/js/src/binance.js +4 -105
- package/js/src/bit2c.js +8 -2
- package/js/src/bitget.d.ts +13 -11
- package/js/src/bitget.js +3455 -2480
- package/js/src/bitmart.js +35 -9
- package/js/src/coinbase.js +2 -0
- package/js/src/coinbasepro.d.ts +0 -4
- package/js/src/coinbasepro.js +1 -44
- package/js/src/coinex.js +14 -1
- package/js/src/coinsph.d.ts +0 -1
- package/js/src/coinsph.js +0 -29
- package/js/src/cryptocom.js +22 -10
- package/js/src/gate.js +37 -39
- package/js/src/gemini.js +1 -0
- package/js/src/novadax.js +28 -16
- package/js/src/okcoin.d.ts +1 -0
- package/js/src/okcoin.js +81 -22
- package/js/src/phemex.d.ts +2 -108
- package/js/src/phemex.js +105 -29
- package/js/src/pro/binance.d.ts +0 -2
- package/js/src/pro/binance.js +19 -216
- package/js/src/pro/bitget.d.ts +3 -5
- package/js/src/pro/bitget.js +780 -736
- package/js/src/pro/bitmart.js +8 -10
- package/js/src/pro/bitmex.js +9 -34
- package/js/src/pro/bitpanda.d.ts +1 -1
- package/js/src/pro/bitpanda.js +4 -4
- package/js/src/pro/bybit.d.ts +1 -2
- package/js/src/pro/bybit.js +21 -97
- package/js/src/pro/coinbasepro.d.ts +2 -2
- package/js/src/pro/coinbasepro.js +36 -40
- package/js/src/pro/cryptocom.d.ts +1 -1
- package/js/src/pro/cryptocom.js +10 -26
- package/js/src/pro/gate.d.ts +1 -0
- package/js/src/pro/gate.js +20 -17
- package/js/src/pro/kucoin.d.ts +1 -0
- package/js/src/pro/kucoin.js +39 -39
- package/js/src/pro/kucoinfutures.d.ts +2 -1
- package/js/src/pro/kucoinfutures.js +40 -36
- package/js/src/pro/okx.d.ts +1 -1
- package/js/src/pro/okx.js +16 -29
- package/js/src/tokocrypto.js +28 -14
- package/js/src/woo.d.ts +1 -0
- package/js/src/woo.js +42 -15
- package/package.json +2 -2
- package/skip-tests.json +3 -14
package/dist/cjs/ccxt.js
CHANGED
|
@@ -50,6 +50,7 @@ var btcturk = require('./src/btcturk.js');
|
|
|
50
50
|
var bybit = require('./src/bybit.js');
|
|
51
51
|
var cex = require('./src/cex.js');
|
|
52
52
|
var coinbase = require('./src/coinbase.js');
|
|
53
|
+
var coinbasepro = require('./src/coinbasepro.js');
|
|
53
54
|
var coincheck = require('./src/coincheck.js');
|
|
54
55
|
var coinex = require('./src/coinex.js');
|
|
55
56
|
var coinlist = require('./src/coinlist.js');
|
|
@@ -131,6 +132,7 @@ var blockchaincom$1 = require('./src/pro/blockchaincom.js');
|
|
|
131
132
|
var bybit$1 = require('./src/pro/bybit.js');
|
|
132
133
|
var cex$1 = require('./src/pro/cex.js');
|
|
133
134
|
var coinbase$1 = require('./src/pro/coinbase.js');
|
|
135
|
+
var coinbasepro$1 = require('./src/pro/coinbasepro.js');
|
|
134
136
|
var coinex$1 = require('./src/pro/coinex.js');
|
|
135
137
|
var cryptocom$1 = require('./src/pro/cryptocom.js');
|
|
136
138
|
var currencycom$1 = require('./src/pro/currencycom.js');
|
|
@@ -166,7 +168,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
166
168
|
|
|
167
169
|
//-----------------------------------------------------------------------------
|
|
168
170
|
// this is updated by vss.js when building
|
|
169
|
-
const version = '4.1.
|
|
171
|
+
const version = '4.1.89';
|
|
170
172
|
Exchange["default"].ccxtVersion = version;
|
|
171
173
|
const exchanges = {
|
|
172
174
|
'ace': ace,
|
|
@@ -207,6 +209,7 @@ const exchanges = {
|
|
|
207
209
|
'bybit': bybit,
|
|
208
210
|
'cex': cex,
|
|
209
211
|
'coinbase': coinbase,
|
|
212
|
+
'coinbasepro': coinbasepro,
|
|
210
213
|
'coincheck': coincheck,
|
|
211
214
|
'coinex': coinex,
|
|
212
215
|
'coinlist': coinlist,
|
|
@@ -290,6 +293,7 @@ const pro = {
|
|
|
290
293
|
'bybit': bybit$1,
|
|
291
294
|
'cex': cex$1,
|
|
292
295
|
'coinbase': coinbase$1,
|
|
296
|
+
'coinbasepro': coinbasepro$1,
|
|
293
297
|
'coinex': coinex$1,
|
|
294
298
|
'cryptocom': cryptocom$1,
|
|
295
299
|
'currencycom': currencycom$1,
|
|
@@ -402,6 +406,7 @@ exports.btcturk = btcturk;
|
|
|
402
406
|
exports.bybit = bybit;
|
|
403
407
|
exports.cex = cex;
|
|
404
408
|
exports.coinbase = coinbase;
|
|
409
|
+
exports.coinbasepro = coinbasepro;
|
|
405
410
|
exports.coincheck = coincheck;
|
|
406
411
|
exports.coinex = coinex;
|
|
407
412
|
exports.coinlist = coinlist;
|
|
@@ -976,7 +976,7 @@ class Exchange {
|
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
spawn(method, ...args) {
|
|
979
|
-
const future = Future.
|
|
979
|
+
const future = Future.Future();
|
|
980
980
|
method.apply(this, args).then(future.resolve).catch(future.reject);
|
|
981
981
|
return future;
|
|
982
982
|
}
|
|
@@ -1029,6 +1029,99 @@ class Exchange {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
return this.clients[url];
|
|
1031
1031
|
}
|
|
1032
|
+
watchMultiple(url, messageHashes, message = undefined, subscribeHashes = undefined, subscription = undefined) {
|
|
1033
|
+
//
|
|
1034
|
+
// Without comments the code of this method is short and easy:
|
|
1035
|
+
//
|
|
1036
|
+
// const client = this.client (url)
|
|
1037
|
+
// const backoffDelay = 0
|
|
1038
|
+
// const future = client.future (messageHash)
|
|
1039
|
+
// const connected = client.connect (backoffDelay)
|
|
1040
|
+
// connected.then (() => {
|
|
1041
|
+
// if (message && !client.subscriptions[subscribeHash]) {
|
|
1042
|
+
// client.subscriptions[subscribeHash] = true
|
|
1043
|
+
// client.send (message)
|
|
1044
|
+
// }
|
|
1045
|
+
// }).catch ((error) => {})
|
|
1046
|
+
// return future
|
|
1047
|
+
//
|
|
1048
|
+
// The following is a longer version of this method with comments
|
|
1049
|
+
//
|
|
1050
|
+
const client = this.client(url);
|
|
1051
|
+
// todo: calculate the backoff using the clients cache
|
|
1052
|
+
const backoffDelay = 0;
|
|
1053
|
+
//
|
|
1054
|
+
// watchOrderBook ---- future ----+---------------+----→ user
|
|
1055
|
+
// | |
|
|
1056
|
+
// ↓ ↑
|
|
1057
|
+
// | |
|
|
1058
|
+
// connect ......→ resolve
|
|
1059
|
+
// | |
|
|
1060
|
+
// ↓ ↑
|
|
1061
|
+
// | |
|
|
1062
|
+
// subscribe -----→ receive
|
|
1063
|
+
//
|
|
1064
|
+
const future = Future.Future.race(messageHashes.map(messageHash => client.future(messageHash)));
|
|
1065
|
+
// read and write subscription, this is done before connecting the client
|
|
1066
|
+
// to avoid race conditions when other parts of the code read or write to the client.subscriptions
|
|
1067
|
+
let missingSubscriptions = [];
|
|
1068
|
+
if (subscribeHashes !== undefined) {
|
|
1069
|
+
for (let i = 0; i < subscribeHashes.length; i++) {
|
|
1070
|
+
const subscribeHash = subscribeHashes[i];
|
|
1071
|
+
if (!client.subscriptions[subscribeHash]) {
|
|
1072
|
+
missingSubscriptions.push(subscribeHash);
|
|
1073
|
+
client.subscriptions[subscribeHash] = subscription || true;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
// we intentionally do not use await here to avoid unhandled exceptions
|
|
1078
|
+
// the policy is to make sure that 100% of promises are resolved or rejected
|
|
1079
|
+
// either with a call to client.resolve or client.reject with
|
|
1080
|
+
// a proper exception class instance
|
|
1081
|
+
const connected = client.connect(backoffDelay);
|
|
1082
|
+
// the following is executed only if the catch-clause does not
|
|
1083
|
+
// catch any connection-level exceptions from the client
|
|
1084
|
+
// (connection established successfully)
|
|
1085
|
+
if ((subscribeHashes === undefined) || missingSubscriptions.length) {
|
|
1086
|
+
connected.then(() => {
|
|
1087
|
+
const options = this.safeValue(this.options, 'ws');
|
|
1088
|
+
const cost = this.safeValue(options, 'cost', 1);
|
|
1089
|
+
if (message) {
|
|
1090
|
+
if (this.enableRateLimit && client.throttle) {
|
|
1091
|
+
// add cost here |
|
|
1092
|
+
// |
|
|
1093
|
+
// V
|
|
1094
|
+
client.throttle(cost).then(() => {
|
|
1095
|
+
client.send(message);
|
|
1096
|
+
}).catch((e) => {
|
|
1097
|
+
for (let i = 0; i < missingSubscriptions.length; i++) {
|
|
1098
|
+
const subscribeHash = missingSubscriptions[i];
|
|
1099
|
+
delete client.subscriptions[subscribeHash];
|
|
1100
|
+
}
|
|
1101
|
+
future.reject(e);
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
client.send(message)
|
|
1106
|
+
.catch((e) => {
|
|
1107
|
+
for (let i = 0; i < missingSubscriptions.length; i++) {
|
|
1108
|
+
const subscribeHash = missingSubscriptions[i];
|
|
1109
|
+
delete client.subscriptions[subscribeHash];
|
|
1110
|
+
}
|
|
1111
|
+
future.reject(e);
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}).catch((e) => {
|
|
1116
|
+
for (let i = 0; i < missingSubscriptions.length; i++) {
|
|
1117
|
+
const subscribeHash = missingSubscriptions[i];
|
|
1118
|
+
delete client.subscriptions[subscribeHash];
|
|
1119
|
+
}
|
|
1120
|
+
future.reject(e);
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
return future;
|
|
1124
|
+
}
|
|
1032
1125
|
watch(url, messageHash, message = undefined, subscribeHash = undefined, subscription = undefined) {
|
|
1033
1126
|
//
|
|
1034
1127
|
// Without comments the code of this method is short and easy:
|
|
@@ -1393,7 +1486,7 @@ class Exchange {
|
|
|
1393
1486
|
const length = usedProxies.length;
|
|
1394
1487
|
if (length > 1) {
|
|
1395
1488
|
const joinedProxyNames = usedProxies.join(',');
|
|
1396
|
-
throw new errors.ExchangeError(this.id + ' you have multiple conflicting settings (' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy,
|
|
1489
|
+
throw new errors.ExchangeError(this.id + ' you have multiple conflicting settings (' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy, wsSocksProxy');
|
|
1397
1490
|
}
|
|
1398
1491
|
return [wsProxy, wssProxy, wsSocksProxy];
|
|
1399
1492
|
}
|
|
@@ -4518,31 +4611,6 @@ class Exchange {
|
|
|
4518
4611
|
*/
|
|
4519
4612
|
return this.filterByArray(objects, key, values, indexed);
|
|
4520
4613
|
}
|
|
4521
|
-
resolvePromiseIfMessagehashMatches(client, prefix, symbol, data) {
|
|
4522
|
-
const messageHashes = this.findMessageHashes(client, prefix);
|
|
4523
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
4524
|
-
const messageHash = messageHashes[i];
|
|
4525
|
-
const parts = messageHash.split('::');
|
|
4526
|
-
const symbolsString = parts[1];
|
|
4527
|
-
const symbols = symbolsString.split(',');
|
|
4528
|
-
if (this.inArray(symbol, symbols)) {
|
|
4529
|
-
client.resolve(data, messageHash);
|
|
4530
|
-
}
|
|
4531
|
-
}
|
|
4532
|
-
}
|
|
4533
|
-
resolveMultipleOHLCV(client, prefix, symbol, timeframe, data) {
|
|
4534
|
-
const messageHashes = this.findMessageHashes(client, 'multipleOHLCV::');
|
|
4535
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
4536
|
-
const messageHash = messageHashes[i];
|
|
4537
|
-
const parts = messageHash.split('::');
|
|
4538
|
-
const symbolsAndTimeframes = parts[1];
|
|
4539
|
-
const splitted = symbolsAndTimeframes.split(',');
|
|
4540
|
-
const id = symbol + '#' + timeframe;
|
|
4541
|
-
if (this.inArray(id, splitted)) {
|
|
4542
|
-
client.resolve([symbol, timeframe, data], messageHash);
|
|
4543
|
-
}
|
|
4544
|
-
}
|
|
4545
|
-
}
|
|
4546
4614
|
createOHLCVObject(symbol, timeframe, data) {
|
|
4547
4615
|
const res = {};
|
|
4548
4616
|
res[symbol] = {};
|
|
@@ -44,11 +44,11 @@ class Client {
|
|
|
44
44
|
};
|
|
45
45
|
Object.assign(this, generic.deepExtend(defaults, config));
|
|
46
46
|
// connection-related Future
|
|
47
|
-
this.connected = Future.
|
|
47
|
+
this.connected = Future.Future();
|
|
48
48
|
}
|
|
49
49
|
future(messageHash) {
|
|
50
50
|
if (!(messageHash in this.futures)) {
|
|
51
|
-
this.futures[messageHash] = Future.
|
|
51
|
+
this.futures[messageHash] = Future.Future();
|
|
52
52
|
}
|
|
53
53
|
const future = this.futures[messageHash];
|
|
54
54
|
if (messageHash in this.rejections) {
|
|
@@ -226,7 +226,7 @@ class Client {
|
|
|
226
226
|
this.log(new Date(), 'sending', message);
|
|
227
227
|
}
|
|
228
228
|
message = (typeof message === 'string') ? message : JSON.stringify(message);
|
|
229
|
-
const future = Future.
|
|
229
|
+
const future = Future.Future();
|
|
230
230
|
if (platform.isNode) {
|
|
231
231
|
/* eslint-disable no-inner-declarations */
|
|
232
232
|
function onSendComplete(error) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
// @ts-nocheck
|
|
6
|
-
function
|
|
6
|
+
function Future() {
|
|
7
7
|
let resolve = undefined, reject = undefined;
|
|
8
8
|
const p = new Promise((resolve_, reject_) => {
|
|
9
9
|
resolve = resolve_;
|
|
@@ -23,5 +23,12 @@ function createFuture() {
|
|
|
23
23
|
};
|
|
24
24
|
return p;
|
|
25
25
|
}
|
|
26
|
+
function wrapFuture(aggregatePromise) {
|
|
27
|
+
const p = Future();
|
|
28
|
+
// wrap the promises as a future
|
|
29
|
+
aggregatePromise.then(p.resolve, p.reject);
|
|
30
|
+
return p;
|
|
31
|
+
}
|
|
32
|
+
Future.race = (futures) => wrapFuture(Promise.race(futures));
|
|
26
33
|
|
|
27
|
-
exports.
|
|
34
|
+
exports.Future = Future;
|
|
@@ -58,7 +58,7 @@ class WsClient extends Client {
|
|
|
58
58
|
close() {
|
|
59
59
|
if (this.connection instanceof WebSocketPlatform) {
|
|
60
60
|
if (this.disconnected === undefined) {
|
|
61
|
-
this.disconnected = Future.
|
|
61
|
+
this.disconnected = Future.Future();
|
|
62
62
|
}
|
|
63
63
|
this.connection.close();
|
|
64
64
|
}
|
package/dist/cjs/src/bigone.js
CHANGED
|
@@ -31,6 +31,7 @@ class bigone extends bigone$1 {
|
|
|
31
31
|
'cancelAllOrders': true,
|
|
32
32
|
'cancelOrder': true,
|
|
33
33
|
'createMarketBuyOrderWithCost': true,
|
|
34
|
+
'createMarketOrderWithCost': false,
|
|
34
35
|
'createMarketSellOrderWithCost': false,
|
|
35
36
|
'createOrder': true,
|
|
36
37
|
'createPostOnlyOrder': true,
|
|
@@ -1158,13 +1159,18 @@ class bigone extends bigone$1 {
|
|
|
1158
1159
|
/**
|
|
1159
1160
|
* @method
|
|
1160
1161
|
* @name bigone#createMarketBuyOrderWithCost
|
|
1161
|
-
* @see https://open.big.one/docs/spot_orders.html#create-order
|
|
1162
1162
|
* @description create a market buy order by providing the symbol and cost
|
|
1163
|
+
* @see https://open.big.one/docs/spot_orders.html#create-order
|
|
1163
1164
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1164
1165
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1165
1166
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1166
1167
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1167
1168
|
*/
|
|
1169
|
+
await this.loadMarkets();
|
|
1170
|
+
const market = this.market(symbol);
|
|
1171
|
+
if (!market['spot']) {
|
|
1172
|
+
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
1173
|
+
}
|
|
1168
1174
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1169
1175
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1170
1176
|
}
|
|
@@ -1183,6 +1189,7 @@ class bigone extends bigone$1 {
|
|
|
1183
1189
|
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1184
1190
|
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
1185
1191
|
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1192
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1186
1193
|
*
|
|
1187
1194
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
1188
1195
|
* @param {string} operator *stop order only* GTE or LTE (default)
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -78,7 +78,6 @@ class binance extends binance$1 {
|
|
|
78
78
|
'fetchIsolatedBorrowRate': false,
|
|
79
79
|
'fetchIsolatedBorrowRates': false,
|
|
80
80
|
'fetchL3OrderBook': false,
|
|
81
|
-
'fetchLastPrices': true,
|
|
82
81
|
'fetchLedger': true,
|
|
83
82
|
'fetchLeverage': false,
|
|
84
83
|
'fetchLeverageTiers': true,
|
|
@@ -3126,110 +3125,6 @@ class binance extends binance$1 {
|
|
|
3126
3125
|
}
|
|
3127
3126
|
return this.parseTickers(response, symbols);
|
|
3128
3127
|
}
|
|
3129
|
-
async fetchLastPrices(symbols = undefined, params = {}) {
|
|
3130
|
-
/**
|
|
3131
|
-
* @method
|
|
3132
|
-
* @name binance#fetchLastPrices
|
|
3133
|
-
* @description fetches the last price for multiple markets
|
|
3134
|
-
* @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker // spot
|
|
3135
|
-
* @see https://binance-docs.github.io/apidocs/future/en/#symbol-price-ticker // swap
|
|
3136
|
-
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
|
|
3137
|
-
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
|
|
3138
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3139
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
3140
|
-
*/
|
|
3141
|
-
await this.loadMarkets();
|
|
3142
|
-
symbols = this.marketSymbols(symbols);
|
|
3143
|
-
const market = this.getMarketFromSymbols(symbols);
|
|
3144
|
-
let type = undefined;
|
|
3145
|
-
let subType = undefined;
|
|
3146
|
-
[subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
|
|
3147
|
-
[type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
|
|
3148
|
-
let response = undefined;
|
|
3149
|
-
if (this.isLinear(type, subType)) {
|
|
3150
|
-
response = await this.fapiPublicV2GetTickerPrice(params);
|
|
3151
|
-
//
|
|
3152
|
-
// [
|
|
3153
|
-
// {
|
|
3154
|
-
// "symbol": "LTCBTC",
|
|
3155
|
-
// "price": "4.00000200"
|
|
3156
|
-
// "time": 1589437530011
|
|
3157
|
-
// },
|
|
3158
|
-
// ...
|
|
3159
|
-
// ]
|
|
3160
|
-
//
|
|
3161
|
-
}
|
|
3162
|
-
else if (this.isInverse(type, subType)) {
|
|
3163
|
-
response = await this.dapiPublicGetTickerPrice(params);
|
|
3164
|
-
//
|
|
3165
|
-
// [
|
|
3166
|
-
// {
|
|
3167
|
-
// "symbol": "BTCUSD_200626",
|
|
3168
|
-
// "ps": "9647.8",
|
|
3169
|
-
// "price": "9647.8",
|
|
3170
|
-
// "time": 1591257246176
|
|
3171
|
-
// }
|
|
3172
|
-
// ]
|
|
3173
|
-
//
|
|
3174
|
-
}
|
|
3175
|
-
else if (type === 'spot') {
|
|
3176
|
-
response = await this.publicGetTickerPrice(params);
|
|
3177
|
-
//
|
|
3178
|
-
// [
|
|
3179
|
-
// {
|
|
3180
|
-
// "symbol": "LTCBTC",
|
|
3181
|
-
// "price": "4.00000200"
|
|
3182
|
-
// },
|
|
3183
|
-
// ...
|
|
3184
|
-
// ]
|
|
3185
|
-
//
|
|
3186
|
-
}
|
|
3187
|
-
else {
|
|
3188
|
-
throw new errors.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
|
|
3189
|
-
}
|
|
3190
|
-
return this.parseLastPrices(response, symbols);
|
|
3191
|
-
}
|
|
3192
|
-
parseLastPrice(info, market = undefined) {
|
|
3193
|
-
//
|
|
3194
|
-
// spot
|
|
3195
|
-
//
|
|
3196
|
-
// {
|
|
3197
|
-
// "symbol": "LTCBTC",
|
|
3198
|
-
// "price": "4.00000200"
|
|
3199
|
-
// }
|
|
3200
|
-
//
|
|
3201
|
-
// usdm (swap/future)
|
|
3202
|
-
//
|
|
3203
|
-
// {
|
|
3204
|
-
// "symbol": "BTCUSDT",
|
|
3205
|
-
// "price": "6000.01",
|
|
3206
|
-
// "time": 1589437530011 // Transaction time
|
|
3207
|
-
// }
|
|
3208
|
-
//
|
|
3209
|
-
//
|
|
3210
|
-
// coinm (swap/future)
|
|
3211
|
-
//
|
|
3212
|
-
// {
|
|
3213
|
-
// "symbol": "BTCUSD_200626", // symbol ("BTCUSD_200626", "BTCUSD_PERP", etc..)
|
|
3214
|
-
// "ps": "BTCUSD", // pair
|
|
3215
|
-
// "price": "9647.8",
|
|
3216
|
-
// "time": 1591257246176
|
|
3217
|
-
// }
|
|
3218
|
-
//
|
|
3219
|
-
const timestamp = this.safeInteger(info, 'time');
|
|
3220
|
-
const type = (timestamp === undefined) ? 'spot' : 'swap';
|
|
3221
|
-
const marketId = this.safeString(info, 'symbol');
|
|
3222
|
-
market = this.safeMarket(marketId, market, undefined, type);
|
|
3223
|
-
const price = this.safeNumber(info, 'price');
|
|
3224
|
-
return {
|
|
3225
|
-
'symbol': market['symbol'],
|
|
3226
|
-
'timestamp': timestamp,
|
|
3227
|
-
'datetime': this.iso8601(timestamp),
|
|
3228
|
-
'price': price,
|
|
3229
|
-
'side': undefined,
|
|
3230
|
-
'info': info,
|
|
3231
|
-
};
|
|
3232
|
-
}
|
|
3233
3128
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
3234
3129
|
/**
|
|
3235
3130
|
* @method
|
|
@@ -3823,6 +3718,7 @@ class binance extends binance$1 {
|
|
|
3823
3718
|
/**
|
|
3824
3719
|
* @method
|
|
3825
3720
|
* @name binance#editSpotOrder
|
|
3721
|
+
* @ignore
|
|
3826
3722
|
* @description edit a trade order
|
|
3827
3723
|
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
|
|
3828
3724
|
* @param {string} id cancel order id
|
|
@@ -6877,6 +6773,7 @@ class binance extends binance$1 {
|
|
|
6877
6773
|
/**
|
|
6878
6774
|
* @method
|
|
6879
6775
|
* @name binance#futuresTransfer
|
|
6776
|
+
* @ignore
|
|
6880
6777
|
* @description transfer between futures account
|
|
6881
6778
|
* @see https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data
|
|
6882
6779
|
* @param {string} code unified currency code
|
|
@@ -7850,6 +7747,7 @@ class binance extends binance$1 {
|
|
|
7850
7747
|
/**
|
|
7851
7748
|
* @method
|
|
7852
7749
|
* @name binance#fetchAccountPositions
|
|
7750
|
+
* @ignore
|
|
7853
7751
|
* @description fetch account positions
|
|
7854
7752
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
7855
7753
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
@@ -7888,6 +7786,7 @@ class binance extends binance$1 {
|
|
|
7888
7786
|
/**
|
|
7889
7787
|
* @method
|
|
7890
7788
|
* @name binance#fetchPositionsRisk
|
|
7789
|
+
* @ignore
|
|
7891
7790
|
* @description fetch positions risk
|
|
7892
7791
|
* @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
|
|
7893
7792
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
|
package/dist/cjs/src/bit2c.js
CHANGED
|
@@ -343,7 +343,13 @@ class bit2c extends bit2c$1 {
|
|
|
343
343
|
if (limit !== undefined) {
|
|
344
344
|
request['limit'] = limit; // max 100000
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
let response = undefined;
|
|
347
|
+
if (method === 'public_get_exchanges_pair_trades') {
|
|
348
|
+
response = await this.publicGetExchangesPairTrades(this.extend(request, params));
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
response = await this.publicGetExchangesPairLasttrades(this.extend(request, params));
|
|
352
|
+
}
|
|
347
353
|
//
|
|
348
354
|
// [
|
|
349
355
|
// {"date":1651785980,"price":127975.68,"amount":0.3750321,"isBid":true,"tid":1261018},
|
|
@@ -431,7 +437,7 @@ class bit2c extends bit2c$1 {
|
|
|
431
437
|
request['Price'] = price;
|
|
432
438
|
const amountString = this.numberToString(amount);
|
|
433
439
|
const priceString = this.numberToString(price);
|
|
434
|
-
request['Total'] = this.
|
|
440
|
+
request['Total'] = this.parseToNumeric(Precise["default"].stringMul(amountString, priceString));
|
|
435
441
|
request['IsBid'] = (side === 'buy');
|
|
436
442
|
}
|
|
437
443
|
const response = await this[method](this.extend(request, params));
|