On Thu, Aug 10, 2023 at 12:50 AM Eric Altendorf <ericaltend...@gmail.com>
wrote:

> On Wed, Aug 9, 2023 at 5:48 AM Martin Blais <bl...@furius.ca> wrote:
>
>> The original goal of bean-price is
>>
>> - load the ledger and figure out which price entries are missing, say, at
>> transaction times and at regular intervals while positions are held
>> - fetch/scrape rates from some external sites
>> - print out the missing Price directives in Beancount format so you can
>> insert them into your file.
>> That's all.
>>
>
> OK, that's what I thought.  It doesn't seem to be doing this for me, not
> sure if there's a bug or if my test cases (e.g. earlier this thread) don't
> match the patterns it looks for.  Although I'm strongly biased against
> forking/duplicating code, this may be a case where I'm better off managing
> price fetching myself...I'll dig inside the library to see if I can at
> least reuse the fetching infra, even if I drive it with my own triggers.
>

Code rots. I haven't been using this regularly myself. It's possibly broken.
There is not much to reuse here; roll out your own is a fine alternative.



>
> In v3/master, moved it to its own repo so I could focus on just the core.
>> I admit it needs a bit more love.
>>
>
> No problem.  Don't construe any of my questions as complaints.  :)  I'm
> just trying to understand the state of the world so I can plan in ways that
> meet my own goals and hopefully also advance the Beancount platform at the
> same time.
>

No worries.
I'm sorry I haven't been able to follow / respond to the flurry of emails.


On Wed, Aug 9, 2023, 13:11 Eric Altendorf <ericaltend...@gmail.com> wrote:
>>
>>> Here's another example:
>>>
>>> 2020-06-02 * "Mining reward of 0.05 BTC"
>>>   Assets:Ledger:BTC  0.05 BTC
>>>   Income:Mining:USD
>>>
>>> $ bean-price -vn price-fetch-test.beancount
>>> INFO    : Using price cache at "/tmp/bean-price.cache" (with indefinite
>>> expiration)
>>> INFO    : Processing at date: 2023-08-08
>>> INFO    : Loading "price-fetch-test.beancount"
>>> BTC /USD                         @ latest     [
>>> beanprice.sources.yahoo(BTC-USD) ]
>>>
>>> None of the transactions I enter seem to cause bean-price to fetch
>>> anything but @latest.
>>>
>>> Is there some annotation I need to be putting on my transactions to say
>>> "hey, price is needed here" ?
>>>
>>>
>>>
>>> On Tue, Aug 8, 2023 at 9:07 PM Eric Altendorf <ericaltend...@gmail.com>
>>> wrote:
>>>
>>>> Thanks, William.
>>>>
>>>> On Tue, Aug 8, 2023 at 4:04 PM William Bean <wbea...@gmail.com> wrote:
>>>>
>>>>> 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:
>>>>>
>>>>
>>>> I have read that too.
>>>>
>>>>
>>>>> bean-price --update ledger.beancount
>>>>>
>>>>> That will fetch all historical prices (as needed by your ledger) up to
>>>>> the current day.
>>>>>
>>>>
>>>> Thanks for confirming that it is supposed to fetch historical prices.
>>>>
>>>> Do you know what beancount considers "needed by the ledger"?  I can't
>>>> seem to make sense of it; as I reported in my original post, it's not
>>>> fetching the prices that it seems to *me* the ledger would need.
>>>>
>>>> I'm assuming bean-price is designed for a different use case than mine
>>>> and offers different behavior, but I can't quite figure out what that use
>>>> case or behavior is, and without understanding that I can't figure out
>>>> whether I can adapt bean-price for my case...
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> 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
>>>>> <https://groups.google.com/d/msgid/beancount/ede58116-e234-4ffb-8d69-4188304af919n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> 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/CAFXPr0v-PtEhQP5q511k9xpkV_L8cpiVQBsyYhzGK%2BLaTd-oZQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/beancount/CAFXPr0v-PtEhQP5q511k9xpkV_L8cpiVQBsyYhzGK%2BLaTd-oZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAK21%2BhPgjxmwB-3p%2BxhVKyAXbU8dOxhc59-P9E8b4%3DuZeXv67w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beancount/CAK21%2BhPgjxmwB-3p%2BxhVKyAXbU8dOxhc59-P9E8b4%3DuZeXv67w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAFXPr0tGDUdsznC-9HXEwXUBqUbW3MvKX1G5GzDFU1M6EvEccw%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAFXPr0tGDUdsznC-9HXEwXUBqUbW3MvKX1G5GzDFU1M6EvEccw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAK21%2BhMQaPASmZQXQ4ziAJWBXAk3GVzL5SKSGYy3gRLihDF7Yg%40mail.gmail.com.

Reply via email to