ccxt-ir 4.7.0 → 4.8.0

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/js/src/kcex.js ADDED
@@ -0,0 +1,335 @@
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 from './abstract/kcex.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class kcex
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class kcex extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'kcex',
19
+ 'name': 'Kcex',
20
+ 'countries': ['SC'],
21
+ 'rateLimit': 1000,
22
+ 'version': '1',
23
+ 'certified': false,
24
+ 'pro': false,
25
+ 'has': {
26
+ 'CORS': undefined,
27
+ 'spot': true,
28
+ 'margin': false,
29
+ 'swap': false,
30
+ 'future': true,
31
+ 'option': false,
32
+ 'addMargin': false,
33
+ 'cancelAllOrders': false,
34
+ 'cancelOrder': false,
35
+ 'cancelOrders': false,
36
+ 'createDepositAddress': false,
37
+ 'createOrder': false,
38
+ 'createStopLimitOrder': false,
39
+ 'createStopMarketOrder': false,
40
+ 'createStopOrder': false,
41
+ 'editOrder': false,
42
+ 'fetchBalance': false,
43
+ 'fetchBorrowInterest': false,
44
+ 'fetchBorrowRateHistories': false,
45
+ 'fetchBorrowRateHistory': false,
46
+ 'fetchClosedOrders': false,
47
+ 'fetchCrossBorrowRate': false,
48
+ 'fetchCrossBorrowRates': false,
49
+ 'fetchCurrencies': false,
50
+ 'fetchDepositAddress': false,
51
+ 'fetchDeposits': false,
52
+ 'fetchFundingHistory': false,
53
+ 'fetchFundingRate': false,
54
+ 'fetchFundingRateHistory': false,
55
+ 'fetchFundingRates': false,
56
+ 'fetchIndexOHLCV': false,
57
+ 'fetchIsolatedBorrowRate': false,
58
+ 'fetchIsolatedBorrowRates': false,
59
+ 'fetchL2OrderBook': false,
60
+ 'fetchL3OrderBook': false,
61
+ 'fetchLedger': false,
62
+ 'fetchLedgerEntry': false,
63
+ 'fetchLeverageTiers': false,
64
+ 'fetchMarkets': true,
65
+ 'fetchMarkOHLCV': false,
66
+ 'fetchMyTrades': false,
67
+ 'fetchOHLCV': true,
68
+ 'fetchOpenInterestHistory': false,
69
+ 'fetchOpenOrders': false,
70
+ 'fetchOrder': false,
71
+ 'fetchOrderBook': true,
72
+ 'fetchOrders': false,
73
+ 'fetchOrderTrades': 'emulated',
74
+ 'fetchPositions': false,
75
+ 'fetchPremiumIndexOHLCV': false,
76
+ 'fetchTicker': true,
77
+ 'fetchTickers': true,
78
+ 'fetchTime': false,
79
+ 'fetchTrades': false,
80
+ 'fetchTradingFee': false,
81
+ 'fetchTradingFees': false,
82
+ 'fetchWithdrawals': false,
83
+ 'setLeverage': false,
84
+ 'setMarginMode': false,
85
+ 'transfer': false,
86
+ 'withdraw': false,
87
+ },
88
+ 'comment': 'This comment is optional',
89
+ 'urls': {
90
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/kcex/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://www.kcex.com/spot/api',
93
+ },
94
+ 'www': 'https://www.kcex.com',
95
+ 'doc': [
96
+ 'https://www.kcex.com',
97
+ ],
98
+ },
99
+ 'timeframes': {
100
+ '1m': '1',
101
+ '1h': '60',
102
+ '3h': '180',
103
+ '6h': '360',
104
+ '12h': '720',
105
+ '1d': '1D',
106
+ },
107
+ 'api': {
108
+ 'public': {
109
+ 'get': {
110
+ 'market-2/spot/market/v2/web/symbols': 1,
111
+ 'market-2/spot/market/v2/web/tickers': 1,
112
+ 'market-2/spot/market/v2/web/symbol/ticker': 1,
113
+ },
114
+ },
115
+ },
116
+ // 'fees': {
117
+ // 'trading': {
118
+ // 'tierBased': false,
119
+ // 'percentage': true,
120
+ // 'maker': this.parseNumber ('0.001'),
121
+ // 'taker': this.parseNumber ('0.001'),
122
+ // },
123
+ // },
124
+ });
125
+ }
126
+ async fetchMarkets(params = {}) {
127
+ /**
128
+ * @method
129
+ * @name kcex#fetchMarkets
130
+ * @description retrieves data on all markets for kcex
131
+ * @see https://api-docs.kcex.ir/#be8d9c51a2
132
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
133
+ * @returns {object[]} an array of objects representing market data
134
+ */
135
+ const response = await this.publicGetMarket2SpotMarketV2WebSymbols(params);
136
+ const data = this.safeDict(response, 'data');
137
+ const USDTmarketList = this.safeList(data, 'USDT');
138
+ const USDCmarketList = this.safeList(data, 'USDC');
139
+ const marketList = this.arrayConcat(USDTmarketList, USDCmarketList);
140
+ const result = [];
141
+ for (let i = 0; i < marketList.length; i++) {
142
+ const market = this.parseMarket(marketList[i]);
143
+ result.push(market);
144
+ }
145
+ return result;
146
+ }
147
+ parseMarket(market) {
148
+ // {
149
+ // id: "e16a2713c7a44bac9d1d4ef98467e75b",
150
+ // mcd: "20f24a571c8544c0b1362794b1804456",
151
+ // mnm: "USDT",
152
+ // cd: "18f40e5428054a4b9c69ddb0cce486f3",
153
+ // vn: "AP",
154
+ // fn: "AMERICA PARTY",
155
+ // srt: 322,
156
+ // sts: 1,
157
+ // in: "F20250607111147267iXgSHIElFbibIQ",
158
+ // fot: 1749247200000,
159
+ // ot: 1749267000000,
160
+ // cp: [
161
+ // "common_section_meme",
162
+ // "common_section_solana"
163
+ // ],
164
+ // ps: 7,
165
+ // qs: 2,
166
+ // cdm: 1
167
+ // }
168
+ const id = this.safeString(market, 'id');
169
+ let baseId = this.safeString(market, 'vn');
170
+ let quoteId = this.safeString(market, 'mnm');
171
+ const base = this.safeCurrencyCode(baseId);
172
+ const quote = this.safeCurrencyCode(quoteId);
173
+ baseId = baseId.toLowerCase();
174
+ quoteId = quoteId.toLowerCase();
175
+ return {
176
+ 'id': id,
177
+ 'symbol': base + '/' + quote,
178
+ 'base': base,
179
+ 'quote': quote,
180
+ 'settle': undefined,
181
+ 'baseId': baseId,
182
+ 'quoteId': quoteId,
183
+ 'settleId': undefined,
184
+ 'type': 'spot',
185
+ 'spot': true,
186
+ 'margin': false,
187
+ 'swap': false,
188
+ 'future': false,
189
+ 'option': false,
190
+ 'active': true,
191
+ 'contract': false,
192
+ 'linear': undefined,
193
+ 'inverse': undefined,
194
+ 'contractSize': undefined,
195
+ 'expiry': undefined,
196
+ 'expiryDatetime': undefined,
197
+ 'strike': undefined,
198
+ 'optionType': undefined,
199
+ 'precision': {
200
+ 'amount': undefined,
201
+ 'price': undefined,
202
+ },
203
+ 'limits': {
204
+ 'leverage': {
205
+ 'min': undefined,
206
+ 'max': undefined,
207
+ },
208
+ 'amount': {
209
+ 'min': undefined,
210
+ 'max': undefined,
211
+ },
212
+ 'price': {
213
+ 'min': undefined,
214
+ 'max': undefined,
215
+ },
216
+ 'cost': {
217
+ 'min': undefined,
218
+ 'max': undefined,
219
+ },
220
+ },
221
+ 'created': undefined,
222
+ 'info': market,
223
+ };
224
+ }
225
+ async fetchTickers(symbols = undefined, params = {}) {
226
+ /**
227
+ * @method
228
+ * @name kcex#fetchTickers
229
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
230
+ * @see https://api-docs.kcex.ir/#be8d9c51a2
231
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
232
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
233
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
234
+ */
235
+ await this.loadMarkets();
236
+ if (symbols !== undefined) {
237
+ symbols = this.marketSymbols(symbols);
238
+ }
239
+ const response = await this.publicGetMarket2SpotMarketV2WebTickers(params);
240
+ const tickers = this.safeList(response, 'data');
241
+ const timestamp = this.safeInteger(response, 'timestamp');
242
+ const result = {};
243
+ const idToMarket = {};
244
+ const marketList = Object.values(this.markets);
245
+ for (let i = 0; i < marketList.length; i++) {
246
+ const market = marketList[i];
247
+ idToMarket[market['id']] = market;
248
+ }
249
+ for (let i = 0; i < tickers.length; i++) {
250
+ const ticker = tickers[i];
251
+ const id = this.safeString(ticker, 'id');
252
+ const market = idToMarket[id];
253
+ ticker['timestamp'] = timestamp;
254
+ if (market !== undefined) {
255
+ const parsedTicker = this.parseTicker(ticker, market);
256
+ const symbol = parsedTicker['symbol'];
257
+ result[symbol] = parsedTicker;
258
+ }
259
+ }
260
+ return this.filterByArrayTickers(result, 'symbol', symbols);
261
+ }
262
+ async fetchTicker(symbol, params = {}) {
263
+ /**
264
+ * @method
265
+ * @name kcex#fetchTicker
266
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
267
+ * @see https://api-docs.kcex.ir/#be8d9c51a2
268
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
269
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
270
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
271
+ */
272
+ await this.loadMarkets();
273
+ const market = this.market(symbol);
274
+ const request = {
275
+ 'symbol': market['base'] + '_' + market['quote'],
276
+ };
277
+ const response = await this.publicGetMarket2SpotMarketV2WebSymbolTicker(request);
278
+ const tickerdata = this.safeDict(response, 'data');
279
+ const ticker = this.parseTicker(tickerdata, market);
280
+ return ticker;
281
+ }
282
+ parseTicker(ticker, market = undefined) {
283
+ // {
284
+ // id: "e16a2713c7a44bac9d1d4ef98467e75b",
285
+ // r8: "-0.0261",
286
+ // tzr: "-0.0261",
287
+ // c: "0.0004552",
288
+ // h: "0.0005745",
289
+ // l: "0.0004552",
290
+ // a: "136545.934217",
291
+ // q: "281221205.24",
292
+ // o: "0.0004674",
293
+ // ot: 1749247200000
294
+ // }
295
+ const symbol = market['symbol'];
296
+ const high = this.safeFloat(ticker, 'h', 0);
297
+ const low = this.safeFloat(ticker, 'l', 0);
298
+ const open = this.safeFloat(ticker, 'o', 0);
299
+ const last = this.safeFloat(ticker, 'c', 0);
300
+ const quoteVolume = this.safeFloat(ticker, 'a', 0);
301
+ const baseVolume = this.safeFloat(ticker, 'q', 0);
302
+ const timestamp = this.safeInteger(ticker, 'timestamp', 0);
303
+ return this.safeTicker({
304
+ 'symbol': symbol,
305
+ 'timestamp': timestamp,
306
+ 'datetime': this.iso8601(timestamp),
307
+ 'high': high,
308
+ 'low': low,
309
+ 'bid': undefined,
310
+ 'bidVolume': undefined,
311
+ 'ask': undefined,
312
+ 'askVolume': undefined,
313
+ 'vwap': undefined,
314
+ 'open': open,
315
+ 'close': last,
316
+ 'last': last,
317
+ 'previousClose': undefined,
318
+ 'change': undefined,
319
+ 'percentage': undefined,
320
+ 'average': undefined,
321
+ 'baseVolume': baseVolume,
322
+ 'quoteVolume': quoteVolume,
323
+ 'info': ticker,
324
+ }, market);
325
+ }
326
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
327
+ const query = this.omit(params, this.extractParams(path));
328
+ let url = this.urls['api']['public'] + '/' + path;
329
+ if (path === 'market-2/spot/market/v2/web/symbol/ticker') {
330
+ url = url + '?' + this.urlencode(query);
331
+ }
332
+ headers = { 'Content-Type': 'application/json' };
333
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
334
+ }
335
+ }
@@ -1,2 +1,8 @@
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
+
1
7
  export = $root;
