> >- Using prices in imports
>> >> For some imports I would like to enhance the transactions with prices
>> >> based on current/daily price, I'm currently fetching and storing
>> >> in beancount, so prices are available in the beancount file but I'm
>> >> sure what the best way to hook this into the importer framework is
>> >Fetching prices automatically /is/ OTOH intended to be automated.
>> >(Note that we're in a funny situation right now with both Yahoo and
>> >Finance APIs disabled.)
>> >These are two separate processes at the moment; run one, then the
>> >Concatenate to a file if you want to.
>> That's what I'm doing. What I'm looking is how to access the prices from
>> the beancount file in the importer, do I have to parse/load the beancount
>> file o my own?
> You'd call beancount.loader.load_file() on your existing file, and then
> build a price_map dict.
> Grep for "price_map" in the source code, you'll find several examples of
> doing that.
I'm wondering if it would make sense to slightly enhance the
ImporterProtocol. Right now bean-extract has already the ability to parse
an existing beancount file and use this for duplicate detection.
Now if those entries could be forwarded to the importer it would open up
some use cases such as:
* custom duplicate logic (e.g. let's say my import file has a unique
identifier which I map to metadata on the transaction, if I now get the
existing import entries, I can make sure to only import new transactions
and either completely ignore duplicates or tag them with the __duplicate__
* my use case where I need data (e.g. prices) from the existing beancount
file to enhance the new entries
I think all that would be needed is to add existingEntries to the extract
That way there is no additional parsing of beancount file needed and there
is a clear way to define which file to parse (e.g. same way to do it when
called from fava as well as from bean-extract)
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to firstname.lastname@example.org.
To view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.