mardi 3 mars 2020

Google Finance query last 5 trading days excluding weekends

I have the following google and yahoo finance queries that generate a simple graph for the last 5 days. How would I go about modifying it to look at last 5 trading days. Simply Monday to Friday only.

=IFERROR(sparkline(query(googlefinance($A16, "price", today()-5, today()), "select Col2 label Col2 ''", 1),{"color",if( INDEX(googlefinance($A16,"price",today()-5),2,2) < INDEX(googlefinance($A16, "price", today()-2),2,2),"green","red");"linewidth",2}))


=SPARKLINE(QUERY(IMPORTHTML(
 "https://finance.yahoo.com/quote/AAPL/history?period1=“&86400*(
 TODAY()-5)-2209161600&"&period2=“&86400*TODAY()-2209161600&
 "&interval=1d&filter=history&frequency=1d”,
 "table", 1),
 “select Col5 order by Col1 asc offset 1”, 0), {“color”, IF(INDEX(SORT(IMPORTHTML(
 "https://finance.yahoo.com/quote/AAPL/history?period1="&86400*(
 TODAY()-5)-2209161600&"&period2="&86400*TODAY()-2209161600&
 "&interval=1d&filter=history&frequency=1d", 
 "table", 1), 1, 1), 1, 5) < INDEX(IMPORTXML(
 "https://finance.yahoo.com/quote/AAPL", 
 "//*[@id='quote-header-info']//span"), 2),
 "green", "red"); "linewidth", 2})

Aucun commentaire:

Enregistrer un commentaire