2
8
  declare var $root: {};
@@ -5,7 +5,7 @@ export function deflate(data: any, opts: any, cb: any): () => void;
5
5
  * @param opts The compression options
6
6
  * @returns The deflated version of the data
7
7
  */
8
- export function deflateSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
8
+ export function deflateSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
9
9
  export function inflate(data: any, opts: any, cb: any): () => void;
10
10
  /**
11
11
  * Expands DEFLATE data with no wrapper
@@ -21,7 +21,7 @@ export function gzip(data: any, opts: any, cb: any): () => void;
21
21
  * @param opts The compression options
22
22
  * @returns The gzipped version of the data
23
23
  */
24
- export function gzipSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
24
+ export function gzipSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
25
25
  export function gunzip(data: any, opts: any, cb: any): () => void;
26
26
  /**
27
27
  * Expands GZIP data
@@ -37,7 +37,7 @@ export function zlib(data: any, opts: any, cb: any): () => void;
37
37
  * @param opts The compression options
38
38
  * @returns The zlib-compressed version of the data
39
39
  */
40
- export function zlibSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
40
+ export function zlibSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
41
41
  export function unzlib(data: any, opts: any, cb: any): () => void;
42
42
  /**
43
43
  * Expands Zlib data
@@ -61,7 +61,7 @@ export function decompressSync(data: any, out: any): any;
61
61
  * not need to be true unless decoding a binary string.
62
62
  * @returns The string encoded in UTF-8/Latin-1 binary
63
63
  */
