Hey Eric,

Check out the repo for this that is located 
here: https://github.com/beancount/beanprice

There is a little documentation there that you can take a look at, but 
basically you'll want to use:

bean-price --update ledger.beancount

That will fetch all historical prices (as needed by your ledger) up to the 
current day.

On Monday, August 7, 2023 at 7:39:31 PM UTC-4 erical...@gmail.com wrote:

> Let me ask a more basic question.  What is bean-price actually supposed to 
> do?
>
> Re-reading
> https://beancount.github.io/docs/fetching_prices_in_beancount.html ,
> I'm piecing together that perhaps the only thing bean-price does is value 
> your assets as of a certain date.  Is that true?  TBH it's not clear from 
> the docs.
>
> There are other uses for prices, e.g., establishing cost basis for a 
> purchase, or establishing the value of the transfer of an asset at a 
> particular point in time be that for income or expenses.  Are there 
> existing plugins that can look up historical prices and annotate 
> transactions with them where they're missing?
>
> On Tue, Aug 1, 2023 at 5:54 PM Eric Altendorf <erical...@gmail.com> wrote:
>
>> I'm having trouble understanding how automatic price fetching works, and 
>> I think it's being additionally complicated by questions of price 
>> imputation and maybe PnL accounts.  Let's start with the simplest case.  
>> Consider (commodity declarations omitted for brevity):
>>
>> 2020-01-01 * "Buy BTC (from USD)"
>>   Assets:Coinbase:BTC       0.50000000 BTC 
>>   Assets:Coinbase:USD  -4750.00000000 USD
>>
>> I would have expected bean-price to fetch a price for BTC for 2020-01-01, 
>> but instead it fails, saying the transaction doesn't balance.  Now, if I 
>> supply a price 
>>
>> 2020-01-01 * "Buy BTC (from USD)"
>>   Assets:Coinbase:BTC       0.50000000 BTC @ 9500.0 USD
>>   Assets:Coinbase:USD  -4750.00000000 USD
>>
>> or supply a price spec with no number:
>>
>> 2020-01-01 * "Buy BTC (from USD)"
>>   Assets:Coinbase:BTC       0.50000000 BTC @ USD
>>   Assets:Coinbase:USDT  -4750.00000000 USD
>>
>> then there is no error, but bean-price fetches *today's* price.
>>
>> Now let's consider a more complex example:
>>
>> 2020-02-01 * "Buy BTC (from USDT)"
>>   Assets:Coinbase:BTC       0.50000000 BTC
>>   Assets:Coinbase:USDT  -4750.00000000 USDT
>>   Income:PnL
>>
>> Here, I'd like to fetch the USD prices of both BTC and USDT, which would 
>> allow PnL to be computed, but bean-price fetches nothing.  Now, if I put "@ 
>> USD" at the end of the BTC posting (as above), instead of getting the price 
>> on 2020-01-01 (as I desire), or the price today (as in the earlier 
>> example), I get "Too many missing numbers for currency group 'USD'".
>>
>> I can't quite figure out what bean-price is doing, or square it against the 
>> documentation 
>> <https://docs.google.com/document/d/1thYRAMell_QT1Da1F_laprSs6BlROZjyK_h3V8qHW9c/edit>.
>>   
>> Any tips to get me unblocked?
>>
>> thanks,
>> eric
>>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/beancount/ede58116-e234-4ffb-8d69-4188304af919n%40googlegroups.com.

Reply via email to