From c74830131d13b8a2ba8a283a28cd45c8d59f3cc2 Mon Sep 17 00:00:00 2001 From: sidward35 Date: Tue, 1 Sep 2020 20:43:24 -0700 Subject: [PATCH] Add more formatting to main dashboard --- bin/quote.py | 2 +- default/data/ui/views/stocks-simple.xml | 3 +- default/data/ui/views/stocks.xml | 40 +++++++++++++++++++++---- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/bin/quote.py b/bin/quote.py index 3f33b3e..d6bfdd4 100644 --- a/bin/quote.py +++ b/bin/quote.py @@ -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'] diff --git a/default/data/ui/views/stocks-simple.xml b/default/data/ui/views/stocks-simple.xml index 17fb51d..ec8c455 100644 --- a/default/data/ui/views/stocks-simple.xml +++ b/default/data/ui/views/stocks-simple.xml @@ -3,7 +3,7 @@
- + DJIA
@@ -14,6 +14,7 @@ | 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 diff --git a/default/data/ui/views/stocks.xml b/default/data/ui/views/stocks.xml index ed057ed..a83a518 100644 --- a/default/data/ui/views/stocks.xml +++ b/default/data/ui/views/stocks.xml @@ -9,12 +9,13 @@ | 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 +| 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 -24h@h now 1 @@ -27,6 +28,7 @@ + @@ -34,8 +36,31 @@ + + + + + + + + + + + + + + + + + + + + + + {"strong buy":#53A051,"buy":#B6C75A,"neutral":#3C444D,"sell":#AF575A,"strong sell":#DC4E41} + - $click.value$ + https://www.investopedia.com/markets/quote?tvwidgetsymbol=$click.value$ @@ -98,8 +123,11 @@ + + {"strong buy":#53A051,"buy":#B6C75A,"neutral":#3C444D,"sell":#AF575A,"strong sell":#DC4E41} + - $click.value$ + https://www.investopedia.com/markets/quote?tvwidgetsymbol=$click.value$