@mathieuc/tradingview 3.5.1 → 3.5.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/package.json +1 -1
- package/src/client.js +4 -0
- package/src/miscRequests.js +4 -2
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -266,6 +266,10 @@ module.exports = class Client {
|
|
|
266
266
|
this.#handleEvent('disconnected');
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
+
this.#ws.on('error', (err) => {
|
|
270
|
+
this.#handleError('WebSocket error:', err.message);
|
|
271
|
+
});
|
|
272
|
+
|
|
269
273
|
this.#ws.on('message', (data) => this.#parsePacket(data));
|
|
270
274
|
}
|
|
271
275
|
|
package/src/miscRequests.js
CHANGED
|
@@ -133,9 +133,10 @@ module.exports = {
|
|
|
133
133
|
* | 'futures' | 'forex' | 'cfd'
|
|
134
134
|
* | 'crypto' | 'index' | 'economic'
|
|
135
135
|
* } [filter] Caterogy filter
|
|
136
|
+
* @param {number} offset Pagination offset
|
|
136
137
|
* @returns {Promise<SearchMarketResult[]>} Search results
|
|
137
138
|
*/
|
|
138
|
-
async searchMarketV3(search, filter = '') {
|
|
139
|
+
async searchMarketV3(search, filter = '', offset = 0) {
|
|
139
140
|
const splittedSearch = search.toUpperCase().replace(/ /g, '+').split(':');
|
|
140
141
|
|
|
141
142
|
const request = await axios.get(
|
|
@@ -148,6 +149,7 @@ module.exports = {
|
|
|
148
149
|
),
|
|
149
150
|
text: splittedSearch.pop(),
|
|
150
151
|
search_type: filter,
|
|
152
|
+
start: offset,
|
|
151
153
|
},
|
|
152
154
|
headers: {
|
|
153
155
|
origin: 'https://www.tradingview.com',
|
|
@@ -160,7 +162,7 @@ module.exports = {
|
|
|
160
162
|
|
|
161
163
|
return data.symbols.map((s) => {
|
|
162
164
|
const exchange = s.exchange.split(' ')[0];
|
|
163
|
-
const id = `${exchange.toUpperCase()}:${s.symbol}`;
|
|
165
|
+
const id = s.prefix ? `${s.prefix}:${s.symbol}` : `${exchange.toUpperCase()}:${s.symbol}`;
|
|
164
166
|
|
|
165
167
|
return {
|
|
166
168
|
id,
|