Is possible to get a stock price for an specific date?

Good morning,
I am using the Stocks Pack by Coda, I am trying to get the quote for an specific date, example, January 3rd, 2022 of the SPY symbol.

I have tried HistoricalQuotes(“SPY”,“2y”), then filter by Date, even by price value, converting the date to number to match with my date’s number (44564), but always returns an empty list.

This is what I’ve tried so far:

HistoricalQuotes(“SPY”,“2y”).Filter(Date = ToDate(“1/3/2022”)).ClosePrice
HistoricalQuotes(“SPY”,“2y”).Filter(Date.ToDate() = ToDate(“1/3/2022”)).ClosePrice
HistoricalQuotes(“SPY”,“2y”).Filter(Date.ToDate().ToNumber() = 44564).ClosePrice

All the time it does return me an empty list.
Thanks in advance.

Hey Jonathan!
It seems that the dates aren’t actually dates, they’re just text, and they seem to be in the ISO format.

Try this!


Also seems there might be a bug here, it doesn’t work without CurrentValue

1 Like

Thank you Rickard, that solved it.
Have a nice week.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.