ccxt-ir 4.9.31 → 4.9.32
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/bit24.js +138 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bit24.d.ts +1 -0
- package/js/src/bit24.d.ts +3 -0
- package/js/src/bit24.js +138 -3
- package/js/test.d.ts +1 -1
- package/js/test.js +33 -33
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -235,7 +235,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
235
235
|
|
|
236
236
|
//-----------------------------------------------------------------------------
|
|
237
237
|
// this is updated by vss.js when building
|
|
238
|
-
const version = '4.9.
|
|
238
|
+
const version = '4.9.32';
|
|
239
239
|
Exchange["default"].ccxtVersion = version;
|
|
240
240
|
const exchanges = {
|
|
241
241
|
'abantether': abantether["default"],
|
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "type": "commonjs" }
|
|
1
|
+
{ "type": "commonjs" }
|
package/dist/cjs/src/bit24.js
CHANGED
|
@@ -90,6 +90,7 @@ class bit24 extends bit24$1["default"] {
|
|
|
90
90
|
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bit24/64x64.png',
|
|
91
91
|
'api': {
|
|
92
92
|
'public': 'https://rest.bit24.cash',
|
|
93
|
+
'otc': 'https://otc-api.bit24.cash',
|
|
93
94
|
},
|
|
94
95
|
'www': 'https://bit24.cash/',
|
|
95
96
|
'doc': [
|
|
@@ -100,6 +101,7 @@ class bit24 extends bit24$1["default"] {
|
|
|
100
101
|
'public': {
|
|
101
102
|
'get': {
|
|
102
103
|
'pro/capi/v1/markets': 1,
|
|
104
|
+
'api/v1/coins/simple-list': 1,
|
|
103
105
|
},
|
|
104
106
|
},
|
|
105
107
|
},
|
|
@@ -116,6 +118,14 @@ class bit24 extends bit24$1["default"] {
|
|
|
116
118
|
* @returns {object[]} an array of objects representing market data
|
|
117
119
|
*/
|
|
118
120
|
const result = [];
|
|
121
|
+
const OTCresponse = await this.publicGetApiV1CoinsSimpleList();
|
|
122
|
+
const OTCmarkets = this.safeDict(OTCresponse, 'data');
|
|
123
|
+
const OTCmarketList = this.safeList(OTCmarkets, 'results', []);
|
|
124
|
+
for (let i = 0; i < OTCmarketList.length; i++) {
|
|
125
|
+
const marketdata = OTCmarketList[i];
|
|
126
|
+
const market = this.parseOtcMarket(marketdata);
|
|
127
|
+
result.push(market);
|
|
128
|
+
}
|
|
119
129
|
let page = 1;
|
|
120
130
|
const limit = 100; // check Bit24 docs for max allowed per page
|
|
121
131
|
while (true) {
|
|
@@ -136,7 +146,7 @@ class bit24 extends bit24$1["default"] {
|
|
|
136
146
|
}
|
|
137
147
|
page += 1;
|
|
138
148
|
}
|
|
139
|
-
return result;
|
|
149
|
+
return this.removeDuplicateValues(result);
|
|
140
150
|
}
|
|
141
151
|
parseMarket(market) {
|
|
142
152
|
// {
|
|
@@ -241,6 +251,68 @@ class bit24 extends bit24$1["default"] {
|
|
|
241
251
|
'info': market,
|
|
242
252
|
};
|
|
243
253
|
}
|
|
254
|
+
parseOtcMarket(market) {
|
|
255
|
+
// {
|
|
256
|
+
// symbol: "0G",
|
|
257
|
+
// name: "0G"
|
|
258
|
+
// },
|
|
259
|
+
let baseId = this.safeString(market, 'symbol');
|
|
260
|
+
let quoteId = 'IRT'; // assuming quote currency is always IRT for OTC markets
|
|
261
|
+
const base = this.safeCurrencyCode(baseId);
|
|
262
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
263
|
+
baseId = baseId.toLowerCase();
|
|
264
|
+
quoteId = quoteId.toLowerCase();
|
|
265
|
+
const id = baseId + '-' + quoteId;
|
|
266
|
+
return {
|
|
267
|
+
'id': id,
|
|
268
|
+
'symbol': base + '/' + quote,
|
|
269
|
+
'base': base,
|
|
270
|
+
'quote': quote,
|
|
271
|
+
'settle': undefined,
|
|
272
|
+
'baseId': baseId,
|
|
273
|
+
'quoteId': quoteId,
|
|
274
|
+
'settleId': undefined,
|
|
275
|
+
'type': 'otc',
|
|
276
|
+
'spot': false,
|
|
277
|
+
'margin': false,
|
|
278
|
+
'swap': false,
|
|
279
|
+
'future': false,
|
|
280
|
+
'option': false,
|
|
281
|
+
'active': true,
|
|
282
|
+
'contract': false,
|
|
283
|
+
'linear': undefined,
|
|
284
|
+
'inverse': undefined,
|
|
285
|
+
'contractSize': undefined,
|
|
286
|
+
'expiry': undefined,
|
|
287
|
+
'expiryDatetime': undefined,
|
|
288
|
+
'strike': undefined,
|
|
289
|
+
'optionType': undefined,
|
|
290
|
+
'precision': {
|
|
291
|
+
'amount': undefined,
|
|
292
|
+
'price': undefined,
|
|
293
|
+
},
|
|
294
|
+
'limits': {
|
|
295
|
+
'leverage': {
|
|
296
|
+
'min': undefined,
|
|
297
|
+
'max': undefined,
|
|
298
|
+
},
|
|
299
|
+
'amount': {
|
|
300
|
+
'min': undefined,
|
|
301
|
+
'max': undefined,
|
|
302
|
+
},
|
|
303
|
+
'price': {
|
|
304
|
+
'min': undefined,
|
|
305
|
+
'max': undefined,
|
|
306
|
+
},
|
|
307
|
+
'cost': {
|
|
308
|
+
'min': undefined,
|
|
309
|
+
'max': undefined,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
'created': undefined,
|
|
313
|
+
'info': market,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
244
316
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
245
317
|
/**
|
|
246
318
|
* @method
|
|
@@ -255,9 +327,18 @@ class bit24 extends bit24$1["default"] {
|
|
|
255
327
|
if (symbols !== undefined) {
|
|
256
328
|
symbols = this.marketSymbols(symbols);
|
|
257
329
|
}
|
|
330
|
+
const result = {};
|
|
331
|
+
const Otcresponse = await this.publicGetApiV1CoinsSimpleList(params);
|
|
332
|
+
const Otcdata = this.safeDict(Otcresponse, 'data', {});
|
|
333
|
+
const OtctickerList = this.safeList(Otcdata, 'results', []);
|
|
334
|
+
for (let i = 0; i < OtctickerList.length; i++) {
|
|
335
|
+
const tickerData = OtctickerList[i];
|
|
336
|
+
const ticker = this.parseOtcTicker(tickerData);
|
|
337
|
+
const symbol = ticker['symbol'];
|
|
338
|
+
result[symbol] = ticker;
|
|
339
|
+
}
|
|
258
340
|
let page = 1;
|
|
259
341
|
const limit = 100; // adjust if Bit24 docs show a different default
|
|
260
|
-
const result = {};
|
|
261
342
|
while (true) {
|
|
262
343
|
const response = await this.publicGetProCapiV1Markets(this.extend(params, {
|
|
263
344
|
'page': page,
|
|
@@ -373,11 +454,65 @@ class bit24 extends bit24$1["default"] {
|
|
|
373
454
|
'info': ticker,
|
|
374
455
|
}, market);
|
|
375
456
|
}
|
|
457
|
+
parseOtcTicker(ticker, market = undefined) {
|
|
458
|
+
// {
|
|
459
|
+
// symbol: "0G",
|
|
460
|
+
// name: "0G"
|
|
461
|
+
// },
|
|
462
|
+
const marketType = 'otc';
|
|
463
|
+
let base_symbol = this.safeString(ticker, 'symbol');
|
|
464
|
+
base_symbol = base_symbol.toLowerCase();
|
|
465
|
+
const quote_symbol = 'irt'; // assuming quote currency is always IRT for OTC markets
|
|
466
|
+
const marketId = base_symbol + '-' + quote_symbol;
|
|
467
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
468
|
+
return this.safeTicker({
|
|
469
|
+
'symbol': symbol,
|
|
470
|
+
'timestamp': undefined,
|
|
471
|
+
'datetime': undefined,
|
|
472
|
+
'high': undefined,
|
|
473
|
+
'low': undefined,
|
|
474
|
+
'bid': undefined,
|
|
475
|
+
'bidVolume': undefined,
|
|
476
|
+
'ask': undefined,
|
|
477
|
+
'askVolume': undefined,
|
|
478
|
+
'vwap': undefined,
|
|
479
|
+
'open': undefined,
|
|
480
|
+
'close': undefined,
|
|
481
|
+
'last': undefined,
|
|
482
|
+
'previousClose': undefined,
|
|
483
|
+
'change': undefined,
|
|
484
|
+
'percentage': undefined,
|
|
485
|
+
'average': undefined,
|
|
486
|
+
'baseVolume': undefined,
|
|
487
|
+
'quoteVolume': undefined,
|
|
488
|
+
'info': ticker,
|
|
489
|
+
}, market);
|
|
490
|
+
}
|
|
491
|
+
async removeDuplicateValues(markets) {
|
|
492
|
+
const uniqueMarkets = [];
|
|
493
|
+
const seenIds = new Set();
|
|
494
|
+
for (let i = 0; i < markets.length; i++) {
|
|
495
|
+
const market = markets[i];
|
|
496
|
+
if (!seenIds.has(market['id'])) {
|
|
497
|
+
seenIds.add(market['id']);
|
|
498
|
+
uniqueMarkets.push(market);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return uniqueMarkets;
|
|
502
|
+
}
|
|
376
503
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
504
|
+
if (path === 'api/v1/coins/simple-list') {
|
|
505
|
+
api = 'otc';
|
|
506
|
+
}
|
|
377
507
|
const query = this.omit(params, this.extractParams(path));
|
|
378
508
|
let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
|
|
379
509
|
url = url + '?' + this.urlencode(query);
|
|
380
|
-
|
|
510
|
+
if (api === 'otc') {
|
|
511
|
+
headers = { 'Content-Type': 'application/json' };
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
headers = { 'Content-Type': 'application/json', 'X-BIT24-APIKEY': 'bdfa2c8c971445d5a4a95c95a5a2a4c2' };
|
|
515
|
+
}
|
|
381
516
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
382
517
|
}
|
|
383
518
|
}
|
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 type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.9.
|
|
7
|
+
declare const version = "4.9.32";
|
|
8
8
|
import abantether from './src/abantether.js';
|
|
9
9
|
import afratether from './src/afratether.js';
|
|
10
10
|
import alpaca from './src/alpaca.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.9.
|
|
41
|
+
const version = '4.9.32';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import abantether from './src/abantether.js';
|
|
@@ -2,6 +2,7 @@ import { implicitReturnType } from '../base/types.js';
|
|
|
2
2
|
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
3
|
interface Exchange {
|
|
4
4
|
publicGetProCapiV1Markets(params?: {}): Promise<implicitReturnType>;
|
|
5
|
+
publicGetApiV1CoinsSimpleList(params?: {}): Promise<implicitReturnType>;
|
|
5
6
|
}
|
|
6
7
|
declare abstract class Exchange extends _Exchange {
|
|
7
8
|
}
|
package/js/src/bit24.d.ts
CHANGED
|
@@ -9,9 +9,12 @@ export default class bit24 extends Exchange {
|
|
|
9
9
|
describe(): any;
|
|
10
10
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
11
11
|
parseMarket(market: any): Market;
|
|
12
|
+
parseOtcMarket(market: any): Market;
|
|
12
13
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
13
14
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
14
15
|
parseTicker(ticker: any, market?: Market): Ticker;
|
|
16
|
+
parseOtcTicker(ticker: any, market?: Market): Ticker;
|
|
17
|
+
removeDuplicateValues(markets: Market[]): Promise<Market[]>;
|
|
15
18
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
16
19
|
url: string;
|
|
17
20
|
method: string;
|
package/js/src/bit24.js
CHANGED
|
@@ -91,6 +91,7 @@ export default class bit24 extends Exchange {
|
|
|
91
91
|
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bit24/64x64.png',
|
|
92
92
|
'api': {
|
|
93
93
|
'public': 'https://rest.bit24.cash',
|
|
94
|
+
'otc': 'https://otc-api.bit24.cash',
|
|
94
95
|
},
|
|
95
96
|
'www': 'https://bit24.cash/',
|
|
96
97
|
'doc': [
|
|
@@ -101,6 +102,7 @@ export default class bit24 extends Exchange {
|
|
|
101
102
|
'public': {
|
|
102
103
|
'get': {
|
|
103
104
|
'pro/capi/v1/markets': 1,
|
|
105
|
+
'api/v1/coins/simple-list': 1,
|
|
104
106
|
},
|
|
105
107
|
},
|
|
106
108
|
},
|
|
@@ -117,6 +119,14 @@ export default class bit24 extends Exchange {
|
|
|
117
119
|
* @returns {object[]} an array of objects representing market data
|
|
118
120
|
*/
|
|
119
121
|
const result = [];
|
|
122
|
+
const OTCresponse = await this.publicGetApiV1CoinsSimpleList();
|
|
123
|
+
const OTCmarkets = this.safeDict(OTCresponse, 'data');
|
|
124
|
+
const OTCmarketList = this.safeList(OTCmarkets, 'results', []);
|
|
125
|
+
for (let i = 0; i < OTCmarketList.length; i++) {
|
|
126
|
+
const marketdata = OTCmarketList[i];
|
|
127
|
+
const market = this.parseOtcMarket(marketdata);
|
|
128
|
+
result.push(market);
|
|
129
|
+
}
|
|
120
130
|
let page = 1;
|
|
121
131
|
const limit = 100; // check Bit24 docs for max allowed per page
|
|
122
132
|
while (true) {
|
|
@@ -137,7 +147,7 @@ export default class bit24 extends Exchange {
|
|
|
137
147
|
}
|
|
138
148
|
page += 1;
|
|
139
149
|
}
|
|
140
|
-
return result;
|
|
150
|
+
return this.removeDuplicateValues(result);
|
|
141
151
|
}
|
|
142
152
|
parseMarket(market) {
|
|
143
153
|
// {
|
|
@@ -242,6 +252,68 @@ export default class bit24 extends Exchange {
|
|
|
242
252
|
'info': market,
|
|
243
253
|
};
|
|
244
254
|
}
|
|
255
|
+
parseOtcMarket(market) {
|
|
256
|
+
// {
|
|
257
|
+
// symbol: "0G",
|
|
258
|
+
// name: "0G"
|
|
259
|
+
// },
|
|
260
|
+
let baseId = this.safeString(market, 'symbol');
|
|
261
|
+
let quoteId = 'IRT'; // assuming quote currency is always IRT for OTC markets
|
|
262
|
+
const base = this.safeCurrencyCode(baseId);
|
|
263
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
264
|
+
baseId = baseId.toLowerCase();
|
|
265
|
+
quoteId = quoteId.toLowerCase();
|
|
266
|
+
const id = baseId + '-' + quoteId;
|
|
267
|
+
return {
|
|
268
|
+
'id': id,
|
|
269
|
+
'symbol': base + '/' + quote,
|
|
270
|
+
'base': base,
|
|
271
|
+
'quote': quote,
|
|
272
|
+
'settle': undefined,
|
|
273
|
+
'baseId': baseId,
|
|
274
|
+
'quoteId': quoteId,
|
|
275
|
+
'settleId': undefined,
|
|
276
|
+
'type': 'otc',
|
|
277
|
+
'spot': false,
|
|
278
|
+
'margin': false,
|
|
279
|
+
'swap': false,
|
|
280
|
+
'future': false,
|
|
281
|
+
'option': false,
|
|
282
|
+
'active': true,
|
|
283
|
+
'contract': false,
|
|
284
|
+
'linear': undefined,
|
|
285
|
+
'inverse': undefined,
|
|
286
|
+
'contractSize': undefined,
|
|
287
|
+
'expiry': undefined,
|
|
288
|
+
'expiryDatetime': undefined,
|
|
289
|
+
'strike': undefined,
|
|
290
|
+
'optionType': undefined,
|
|
291
|
+
'precision': {
|
|
292
|
+
'amount': undefined,
|
|
293
|
+
'price': undefined,
|
|
294
|
+
},
|
|
295
|
+
'limits': {
|
|
296
|
+
'leverage': {
|
|
297
|
+
'min': undefined,
|
|
298
|
+
'max': undefined,
|
|
299
|
+
},
|
|
300
|
+
'amount': {
|
|
301
|
+
'min': undefined,
|
|
302
|
+
'max': undefined,
|
|
303
|
+
},
|
|
304
|
+
'price': {
|
|
305
|
+
'min': undefined,
|
|
306
|
+
'max': undefined,
|
|
307
|
+
},
|
|
308
|
+
'cost': {
|
|
309
|
+
'min': undefined,
|
|
310
|
+
'max': undefined,
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
'created': undefined,
|
|
314
|
+
'info': market,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
245
317
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
246
318
|
/**
|
|
247
319
|
* @method
|
|
@@ -256,9 +328,18 @@ export default class bit24 extends Exchange {
|
|
|
256
328
|
if (symbols !== undefined) {
|
|
257
329
|
symbols = this.marketSymbols(symbols);
|
|
258
330
|
}
|
|
331
|
+
const result = {};
|
|
332
|
+
const Otcresponse = await this.publicGetApiV1CoinsSimpleList(params);
|
|
333
|
+
const Otcdata = this.safeDict(Otcresponse, 'data', {});
|
|
334
|
+
const OtctickerList = this.safeList(Otcdata, 'results', []);
|
|
335
|
+
for (let i = 0; i < OtctickerList.length; i++) {
|
|
336
|
+
const tickerData = OtctickerList[i];
|
|
337
|
+
const ticker = this.parseOtcTicker(tickerData);
|
|
338
|
+
const symbol = ticker['symbol'];
|
|
339
|
+
result[symbol] = ticker;
|
|
340
|
+
}
|
|
259
341
|
let page = 1;
|
|
260
342
|
const limit = 100; // adjust if Bit24 docs show a different default
|
|
261
|
-
const result = {};
|
|
262
343
|
while (true) {
|
|
263
344
|
const response = await this.publicGetProCapiV1Markets(this.extend(params, {
|
|
264
345
|
'page': page,
|
|
@@ -374,11 +455,65 @@ export default class bit24 extends Exchange {
|
|
|
374
455
|
'info': ticker,
|
|
375
456
|
}, market);
|
|
376
457
|
}
|
|
458
|
+
parseOtcTicker(ticker, market = undefined) {
|
|
459
|
+
// {
|
|
460
|
+
// symbol: "0G",
|
|
461
|
+
// name: "0G"
|
|
462
|
+
// },
|
|
463
|
+
const marketType = 'otc';
|
|
464
|
+
let base_symbol = this.safeString(ticker, 'symbol');
|
|
465
|
+
base_symbol = base_symbol.toLowerCase();
|
|
466
|
+
const quote_symbol = 'irt'; // assuming quote currency is always IRT for OTC markets
|
|
467
|
+
const marketId = base_symbol + '-' + quote_symbol;
|
|
468
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
469
|
+
return this.safeTicker({
|
|
470
|
+
'symbol': symbol,
|
|
471
|
+
'timestamp': undefined,
|
|
472
|
+
'datetime': undefined,
|
|
473
|
+
'high': undefined,
|
|
474
|
+
'low': undefined,
|
|
475
|
+
'bid': undefined,
|
|
476
|
+
'bidVolume': undefined,
|
|
477
|
+
'ask': undefined,
|
|
478
|
+
'askVolume': undefined,
|
|
479
|
+
'vwap': undefined,
|
|
480
|
+
'open': undefined,
|
|
481
|
+
'close': undefined,
|
|
482
|
+
'last': undefined,
|
|
483
|
+
'previousClose': undefined,
|
|
484
|
+
'change': undefined,
|
|
485
|
+
'percentage': undefined,
|
|
486
|
+
'average': undefined,
|
|
487
|
+
'baseVolume': undefined,
|
|
488
|
+
'quoteVolume': undefined,
|
|
489
|
+
'info': ticker,
|
|
490
|
+
}, market);
|
|
491
|
+
}
|
|
492
|
+
async removeDuplicateValues(markets) {
|
|
493
|
+
const uniqueMarkets = [];
|
|
494
|
+
const seenIds = new Set();
|
|
495
|
+
for (let i = 0; i < markets.length; i++) {
|
|
496
|
+
const market = markets[i];
|
|
497
|
+
if (!seenIds.has(market['id'])) {
|
|
498
|
+
seenIds.add(market['id']);
|
|
499
|
+
uniqueMarkets.push(market);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return uniqueMarkets;
|
|
503
|
+
}
|
|
377
504
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
505
|
+
if (path === 'api/v1/coins/simple-list') {
|
|
506
|
+
api = 'otc';
|
|
507
|
+
}
|
|
378
508
|
const query = this.omit(params, this.extractParams(path));
|
|
379
509
|
let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
|
|
380
510
|
url = url + '?' + this.urlencode(query);
|
|
381
|
-
|
|
511
|
+
if (api === 'otc') {
|
|
512
|
+
headers = { 'Content-Type': 'application/json' };
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
headers = { 'Content-Type': 'application/json', 'X-BIT24-APIKEY': 'bdfa2c8c971445d5a4a95c95a5a2a4c2' };
|
|
516
|
+
}
|
|
382
517
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
383
518
|
}
|
|
384
519
|
}
|
package/js/test.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/js/test.js
CHANGED
|
@@ -4,36 +4,36 @@
|
|
|
4
4
|
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
5
|
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
6
|
|
|
7
|
-
import ccxt from './ccxt.js';
|
|
8
|
-
async function testBit24() {
|
|
9
|
-
const exchange = new ccxt.bit24();
|
|
10
|
-
try {
|
|
11
|
-
// Load markets first
|
|
12
|
-
await exchange.loadMarkets();
|
|
13
|
-
console.log('Markets loaded successfully.');
|
|
14
|
-
// Test fetchMarkets
|
|
15
|
-
console.log('Testing fetchMarkets...');
|
|
16
|
-
const markets = await exchange.fetchMarkets();
|
|
17
|
-
console.log('fetchMarkets result:', markets);
|
|
18
|
-
console.log('Number of markets:', Object.keys(markets).length);
|
|
19
|
-
// Test fetchTickers
|
|
20
|
-
console.log('Testing fetchTickers...');
|
|
21
|
-
const tickers = await exchange.fetchTickers();
|
|
22
|
-
console.log('fetchTickers result:', tickers);
|
|
23
|
-
console.log('Number of tickers:', Object.keys(tickers).length);
|
|
24
|
-
// Test fetchTicker for a specific symbol
|
|
25
|
-
if (Object.keys(markets).length > 0) {
|
|
26
|
-
const firstSymbol = Object.keys(markets)[0];
|
|
27
|
-
console.log('Testing fetchTicker for symbol:', firstSymbol);
|
|
28
|
-
const ticker = await exchange.fetchTicker(firstSymbol);
|
|
29
|
-
console.log('fetchTicker result:', ticker);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
console.log('No markets available to test fetchTicker.');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.error('Error during testing:', error);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
testBit24();
|
|
7
|
+
import ccxt from './ccxt.js';
|
|
8
|
+
async function testBit24() {
|
|
9
|
+
const exchange = new ccxt.bit24();
|
|
10
|
+
try {
|
|
11
|
+
// Load markets first
|
|
12
|
+
await exchange.loadMarkets();
|
|
13
|
+
console.log('Markets loaded successfully.');
|
|
14
|
+
// Test fetchMarkets
|
|
15
|
+
console.log('Testing fetchMarkets...');
|
|
16
|
+
const markets = await exchange.fetchMarkets();
|
|
17
|
+
console.log('fetchMarkets result:', markets);
|
|
18
|
+
console.log('Number of markets:', Object.keys(markets).length);
|
|
19
|
+
// Test fetchTickers
|
|
20
|
+
console.log('Testing fetchTickers...');
|
|
21
|
+
const tickers = await exchange.fetchTickers();
|
|
22
|
+
console.log('fetchTickers result:', tickers);
|
|
23
|
+
console.log('Number of tickers:', Object.keys(tickers).length);
|
|
24
|
+
// Test fetchTicker for a specific symbol
|
|
25
|
+
if (Object.keys(markets).length > 0) {
|
|
26
|
+
const firstSymbol = Object.keys(markets)[0];
|
|
27
|
+
console.log('Testing fetchTicker for symbol:', firstSymbol);
|
|
28
|
+
const ticker = await exchange.fetchTicker(firstSymbol);
|
|
29
|
+
console.log('fetchTicker result:', ticker);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log('No markets available to test fetchTicker.');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('Error during testing:', error);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
testBit24();
|
package/package.json
CHANGED