Skip to content
Closed
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
84caa21
feat: getPersonalIndicator
ThisIsRuddy Jan 27, 2025
d90503d
Merge remote-tracking branch 'upstream/main' into feat/personal-indic…
ThisIsRuddy Jan 28, 2025
8accb1f
Merge pull request #1 from danielgroen/feat/personal-indicators
danielgroen Jan 28, 2025
1899cf1
fix: re-add missing getInviteOnlyScripts function
ThisIsRuddy Jan 28, 2025
da0094d
Merge pull request #2 from danielgroen/feat/personal-indicators
ThisIsRuddy Jan 28, 2025
7b934eb
fix: reimplement deeptest since resynce with original repo
ThisIsRuddy Feb 8, 2025
5a85ece
Merge pull request #3 from danielgroen/feat/deepbacktest
ThisIsRuddy Feb 8, 2025
2aa64b9
feat: added clone function to PineIndicator & BuiltInIndicator classes
ThisIsRuddy Feb 17, 2025
3ecc9c9
Merge pull request #4 from danielgroen/feat/clone-indicator
ThisIsRuddy Feb 17, 2025
c12e4ee
dev: created initial types main.d.ts
ThisIsRuddy Feb 17, 2025
2a172f2
dev: enhanced types main.d.ts
ThisIsRuddy Feb 17, 2025
27721d9
dev: enhanced types main.d.ts
ThisIsRuddy Feb 18, 2025
b1fdb8f
feat: layouts
ThisIsRuddy Feb 23, 2025
830fff8
dev: rework + clean-up
ThisIsRuddy Feb 25, 2025
a9ec7c2
dev: deleteLayout
ThisIsRuddy Feb 25, 2025
943e58a
dev: replace env variable refs
ThisIsRuddy Feb 25, 2025
de11a83
Merge pull request #5 from danielgroen/feat/layouts
ThisIsRuddy Feb 25, 2025
3d43bac
dev: re-add console.error in try catches
ThisIsRuddy Feb 25, 2025
5875406
Merge pull request #6 from danielgroen/feat/layouts
ThisIsRuddy Feb 25, 2025
db626ec
dev: change createLayout to only return layoutShortURL
ThisIsRuddy Feb 25, 2025
0842980
Merge pull request #7 from danielgroen/feat/layouts
ThisIsRuddy Feb 25, 2025
8388613
adding 2fa login and changed return object of user
Mar 2, 2025
b643841
fixed type
Mar 2, 2025
2127b1a
adding totp for 2fa
Mar 2, 2025
c2b1835
added conditional qmark to prevent err
Mar 2, 2025
05f7347
optional chaining to prevent errors
Mar 2, 2025
ce1526a
Merge pull request #8 from danielgroen/feat/twofalogin
danielgroen Mar 2, 2025
9d9cae6
Added feature to get the first bar available for deepbacktest
Mar 2, 2025
68d8180
Added feature to get the first bar available for deepbacktest
Mar 2, 2025
2d229b9
fix: update getPersonalIndicator to use latest version
ThisIsRuddy Mar 5, 2025
b04deda
Merge pull request #11 from danielgroen/hotfix/latest-personal
ThisIsRuddy Mar 5, 2025
a008a88
Merge pull request #10 from danielgroen/feat/getFirstBarAvailable
ThisIsRuddy Mar 6, 2025
0def8b9
added more fields for getuser
Mar 6, 2025
41f0ebc
added more fields for getuser
Mar 6, 2025
47510e4
Merge pull request #12 from danielgroen/feat/get-user-expanded
danielgroen Mar 6, 2025
0384184
cleanup
Mar 6, 2025
c902fa0
Added new alert functionalities
Mar 12, 2025
28dd4fe
Merge pull request #13 from danielgroen/feat/alerts
danielgroen Mar 12, 2025
e083887
bugfix authtoken
Mar 17, 2025
93c991c
Merge pull request #14 from danielgroen/feat/fix-authToken
danielgroen Mar 17, 2025
db97878
typo
Apr 7, 2025
6863f8b
test
Apr 8, 2025
af01bc5
test
Apr 8, 2025
a814be5
test
Apr 8, 2025
93c84aa
feat: createAlertForChart
ThisIsRuddy Apr 12, 2025
9be5f4a
Merge pull request #15 from danielgroen/feat/createAlertForChart
ThisIsRuddy Apr 12, 2025
9a9af73
fix: resolves bad currency issue with some symbols
ThisIsRuddy Apr 26, 2025
0487905
Merge pull request #16 from danielgroen/fix/create-layouts
ThisIsRuddy Apr 26, 2025
33eae0c
feat: udpateLayoutStudyInputs
ThisIsRuddy Apr 26, 2025
6e0dda2
Merge pull request #17 from danielgroen/feat/updateLayoutInputs
ThisIsRuddy Apr 26, 2025
e9e0947
rebase from fork
May 6, 2025
fe1e6f7
Merge pull request #18 from danielgroen/feat/rebase
danielgroen May 6, 2025
775773f
up
Jun 11, 2025
d965702
up
Jun 11, 2025
079532d
test
Jun 11, 2025
9282576
test
Jun 11, 2025
0c3c378
up
Jun 11, 2025
9755305
test
Jun 13, 2025
481eccc
test
Jun 13, 2025
1e53249
up
Jun 13, 2025
2170f60
up
Jun 14, 2025
e20d12e
up
Jun 14, 2025
15b1e9e
up
Jun 14, 2025
dc99a42
Adding new alertToBacktest function
Jun 14, 2025
4b06fff
fixed tv general indic
Jun 14, 2025
777fb52
up
Jun 14, 2025
c494cbb
up
Jun 14, 2025
e4eefed
up
Jun 14, 2025
a2f137c
added setvales for builtin indicator
Jun 16, 2025
08fc091
fixed personal indicators
Jun 16, 2025
f5f4bef
Merge pull request #20 from danielgroen/feat/external-indicators-rc3
danielgroen Jun 28, 2025
70d43e1
improved fraud detection
Jul 2, 2025
242af8e
logs
Jul 2, 2025
cfdedc2
up
Jul 2, 2025
ffe4d4e
up
Jul 2, 2025
4f60f9d
up
Jul 2, 2025
70a8f56
Merge pull request #21 from danielgroen/feat/fraud-detection
danielgroen Jul 2, 2025
5fd18b5
Merge pull request #1 from danielgroen/main
jwelmac Jul 30, 2025
4c20e60
fix: type error
jwelmac Jul 30, 2025
a0d215b
feat(typings): update ChartStudy documentation and fix periods type
jwelmac Jul 30, 2025
b5894d5
fix(typings): ChartStudy constructor type
jwelmac Jul 30, 2025
5e83488
docs: add documentation throughout typing
jwelmac Aug 2, 2025
d36557a
Merge remote-tracking branch 'upstream/main'
Aug 22, 2025
0e89595
Merge pull request #22 from Khuwn-Soulutions/dg-fixes
ThisIsRuddy Aug 22, 2025
1c8aaa2
adding new functions
Sep 3, 2025
89c2b75
adding new functions
Sep 3, 2025
b134673
adding new functions
Sep 3, 2025
86bd26c
adding types
Sep 3, 2025
3c5313a
adding types
Sep 3, 2025
2547215
up
Sep 3, 2025
43cae82
add new helper functions
Sep 15, 2025
fe697b8
add new helper functions
Sep 15, 2025
f6ffcee
add new helper functions
Sep 15, 2025
fae62cc
add new helper functions
Sep 15, 2025
8be9316
add new helper functions
Sep 15, 2025
4b5656d
Merge pull request #23 from danielgroen/feat/generalfunctions
danielgroen Sep 15, 2025
de1e793
up
Sep 15, 2025
4507e68
test
Sep 17, 2025
4a31c05
test
Sep 17, 2025
55dfd2b
revert
Sep 17, 2025
ee12dfb
test
Sep 17, 2025
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
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module.exports = {
es2021: true,
node: true,
},
extends: [
'airbnb-base',
],
extends: ['airbnb-base'],
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 12,
requireConfigFile: false,
},
rules: {
quotes: ['error', 'single'],
'no-console': 'off',
'max-len': ['error', { code: 160 }],
'import/no-extraneous-dependencies': [
'error',
{
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
.env
.idea
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
31 changes: 31 additions & 0 deletions examples/GetAlerts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const TradingView = require('../main');

/**
* This example gets all the alerts of the user
*/

if (!process.env.SESSION || !process.env.SIGNATURE) throw Error('Please set your sessionid and signature cookies');

// First parameter must be the layoutID
// If the layout is private:
// - Second parameter must be the userid (you can use getUser function)
// - You should provide your sessionid and signature cookies in .env file

TradingView.getAlerts(process.env.SESSION, process.env.SIGNATURE).then((alerts) => {
console.log(alerts);
}).catch((err) => {
console.error('Error:', err.message);
});

// TradingView.getFiredAlerts({ limit: 50, symbol: 'BYBIT:BTCUSDT.P' }, process.argv[2], process.argv[3]).then((alerts) => {
// console.log(alerts);
// }).catch((err) => {
// console.error('Error:', err.message);
// });

// const alertsToModify = [123124, 125123];
// TradingView.modifyAlerts(alertsToModify, 'start', process.argv[2], process.argv[3]).then((alerts) => {
// console.log(alerts);
// }).catch((err) => {
// console.error('Error:', err.message);
// });
16 changes: 16 additions & 0 deletions examples/GetQuoteSymbolInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const TradingView = require('../main');

/**
* This example creates a simple quote
* Handy if you need to retreive the first_bar for deep_backtest
*/

const client = new TradingView.Client();

const chart = new client.Session.Quote({ fields: 'all' });
const symbol = new chart.Market('BYBIT:BTCUSDT.P');

symbol.onLoaded(() => {
console.log('SymbolInfo: ', symbol.symbolInfo);
client.end();
});
41 changes: 41 additions & 0 deletions examples/GetResultOfAlert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const TradingView = require('../main');

if (!process.env.SESSION || !process.env.SIGNATURE) throw Error('Please set your sessionid and signature cookies');

// WORKING
// Replace this with your own alertName
// const alertQuery = '#22';
// const alertQuery = '#39';
// const alertQuery = '#43';

// NOT WORKING
// const alertQuery = '#99';
// const alertQuery = '#100';
const alertQuery = 'henrik';

(async () => {
const alerts = await TradingView.getAlerts(process.env.SESSION, process.env.SIGNATURE);
const filteredAlerts = alerts.map(({
resolution, symbol, name, condition, active, ...rest
}) => ({
resolution,
symbol,
name,
condition,
active,
...rest,
}));

const alert = await filteredAlerts.filter((a) => a.name.includes(alertQuery))[0];
if (!alert) throw Error('Alert not found');

const result = await TradingView.alertToBacktest(alert, process.env.SESSION, process.env.SIGNATURE);

const {
strategyReport: {
history: { equityPercent },
performance: { all },
},
} = result;
console.log(all);
})();
46 changes: 46 additions & 0 deletions examples/GetStrategyWithExternalIndicator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const TradingView = require('../main');

if (!process.env.SESSION || !process.env.SIGNATURE) {
throw Error('Please set your sessionid and signature cookies');
}

const client = new TradingView.Client({
server: 'prodata',
token: process.env.SESSION,
signature: process.env.SIGNATURE,
// DEBUG: true,
});

const chart = new client.Session.Chart();
chart.setMarket('BYBIT:LINKUSDT.P', {
timeframe: '60',
range: 99999,
});

chart.onError((...err) => {
console.log(err);
});

// Chart: https://www.tradingview.com/chart/iLrw9UNL/
const mystratId = 'PUB;db3dda4d2c1f475bbc9240ff0a41116b';
// const rsiStrategyId = 'STD;RSI%1Strategy';
const rsiStudyId = 'STD;RSI';

(async () => {
const indicators = {
rsiStudy: await TradingView.getIndicator(rsiStudyId),
myStrategy: await TradingView.getIndicator(mystratId),
};

indicators.rsiStudy.setOption('RSI_Length', 9);
const study = new chart.Study(indicators.rsiStudy);

indicators.myStrategy.setOption('Enter_Short_after_crossing', `${study.studID}$0`); // important to be before next line
const myStrategy = new chart.Study(indicators.myStrategy);

myStrategy.onUpdate(() => {
const { strategyReport: { performance: { all } } } = myStrategy;
console.log('Result: ', all);
client.end();
});
})();
6 changes: 6 additions & 0 deletions examples/GetStudyTemplates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const TradingView = require('../main');

(async () => {
const templates = await TradingView.getStudyTemplates();
console.log(templates);
})();
16 changes: 16 additions & 0 deletions examples/TwoFa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const TradingView = require('../main');

/**
* 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.twoFactorAuth(process.argv[2], process.argv[3], 'sms', process.argv[4])
.then((data) => {
console.log(data);
})
.catch((err) => {
console.error('Login error:', err.message);
});
13 changes: 13 additions & 0 deletions examples/getUser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const TradingView = require('../main');

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

if (!process.env.SESSION || !process.env.SIGNATURE) throw Error('Please set your sessionid and signature cookies');

TradingView.getUser(process.env.SESSION, process.env.SIGNATURE).then((data) => {
console.log(data);
}).catch((err) => {
console.error('Login error:', err.message);
});
Loading