Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ module.exports = {
],
'no-restricted-syntax': 'off',
'no-await-in-loop': 'off',
'no-continue': 'off',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 15.x, 16.x]
node-version: [16.x, 18.x, 19.x]

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
package-lock.json
.env
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules/
.github/
package-lock.json
tests/
.env
9 changes: 5 additions & 4 deletions examples/AllPrivateIndicators.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const TradingView = require('../main');

/*
This example creates a chart with
all user's private indicators
*/
/**
* This example creates a chart with all user's private indicators
*/

if (!process.argv[2]) throw Error('Please specify your \'sessionid\' cookie');
if (!process.argv[3]) throw Error('Please specify your \'signature\' cookie');

const client = new TradingView.Client({
token: process.argv[2],
signature: process.argv[3],
});

const chart = new client.Session.Chart();
Expand Down
7 changes: 3 additions & 4 deletions examples/BuiltInIndicator.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const TradingView = require('../main');

/*
This example tests built-in indicators
like volume-based indicators
*/
/**
* This example tests built-in indicators like volume-based indicators
*/

const volumeProfile = new TradingView.BuiltInIndicator('VbPFixed@tv-basicstudies-139!');

Expand Down
10 changes: 4 additions & 6 deletions examples/CustomChartType.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const TradingView = require('../main');

/*
This example creates charts of custom
types such as 'HeikinAshi', 'Renko',
'LineBreak', 'Kagi', 'PointAndFigure',
and 'Range' with default settings
*/
/**
* This example creates charts of custom types such as 'HeikinAshi', 'Renko',
* 'LineBreak', 'Kagi', 'PointAndFigure', and 'Range' with default settings.
*/

const client = new TradingView.Client({
/* Token is only required if you want to use intraday
Expand Down
7 changes: 3 additions & 4 deletions examples/CustomTimeframe.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const TradingView = require('../main');

/*
This example tests custom
timeframes like 1 second
*/
/**
* This example tests custom timeframes like 1 second
*/

if (!process.argv[2]) throw Error('Please specify your \'sessionid\' cookie');

Expand Down
6 changes: 3 additions & 3 deletions examples/Errors.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const TradingView = require('../main');

/*
This example tests many types of errors
*/
/**
* This example tests many types of errors
*/

const client = new TradingView.Client(); // Creates a websocket client

Expand Down
9 changes: 4 additions & 5 deletions examples/FakeReplayMode.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const { Client } = require('../main');

/*
This example tests the fake
replay mode which works in
intraday even with free plan
*/
/**
* This example tests the fake replay mode which
* works in intraday even with free plan
*/

console.log('----- Testing FakeReplayMode: -----');

Expand Down
9 changes: 4 additions & 5 deletions examples/FromToData.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const TradingView = require('../main');

/*
This example tests fetching chart
data of a number of candles before
or after a timestamp
*/
/**
* This example tests fetching chart data of a number
* of candles before or after a timestamp
*/

const client = new TradingView.Client();

Expand Down
7 changes: 3 additions & 4 deletions examples/GetDrawings.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const TradingView = require('../main');

/*
This example tests the
getDrawings function
*/
/**
* This example tests the getDrawings function
*/

// First parameter must be the layoutID
// (if the layout is private) Second parameter must be the sessionid cookie
Expand Down
9 changes: 4 additions & 5 deletions examples/GraphicIndicator.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const TradingView = require('../main');

/*
This example tests an indicator that sends
graphic data such as 'lines', 'labels',
'boxes', 'tables', 'polygons', etc...
*/
/**
* This example tests an indicator that sends graphic data such
* as 'lines', 'labels', 'boxes', 'tables', 'polygons', etc...
*/

const client = new TradingView.Client();

Expand Down
7 changes: 3 additions & 4 deletions examples/MultipleSyncFetch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const TradingView = require('../main');

/*
This examples synchronously
fetches data from 3 indicators
*/
/**
* This examples synchronously fetches data from 3 indicators
*/

const client = new TradingView.Client();
const chart = new client.Session.Chart();
Expand Down
14 changes: 7 additions & 7 deletions examples/PinePermManage.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const { PinePermManager } = require('../main');

/*
This example creates a pine
permission manager and tests
all the available functions
*/
/**
* This example creates a pine permission manager
* and tests all the available functions
*/

const sessionid = process.argv[2];
const pineid = process.argv[3];
const signature = process.argv[3];
const pineid = process.argv[4];

const manager = new PinePermManager(sessionid, pineid);
const manager = new PinePermManager(sessionid, signature, pineid);

(async () => {
console.log('Users:', await manager.getUsers());
Expand Down
9 changes: 4 additions & 5 deletions examples/ReplayMode.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const TradingView = require('../main');

/*
This example tests the real replay
mode by fetching indicator data and
stores it in a 'periods' variable
*/
/**
* This example tests the real replay mode by fetching
* indicator data and stores it in a 'periods' variable
*/

const config = {
symbol: 'BINANCE:BTCEUR',
Expand Down
9 changes: 4 additions & 5 deletions examples/Search.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const TradingView = require('../main');

/*
This example tests the searching
functions such as 'searchMarket'
and 'searchIndicator'
*/
/**
* This example tests the searching functions such
* as 'searchMarket' and 'searchIndicator'
*/

TradingView.searchMarket('BINANCE:').then((rs) => {
console.log('Found Markets:', rs);
Expand Down
6 changes: 3 additions & 3 deletions examples/SimpleChart.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const TradingView = require('../main');

/*
This example creates a BTCEUR daily chart
*/
/**
* This example creates a BTCEUR daily chart
*/

const client = new TradingView.Client(); // Creates a websocket client

Expand Down
8 changes: 4 additions & 4 deletions examples/UserLogin.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const TradingView = require('../main');

/*
This example tests the
user login function
*/
/**
* This example tests the user login function
*/

if (!process.argv[2]) throw Error('Please specify your username/email');
if (!process.argv[3]) throw Error('Please specify your password');

TradingView.loginUser(process.argv[2], process.argv[3], false).then((user) => {
console.log('User:', user);
console.log('Sessionid:', user.session);
console.log('Signature:', user.signature);
}).catch((err) => {
console.error('Login error:', err.message);
});
Loading