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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAFXPr0v50nna0Q2V9znAdpCRweo%2BS9TcZL9bO3AyrUcqktnvrA%40mail.gmail.com.

Reply via email to