I am trying to create a google sheet showing various crypto prices for a few set times (but lets just use BTC-USD for the moment). The sheet would show
BTCUSD Current Price, Previous Close, Close 5 days ago and Close 31 days ago
I have tried the following but running into the problems described which appear to be reserved for crypto.
There are various ways one can get the current price:
=GOOGLEFINANCE("BTCUSD")
will work - so we are ok for current price
=GOOGLEFINANCE("BTCUSD","change")
will not work, however it will work for an equity
=GOOGLEFINANCE("AAPL","change")
will work
Similarly
=index(IMPORTHTML(CONCATENATE("https://finance.yahoo.com/quote/","AAPL"),"table",1),1,2)
will return from table 1 row 1, column 2 from the yahoo finance page for Apple (an equity)
However
=index(IMPORTHTML(CONCATENATE("https://finance.yahoo.com/quote/","BTC-USD"),"table",1),1,2)
does not work even though the page and table layout appear to be the same
I also notice that
=GOOGLEFINANCE("BTCUSD", "price", DATE(2022,1,1), DATE(2022,8,15), "DAILY")
will return the price of bitcoin for the date range,
However
=GOOGLEFINANCE("BTCUSD", "price", DATE(a1), DATE(a2), "DAILY")
will not work even if cell a1 and a2 have a copy and paste of the 2022,1,1 and 2022,8,15 in them.
I suspect the second question relates to the fact that the dates in the formula are not in quotes, however if you reference them from a cell excel may inadvertently put them into a quote causing a problem. This last problem makes it difficult to solve the problem from a different angle ie by referencing cells as the day changes and we refresh the sheet ie we cannot reference a cell which would always be 5 days ago or 31 days ago.