64
- export function strToU8(str: any, latin1: any): Uint8Array | Uint32Array | Uint16Array;
64
+ export function strToU8(str: any, latin1: any): Uint8Array | Uint16Array | Uint32Array;
65
65
  /**
66
66
  * Converts a Uint8Array to a string
67
67
  * @param dat The data to decode to string
@@ -69,7 +69,7 @@ export function strToU8(str: any, latin1: any): Uint8Array | Uint32Array | Uint1
69
69
  * not need to be true unless encoding to binary string.
70
70
  * @returns The original UTF-8/Latin-1 string
71
71
  */
72
- export function strFromU8(dat: any, latin1: any): string | Uint8Array | Uint32Array | Uint16Array;
72
+ export function strFromU8(dat: any, latin1: any): string | Uint8Array | Uint16Array | Uint32Array;
73
73
  export function zip(data: any, opts: any, cb: any): () => void;
74
74
  /**
75
75
  * Synchronously creates a ZIP file. Prefer using `zip` for better performance
@@ -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 | 0 | -1;
18
+ protected signum(): 0 | 1 | -1;
19
19
  toByteArray(): number[];
20
20
  protected equals(a: BigInteger): boolean;
21
21
  protected min(a: BigInteger): BigInteger;
@@ -1,3 +1,9 @@
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
+
1
7
  declare const _default: string;
2
8
  export declare namespace formatters {
3
9
  function RFC1738(value: any): string;
@@ -1,3 +1,9 @@
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
+
1
7
  import formats = require("./formats.cjs");
2
8
  import parse = require("./parse.cjs");
3
9
  import stringify = require("./stringify.cjs");
@@ -1,2 +1,8 @@
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
+
1
7
  declare function _exports(str: any, opts: any): any;
2
8
  export = _exports;
@@ -1,2 +1,8 @@
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
+
1
7
  declare function _exports(object: any, opts: any): string;
2
8
  export = _exports;
@@ -1,3 +1,9 @@
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
+
1
7
  export function arrayToObject(source: any, options: any): any;
2
8
  export function assign(target: any, source: any): any;
3
9
  export function combine(a: any, b: any): any[];
@@ -1,5 +1,5 @@
1
1
  import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
2
2
  import { AbiParserInterface } from './interface.js';
3
3
  export declare function createAbiParser(abi: Abi): AbiParserInterface;
4
- export declare function getAbiVersion(abi: Abi): 1 | 0 | 2;
4
+ export declare function getAbiVersion(abi: Abi): 0 | 1 | 2;
5
5
  export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt-ir",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
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",