【发布时间】:2020-03-03 08:48:58
【问题描述】:
我有以下 google 和 yahoo 财务查询,它们生成了过去 5 天的简单图表。我将如何修改它以查看最近 5 个交易日。仅限周一至周五。
=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})
【问题讨论】:
标签: if-statement google-sheets google-sheets-query yahoo-finance google-finance