ccxt 4.3.41 → 4.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +169 -44
- package/dist/cjs/src/bitmart.js +196 -100
- package/dist/cjs/src/blockchaincom.js +11 -7
- package/dist/cjs/src/btcmarkets.js +31 -2
- package/dist/cjs/src/coinex.js +107 -108
- package/dist/cjs/src/kraken.js +30 -3
- package/dist/cjs/src/krakenfutures.js +56 -1
- package/dist/cjs/src/kucoin.js +59 -2
- package/dist/cjs/src/phemex.js +5 -4
- package/dist/cjs/src/pro/bitget.js +36 -22
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/mexc.js +2 -2
- package/dist/cjs/src/pro/upbit.js +8 -4
- package/dist/cjs/src/pro/woo.js +2 -2
- package/dist/cjs/src/tradeogre.js +11 -5
- package/dist/cjs/src/wavesexchange.js +2 -2
- package/dist/cjs/src/wazirx.js +38 -15
- package/dist/cjs/src/zonda.js +9 -1
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinex.d.ts +2 -1
- package/js/src/binance.js +169 -44
- package/js/src/bitmart.js +196 -100
- package/js/src/blockchaincom.d.ts +2 -8
- package/js/src/blockchaincom.js +11 -7
- package/js/src/btcmarkets.d.ts +2 -2
- package/js/src/btcmarkets.js +31 -2
- package/js/src/coinex.js +107 -108
- package/js/src/kraken.d.ts +3 -3
- package/js/src/kraken.js +30 -3
- package/js/src/krakenfutures.d.ts +1 -1
- package/js/src/krakenfutures.js +56 -1
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +59 -2
- package/js/src/phemex.js +6 -5
- package/js/src/pro/bitget.js +36 -22
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/mexc.js +2 -2
- package/js/src/pro/upbit.js +8 -4
- package/js/src/pro/woo.js +2 -2
- package/js/src/tradeogre.d.ts +1 -1
- package/js/src/tradeogre.js +12 -6
- package/js/src/wavesexchange.d.ts +1 -20
- package/js/src/wavesexchange.js +2 -2
- package/js/src/wazirx.d.ts +1 -1
- package/js/src/wazirx.js +38 -15
- package/js/src/zonda.d.ts +1 -1
- package/js/src/zonda.js +9 -1
- package/package.json +1 -1
package/js/src/bitmart.js
CHANGED
|
@@ -1130,27 +1130,46 @@ export default class bitmart extends Exchange {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
parseTicker(ticker, market = undefined) {
|
|
1132
1132
|
//
|
|
1133
|
-
// spot (REST)
|
|
1133
|
+
// spot (REST) fetchTickers
|
|
1134
1134
|
//
|
|
1135
|
-
//
|
|
1136
|
-
//
|
|
1137
|
-
//
|
|
1138
|
-
//
|
|
1139
|
-
//
|
|
1140
|
-
//
|
|
1141
|
-
//
|
|
1142
|
-
//
|
|
1143
|
-
//
|
|
1144
|
-
//
|
|
1145
|
-
//
|
|
1146
|
-
//
|
|
1147
|
-
//
|
|
1148
|
-
//
|
|
1149
|
-
//
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1135
|
+
// {
|
|
1136
|
+
// 'result': [
|
|
1137
|
+
// "AFIN_USDT", // symbol
|
|
1138
|
+
// "0.001047", // last
|
|
1139
|
+
// "11110", // v_24h
|
|
1140
|
+
// "11.632170", // qv_24h
|
|
1141
|
+
// "0.001048", // open_24h
|
|
1142
|
+
// "0.001048", // high_24h
|
|
1143
|
+
// "0.001047", // low_24h
|
|
1144
|
+
// "-0.00095", // price_change_24h
|
|
1145
|
+
// "0.001029", // bid_px
|
|
1146
|
+
// "5555", // bid_sz
|
|
1147
|
+
// "0.001041", // ask_px
|
|
1148
|
+
// "5297", // ask_sz
|
|
1149
|
+
// "1717122550482" // timestamp
|
|
1150
|
+
// ]
|
|
1151
|
+
// }
|
|
1152
|
+
//
|
|
1153
|
+
// spot (REST) fetchTicker
|
|
1154
|
+
//
|
|
1155
|
+
// {
|
|
1156
|
+
// "symbol": "BTC_USDT",
|
|
1157
|
+
// "last": "68500.00",
|
|
1158
|
+
// "v_24h": "10491.65490",
|
|
1159
|
+
// "qv_24h": "717178990.42",
|
|
1160
|
+
// "open_24h": "68149.75",
|
|
1161
|
+
// "high_24h": "69499.99",
|
|
1162
|
+
// "low_24h": "67132.40",
|
|
1163
|
+
// "fluctuation": "0.00514",
|
|
1164
|
+
// "bid_px": "68500",
|
|
1165
|
+
// "bid_sz": "0.00162",
|
|
1166
|
+
// "ask_px": "68500.01",
|
|
1167
|
+
// "ask_sz": "0.01722",
|
|
1168
|
+
// "ts": "1717131391671"
|
|
1169
|
+
// }
|
|
1152
1170
|
//
|
|
1153
1171
|
// spot (WS)
|
|
1172
|
+
//
|
|
1154
1173
|
// {
|
|
1155
1174
|
// "symbol":"BTC_USDT",
|
|
1156
1175
|
// "last_price":"146.24",
|
|
@@ -1176,21 +1195,47 @@ export default class bitmart extends Exchange {
|
|
|
1176
1195
|
// "legal_coin_price":"0.1302699"
|
|
1177
1196
|
// }
|
|
1178
1197
|
//
|
|
1179
|
-
|
|
1198
|
+
const result = this.safeList(ticker, 'result', []);
|
|
1199
|
+
const average = this.safeString2(ticker, 'avg_price', 'index_price');
|
|
1200
|
+
let marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
|
|
1201
|
+
let timestamp = this.safeInteger2(ticker, 'timestamp', 'ts');
|
|
1202
|
+
let last = this.safeString2(ticker, 'last_price', 'last');
|
|
1203
|
+
let percentage = this.safeString(ticker, 'price_change_percent_24h');
|
|
1204
|
+
let change = this.safeString(ticker, 'fluctuation');
|
|
1205
|
+
let high = this.safeString2(ticker, 'high_24h', 'high_price');
|
|
1206
|
+
let low = this.safeString2(ticker, 'low_24h', 'low_price');
|
|
1207
|
+
let bid = this.safeString2(ticker, 'best_bid', 'bid_px');
|
|
1208
|
+
let bidVolume = this.safeString2(ticker, 'best_bid_size', 'bid_sz');
|
|
1209
|
+
let ask = this.safeString2(ticker, 'best_ask', 'ask_px');
|
|
1210
|
+
let askVolume = this.safeString2(ticker, 'best_ask_size', 'ask_sz');
|
|
1211
|
+
let open = this.safeString(ticker, 'open_24h');
|
|
1212
|
+
let baseVolume = this.safeString2(ticker, 'base_volume_24h', 'v_24h');
|
|
1213
|
+
let quoteVolume = this.safeStringLower2(ticker, 'quote_volume_24h', 'qv_24h');
|
|
1214
|
+
const listMarketId = this.safeString(result, 0);
|
|
1215
|
+
if (listMarketId !== undefined) {
|
|
1216
|
+
marketId = listMarketId;
|
|
1217
|
+
timestamp = this.safeInteger(result, 12);
|
|
1218
|
+
high = this.safeString(result, 5);
|
|
1219
|
+
low = this.safeString(result, 6);
|
|
1220
|
+
bid = this.safeString(result, 8);
|
|
1221
|
+
bidVolume = this.safeString(result, 9);
|
|
1222
|
+
ask = this.safeString(result, 10);
|
|
1223
|
+
askVolume = this.safeString(result, 11);
|
|
1224
|
+
open = this.safeString(result, 4);
|
|
1225
|
+
last = this.safeString(result, 1);
|
|
1226
|
+
change = this.safeString(result, 7);
|
|
1227
|
+
baseVolume = this.safeString(result, 2);
|
|
1228
|
+
quoteVolume = this.safeStringLower(result, 3);
|
|
1229
|
+
}
|
|
1230
|
+
market = this.safeMarket(marketId, market);
|
|
1231
|
+
const symbol = market['symbol'];
|
|
1180
1232
|
if (timestamp === undefined) {
|
|
1181
1233
|
// ticker from WS has a different field (in seconds)
|
|
1182
1234
|
timestamp = this.safeIntegerProduct(ticker, 's_t', 1000);
|
|
1183
1235
|
}
|
|
1184
|
-
const marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
|
|
1185
|
-
market = this.safeMarket(marketId, market);
|
|
1186
|
-
const symbol = market['symbol'];
|
|
1187
|
-
const last = this.safeString2(ticker, 'close_24h', 'last_price');
|
|
1188
|
-
let percentage = this.safeString(ticker, 'price_change_percent_24h');
|
|
1189
1236
|
if (percentage === undefined) {
|
|
1190
|
-
percentage = Precise.stringMul(
|
|
1237
|
+
percentage = Precise.stringMul(change, '100');
|
|
1191
1238
|
}
|
|
1192
|
-
let baseVolume = this.safeString(ticker, 'base_volume_24h');
|
|
1193
|
-
let quoteVolume = this.safeString(ticker, 'quote_volume_24h');
|
|
1194
1239
|
if (quoteVolume === undefined) {
|
|
1195
1240
|
if (baseVolume === undefined) {
|
|
1196
1241
|
// this is swap
|
|
@@ -1203,25 +1248,22 @@ export default class bitmart extends Exchange {
|
|
|
1203
1248
|
baseVolume = undefined;
|
|
1204
1249
|
}
|
|
1205
1250
|
}
|
|
1206
|
-
const average = this.safeString2(ticker, 'avg_price', 'index_price');
|
|
1207
|
-
const high = this.safeString2(ticker, 'high_24h', 'high_price');
|
|
1208
|
-
const low = this.safeString2(ticker, 'low_24h', 'low_price');
|
|
1209
1251
|
return this.safeTicker({
|
|
1210
1252
|
'symbol': symbol,
|
|
1211
1253
|
'timestamp': timestamp,
|
|
1212
1254
|
'datetime': this.iso8601(timestamp),
|
|
1213
1255
|
'high': high,
|
|
1214
1256
|
'low': low,
|
|
1215
|
-
'bid':
|
|
1216
|
-
'bidVolume':
|
|
1217
|
-
'ask':
|
|
1218
|
-
'askVolume':
|
|
1257
|
+
'bid': bid,
|
|
1258
|
+
'bidVolume': bidVolume,
|
|
1259
|
+
'ask': ask,
|
|
1260
|
+
'askVolume': askVolume,
|
|
1219
1261
|
'vwap': undefined,
|
|
1220
|
-
'open':
|
|
1262
|
+
'open': open,
|
|
1221
1263
|
'close': last,
|
|
1222
1264
|
'last': last,
|
|
1223
1265
|
'previousClose': undefined,
|
|
1224
|
-
'change':
|
|
1266
|
+
'change': change,
|
|
1225
1267
|
'percentage': percentage,
|
|
1226
1268
|
'average': average,
|
|
1227
1269
|
'baseVolume': baseVolume,
|
|
@@ -1234,6 +1276,7 @@ export default class bitmart extends Exchange {
|
|
|
1234
1276
|
* @method
|
|
1235
1277
|
* @name bitmart#fetchTicker
|
|
1236
1278
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1279
|
+
* @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
|
|
1237
1280
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1238
1281
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1239
1282
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1245,78 +1288,72 @@ export default class bitmart extends Exchange {
|
|
|
1245
1288
|
if (market['swap']) {
|
|
1246
1289
|
request['contract_symbol'] = market['id'];
|
|
1247
1290
|
response = await this.publicGetContractV1Tickers(this.extend(request, params));
|
|
1291
|
+
//
|
|
1292
|
+
// {
|
|
1293
|
+
// "message":"OK",
|
|
1294
|
+
// "code":1000,
|
|
1295
|
+
// "trace":"4a0ebceb-d3f7-45a3-8feb-f61e230e24cd",
|
|
1296
|
+
// "data":{
|
|
1297
|
+
// "tickers":[
|
|
1298
|
+
// {
|
|
1299
|
+
// "contract_symbol":"DOGEUSDT",
|
|
1300
|
+
// "last_price":"0.130180",
|
|
1301
|
+
// "index_price":"0.13028635",
|
|
1302
|
+
// "last_funding_rate":"0.00002025",
|
|
1303
|
+
// "price_change_percent_24h":"-2.326",
|
|
1304
|
+
// "volume_24h":"116789313.01797258",
|
|
1305
|
+
// "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
|
|
1306
|
+
// "high_price":"0.134520",
|
|
1307
|
+
// "low_price":"0.128570",
|
|
1308
|
+
// "legal_coin_price":"0.13017401"
|
|
1309
|
+
// }
|
|
1310
|
+
// ]
|
|
1311
|
+
// }
|
|
1312
|
+
// }
|
|
1313
|
+
//
|
|
1248
1314
|
}
|
|
1249
1315
|
else if (market['spot']) {
|
|
1250
1316
|
request['symbol'] = market['id'];
|
|
1251
|
-
response = await this.
|
|
1317
|
+
response = await this.publicGetSpotQuotationV3Ticker(this.extend(request, params));
|
|
1318
|
+
//
|
|
1319
|
+
// {
|
|
1320
|
+
// "code": 1000,
|
|
1321
|
+
// "trace": "f2194c2c202d2.99.1717535",
|
|
1322
|
+
// "message": "success",
|
|
1323
|
+
// "data": {
|
|
1324
|
+
// "symbol": "BTC_USDT",
|
|
1325
|
+
// "last": "68500.00",
|
|
1326
|
+
// "v_24h": "10491.65490",
|
|
1327
|
+
// "qv_24h": "717178990.42",
|
|
1328
|
+
// "open_24h": "68149.75",
|
|
1329
|
+
// "high_24h": "69499.99",
|
|
1330
|
+
// "low_24h": "67132.40",
|
|
1331
|
+
// "fluctuation": "0.00514",
|
|
1332
|
+
// "bid_px": "68500",
|
|
1333
|
+
// "bid_sz": "0.00162",
|
|
1334
|
+
// "ask_px": "68500.01",
|
|
1335
|
+
// "ask_sz": "0.01722",
|
|
1336
|
+
// "ts": "1717131391671"
|
|
1337
|
+
// }
|
|
1338
|
+
// }
|
|
1339
|
+
//
|
|
1252
1340
|
}
|
|
1253
1341
|
else {
|
|
1254
1342
|
throw new NotSupported(this.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted');
|
|
1255
1343
|
}
|
|
1256
|
-
//
|
|
1257
|
-
// spot
|
|
1258
|
-
//
|
|
1259
|
-
// {
|
|
1260
|
-
// "message":"OK",
|
|
1261
|
-
// "code":1000,
|
|
1262
|
-
// "trace":"6aa5b923-2f57-46e3-876d-feca190e0b82",
|
|
1263
|
-
// "data":{
|
|
1264
|
-
// "tickers":[
|
|
1265
|
-
// {
|
|
1266
|
-
// "symbol":"ETH_BTC",
|
|
1267
|
-
// "last_price":"0.036037",
|
|
1268
|
-
// "quote_volume_24h":"4380.6660000000",
|
|
1269
|
-
// "base_volume_24h":"159.3582006712",
|
|
1270
|
-
// "high_24h":"0.036972",
|
|
1271
|
-
// "low_24h":"0.035524",
|
|
1272
|
-
// "open_24h":"0.036561",
|
|
1273
|
-
// "close_24h":"0.036037",
|
|
1274
|
-
// "best_ask":"0.036077",
|
|
1275
|
-
// "best_ask_size":"9.9500",
|
|
1276
|
-
// "best_bid":"0.035983",
|
|
1277
|
-
// "best_bid_size":"4.2792",
|
|
1278
|
-
// "fluctuation":"-0.0143",
|
|
1279
|
-
// "url":"https://www.bitmart.com/trade?symbol=ETH_BTC"
|
|
1280
|
-
// }
|
|
1281
|
-
// ]
|
|
1282
|
-
// }
|
|
1283
|
-
// }
|
|
1284
|
-
//
|
|
1285
|
-
// swap
|
|
1286
|
-
//
|
|
1287
|
-
// {
|
|
1288
|
-
// "message":"OK",
|
|
1289
|
-
// "code":1000,
|
|
1290
|
-
// "trace":"4a0ebceb-d3f7-45a3-8feb-f61e230e24cd",
|
|
1291
|
-
// "data":{
|
|
1292
|
-
// "tickers":[
|
|
1293
|
-
// {
|
|
1294
|
-
// "contract_symbol":"DOGEUSDT",
|
|
1295
|
-
// "last_price":"0.130180",
|
|
1296
|
-
// "index_price":"0.13028635",
|
|
1297
|
-
// "last_funding_rate":"0.00002025",
|
|
1298
|
-
// "price_change_percent_24h":"-2.326",
|
|
1299
|
-
// "volume_24h":"116789313.01797258",
|
|
1300
|
-
// "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
|
|
1301
|
-
// "high_price":"0.134520",
|
|
1302
|
-
// "low_price":"0.128570",
|
|
1303
|
-
// "legal_coin_price":"0.13017401"
|
|
1304
|
-
// }
|
|
1305
|
-
// ]
|
|
1306
|
-
// }
|
|
1307
|
-
// }
|
|
1308
|
-
//
|
|
1309
|
-
const data = this.safeValue(response, 'data', {});
|
|
1310
|
-
const tickers = this.safeValue(data, 'tickers', []);
|
|
1311
1344
|
// fails in naming for contract tickers 'contract_symbol'
|
|
1312
1345
|
let tickersById = undefined;
|
|
1346
|
+
let tickers = [];
|
|
1347
|
+
let ticker = {};
|
|
1313
1348
|
if (market['spot']) {
|
|
1314
|
-
|
|
1349
|
+
ticker = this.safeDict(response, 'data', {});
|
|
1315
1350
|
}
|
|
1316
|
-
else
|
|
1351
|
+
else {
|
|
1352
|
+
const data = this.safeDict(response, 'data', {});
|
|
1353
|
+
tickers = this.safeList(data, 'tickers', []);
|
|
1317
1354
|
tickersById = this.indexBy(tickers, 'contract_symbol');
|
|
1355
|
+
ticker = this.safeDict(tickersById, market['id']);
|
|
1318
1356
|
}
|
|
1319
|
-
const ticker = this.safeDict(tickersById, market['id']);
|
|
1320
1357
|
return this.parseTicker(ticker, market);
|
|
1321
1358
|
}
|
|
1322
1359
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
@@ -1324,7 +1361,7 @@ export default class bitmart extends Exchange {
|
|
|
1324
1361
|
* @method
|
|
1325
1362
|
* @name bitmart#fetchTickers
|
|
1326
1363
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1327
|
-
* @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-
|
|
1364
|
+
* @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
|
|
1328
1365
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1329
1366
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1330
1367
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1340,19 +1377,78 @@ export default class bitmart extends Exchange {
|
|
|
1340
1377
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
1341
1378
|
let response = undefined;
|
|
1342
1379
|
if (type === 'spot') {
|
|
1343
|
-
response = await this.
|
|
1380
|
+
response = await this.publicGetSpotQuotationV3Tickers(params);
|
|
1381
|
+
//
|
|
1382
|
+
// {
|
|
1383
|
+
// "code": 1000,
|
|
1384
|
+
// "trace": "17c5e5d9ac49f9b71efca2bed55f1a.105.171225637482393",
|
|
1385
|
+
// "message": "success",
|
|
1386
|
+
// "data": [
|
|
1387
|
+
// [
|
|
1388
|
+
// "AFIN_USDT",
|
|
1389
|
+
// "0.001047",
|
|
1390
|
+
// "11110",
|
|
1391
|
+
// "11.632170",
|
|
1392
|
+
// "0.001048",
|
|
1393
|
+
// "0.001048",
|
|
1394
|
+
// "0.001047",
|
|
1395
|
+
// "-0.00095",
|
|
1396
|
+
// "0.001029",
|
|
1397
|
+
// "5555",
|
|
1398
|
+
// "0.001041",
|
|
1399
|
+
// "5297",
|
|
1400
|
+
// "1717122550482"
|
|
1401
|
+
// ],
|
|
1402
|
+
// ]
|
|
1403
|
+
// }
|
|
1404
|
+
//
|
|
1344
1405
|
}
|
|
1345
1406
|
else if (type === 'swap') {
|
|
1346
1407
|
response = await this.publicGetContractV1Tickers(params);
|
|
1408
|
+
//
|
|
1409
|
+
// {
|
|
1410
|
+
// "message": "OK",
|
|
1411
|
+
// "code": 1000,
|
|
1412
|
+
// "trace": "c1dec681c24ea5d.105.171712565",
|
|
1413
|
+
// "data": {
|
|
1414
|
+
// "tickers": [
|
|
1415
|
+
// {
|
|
1416
|
+
// "contract_symbol": "SNTUSDT",
|
|
1417
|
+
// "last_price": "0.0366600",
|
|
1418
|
+
// "index_price": "0.03587373",
|
|
1419
|
+
// "last_funding_rate": "0.00005000",
|
|
1420
|
+
// "price_change_percent_24h": "-2.629",
|
|
1421
|
+
// "volume_24h": "10102540.19909109848",
|
|
1422
|
+
// "url": "https://futures.bitmart.com/en?symbol=SNTUSDT",
|
|
1423
|
+
// "high_price": "0.0405600",
|
|
1424
|
+
// "low_price": "0.0355000",
|
|
1425
|
+
// "legal_coin_price": "0.03666697"
|
|
1426
|
+
// },
|
|
1427
|
+
// ]
|
|
1428
|
+
// }
|
|
1429
|
+
// }
|
|
1430
|
+
//
|
|
1347
1431
|
}
|
|
1348
1432
|
else {
|
|
1349
1433
|
throw new NotSupported(this.id + ' fetchTickers() does not support ' + type + ' markets, only spot and swap markets are accepted');
|
|
1350
1434
|
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1435
|
+
let tickers = [];
|
|
1436
|
+
if (type === 'spot') {
|
|
1437
|
+
tickers = this.safeList(response, 'data', []);
|
|
1438
|
+
}
|
|
1439
|
+
else {
|
|
1440
|
+
const data = this.safeDict(response, 'data', {});
|
|
1441
|
+
tickers = this.safeList(data, 'tickers', []);
|
|
1442
|
+
}
|
|
1353
1443
|
const result = {};
|
|
1354
1444
|
for (let i = 0; i < tickers.length; i++) {
|
|
1355
|
-
|
|
1445
|
+
let ticker = {};
|
|
1446
|
+
if (type === 'spot') {
|
|
1447
|
+
ticker = this.parseTicker({ 'result': tickers[i] });
|
|
1448
|
+
}
|
|
1449
|
+
else {
|
|
1450
|
+
ticker = this.parseTicker(tickers[i]);
|
|
1451
|
+
}
|
|
1356
1452
|
const symbol = ticker['symbol'];
|
|
1357
1453
|
result[symbol] = ticker;
|
|
1358
1454
|
}
|
|
@@ -16,14 +16,8 @@ export default class blockchaincom extends Exchange {
|
|
|
16
16
|
parseOrderState(state: any): string;
|
|
17
17
|
parseOrder(order: Dict, market?: Market): Order;
|
|
18
18
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
19
|
-
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<
|
|
20
|
-
|
|
21
|
-
info: any;
|
|
22
|
-
}>;
|
|
23
|
-
cancelAllOrders(symbol?: Str, params?: {}): Promise<{
|
|
24
|
-
symbol: string;
|
|
25
|
-
info: any;
|
|
26
|
-
}>;
|
|
19
|
+
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
20
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
|
|
27
21
|
fetchTradingFees(params?: {}): Promise<TradingFees>;
|
|
28
22
|
fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
29
23
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
package/js/src/blockchaincom.js
CHANGED
|
@@ -616,17 +616,17 @@ export default class blockchaincom extends Exchange {
|
|
|
616
616
|
'orderId': id,
|
|
617
617
|
};
|
|
618
618
|
const response = await this.privateDeleteOrdersOrderId(this.extend(request, params));
|
|
619
|
-
return {
|
|
619
|
+
return this.safeOrder({
|
|
620
620
|
'id': id,
|
|
621
621
|
'info': response,
|
|
622
|
-
};
|
|
622
|
+
});
|
|
623
623
|
}
|
|
624
624
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
625
625
|
/**
|
|
626
626
|
* @method
|
|
627
627
|
* @name blockchaincom#cancelAllOrders
|
|
628
628
|
* @description cancel all open orders
|
|
629
|
-
* @see https://api.blockchain.com/v3
|
|
629
|
+
* @see https://api.blockchain.com/v3/#deleteallorders
|
|
630
630
|
* @param {string} symbol unified market symbol of the market to cancel orders in, all markets are used if undefined, default is undefined
|
|
631
631
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
632
632
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -642,10 +642,14 @@ export default class blockchaincom extends Exchange {
|
|
|
642
642
|
request['symbol'] = marketId;
|
|
643
643
|
}
|
|
644
644
|
const response = await this.privateDeleteOrders(this.extend(request, params));
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
645
|
+
//
|
|
646
|
+
// {}
|
|
647
|
+
//
|
|
648
|
+
return [
|
|
649
|
+
this.safeOrder({
|
|
650
|
+
'info': response,
|
|
651
|
+
}),
|
|
652
|
+
];
|
|
649
653
|
}
|
|
650
654
|
async fetchTradingFees(params = {}) {
|
|
651
655
|
/**
|
package/js/src/btcmarkets.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ export default class btcmarkets extends Exchange {
|
|
|
27
27
|
parseTrade(trade: Dict, market?: Market): Trade;
|
|
28
28
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
29
29
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
30
|
-
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<
|
|
31
|
-
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<
|
|
30
|
+
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
|
|
31
|
+
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
32
32
|
calculateFee(symbol: any, type: any, side: any, amount: any, price: any, takerOrMaker?: string, params?: {}): {
|
|
33
33
|
type: string;
|
|
34
34
|
currency: any;
|
package/js/src/btcmarkets.js
CHANGED
|
@@ -900,7 +900,29 @@ export default class btcmarkets extends Exchange {
|
|
|
900
900
|
const request = {
|
|
901
901
|
'ids': ids,
|
|
902
902
|
};
|
|
903
|
-
|
|
903
|
+
const response = await this.privateDeleteBatchordersIds(this.extend(request, params));
|
|
904
|
+
//
|
|
905
|
+
// {
|
|
906
|
+
// "cancelOrders": [
|
|
907
|
+
// {
|
|
908
|
+
// "orderId": "414186",
|
|
909
|
+
// "clientOrderId": "6"
|
|
910
|
+
// },
|
|
911
|
+
// ...
|
|
912
|
+
// ],
|
|
913
|
+
// "unprocessedRequests": [
|
|
914
|
+
// {
|
|
915
|
+
// "code": "OrderAlreadyCancelled",
|
|
916
|
+
// "message": "order is already cancelled.",
|
|
917
|
+
// "requestId": "1"
|
|
918
|
+
// }
|
|
919
|
+
// ]
|
|
920
|
+
// }
|
|
921
|
+
//
|
|
922
|
+
const cancelOrders = this.safeList(response, 'cancelOrders', []);
|
|
923
|
+
const unprocessedRequests = this.safeList(response, 'unprocessedRequests', []);
|
|
924
|
+
const orders = this.arrayConcat(cancelOrders, unprocessedRequests);
|
|
925
|
+
return this.parseOrders(orders);
|
|
904
926
|
}
|
|
905
927
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
906
928
|
/**
|
|
@@ -917,7 +939,14 @@ export default class btcmarkets extends Exchange {
|
|
|
917
939
|
const request = {
|
|
918
940
|
'id': id,
|
|
919
941
|
};
|
|
920
|
-
|
|
942
|
+
const response = await this.privateDeleteOrdersId(this.extend(request, params));
|
|
943
|
+
//
|
|
944
|
+
// {
|
|
945
|
+
// "orderId": "7524",
|
|
946
|
+
// "clientOrderId": "123-456"
|
|
947
|
+
// }
|
|
948
|
+
//
|
|
949
|
+
return this.parseOrder(response);
|
|
921
950
|
}
|
|
922
951
|
calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
|
923
952
|
/**
|