ccxt-ir 4.23.2 → 4.24.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/README.md +4 -4
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +264 -261
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/abstract/balinex.js +11 -0
- package/dist/cjs/src/balinex.js +227 -0
- package/dist/cjs/src/bitbarg.js +322 -322
- package/dist/cjs/src/swapwallet.js +209 -209
- package/js/ccxt.d.ts +772 -769
- package/js/ccxt.js +557 -555
- package/js/src/abstract/balinex.d.ts +8 -0
- package/js/src/abstract/balinex.js +11 -0
- package/js/src/abstract/swapwallet.js +5 -5
- package/js/src/balinex.d.ts +20 -0
- package/js/src/balinex.js +226 -0
- package/js/src/base/Exchange.d.ts +926 -926
- package/js/src/bitbarg.js +325 -325
- package/js/src/coinbaseexchange.d.ts +334 -334
- package/js/src/protobuf/mexc/compiled.d.cts +8 -2
- package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
- package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +2 -2
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
- package/js/src/static_dependencies/qs/formats.d.cts +14 -8
- package/js/src/static_dependencies/qs/index.d.cts +10 -4
- package/js/src/static_dependencies/qs/parse.d.cts +8 -2
- package/js/src/static_dependencies/qs/stringify.d.cts +8 -2
- package/js/src/static_dependencies/qs/utils.d.cts +15 -9
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
- package/js/src/swapwallet.js +212 -212
- package/js/test.js +62 -15
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { implicitReturnType } from '../base/types.js';
|
|
2
|
+
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
|
+
interface Exchange {
|
|
4
|
+
publicGetPublicMarkets(params?: {}): Promise<implicitReturnType>;
|
|
5
|
+
}
|
|
6
|
+
declare abstract class Exchange extends _Exchange {
|
|
7
|
+
}
|
|
8
|
+
export default Exchange;
|
|
@@ -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;
|
|
@@ -4,8 +4,8 @@
|
|
|
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
|
-
// -------------------------------------------------------------------------------
|
|
8
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
-
class Exchange extends _Exchange {
|
|
10
|
-
}
|
|
11
|
-
export default Exchange;
|
|
7
|
+
// -------------------------------------------------------------------------------
|
|
8
|
+
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
+
class Exchange extends _Exchange {
|
|
10
|
+
}
|
|
11
|
+
export default Exchange;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Exchange from './abstract/balinex.js';
|
|
2
|
+
import { Market, Strings, Ticker, Tickers } from './base/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @class balinex
|
|
5
|
+
* @augments Exchange
|
|
6
|
+
*/
|
|
7
|
+
export default class balinex extends Exchange {
|
|
8
|
+
describe(): any;
|
|
9
|
+
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
10
|
+
parseMarket(market: any): Market;
|
|
11
|
+
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
12
|
+
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
13
|
+
parseTicker(ticker: any, market?: Market): Ticker;
|
|
14
|
+
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
15
|
+
url: string;
|
|
16
|
+
method: string;
|
|
17
|
+
body: any;
|
|
18
|
+
headers: any;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
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/balinex.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* @class balinex
|
|
12
|
+
* @augments Exchange
|
|
13
|
+
*/
|
|
14
|
+
export default class balinex extends Exchange {
|
|
15
|
+
describe() {
|
|
16
|
+
return this.deepExtend(super.describe(), {
|
|
17
|
+
'id': 'balinex',
|
|
18
|
+
'name': 'Balinex',
|
|
19
|
+
'countries': ['IR'],
|
|
20
|
+
'rateLimit': 1000,
|
|
21
|
+
'version': '1',
|
|
22
|
+
'certified': false,
|
|
23
|
+
'pro': false,
|
|
24
|
+
'has': {
|
|
25
|
+
'CORS': undefined,
|
|
26
|
+
'spot': true,
|
|
27
|
+
'margin': false,
|
|
28
|
+
'swap': false,
|
|
29
|
+
'future': false,
|
|
30
|
+
'option': false,
|
|
31
|
+
'fetchMarkets': true,
|
|
32
|
+
'fetchTicker': true,
|
|
33
|
+
'fetchTickers': true,
|
|
34
|
+
},
|
|
35
|
+
'urls': {
|
|
36
|
+
'logo': 'https://balinex.com/favicon.ico',
|
|
37
|
+
'api': {
|
|
38
|
+
'public': 'https://api.balinex.com',
|
|
39
|
+
},
|
|
40
|
+
'www': 'https://balinex.com',
|
|
41
|
+
'doc': [
|
|
42
|
+
'https://api.balinex.com/public/markets',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
'api': {
|
|
46
|
+
'public': {
|
|
47
|
+
'get': {
|
|
48
|
+
'public/markets': 1,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async fetchMarkets(params = {}) {
|
|
55
|
+
/**
|
|
56
|
+
* @method
|
|
57
|
+
* @name balinex#fetchMarkets
|
|
58
|
+
* @description retrieves data on all markets for balinex
|
|
59
|
+
* @see https://api.balinex.com/public/markets
|
|
60
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
61
|
+
* @returns {object[]} an array of objects representing market data
|
|
62
|
+
*/
|
|
63
|
+
const response = await this.publicGetPublicMarkets(params);
|
|
64
|
+
const data = this.safeDict(response, 'result', {});
|
|
65
|
+
const items = this.safeList(data, 'items', []);
|
|
66
|
+
const result = [];
|
|
67
|
+
for (let i = 0; i < items.length; i++) {
|
|
68
|
+
result.push(this.parseMarket(items[i]));
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
parseMarket(market) {
|
|
73
|
+
// {
|
|
74
|
+
// "productId": "ADAUSDT",
|
|
75
|
+
// "baseCurrency": "ADA",
|
|
76
|
+
// "quoteCurrency": "USDT",
|
|
77
|
+
// "baseScale": 2,
|
|
78
|
+
// "quoteScale": 4,
|
|
79
|
+
// "lastPrice": "0.2047",
|
|
80
|
+
// "openPrice24h": "0.2089",
|
|
81
|
+
// "highPrice24h": "0.2103",
|
|
82
|
+
// "lowPrice24h": "0.2012",
|
|
83
|
+
// "volume24h": "1530110.38",
|
|
84
|
+
// "quoteVolume24h": "313213.5968",
|
|
85
|
+
// "priceChange24h": "-0.0042",
|
|
86
|
+
// "percentChange24h": "-2.01",
|
|
87
|
+
// "allowBuy": true,
|
|
88
|
+
// "allowSell": true
|
|
89
|
+
// }
|
|
90
|
+
const id = this.safeString(market, 'productId');
|
|
91
|
+
const baseId = this.safeString(market, 'baseCurrency');
|
|
92
|
+
const quoteId = this.safeString(market, 'quoteCurrency');
|
|
93
|
+
const base = this.safeCurrencyCode(baseId);
|
|
94
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
95
|
+
const allowBuy = this.safeBool(market, 'allowBuy', false);
|
|
96
|
+
const allowSell = this.safeBool(market, 'allowSell', false);
|
|
97
|
+
return {
|
|
98
|
+
'id': id,
|
|
99
|
+
'symbol': base + '/' + quote,
|
|
100
|
+
'base': base,
|
|
101
|
+
'quote': quote,
|
|
102
|
+
'settle': undefined,
|
|
103
|
+
'baseId': baseId,
|
|
104
|
+
'quoteId': quoteId,
|
|
105
|
+
'settleId': undefined,
|
|
106
|
+
'type': 'spot',
|
|
107
|
+
'spot': true,
|
|
108
|
+
'margin': false,
|
|
109
|
+
'swap': false,
|
|
110
|
+
'future': false,
|
|
111
|
+
'option': false,
|
|
112
|
+
'active': allowBuy && allowSell,
|
|
113
|
+
'contract': false,
|
|
114
|
+
'linear': undefined,
|
|
115
|
+
'inverse': undefined,
|
|
116
|
+
'contractSize': undefined,
|
|
117
|
+
'expiry': undefined,
|
|
118
|
+
'expiryDatetime': undefined,
|
|
119
|
+
'strike': undefined,
|
|
120
|
+
'optionType': undefined,
|
|
121
|
+
'precision': {
|
|
122
|
+
'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseScale'))),
|
|
123
|
+
'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quoteScale'))),
|
|
124
|
+
},
|
|
125
|
+
'limits': {
|
|
126
|
+
'leverage': { 'min': undefined, 'max': undefined },
|
|
127
|
+
'amount': { 'min': undefined, 'max': undefined },
|
|
128
|
+
'price': { 'min': undefined, 'max': undefined },
|
|
129
|
+
'cost': { 'min': undefined, 'max': undefined },
|
|
130
|
+
},
|
|
131
|
+
'created': undefined,
|
|
132
|
+
'info': market,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
136
|
+
/**
|
|
137
|
+
* @method
|
|
138
|
+
* @name balinex#fetchTickers
|
|
139
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
140
|
+
* @see https://api.balinex.com/public/markets
|
|
141
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
142
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
143
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
144
|
+
*/
|
|
145
|
+
await this.loadMarkets();
|
|
146
|
+
if (symbols !== undefined) {
|
|
147
|
+
symbols = this.marketSymbols(symbols);
|
|
148
|
+
}
|
|
149
|
+
const response = await this.publicGetPublicMarkets(params);
|
|
150
|
+
const data = this.safeDict(response, 'result', {});
|
|
151
|
+
const items = this.safeList(data, 'items', []);
|
|
152
|
+
const result = {};
|
|
153
|
+
for (let i = 0; i < items.length; i++) {
|
|
154
|
+
const ticker = this.parseTicker(items[i]);
|
|
155
|
+
const symbol = ticker['symbol'];
|
|
156
|
+
result[symbol] = ticker;
|
|
157
|
+
}
|
|
158
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
159
|
+
}
|
|
160
|
+
async fetchTicker(symbol, params = {}) {
|
|
161
|
+
/**
|
|
162
|
+
* @method
|
|
163
|
+
* @name balinex#fetchTicker
|
|
164
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
165
|
+
* @see https://api.balinex.com/public/markets
|
|
166
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
167
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
168
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
169
|
+
*/
|
|
170
|
+
const ticker = await this.fetchTickers([symbol], params);
|
|
171
|
+
return ticker[symbol];
|
|
172
|
+
}
|
|
173
|
+
parseTicker(ticker, market = undefined) {
|
|
174
|
+
// {
|
|
175
|
+
// "productId": "BTCIRT",
|
|
176
|
+
// "baseCurrency": "BTC",
|
|
177
|
+
// "quoteCurrency": "IRT",
|
|
178
|
+
// "baseScale": 7,
|
|
179
|
+
// "quoteScale": 0,
|
|
180
|
+
// "lastPrice": "21703802224",
|
|
181
|
+
// "openPrice24h": "21816018777",
|
|
182
|
+
// "highPrice24h": "21823312074",
|
|
183
|
+
// "lowPrice24h": "21341032776",
|
|
184
|
+
// "volume24h": "1.4538258",
|
|
185
|
+
// "quoteVolume24h": "31553547631",
|
|
186
|
+
// "priceChange24h": "-112216553",
|
|
187
|
+
// "percentChange24h": "-0.51",
|
|
188
|
+
// "allowBuy": true,
|
|
189
|
+
// "allowSell": true
|
|
190
|
+
// }
|
|
191
|
+
const marketId = this.safeString(ticker, 'productId');
|
|
192
|
+
market = this.safeMarket(marketId, market);
|
|
193
|
+
const last = this.safeString(ticker, 'lastPrice');
|
|
194
|
+
return this.safeTicker({
|
|
195
|
+
'symbol': market['symbol'],
|
|
196
|
+
'timestamp': undefined,
|
|
197
|
+
'datetime': undefined,
|
|
198
|
+
'high': this.safeString(ticker, 'highPrice24h'),
|
|
199
|
+
'low': this.safeString(ticker, 'lowPrice24h'),
|
|
200
|
+
'bid': undefined,
|
|
201
|
+
'bidVolume': undefined,
|
|
202
|
+
'ask': undefined,
|
|
203
|
+
'askVolume': undefined,
|
|
204
|
+
'vwap': undefined,
|
|
205
|
+
'open': this.safeString(ticker, 'openPrice24h'),
|
|
206
|
+
'close': last,
|
|
207
|
+
'last': last,
|
|
208
|
+
'previousClose': undefined,
|
|
209
|
+
'change': this.safeString(ticker, 'priceChange24h'),
|
|
210
|
+
'percentage': this.safeString(ticker, 'percentChange24h'),
|
|
211
|
+
'average': undefined,
|
|
212
|
+
'baseVolume': this.safeString(ticker, 'volume24h'),
|
|
213
|
+
'quoteVolume': this.safeString(ticker, 'quoteVolume24h'),
|
|
214
|
+
'info': ticker,
|
|
215
|
+
}, market);
|
|
216
|
+
}
|
|
217
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
218
|
+
let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
|
|
219
|
+
const query = this.omit(params, this.extractParams(path));
|
|
220
|
+
if (Object.keys(query).length) {
|
|
221
|
+
url += '?' + this.urlencode(query);
|
|
222
|
+
}
|
|
223
|
+
headers = { 'Accept': 'application/json' };
|
|
224
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
225
|
+
}
|
|
226
|
+
}
|