Skip to content

Commit

Permalink
Refactor tradingview opts + Bump to 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvana-tikku committed Aug 19, 2017
1 parent 86cf07a commit 889d49d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
33 changes: 27 additions & 6 deletions enhancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,33 @@ Enhancer.initTradingViewWidget = function initTradingViewWidget(ticker){
script.src = '//s3.tradingview.com/tv.js';
script.async = true;
script.addEventListener('load', function(){
let insertTradingViewChartCode = ['new TradingView.widget({'];
insertTradingViewChartCode.push('"symbol": "'+ticker+'","width": "100%","height": 550,"interval": "30","timezone": "Etc/UTC",');
insertTradingViewChartCode.push('"theme": "White","style": "1","locale": "en","toolbar_bg": "#f1f3f6",');
insertTradingViewChartCode.push('"enable_publishing": false,"withdateranges": true, "studies": ["RSI@tv-basicstudies","MACD@tv-basicstudies"],');
insertTradingViewChartCode.push('"hide_side_toolbar": false, "show_popup_button": true, "popup_width": "1000", "popup_height": "650", ');
insertTradingViewChartCode.push('"allow_symbol_change": true, "hideideas": true, "container_id": "tv-chart-'+ticker+'"});');
let tradingViewOpts = {
symbol: ticker,
width: '100%',
height: 550,
interval: 30,
timezone: 'Etc/UTC',
theme: 'White',
style: 1,
locale: 'en',
toolbar_bg: '#f1f3f6',
enable_publishing: false,
withdateranges: true,
studies: [
'RSI@tv-basicstudies',
'MACD@tv-basicstudies'
],
hide_side_toolbar: false,
show_popup_button: true,
popup_width: 1000,
popup_height: 650,
allow_symbol_change: true,
hideideas: true,
container_id: 'tv-chart-'+ticker
};
let insertTradingViewChartCode = ['new TradingView.widget('];
insertTradingViewChartCode.push(JSON.stringify(tradingViewOpts));
insertTradingViewChartCode.push(');');
const chartScript = document.createElement('script');
chartScript.type = 'text/javascript';
chartScript.innerText = insertTradingViewChartCode.join('');
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "Bittrex Enhanced",
"description": "Enhance your Bittrex experience by including USD values alongside BTC prices, and using the TradingView chart widget instead.",
"version": "1.3",
"version": "1.3.1",

"browser_action": {
"default_title": "Enhance Trex"
Expand Down

0 comments on commit 889d49d

Please sign in to comment.