Hi Aaron I'm a beancount user and also own and maintain the market_prices <https://github.com/maread99/market_prices> library which I use for getting price data. There are no rate limits and you can be very specific about what you're after. The data is from Yahoo (from what I've ever been able to tell, the data from Yahoo and Alpha Vantage is one and the same).
I mention it only as a possible useful source for price data - there's no public interface to generate price directives and I've never sought to integrate it with `beanprice`. Hope you might find it useful. Cheers Marcus On Tue, 8 Apr 2025 at 03:54, aaron via Beancount <[email protected]> wrote: > So my Yahoo price updates have been toast for a couple months now and > I'm looking for something different. Might as well try Alpha Vantage. > I found that it could only retrieve the most recent price. > > So I built out the get_historical_price function for that, and it does > work. Code here: > > https://github.com/aaronaxvig/beanprice/blob/master/beanprice/sources/alphavantage.py#L111 > At least it did work until I ran into the API limit this evening and I > had a few minor changes made after that...but probably is fine. > > I do plan to add tests and do a pull request soon. > > In the meantime, the reason for this email is an architecture question. > The free API always returns 100 (most recent) price values. So it > seemed inefficient to be dumping 99 values every single time I was > looking up a historic value. And then of course I ran into the 25 API > calls per day rate limit which added an actual need to solve that > inefficiency. > > The idea would be to save all 100 values into the cache even when only > one is requested. This would seamlessly provide a pretty good and > efficient experience. My first idea was to make get_historical_price > able to return either a SourcePrice or a List[SourcePrice]. > get_prices_series of course was the inspiration there for the latter. > This seems a little messy though and would require some handling in > price.py around the two existing "source.get_historical_price(symbol, > time)" lines. Then other source.py implementations could choose to > return the List sometimes too...completely optional. > > Is this dumb? > > I couldn't find anywhere that called get_price_series (implemented in > yahoo.py, for example) to get ideas. > > The easy answer that kind of sucks, of course: implement the get price > series function and tell people to use that instead. > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/beancount/38bc65bb26b36b3068e2b039742f419f%40axvig.com > . > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/beancount/CACNAvY3vdRv%2BUau%2Bvz4vQ57T19Z1A3esGVWkLMKaKMf_e9bwMw%40mail.gmail.com.
