Skip to content

Commit

Permalink
Add more formatting to main dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
sidward35 committed Sep 2, 2020
1 parent a285257 commit c748301
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def export_json(content):
results.append(row)

def get_basic_info(stock):
if(stock==''):
if(stock=='' or stock=='default'):
tickers = ['SPLK', 'TSLA', 'AMZN', 'NFLX', 'MSFT', 'NVDA', 'INTC', 'PYPL', 'VMW', 'NET']
elif(stock=='DJIA'):
tickers = ['JPM', 'IBM', 'UNH', 'PG', 'BA', 'VZ', 'GS', 'INTC', 'HD', 'MCD', 'CSCO', 'V', 'MSFT', 'KO', 'AXP', 'AMGN', 'MRK', 'CVX', 'MMM', 'TRV', 'JNJ', 'DIS', 'HON', 'CAT', 'NKE', 'CRM', 'WBA', 'AAPL', 'DOW', 'WMT']
Expand Down
3 changes: 2 additions & 1 deletion default/data/ui/views/stocks-simple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<fieldset submitButton="false">
<input type="text" token="ticker" searchWhenChanged="true">
<label>Symbol(s)</label>
<default></default>
<default>DJIA</default>
</input>
</fieldset>
<row>
Expand All @@ -14,6 +14,7 @@
<search>
<query>| quote $ticker$
| spath
| dedup ticker
| convert num(quote.c), num(quote.pc), num(sentiment.sentiment.bullishPercent), num(sentiment.sectorAverageBullishPercent)
| eval change = ('quote.c'/'quote.pc'-1)*100, bullishPercent = 'sentiment.sentiment.bullishPercent'*100, sectorAvgBullishPercent = 'sentiment.sectorAverageBullishPercent'*100, signalRating = case('technicalAnalysis.signal' = "strong buy", 5, 'technicalAnalysis.signal' = "buy", 4, 'technicalAnalysis.signal' = "neutral", 3, 'technicalAnalysis.signal' = "sell", 2, 'technicalAnalysis.signal' = "strong sell", 1, true(), 0)
| table ticker change quote.c quote.pc signalRating technicalAnalysis.signal sentiment.buzz.articlesInLastWeek sentiment.buzz.weeklyAverage sentiment.companyNewsScore sentiment.sectorAverageNewsScore sentiment.buzz.buzz bullishPercent sectorAvgBullishPercent
Expand Down
40 changes: 34 additions & 6 deletions default/data/ui/views/stocks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
<search>
<query>| quote
| spath
| convert num(quote.c), num(quote.pc)
| eval change = ('quote.c'/'quote.pc'-1)*100, signalRating = case('technicalAnalysis.signal' = "strong buy", 5, 'technicalAnalysis.signal' = "buy", 4, 'technicalAnalysis.signal' = "neutral", 3, 'technicalAnalysis.signal' = "sell", 2, 'technicalAnalysis.signal' = "strong sell", 1, true(), 0)
| table ticker change quote.c quote.pc signalRating technicalAnalysis.signal sentiment.buzz.articlesInLastWeek sentiment.buzz.weeklyAverage sentiment.companyNewsScore sentiment.sectorAverageNewsScore sentiment.buzz.buzz sentiment.sentiment.bullishPercent sentiment.sectorAverageBullishPercent
| dedup ticker
| convert num(quote.c), num(quote.pc), num(sentiment.sentiment.bullishPercent), num(sentiment.sectorAverageBullishPercent)
| eval change = ('quote.c'/'quote.pc'-1)*100, bullishPercent = 'sentiment.sentiment.bullishPercent'*100, sectorAvgBullishPercent = 'sentiment.sectorAverageBullishPercent'*100, signalRating = case('technicalAnalysis.signal' = "strong buy", 5, 'technicalAnalysis.signal' = "buy", 4, 'technicalAnalysis.signal' = "neutral", 3, 'technicalAnalysis.signal' = "sell", 2, 'technicalAnalysis.signal' = "strong sell", 1, true(), 0)
| table ticker change quote.c quote.pc signalRating technicalAnalysis.signal sentiment.buzz.articlesInLastWeek sentiment.buzz.weeklyAverage sentiment.companyNewsScore sentiment.sectorAverageNewsScore sentiment.buzz.buzz bullishPercent sectorAvgBullishPercent
| sort - signalRating sentiment.sentiment.bullishPercent sentiment.companyNewsScore sentiment.buzz.articlesInLastWeek +change
| fields - signalRating
| rename quote.c as close, quote.pc as prevClose, technicalAnalysis.signal as signal, sentiment.buzz.articlesInLastWeek as articlesLastWeek, sentiment.buzz.weeklyAverage as weeklyAverage, sentiment.companyNewsScore as newsScore, sentiment.sectorAverageNewsScore as sectorAvgNewsScore, sentiment.buzz.buzz as buzz, sentiment.sentiment.bullishPercent as bullishPercent, sentiment.sectorAverageBullishPercent as sectorAvgBullishPercent</query>
| rename quote.c as close, quote.pc as prevClose, technicalAnalysis.signal as signal, sentiment.buzz.articlesInLastWeek as articlesLastWeek, sentiment.buzz.weeklyAverage as weeklyAverage, sentiment.companyNewsScore as newsScore, sentiment.sectorAverageNewsScore as sectorAvgNewsScore, sentiment.buzz.buzz as buzz</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
Expand All @@ -27,15 +28,39 @@
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
<option name="refresh.auto.interval">60</option>
<format type="color" field="change">
<colorPalette type="minMidMax" maxColor="#53A051" midColor="#3C444D" minColor="#DC4E41"></colorPalette>
<scale type="minMidMax" maxValue="3.5" midValue="0" minValue="-3.5"></scale>
</format>
<format type="number" field="change">
<option name="unit">%</option>
</format>
<format type="number" field="bullishPercent">
<option name="precision">0</option>
<option name="unit">%</option>
</format>
<format type="number" field="sectorAvgBullishPercent">
<option name="precision">0</option>
<option name="unit">%</option>
</format>
<format type="color" field="bullishPercent">
<colorPalette type="minMidMax" maxColor="#006D9C" midColor="#3C444D" minColor="#EC9960"></colorPalette>
<scale type="minMidMax" maxValue="100" midValue="50" minValue="0"></scale>
</format>
<format type="color" field="newsScore">
<colorPalette type="minMidMax" maxColor="#294E70" minColor="#3C444D"></colorPalette>
<scale type="minMidMax" maxValue="1" minValue="0"></scale>
</format>
<format type="color" field="articlesLastWeek">
<colorPalette type="minMidMax" maxColor="#5A4575" minColor="#3C444D"></colorPalette>
<scale type="minMidMax"></scale>
</format>
<format type="color" field="signal">
<colorPalette type="map">{"strong buy":#53A051,"buy":#B6C75A,"neutral":#3C444D,"sell":#AF575A,"strong sell":#DC4E41}</colorPalette>
</format>
<drilldown>
<set token="ticker">$click.value$</set>
<link target="_blank">https://www.investopedia.com/markets/quote?tvwidgetsymbol=$click.value$</link>
</drilldown>
</table>
</panel>
Expand Down Expand Up @@ -98,8 +123,11 @@
<format type="number" field="change">
<option name="unit">%</option>
</format>
<format type="color" field="signal">
<colorPalette type="map">{"strong buy":#53A051,"buy":#B6C75A,"neutral":#3C444D,"sell":#AF575A,"strong sell":#DC4E41}</colorPalette>
</format>
<drilldown>
<set token="ticker">$click.value$</set>
<link target="_blank">https://www.investopedia.com/markets/quote?tvwidgetsymbol=$click.value$</link>
</drilldown>
</table>
</panel>
Expand Down

0 comments on commit c748301

Please sign in to comment.