Hi Patrick,


Thank you for your guidance! I thought I did, but I must've done something 
wrong earlier. I've reinstalled and can now successfully retrieve prices 
using Yahoo. 


For example:


❯ bean-price -e 'AUD:yahoo/VDHG.AX'

2024-12-27 price VDHG.AX                             69.53 AUD


I’ve defined my commodities in a commodities.bean file. For instance, VDHG 
is defined as follows:


2000-01-01 commodity VDHG

  name: "Vanguard Diversified High Growth ETF"

  asset-class: "Equity"

  symbol: "VDHG"

  price: "AUD:yahoo/VDHG.AX"


However, when I run the following command, it seems to execute 
successfully, but I don’t see the prices updated in any of my files:


❯ bean-price commodities.bean


Ideally, I’d like the latest prices to be saved automatically in a 
prices.bean file. Is there something I’m missing in my setup or an 
additional step I need to take to ensure the prices are recorded in the 
desired file?


Thanks again for your help!


Best regards,

Errol

On Tuesday, December 24, 2024 at 3:46:05 PM UTC+8 Patrick Ruckstuhl wrote:

> Hi Errol,
>
> Did you install beanprice separately?
>
> https://github.com/beancount/beanprice
>
> I'm using alphavantage on a daily basis.
>
> You will need to set an environment variable ALPHAVANTAGE_API_KEY with a 
> free api key from them and use it like
>
> USD:alphavantage/price:AAPL:USD
>
> Regards,
> Patrick 
>
>
> On December 24, 2024 2:48:02 AM GMT+01:00, Errol Lee <errol...@gmail.com> 
> wrote:
>
>> Hi everyone,
>>
>>
>> I’m new to Beancount (and honestly, I’m amazed by the amount of 
>> functionality it offers—wish I had discovered it sooner!). I’m trying to 
>> set up bean-price to fetch stock prices, but I’ve run into some issues, 
>> particularly with Yahoo and Alphavantage as sources.
>>
>>
>> Here’s what I’ve tried so far:
>>
>> 1. *Yahoo*:
>>
>> It seems like Yahoo has blocked API access for fetching stock prices. 
>> When I try fetching prices for AAPL, I get the following error:
>>
>>
>> ❯ bean-price -e 'USD:yahoo/AAPL'                 
>>
>> ERROR   : Error fetching AAPL: Status 401: {'code': 'Unauthorized', 
>> 'description': 'User is unable to access this feature - 
>> https://bit.ly/yahoo-finance-api-feedback'}
>>
>> ERROR   : Could not fetch for job: DatedPrice(base='AAPL', quote='USD', 
>> date=None, sources=[PriceSource(module=<module 
>> 'beancount.prices.sources.yahoo' from 
>> '/opt/homebrew/lib/python3.11/site-packages/beancount/prices/sources/yahoo.py'>,
>>  
>> symbol='AAPL', invert=False)])
>>
>>
>>
>> 2. *Alphavantage*:
>>
>> Despite being listed as a source in the GitHub documentation, I can’t 
>> seem to get it working. Here’s the error I encounter:
>>
>>
>> ❯ bean-price -e 'USD:alphavantage/AAPL'          
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "/opt/homebrew/lib/python3.11/site-packages/beancount/prices/price.py", 
>> line 178, inimport_source
>>
>>     __import__(default_name)
>>
>> ModuleNotFoundError: No module named 
>> 'beancount.prices.sources.alphavantage'
>>
>>
>> During handling of the above exception, another exception occurred:
>>
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "/opt/homebrew/lib/python3.11/site-packages/beancount/prices/price.py", 
>> line 182, inimport_source
>>
>>     __import__(module_name)
>>
>> ModuleNotFoundError: No module named 'alphavantage'
>>
>>
>> Ultimately, I’d like to fetch prices for some Australian stocks in my 
>> portfolio (e.g., ASX:VDHG, ASX:VGS, etc.).
>>
>>
>> Does anyone have advice on:
>>
>> • Workarounds for Yahoo?
>>
>> • How to enable or properly configure Alphavantage as a source?
>>
>> • Any other sources I can use for Australian stocks?
>>
>>
>> Thanks in advance for your help! Any guidance would be much appreciated.
>>
>>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/1e797d83-4d9c-4951-8609-a20781fb5164n%40googlegroups.com.

Reply via email to