Historical prices - what alternative to yahoo for use with bean-price?

61 views
Skip to first unread message

Oon-Ee Ng

unread,
Oct 31, 2025, 11:13:16 AM (4 days ago) Oct 31
to bean...@googlegroups.com
Haven't kept up to date, but my bean-price stopped working (for getting my ETF prices) roughly in May, and now that I'm looking into it...

Firstly it seems curl_cffi is now needed if using the yahoo source, so I got that installed, but I keep getting variants of this error:-

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/beanprice/price.py", line 511, in fetch_cached_price
    timestamp_created, result_naive = _CACHE[key]
                                      ~~~~~~^^^^^
  File "/usr/lib/python3.13/site-packages/diskcache/core.py", line 1234, in __getitem__
    raise KeyError(key)
KeyError: '1b8bfc85ef72b8165072e7e2a6ea5175'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/bean-price", line 33, in <module>
    sys.exit(load_entry_point('beanprice==2.1.0', 'console_scripts', 'bean-price')())
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/beanprice/price.py", line 975, in main
    price_entries = sorted(price_entries, key=lambda e: e.currency)
  File "/usr/lib/python3.13/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib/python3.13/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.13/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.13/site-packages/beanprice/price.py", line 604, in fetch_price
    srcprice = fetch_cached_price(source, psource.symbol, dprice.date)
  File "/usr/lib/python3.13/site-packages/beanprice/price.py", line 529, in fetch_cached_price
    source.get_latest_price(symbol)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib/python3.13/site-packages/beanprice/sources/yahoo.py", line 163, in get_latest_price
    result = parse_response(response)
  File "/usr/lib/python3.13/site-packages/beanprice/sources/yahoo.py", line 40, in parse_response
    json = response.json(parse_float=Decimal)
  File "/usr/lib/python3.13/site-packages/curl_cffi/requests/models.py", line 226, in json
    return loads(self.content, **kw)
TypeError: orjson.loads() takes no keyword arguments

Exploring other data sources led me to alphavantage which works but doesn't give historical prices. Is there anything else I can do to obtain pricing for equities/ETFs? Is alphavantage the best currently (but with no history)?

Justus Pendleton

unread,
Oct 31, 2025, 5:04:49 PM (4 days ago) Oct 31
to Beancount
First try use --no-cache with bean-price. I used to get those KeyErrors all the time and just using --no-cache would fix them. I never bothered to look into why. It could be that Yahoo still works but your cache is messed up, so try that.

I switched away from yahoo years ago due to getting fed up with it breaking every year or two. I use my broker to get ticker prices[1] but, yes, it does mean not having easy access to ticker history.

[1]: they provide an API and I use a fork of  https://tariochbctools.readthedocs.io/en/latest/price_fetchers.html



William Bean

unread,
Nov 1, 2025, 1:43:14 PM (3 days ago) Nov 1
to Beancount
Make sure you update to the latest version. There have been multiple iterations of yahoo failing that have been fixed with with various beanprice versions.

Alen Šiljak

unread,
Nov 2, 2025, 4:53:50 PM (2 days ago) Nov 2
to Beancount
I ported my downloader to work with Bean-price and am using that.
I think I'm using a different API endpoint than yfinance. Sorry, I forgot the details as everything has been working well for a long time, and it is not as convenient to browse the source code with the phone.
Cheers!



Reply all
Reply to author
Forward
0 new messages