-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6719507
commit 945a8ca
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const TradingView = require('../main'); | ||
|
||
/* | ||
This example tests the | ||
getDrawings function | ||
*/ | ||
|
||
// First parameter must be the layoutID | ||
// (if the layout is private) Second parameter must be the sessionid cookie | ||
// (if the layout is private) Third parameter must be the userid (you can use getUser function) | ||
|
||
if (!process.argv[2]) throw Error('Please specify a layoutID'); | ||
|
||
TradingView.getDrawings(process.argv[2], null, { | ||
session: process.argv[3], | ||
id: process.argv[4], | ||
}).then((chartToken) => { | ||
console.log(`Found ${chartToken.length} drawings:`, chartToken.map((d) => ({ | ||
id: d.id, | ||
symbol: d.symbol, | ||
type: d.type, | ||
text: d.state.text, | ||
}))); | ||
}).catch((err) => { | ||
console.error('Error:', err.message); | ||
}); |