-
-
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
a4b9f66
commit e17b61d
Showing
3 changed files
with
46 additions
and
11 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,29 @@ | ||
const TradingView = require('../main'); | ||
|
||
/* | ||
This example tests fetching chart | ||
data of a number of candles before | ||
or after a timestamp | ||
*/ | ||
|
||
const client = new TradingView.Client(); | ||
|
||
const chart = new client.Session.Chart(); | ||
chart.setMarket('BINANCE:BTCEUR', { | ||
timeframe: '240', | ||
range: 2, // Can be positive to get before or negative to get after | ||
to: 1600000000, | ||
}); | ||
|
||
// This works with indicators | ||
|
||
TradingView.getIndicator('STD;Supertrend').then(async (indic) => { | ||
console.log(`Loading '${indic.description}' study...`); | ||
const SUPERTREND = new chart.Study(indic); | ||
|
||
SUPERTREND.onUpdate(() => { | ||
console.log('Prices periods:', chart.periods); | ||
console.log('Study periods:', SUPERTREND.periods); | ||
client.end(); | ||
}); | ||
}); |
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
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