ccxt-ir 4.23.0 → 4.23.2
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 +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitbarg.js +23 -4
- package/dist/cjs/src/swapwallet.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/swapwallet.js +11 -0
- package/js/src/bitbarg.js +23 -4
- package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +2 -2
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/swapwallet.js +1 -1
- package/js/test.js +7 -54
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -264,7 +264,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
264
264
|
|
|
265
265
|
//-----------------------------------------------------------------------------
|
|
266
266
|
// this is updated by vss.js when building
|
|
267
|
-
const version = '4.23.
|
|
267
|
+
const version = '4.23.2';
|
|
268
268
|
Exchange["default"].ccxtVersion = version;
|
|
269
269
|
const exchanges = {
|
|
270
270
|
'abantether': abantether["default"],
|
package/dist/cjs/src/bitbarg.js
CHANGED
|
@@ -126,7 +126,12 @@ class bitbarg extends bitbarg$1["default"] {
|
|
|
126
126
|
// "decimal": 8,
|
|
127
127
|
// "isFavorite": false,
|
|
128
128
|
const baseId = this.safeString(market, 'coin');
|
|
129
|
-
|
|
129
|
+
// Bitbarg reports USDT's price in IRT; all other currencies are
|
|
130
|
+
// quoted in USDT.
|
|
131
|
+
let quoteId = 'USDT';
|
|
132
|
+
if (baseId === 'USDT') {
|
|
133
|
+
quoteId = 'IRT';
|
|
134
|
+
}
|
|
130
135
|
const base = this.safeCurrencyCode(baseId);
|
|
131
136
|
const quote = this.safeCurrencyCode(quoteId);
|
|
132
137
|
const id = baseId + '/' + quoteId;
|
|
@@ -222,13 +227,19 @@ class bitbarg extends bitbarg$1["default"] {
|
|
|
222
227
|
};
|
|
223
228
|
const response = await this.publicGetApiV1Currencies(request);
|
|
224
229
|
const data = this.safeDict(response, 'result', {});
|
|
230
|
+
const meta = this.safeDict(data, 'meta', {});
|
|
231
|
+
const usdtPrice = this.safeFloat(meta, 'usdtPrice');
|
|
225
232
|
const items = this.safeList(data, 'items', []);
|
|
226
233
|
const result = {};
|
|
227
234
|
for (let i = 0; i < items.length; i++) {
|
|
228
235
|
const coinData = items[i];
|
|
229
236
|
const baseId = this.safeString(coinData, 'coin');
|
|
230
|
-
//
|
|
231
|
-
|
|
237
|
+
// All currencies are quoted in USDT except USDT itself, which is
|
|
238
|
+
// quoted in IRT by the API.
|
|
239
|
+
let quoteId = 'USDT';
|
|
240
|
+
if (baseId === 'USDT') {
|
|
241
|
+
quoteId = 'IRT';
|
|
242
|
+
}
|
|
232
243
|
const base = this.safeCurrencyCode(baseId);
|
|
233
244
|
const quote = this.safeCurrencyCode(quoteId);
|
|
234
245
|
const symbol = base + '/' + quote;
|
|
@@ -238,6 +249,9 @@ class bitbarg extends bitbarg$1["default"] {
|
|
|
238
249
|
'quoteId': quoteId,
|
|
239
250
|
'id': baseId + '/' + quoteId,
|
|
240
251
|
}, coinData);
|
|
252
|
+
if (baseId === 'USDT' && usdtPrice !== undefined) {
|
|
253
|
+
ticker['price'] = usdtPrice;
|
|
254
|
+
}
|
|
241
255
|
result[symbol] = this.parseTicker(ticker);
|
|
242
256
|
}
|
|
243
257
|
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
@@ -272,7 +286,12 @@ class bitbarg extends bitbarg$1["default"] {
|
|
|
272
286
|
// "chart": [...]
|
|
273
287
|
// }
|
|
274
288
|
const marketType = 'spot';
|
|
275
|
-
const
|
|
289
|
+
const baseId = this.safeString(ticker, 'coin');
|
|
290
|
+
let quoteId = 'USDT';
|
|
291
|
+
if (baseId === 'USDT') {
|
|
292
|
+
quoteId = 'IRT';
|
|
293
|
+
}
|
|
294
|
+
const marketId = baseId + '/' + quoteId;
|
|
276
295
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
277
296
|
const last = this.safeFloat(ticker, 'price', 0);
|
|
278
297
|
const percentage = this.safeFloat(ticker, 'percent', 0);
|
|
@@ -211,7 +211,7 @@ class swapwallet extends Exchange["default"] {
|
|
|
211
211
|
if (Object.keys(query).length) {
|
|
212
212
|
url += '?' + this.urlencode(query);
|
|
213
213
|
}
|
|
214
|
-
headers =
|
|
214
|
+
headers = { 'Content-Type': 'application/json' };
|
|
215
215
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
216
216
|
}
|
|
217
217
|
}
|
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.23.
|
|
7
|
+
declare const version = "4.23.2";
|
|
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.23.
|
|
41
|
+
const version = '4.23.2';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import abantether from './src/abantether.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
+
|
|
7
|
+
// -------------------------------------------------------------------------------
|
|
8
|
+
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
+
class Exchange extends _Exchange {
|
|
10
|
+
}
|
|
11
|
+
export default Exchange;
|
package/js/src/bitbarg.js
CHANGED
|
@@ -127,7 +127,12 @@ export default class bitbarg extends Exchange {
|
|
|
127
127
|
// "decimal": 8,
|
|
128
128
|
// "isFavorite": false,
|
|
129
129
|
const baseId = this.safeString(market, 'coin');
|
|
130
|
-
|
|
130
|
+
// Bitbarg reports USDT's price in IRT; all other currencies are
|
|
131
|
+
// quoted in USDT.
|
|
132
|
+
let quoteId = 'USDT';
|
|
133
|
+
if (baseId === 'USDT') {
|
|
134
|
+
quoteId = 'IRT';
|
|
135
|
+
}
|
|
131
136
|
const base = this.safeCurrencyCode(baseId);
|
|
132
137
|
const quote = this.safeCurrencyCode(quoteId);
|
|
133
138
|
const id = baseId + '/' + quoteId;
|
|
@@ -223,13 +228,19 @@ export default class bitbarg extends Exchange {
|
|
|
223
228
|
};
|
|
224
229
|
const response = await this.publicGetApiV1Currencies(request);
|
|
225
230
|
const data = this.safeDict(response, 'result', {});
|
|
231
|
+
const meta = this.safeDict(data, 'meta', {});
|
|
232
|
+
const usdtPrice = this.safeFloat(meta, 'usdtPrice');
|
|
226
233
|
const items = this.safeList(data, 'items', []);
|
|
227
234
|
const result = {};
|
|
228
235
|
for (let i = 0; i < items.length; i++) {
|
|
229
236
|
const coinData = items[i];
|
|
230
237
|
const baseId = this.safeString(coinData, 'coin');
|
|
231
|
-
//
|
|
232
|
-
|
|
238
|
+
// All currencies are quoted in USDT except USDT itself, which is
|
|
239
|
+
// quoted in IRT by the API.
|
|
240
|
+
let quoteId = 'USDT';
|
|
241
|
+
if (baseId === 'USDT') {
|
|
242
|
+
quoteId = 'IRT';
|
|
243
|
+
}
|
|
233
244
|
const base = this.safeCurrencyCode(baseId);
|
|
234
245
|
const quote = this.safeCurrencyCode(quoteId);
|
|
235
246
|
const symbol = base + '/' + quote;
|
|
@@ -239,6 +250,9 @@ export default class bitbarg extends Exchange {
|
|
|
239
250
|
'quoteId': quoteId,
|
|
240
251
|
'id': baseId + '/' + quoteId,
|
|
241
252
|
}, coinData);
|
|
253
|
+
if (baseId === 'USDT' && usdtPrice !== undefined) {
|
|
254
|
+
ticker['price'] = usdtPrice;
|
|
255
|
+
}
|
|
242
256
|
result[symbol] = this.parseTicker(ticker);
|
|
243
257
|
}
|
|
244
258
|
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
@@ -273,7 +287,12 @@ export default class bitbarg extends Exchange {
|
|
|
273
287
|
// "chart": [...]
|
|
274
288
|
// }
|
|
275
289
|
const marketType = 'spot';
|
|
276
|
-
const
|
|
290
|
+
const baseId = this.safeString(ticker, 'coin');
|
|
291
|
+
let quoteId = 'USDT';
|
|
292
|
+
if (baseId === 'USDT') {
|
|
293
|
+
quoteId = 'IRT';
|
|
294
|
+
}
|
|
295
|
+
const marketId = baseId + '/' + quoteId;
|
|
277
296
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
278
297
|
const last = this.safeFloat(ticker, 'price', 0);
|
|
279
298
|
const percentage = this.safeFloat(ticker, 'percent', 0);
|
|
@@ -12,7 +12,7 @@ export declare class Stream {
|
|
|
12
12
|
parseStringUTF(start: number, end: number): string;
|
|
13
13
|
parseStringBMP(start: number, end: number): string;
|
|
14
14
|
parseTime(start: number, end: number, shortYear: boolean): string;
|
|
15
|
-
parseInteger(start: number, end: number): string |
|
|
15
|
+
parseInteger(start: number, end: number): string | -1 | 0;
|
|
16
16
|
parseBitString(start: number, end: number, maxLength: number): string;
|
|
17
17
|
parseOctetString(start: number, end: number, maxLength: number): string;
|
|
18
18
|
parseOID(start: number, end: number, maxLength: number): string;
|
|
@@ -25,7 +25,7 @@ export declare class ASN1 {
|
|
|
25
25
|
private tag;
|
|
26
26
|
sub: ASN1[];
|
|
27
27
|
typeName(): string;
|
|
28
|
-
content(maxLength: number): string |
|
|
28
|
+
content(maxLength: number): string | -1 | 0;
|
|
29
29
|
toString(): string;
|
|
30
30
|
toPrettyString(indent: string): string;
|
|
31
31
|
posStart(): number;
|
|
@@ -15,7 +15,7 @@ export declare class BigInteger {
|
|
|
15
15
|
protected intValue(): number;
|
|
16
16
|
protected byteValue(): number;
|
|
17
17
|
protected shortValue(): number;
|
|
18
|
-
protected signum(): 1 |
|
|
18
|
+
protected signum(): 1 | -1 | 0;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
package/js/src/swapwallet.js
CHANGED
|
@@ -212,7 +212,7 @@ export default class swapwallet extends Exchange {
|
|
|
212
212
|
if (Object.keys(query).length) {
|
|
213
213
|
url += '?' + this.urlencode(query);
|
|
214
214
|
}
|
|
215
|
-
headers =
|
|
215
|
+
headers = { 'Content-Type': 'application/json' };
|
|
216
216
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
217
217
|
}
|
|
218
218
|
}
|
package/js/test.js
CHANGED
|
@@ -4,65 +4,18 @@
|
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// { 'id': 'baazar', 'Exchange': baazar },
|
|
11
|
-
// { 'id': 'hamrahgold', 'Exchange': hamrahgold },
|
|
12
|
-
// { 'id': 'zarniv', 'Exchange': zarniv },
|
|
13
|
-
// { 'id': 'zarminex', 'Exchange': zarminex },
|
|
14
|
-
// { 'id': 'zarafza', 'Exchange': zarafza },
|
|
15
|
-
// { 'id': 'daric', 'Exchange': daric },
|
|
16
|
-
// { 'id': 'digikalagold', 'Exchange': digikalagold },
|
|
17
|
-
// { 'id': 'gerami', 'Exchange': gerami },
|
|
18
|
-
// { 'id': 'goldika', 'Exchange': goldika },
|
|
19
|
-
// { 'id': 'goldis', 'Exchange': goldis },
|
|
20
|
-
{ 'id': 'bit24', 'Exchange': bit24 },
|
|
21
|
-
// { 'id': 'milligold', 'Exchange': milligold },
|
|
22
|
-
// { 'id': 'ramzinex', 'Exchange': ramzinex },
|
|
23
|
-
// { 'id': 'wallgold', 'Exchange': wallgold },
|
|
24
|
-
// { 'id': 'talapp', 'Exchange': talapp },
|
|
25
|
-
// { 'id': 'talaavan', 'Exchange': talaavan },
|
|
26
|
-
// { 'id': 'talasea', 'Exchange': talasea },
|
|
27
|
-
// { 'id': 'zarpin', 'Exchange': zarpin },
|
|
28
|
-
];
|
|
29
|
-
async function testExchange(id, ExchangeClass) {
|
|
30
|
-
const exchange = new ExchangeClass({
|
|
31
|
-
'enableRateLimit': true,
|
|
32
|
-
'timeout': 20000,
|
|
33
|
-
});
|
|
7
|
+
import ccxt from './ccxt.js';
|
|
8
|
+
async function main() {
|
|
9
|
+
const exchange = new ccxt.bitbarg();
|
|
34
10
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
for (let i = 0; i < symbols.length; i++) {
|
|
38
|
-
const symbol = symbols[i];
|
|
39
|
-
const ticker = tickers[symbol];
|
|
40
|
-
const bid = ticker['bid'];
|
|
41
|
-
const ask = ticker['ask'];
|
|
42
|
-
const last = ticker['last'];
|
|
43
|
-
if (bid !== undefined || ask !== undefined) {
|
|
44
|
-
let expectedLast = bid;
|
|
45
|
-
if (ask !== undefined && (expectedLast === undefined || ask > expectedLast)) {
|
|
46
|
-
expectedLast = ask;
|
|
47
|
-
}
|
|
48
|
-
if (last !== expectedLast) {
|
|
49
|
-
throw new Error(symbol + ' last=' + last + ', expected=' + expectedLast);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
console.log(id + ' ' + symbol + ' bid=' + bid + ' ask=' + ask + ' last=' + last + ' OK');
|
|
53
|
-
}
|
|
11
|
+
const ticker = await exchange.fetchTicker('USDT/IRT');
|
|
12
|
+
console.log(ticker);
|
|
54
13
|
}
|
|
55
14
|
finally {
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function main() {
|
|
60
|
-
for (let i = 0; i < exchanges.length; i++) {
|
|
61
|
-
const entry = exchanges[i];
|
|
62
|
-
await testExchange(entry['id'], entry['Exchange']);
|
|
15
|
+
exchange.close();
|
|
63
16
|
}
|
|
64
17
|
}
|
|
65
18
|
main().catch((error) => {
|
|
66
|
-
console.error(
|
|
19
|
+
console.error(error);
|
|
67
20
|
process.exitCode = 1;
|
|
68
21
|
});
|
package/package.json
CHANGED