API for fetching historical Vanguard NAV prices?

Skip to first unread message

Aaron Stacy

Oct 9, 2021, 11:53:42 AM10/9/21
to ledge...@googlegroups.com
I've got a script that fetches prices for Vanguard frunds from one of the APIs I found their website was making XHR's to. It looks something like (tho I also needed the "Referer: https://vanguard.com" header:

This has worked for most of a year, up til last month, not only for ETFs, but also Vanguard funds like their target retirement funds, and even the target retirement trust fund my company uses for the 401k, but now I'm getting 404s.

I've found this will give me JSON of today's price (but not historical):

And this will give me HTML of historical prices, but not for the Target Retirement 2050 Trust fund my company uses for their 401k:

Does anyone know of APIs to fetch NAV prices for these funds by date?

Aaron Stacy

Oct 9, 2021, 11:55:10 AM10/9/21
to ledge...@googlegroups.com
...and I can answer my own question, but I'll post it here in case it saves anyone else some time:

The JSON API that now works came from inspecting this page, and searching through the XHRs for the NAV price listed. This came up (no headers seem to be needed):


Where "7743" is the FIID (fund ID? IDK), and while I don't remember where I originally got 7743, I think it was in the malformed OFX export XML from logging into my Vanguard portal.

Aaron Stacy

Oct 9, 2021, 11:56:00 AM10/9/21
to ledge...@googlegroups.com
And of course feel free to share if anyone has ideas for getting stuff like this from a proper API 🙂

Chris Berkhout

Oct 10, 2021, 9:14:53 AM10/10/21
to ledge...@googlegroups.com
The data comes in HTML but this looks like a pretty clean and self-explanatory interface for Vanguard US:


You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/CACjABk%3DYC29kxrLsM4n3qm%3DP-oZ0RSZxBEsrWLN4tEvGycpQkg%40mail.gmail.com.
Reply all
Reply to author
0 new messages