Beanprice custom source

2021-04-11 Thread Thomas den Hollander
Hello everyone, I wanted to write custom sources for bean-price, but I'm unsure what the best way to do this is. I'm not very experienced with Python or its module system. Say I have a folder with my own sources, how do I reference these while fetching the price? Should I add the path to my PY

Re: Beanprice custom source

2021-04-11 Thread Martin Blais
You can reference them by the name of their Python module if they're outside the library. You can use the short name if they're in the library, here: https://github.com/beancount/beanprice/tree/master/beanprice/sources New ones are welcome. Minimal requirement for inclusion in the library is a uni

Re: Beanprice custom source

2021-04-11 Thread Thomas den Hollander
Thanks! My price source is pretty specific, but I'll probably publish it at some point. Op zondag 11 april 2021 om 15:34:51 UTC+2 schreef bl...@furius.ca: > You can reference them by the name of their Python module if they're > outside the library. > You can use the short name if they're in the

Re: Beanprice custom source

2021-04-11 Thread Thomas den Hollander
One more question. Many price sources are only available in USD while my main currency is EUR. How do I deal with that? Is Fava able to display the total worth by converting via USD to EUR? Should I convert these price statements myself, and if so, would it be useful to have such functionality

Re: Beanprice custom source

2021-04-11 Thread Martin Blais
Fava is a completely different question and AFAIK it should respect Beancount's notion of "operating currency", which is configurable. For Beanprice, the sources may return their quote currency, here: https://github.com/beancount/beanprice/blob/master/beanprice/source.py#L31 On Sun, Apr 11, 2021

Re: Beanprice custom source

2021-04-11 Thread 'Patrick Ruckstuhl' via Beancount
What I'm using is to calculate cross rates on the flying using a plugin: So if you have e.g. a stock price in USD and the fx rate between EUR and USD, it calculates the stock price in EUR https://github.com/tarioch/beancounttools/blob/master/src/tariochbctools/plugins/generate_base_ccy_price

Add optional base ccy argument to beanprice contract?

2021-04-11 Thread 'Patrick Ruckstuhl' via Beancount
Hi, I started looking into moving my price fetchers into beanprice and noticed something. Most of my price sources actually allow you to specify in which base ccy to return the result. As far as I can tell, at the moment the Source interface https://github.com/beancount/beanprice/blob/mast

Re: Add optional base ccy argument to beanprice contract?

2021-04-11 Thread Martin Blais
I don't think so. Conversions is something you should be doing from the caller side. Price sources should always return numbers in original quote currencies On Sun, Apr 11, 2021, 14:52 'Patrick Ruckstuhl' via Beancount < beancount@googlegroups.com> wrote: > Hi, > > I started looking into moving

Re: Add optional base ccy argument to beanprice contract?

2021-04-11 Thread 'Patrick Ruckstuhl' via Beancount
I think my cases are often cases where there is no "original" quote currency. E.g. fx rates or crypto rates. At least for me it's very useful to specify in which currency I want to get my rates. As an alternative I can create a custom ticker format. One related thing I'm not getting is, that bo

beangulp loader is confused by csv module name

