ccxt-ir 4.16.0 → 4.16.3

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.
@@ -1,8 +1,14 @@
1
- declare const _default: string;
2
- export declare namespace formatters {
3
- function RFC1738(value: any): string;
4
- function RFC3986(value: any): any;
5
- }
6
- declare const RFC1738_1: string;
7
- declare const RFC3986_1: string;
8
- export { _default as default, RFC1738_1 as RFC1738, RFC3986_1 as RFC3986 };
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
+ declare const _default: string;
8
+ export declare namespace formatters {
9
+ function RFC1738(value: any): string;
10
+ function RFC3986(value: any): any;
11
+ }
12
+ declare const RFC1738_1: string;
13
+ declare const RFC3986_1: string;
14
+ export { _default as default, RFC1738_1 as RFC1738, RFC3986_1 as RFC3986 };
@@ -1,4 +1,10 @@
1
- import formats = require("./formats.cjs");
2
- import parse = require("./parse.cjs");
3
- import stringify = require("./stringify.cjs");
4
- export { formats, parse, stringify };
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
+ import formats = require("./formats.cjs");
8
+ import parse = require("./parse.cjs");
9
+ import stringify = require("./stringify.cjs");
10
+ export { formats, parse, stringify };
@@ -1,2 +1,8 @@
1
- declare function _exports(str: any, opts: any): any;
2
- export = _exports;
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
+ declare function _exports(str: any, opts: any): any;
8
+ export = _exports;
@@ -1,2 +1,8 @@
1
- declare function _exports(object: any, opts: any): string;
2
- export = _exports;
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
+ declare function _exports(object: any, opts: any): string;
8
+ export = _exports;
@@ -1,9 +1,15 @@
1
- export function arrayToObject(source: any, options: any): any;
2
- export function assign(target: any, source: any): any;
3
- export function combine(a: any, b: any): any[];
4
- export function compact(value: any): any;
5
- export function decode(str: any, decoder: any, charset: any): any;
6
- export function encode(str: any, defaultEncoder: any, charset: any): any;
7
- export function isBuffer(obj: any): boolean;
8
- export function isRegExp(obj: any): boolean;
9
- export function merge(target: any, source: any, options: any): any;
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
+ export function arrayToObject(source: any, options: any): any;
8
+ export function assign(target: any, source: any): any;
9
+ export function combine(a: any, b: any): any[];
10
+ export function compact(value: any): any;
11
+ export function decode(str: any, decoder: any, charset: any): any;
12
+ export function encode(str: any, defaultEncoder: any, charset: any): any;
13
+ export function isBuffer(obj: any): boolean;
14
+ export function isRegExp(obj: any): boolean;
15
+ export function merge(target: any, source: any, options: any): any;
@@ -1,5 +1,5 @@
1
- import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
2
- import { AbiParserInterface } from './interface.js';
3
- export declare function createAbiParser(abi: Abi): AbiParserInterface;
4
- export declare function getAbiVersion(abi: Abi): 1 | 0 | 2;
5
- export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
1
+ import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
2
+ import { AbiParserInterface } from './interface.js';
3
+ export declare function createAbiParser(abi: Abi): AbiParserInterface;
4
+ export declare function getAbiVersion(abi: Abi): 0 | 1 | 2;
5
+ export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
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({
10
- enableRateLimit: true,
11
- timeout: 20000,
12
- });
13
- try {
14
- const markets = await exchange.fetchMarkets();
15
- if (markets.length === 0) {
16
- throw new Error('Asacoine returned no markets');
17
- }
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');
21
- }
22
- if (markets.some((market) => market['type'] !== 'spot')) {
23
- throw new Error('Asacoine default market filtering failed');
24
- }
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');
28
- }
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');
33
- }
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
- });
89
- }
90
- finally {
91
- await exchange.close();
92
- }
93
- }
94
- testAsacoine().catch((error) => {
95
- console.error('Asacoine test failed:', error);
96
- process.exitCode = 1;
97
- });
7
+ import raastin from './src/raastin.js';
8
+ async function main() {
9
+ const exchange = new raastin({
10
+ enableRateLimit: true,
11
+ timeout: 30000,
12
+ });
13
+ try {
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
+ }
22
+ }
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
+ }
35
+ }
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
+ });
52
+ }
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
+ });
62
+ }
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
+ });
75
+ }
76
+ }
77
+ catch (error) {
78
+ console.error('Raastin ticker test failed:', error);
79
+ process.exitCode = 1;
80
+ }
81
+ finally {
82
+ await exchange.close();
83
+ }
84
+ }
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.3",
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",