Can someone help me write a one cell query similar to the one below but using yahoo finance data instead of google finance. This sparkline shows a trend on daily price for the last 365 days and colors the sparkline green or red depending if the current price is higher or lower than the first day from the range provided. In this case 1st day from 365 days.
I really hope this can be done as I don't want to create additional tables or tabs to store data and then produce a sparkline.
=sparkline(query(googlefinance(AAPL, "price", today()-365, today()-2), "select Col2 label Col2 ''", 1),{"color",if( INDEX(googlefinance(AAPL,"price",today()-365),2,2) < INDEX(googlefinance(AAPL, "price", today()-2),2,2),"green","red");"linewidth",2})
Here is an example of how to grab the latest price using yahoo finance.
=index(IMPORTXML("https://finance.yahoo.com/quote/AAPL","//*[@id='quote-header-info']//span"),2)