ccxt-ir 4.16.0 → 4.16.1

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/dist/cjs/ccxt.js CHANGED
@@ -243,7 +243,7 @@ var xt$1 = require('./src/pro/xt.js');
243
243
 
244
244
  //-----------------------------------------------------------------------------
245
245
  // this is updated by vss.js when building
246
- const version = '4.16.0';
246
+ const version = '4.16.1';
247
247
  Exchange["default"].ccxtVersion = version;
248
248
  const exchanges = {
249
249
  'abantether': abantether["default"],
@@ -67,23 +67,72 @@ class asacoine extends Exchange["default"] {
67
67
  const quoteId = this.safeString(market, 'quoteId');
68
68
  const base = this.safeCurrencyCode(baseId);
69
69
  const quote = this.safeCurrencyCode(quoteId);
70
- const isOtc = this.safeString(market, 'type', 'spot') === 'otc';
71
- let marketType = 'spot';
72
- if (isOtc) {
73
- marketType = 'otc';
74
- }
75
- const suffix = '';
76
70
  return {
77
- 'id': baseId + '/' + quoteId + suffix,
78
- 'symbol': base + '/' + quote + suffix,
71
+ 'id': baseId + '/' + quoteId,
72
+ 'symbol': base + '/' + quote,
73
+ 'base': base,
74
+ 'quote': quote,
75
+ 'settle': undefined,
76
+ 'baseId': baseId,
77
+ 'quoteId': quoteId,
78
+ 'settleId': undefined,
79
+ 'type': 'spot',
80
+ 'spot': true,
81
+ 'margin': false,
82
+ 'swap': false,
83
+ 'future': false,
84
+ 'option': false,
85
+ 'active': true,
86
+ 'contract': false,
87
+ 'linear': undefined,
88
+ 'inverse': undefined,
89
+ 'contractSize': undefined,
90
+ 'expiry': undefined,
91
+ 'expiryDatetime': undefined,
92
+ 'strike': undefined,
93
+ 'optionType': undefined,
94
+ 'precision': {
95
+ 'amount': undefined,
96
+ 'price': undefined,
97
+ },
98
+ 'limits': {
99
+ 'leverage': {
100
+ 'min': undefined,
101
+ 'max': undefined,
102
+ },
103
+ 'amount': {
104
+ 'min': undefined,
105
+ 'max': undefined,
106
+ },
107
+ 'price': {
108
+ 'min': undefined,
109
+ 'max': undefined,
110
+ },
111
+ 'cost': {
112
+ 'min': undefined,
113
+ 'max': undefined,
114
+ },
115
+ },
116
+ 'created': undefined,
117
+ 'info': this.safeValue(market, 'info', market),
118
+ };
119
+ }
120
+ parseOtcMarket(market) {
121
+ const baseId = this.safeString(market, 'baseId');
122
+ const quoteId = this.safeString(market, 'quoteId');
123
+ const base = this.safeCurrencyCode(baseId);
124
+ const quote = this.safeCurrencyCode(quoteId);
125
+ return {
126
+ 'id': baseId + '/' + quoteId,
127
+ 'symbol': base + '/' + quote,
79
128
  'base': base,
80
129
  'quote': quote,
81
130
  'settle': undefined,
82
131
  'baseId': baseId,
83
132
  'quoteId': quoteId,
84
133
  'settleId': undefined,
85
- 'type': marketType,
86
- 'spot': !isOtc,
134
+ 'type': 'otc',
135
+ 'spot': false,
87
136
  'margin': false,
88
137
  'swap': false,
89
138
  'future': false,
@@ -134,12 +183,12 @@ class asacoine extends Exchange["default"] {
134
183
  for (let j = 0; j < quoteIds.length; j++) {
135
184
  const quoteId = quoteIds[j];
136
185
  const ticker = this.safeDict(quotes, quoteId, {});
137
- result.push(this.parseMarket({ 'baseId': baseId, 'quoteId': quoteId, 'info': ticker, 'type': 'spot' }));
186
+ result.push(this.parseMarket({ 'baseId': baseId, 'quoteId': quoteId, 'info': ticker }));
138
187
  }
139
188
  }
140
189
  return result;
141
190
  }
142
- parseCumulativeMarkets(response, type = 'otc') {
191
+ parseCumulativeMarkets(response) {
143
192
  const data = this.safeDict(response, 'data', {});
144
193
  const keys = this.safeList(data, 'keys', []);
145
194
  const values = this.safeList(data, 'values', []);
@@ -151,15 +200,14 @@ class asacoine extends Exchange["default"] {
151
200
  market[keys[j]] = row[j];
152
201
  }
153
202
  const marketTypes = this.safeList(market, 'marketTypes', []);
154
- if (!this.inArray(type, marketTypes)) {
203
+ if (!this.inArray('otc', marketTypes)) {
155
204
  continue;
156
205
  }
157
206
  const name = this.safeString(market, 'name');
158
207
  const [baseId, quoteId] = name.split('-');
159
208
  market['baseId'] = baseId;
160
209
  market['quoteId'] = quoteId;
161
- market['type'] = type;
162
- result.push(this.parseMarket(market));
210
+ result.push(this.parseOtcMarket(market));
163
211
  }
164
212
  return result;
165
213
  }
@@ -176,7 +224,7 @@ class asacoine extends Exchange["default"] {
176
224
  const request = this.omit(params, ['type']);
177
225
  if (type === 'otc') {
178
226
  const cumulativeResponse = await this.publicGetV1MarketPairsCumulative(request);
179
- return this.parseCumulativeMarkets(cumulativeResponse, type);
227
+ return this.parseCumulativeMarkets(cumulativeResponse);
180
228
  }
181
229
  const response = await this.publicGetV1MarketPairsPricing(request);
182
230
  return this.parseMarkets(response);
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.16.0";
7
+ declare const version = "4.16.1";
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.16.0';
41
+ const version = '4.16.1';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import abantether from './src/abantether.js';
@@ -7,8 +7,9 @@ import { Market, Strings, Ticker, Tickers } from './base/types.js';
7
7
  export default class asacoine extends Exchange {
8
8
  describe(): any;
9
9
  parseMarket(market: any): Market;
10
+ parseOtcMarket(market: any): Market;
10
11
  parseMarkets(response: any): Market[];
11
- parseCumulativeMarkets(response: any, type?: string): Market[];
12
+ parseCumulativeMarkets(response: any): Market[];
12
13
  fetchMarkets(params?: {}): Promise<import("./base/types.js").MarketInterface[]>;
13
14
  parseTicker(ticker: any, market?: Market): Ticker;
14
15
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
@@ -68,23 +68,72 @@ export default class asacoine extends Exchange {
68
68
  const quoteId = this.safeString(market, 'quoteId');
69
69
  const base = this.safeCurrencyCode(baseId);
70
70
  const quote = this.safeCurrencyCode(quoteId);
71
- const isOtc = this.safeString(market, 'type', 'spot') === 'otc';
72
- let marketType = 'spot';
73
- if (isOtc) {
74
- marketType = 'otc';
75
- }
76
- const suffix = '';
77
71
  return {
78
- 'id': baseId + '/' + quoteId + suffix,
79
- 'symbol': base + '/' + quote + suffix,
72
+ 'id': baseId + '/' + quoteId,
73
+ 'symbol': base + '/' + quote,
74
+ 'base': base,
75
+ 'quote': quote,
76
+ 'settle': undefined,
77
+ 'baseId': baseId,
78
+ 'quoteId': quoteId,
79
+ 'settleId': undefined,
80
+ 'type': 'spot',
81
+ 'spot': true,
82
+ 'margin': false,
83
+ 'swap': false,
84
+ 'future': false,
85
+ 'option': false,
86
+ 'active': true,
87
+ 'contract': false,
88
+ 'linear': undefined,
89
+ 'inverse': undefined,
90
+ 'contractSize': undefined,
91
+ 'expiry': undefined,
92
+ 'expiryDatetime': undefined,
93
+ 'strike': undefined,
94
+ 'optionType': undefined,
95
+ 'precision': {
96
+ 'amount': undefined,
97
+ 'price': undefined,
98
+ },
99
+ 'limits': {
100
+ 'leverage': {
101
+ 'min': undefined,
102
+ 'max': undefined,
103
+ },
104
+ 'amount': {
105
+ 'min': undefined,
106
+ 'max': undefined,
107
+ },
108
+ 'price': {
109
+ 'min': undefined,
110
+ 'max': undefined,
111
+ },
112
+ 'cost': {
113
+ 'min': undefined,
114
+ 'max': undefined,
115
+ },
116
+ },
117
+ 'created': undefined,
118
+ 'info': this.safeValue(market, 'info', market),
119
+ };
120
+ }
121
+ parseOtcMarket(market) {
122
+ const baseId = this.safeString(market, 'baseId');
123
+ const quoteId = this.safeString(market, 'quoteId');
124
+ const base = this.safeCurrencyCode(baseId);
125
+ const quote = this.safeCurrencyCode(quoteId);
126
+ return {
127
+ 'id': baseId + '/' + quoteId,
128
+ 'symbol': base + '/' + quote,
80
129
  'base': base,
81
130
  'quote': quote,
82
131
  'settle': undefined,
83
132
  'baseId': baseId,
84
133
  'quoteId': quoteId,
85
134
  'settleId': undefined,
86
- 'type': marketType,
87
- 'spot': !isOtc,
135
+ 'type': 'otc',
136
+ 'spot': false,
88
137
  'margin': false,
89
138
  'swap': false,
90
139
  'future': false,
@@ -135,12 +184,12 @@ export default class asacoine extends Exchange {
135
184
  for (let j = 0; j < quoteIds.length; j++) {
136
185
  const quoteId = quoteIds[j];
137
186
  const ticker = this.safeDict(quotes, quoteId, {});
138
- result.push(this.parseMarket({ 'baseId': baseId, 'quoteId': quoteId, 'info': ticker, 'type': 'spot' }));
187
+ result.push(this.parseMarket({ 'baseId': baseId, 'quoteId': quoteId, 'info': ticker }));
139
188
  }
140
189
  }
141
190
  return result;
142
191
  }
143
- parseCumulativeMarkets(response, type = 'otc') {
192
+ parseCumulativeMarkets(response) {
144
193
  const data = this.safeDict(response, 'data', {});
145
194
  const keys = this.safeList(data, 'keys', []);
146
195
  const values = this.safeList(data, 'values', []);
@@ -152,15 +201,14 @@ export default class asacoine extends Exchange {
152
201
  market[keys[j]] = row[j];
153
202
  }
154
203
  const marketTypes = this.safeList(market, 'marketTypes', []);
155
- if (!this.inArray(type, marketTypes)) {
204
+ if (!this.inArray('otc', marketTypes)) {
156
205
  continue;
157
206
  }
158
207
  const name = this.safeString(market, 'name');
159
208
  const [baseId, quoteId] = name.split('-');
160
209
  market['baseId'] = baseId;
161
210
  market['quoteId'] = quoteId;
162
- market['type'] = type;
163
- result.push(this.parseMarket(market));
211
+ result.push(this.parseOtcMarket(market));
164
212
  }
165
213
  return result;
166
214
  }
@@ -177,7 +225,7 @@ export default class asacoine extends Exchange {
177
225
  const request = this.omit(params, ['type']);
178
226
  if (type === 'otc') {
179
227
  const cumulativeResponse = await this.publicGetV1MarketPairsCumulative(request);
180
- return this.parseCumulativeMarkets(cumulativeResponse, type);
228
+ return this.parseCumulativeMarkets(cumulativeResponse);
181
229
  }
182
230
  const response = await this.publicGetV1MarketPairsPricing(request);
183
231
  return this.parseMarkets(response);
package/js/test.js CHANGED
@@ -4,94 +4,82 @@
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 asacoine from './src/asacoine.js';
8
- async function testAsacoine() {
9
- const exchange = new asacoine({
7
+ import raastin from './src/raastin.js';
8
+ async function main() {
9
+ const exchange = new raastin({
10
10
  enableRateLimit: true,
11
- timeout: 20000,
11
+ timeout: 30000,
12
12
  });
13
13
  try {
14
- const markets = await exchange.fetchMarkets();
15
- if (markets.length === 0) {
16
- throw new Error('Asacoine returned no markets');
14
+ const spotMarkets = await exchange.loadMarkets(true, { 'type': 'spot' });
15
+ const spotSymbols = [];
16
+ const preferredSymbols = ['USDT/IRT', 'BTC/IRT', 'ETH/IRT'];
17
+ for (let i = 0; i < preferredSymbols.length; i++) {
18
+ const symbol = preferredSymbols[i];
19
+ if (symbol in spotMarkets) {
20
+ spotSymbols.push(symbol);
21
+ }
17
22
  }
18
- const btcUsdtMarket = markets.find((market) => market['symbol'] === 'BTC/USDT');
19
- if (btcUsdtMarket === undefined) {
20
- throw new Error('Asacoine did not return the BTC/USDT market');
23
+ if (spotSymbols.length === 0) {
24
+ const marketSymbols = Object.keys(spotMarkets);
25
+ for (let i = 0; i < marketSymbols.length; i++) {
26
+ const symbol = marketSymbols[i];
27
+ const market = spotMarkets[symbol];
28
+ if (market['type'] === 'spot') {
29
+ spotSymbols.push(symbol);
30
+ }
31
+ if (spotSymbols.length >= 3) {
32
+ break;
33
+ }
34
+ }
21
35
  }
22
- if (markets.some((market) => market['type'] !== 'spot')) {
23
- throw new Error('Asacoine default market filtering failed');
36
+ console.log('spot symbols:', spotSymbols);
37
+ const spotTickers = await exchange.fetchTickers(spotSymbols);
38
+ console.log('spot tickers:');
39
+ for (let i = 0; i < spotSymbols.length; i++) {
40
+ const symbol = spotSymbols[i];
41
+ const ticker = spotTickers[symbol];
42
+ console.log({
43
+ symbol: ticker['symbol'],
44
+ last: ticker['last'],
45
+ high: ticker['high'],
46
+ low: ticker['low'],
47
+ change: ticker['change'],
48
+ percentage: ticker['percentage'],
49
+ baseVolume: ticker['baseVolume'],
50
+ quoteVolume: ticker['quoteVolume'],
51
+ });
24
52
  }
25
- const spotMarkets = await exchange.fetchMarkets({ 'type': 'spot' });
26
- if (spotMarkets.length === 0 || spotMarkets.some((market) => market['type'] !== 'spot')) {
27
- throw new Error('Asacoine spot market filtering failed');
53
+ const singleSpotSymbol = spotSymbols[0];
54
+ if (singleSpotSymbol !== undefined) {
55
+ const singleSpotTicker = await exchange.fetchTicker(singleSpotSymbol);
56
+ console.log('single spot ticker:', {
57
+ symbol: singleSpotTicker['symbol'],
58
+ last: singleSpotTicker['last'],
59
+ change: singleSpotTicker['change'],
60
+ percentage: singleSpotTicker['percentage'],
61
+ });
28
62
  }
29
- const tickers = await exchange.fetchTickers();
30
- const btcUsdtTicker = tickers['BTC/USDT'];
31
- if (btcUsdtTicker === undefined) {
32
- throw new Error('Asacoine did not return a BTC/USDT ticker');
63
+ const otcMarkets = await exchange.loadMarkets(true, { 'type': 'otc' });
64
+ console.log('otc markets:', otcMarkets);
65
+ const otcSymbols = Object.keys(otcMarkets);
66
+ const otcSymbol = otcSymbols[0];
67
+ if (otcSymbol !== undefined) {
68
+ const otcTicker = await exchange.fetchTicker(otcSymbol, { 'type': 'otc' });
69
+ console.log('single otc ticker:', {
70
+ symbol: otcTicker['symbol'],
71
+ last: otcTicker['last'],
72
+ bid: otcTicker['bid'],
73
+ ask: otcTicker['ask'],
74
+ });
33
75
  }
34
- const spotTicker = await exchange.fetchTicker('BTC/USDT');
35
- if (spotTicker['bid'] === undefined || spotTicker['ask'] === undefined) {
36
- throw new Error('Asacoine spot fetchTicker did not return bid/ask');
37
- }
38
- const otcMarkets = await exchange.fetchMarkets({ 'type': 'otc' });
39
- if (otcMarkets.length === 0) {
40
- throw new Error('Asacoine returned no OTC markets');
41
- }
42
- if (otcMarkets.some((market) => market['type'] !== 'otc' || market['symbol'].includes(':OTC'))) {
43
- throw new Error('Asacoine OTC market typing or symbol format failed');
44
- }
45
- const otcTickers = await exchange.fetchTickers(undefined, { 'type': 'otc' });
46
- if (Object.keys(otcTickers).length === 0) {
47
- throw new Error('Asacoine returned no OTC tickers');
48
- }
49
- if (Object.keys(otcTickers).some((symbol) => otcMarkets.every((market) => market['symbol'] !== symbol))) {
50
- throw new Error('Asacoine OTC ticker filtering failed');
51
- }
52
- const otcMarket = otcMarkets[0];
53
- const spotSymbols = new Set(markets.map((market) => market['symbol']));
54
- if (Object.keys(tickers).some((symbol) => !spotSymbols.has(symbol))) {
55
- throw new Error('Asacoine default tickers unexpectedly included non-spot data');
56
- }
57
- const otcTicker = otcTickers[otcMarket['symbol']];
58
- if (otcTicker === undefined) {
59
- throw new Error('Asacoine did not return the first OTC market ticker');
60
- }
61
- const singleOtcTicker = await exchange.fetchTicker(otcMarket['symbol'], { 'type': 'otc' });
62
- if (singleOtcTicker['symbol'] !== otcMarket['symbol'] || singleOtcTicker['bid'] === undefined || singleOtcTicker['ask'] === undefined) {
63
- throw new Error('Asacoine OTC fetchTicker did not return the selected market');
64
- }
65
- console.log('Asacoine test passed:', {
66
- endpoints: {
67
- pricing: 'https://api.asacoine.com/api/v1/market/pairs/pricing',
68
- cumulative: 'https://api.asacoine.com/api/v1/market/pairs/cumulative',
69
- },
70
- markets: markets.length,
71
- tickers: Object.keys(tickers).length,
72
- otcMarkets: otcMarkets.length,
73
- otcTickers: Object.keys(otcTickers).length,
74
- btcUsdt: {
75
- symbol: btcUsdtTicker.symbol,
76
- bid: btcUsdtTicker.bid,
77
- ask: btcUsdtTicker.ask,
78
- last: btcUsdtTicker.last,
79
- bidVolume: btcUsdtTicker.bidVolume,
80
- askVolume: btcUsdtTicker.askVolume,
81
- },
82
- otc: {
83
- symbol: otcTicker.symbol,
84
- bid: otcTicker.bid,
85
- ask: otcTicker.ask,
86
- last: otcTicker.last,
87
- },
88
- });
76
+ }
77
+ catch (error) {
78
+ console.error('Raastin ticker test failed:', error);
79
+ process.exitCode = 1;
89
80
  }
90
81
  finally {
91
82
  await exchange.close();
92
83
  }
93
84
  }
94
- testAsacoine().catch((error) => {
95
- console.error('Asacoine test failed:', error);
96
- process.exitCode = 1;
97
- });
85
+ void main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt-ir",
3
- "version": "4.16.0",
3
+ "version": "4.16.1",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",