* Get user's private indicators from a 'sessionid' cookie * @function getPrivateIndicators * @param {string} session User 'sessionid' cookie * @param {string} [signature] User 'sessionid_sign' cookie * @returns {Promise } Search results
(session, signature = '')
| 475 | * @returns {Promise<SearchIndicatorResult[]>} Search results |
| 476 | */ |
| 477 | async getPrivateIndicators(session, signature = '') { |
| 478 | const { data } = await axios.get( |
| 479 | 'https://pine-facade.tradingview.com/pine-facade/list', |
| 480 | { |
| 481 | headers: { |
| 482 | cookie: genAuthCookies(session, signature), |
| 483 | }, |
| 484 | params: { |
| 485 | filter: 'saved', |
| 486 | }, |
| 487 | validateStatus, |
| 488 | }, |
| 489 | ); |
| 490 | |
| 491 | return data.map((ind) => ({ |
| 492 | id: ind.scriptIdPart, |
| 493 | version: ind.version, |
| 494 | name: ind.scriptName, |
| 495 | author: { |
| 496 | id: -1, |
| 497 | username: '@ME@', |
| 498 | }, |
| 499 | image: ind.imageUrl, |
| 500 | access: 'private', |
| 501 | source: ind.scriptSource, |
| 502 | type: (ind.extra && ind.extra.kind) ? ind.extra.kind : 'study', |
| 503 | get() { |
| 504 | return module.exports.getIndicator( |
| 505 | ind.scriptIdPart, |
| 506 | ind.version, |
| 507 | session, |
| 508 | signature, |
| 509 | ); |
| 510 | }, |
| 511 | })); |
| 512 | }, |
| 513 | |
| 514 | /** |
| 515 | * User credentials |
nothing calls this directly
no test coverage detected