2021-04-11 Thread kuba....@gmail.com
Hi, I'm having some problems using the debugger in the beangulp project. I'm using PyCharm 2021.1. Python 3.9.2 (default, Feb 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux When I run pytest normally everything runs fine, but if I try and use the debugger, the application

Re: petl (Was: Re: Visidata)

2021-04-11 Thread Ben Blount
Did either of you end up making some end to end flows with this that you'd be willing to share? I'm looking to make a pivot-table of account rollup balances over time and something like PETL would be a great fit. On Fri, Jan 29, 2021 at 6:50 PM redst...@gmail.com wrote: > Excellent find. I've be

Re: petl (Was: Re: Visidata)

2021-04-11 Thread Martin Blais
Using it a ton but not with Beancount yet On Sun, Apr 11, 2021 at 5:37 PM Ben Blount wrote: > Did either of you end up making some end to end flows with this that you'd > be willing to share? > I'm looking to make a pivot-table of account rollup balances over time and > something like PETL woul

Re: petl (Was: Re: Visidata)

2021-04-11 Thread redst...@gmail.com
Yes, extensively in my importers . *Context:* https://reds-rants.netlify.app/personal-finance/make-importers-easy-to-write-and-write-lots-of-them/ https://reds-rants.netlify.app/personal-finance/file-format-readers/ *Reader code using petl:*

Re: beangulp loader is confused by csv module name

2021-04-11 Thread Daniele Nicolodi
On 11/04/2021 23:16, kuba@gmail.com wrote: > Hi, > > I'm having some problems using the debugger in the beangulp project. > > I'm using PyCharm 2021.1. > Python 3.9.2 (default, Feb 20 2021, 00:00:00)  > [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux > > When I run pytest normally everythi

Re: beangulp loader is confused by csv module name

2021-04-11 Thread Daniele Nicolodi
On 11/04/2021 23:43, Daniele Nicolodi wrote: > On 11/04/2021 23:16, kuba@gmail.com wrote: >> Hi, >> >> I'm having some problems using the debugger in the beangulp project. >> >> I'm using PyCharm 2021.1. >> Python 3.9.2 (default, Feb 20 2021, 00:00:00)  >> [GCC 10.2.1 20201125 (Red Hat 10.2.1-9

Re: Add optional base ccy argument to beanprice contract?

2021-04-11 Thread Martin Blais
I view these are different financial instruments altogether spot fx: USD/JPY != USD/GBP Ditto for DA: BTC/USD != BTC/EUR On Sun, Apr 11, 2021 at 4:03 PM Patrick Ruckstuhl wrote: > I think my cases are often cases where there is no "original" quote > currency. E.g. fx rates or crypto rates. At

Re: beangulp loader is confused by csv module name

2021-04-11 Thread kuba....@gmail.com
Hi Dan, Yes, I am able to reproduce the same problem using the command line if I invoke the csv_test.py script. (venv) bash-5.0$ git status On branch master Your branch is up to date with 'upstream/master'. nothing to commit, working tree clean (venv) bash-5.0$ python beangulp/importers/csv_te

Re: beangulp loader is confused by csv module name

2021-04-11 Thread Daniele Nicolodi
On 11/04/2021 23:55, kuba@gmail.com wrote: > Hi Dan, > > Yes, I am able to reproduce the same problem using the command line if I > invoke the csv_test.py script. I see it too. I'm in it. In the meanwhile: bin/python -m pytest beangulp/importers/csv_test.py works (here at least). Cheers, D

Re: beangulp loader is confused by csv module name

2021-04-11 Thread Daniele Nicolodi
On 12/04/2021 00:00, Daniele Nicolodi wrote: > On 11/04/2021 23:55, kuba@gmail.com wrote: >> Hi Dan, >> >> Yes, I am able to reproduce the same problem using the command line if I >> invoke the csv_test.py script. > > I see it too. I'm in it. In the meanwhile: > > bin/python -m pytest beangul

Re: beangulp loader is confused by csv module name

2021-04-11 Thread Martin Blais
We *could* just rename csv.py to csvimp.py On Sun, Apr 11, 2021 at 6:19 PM Daniele Nicolodi wrote: > On 12/04/2021 00:00, Daniele Nicolodi wrote: > > On 11/04/2021 23:55, kuba@gmail.com wrote: > >> Hi Dan, > >> > >> Yes, I am able to reproduce the same problem using the command line if I >

Re: Add optional base ccy argument to beanprice contract?

2021-04-11 Thread 'Patrick Ruckstuhl' via Beancount
True, looking at it from that point it makes sense to have it part of the ticker. Thanks for the discussion. On April 11, 2021 11:45:40 PM GMT+02:00, Martin Blais wrote: >I view these are different financial instruments altogether >spot fx: USD/JPY != USD/GBP >Ditto for DA: BTC/USD != BTC/EUR >

Re: Add optional base ccy argument to beanprice contract?

2021-04-11 Thread Tomasz Zurkowski
In my ledger I have USD's that I want to convert to CHF, so I need a price of USD in CHF as base price. I do it by adding following commodity: 2013-01-01 commodity USD price: "CHF:yahoo/USDCHF=X" The base currency is encoded in the source specific symbol. Now, it might look weird that all tic