Re: Import from email notifications

2024-01-06 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

not exactly the same case, but related.


I created an importer which wrapps around other importers for 
attachments, 
https://tariochbctools.readthedocs.io/en/latest/importers.html#mail-adapter


Maybe you can use some of it as a base for your importer.


Regards,

Patrick


On 06.01.2024 19:57, 'Aaron Axvig' via Beancount wrote:
Hello, new Beancount user of a few weeks here.  I'm cutting over from 
Quicken as of the first of the year.  The import was a lot of work but 
I have fiddled my way to a beautiful 61,000 line file of converted 
data.  Some fixing of QIF parsers and converters, and lots of fixing 
my old data.  Quicken allows some real garbage!


Anyways, as I get ready to do my first import of transactions directly 
into Beancount, it occurs to me that I get an email of every 
transaction that occurs on my credit cards.  With some email rules and 
cron jobs this could potentially keep my credit card accounts 
perpetually up to date on at least a daily basis if not better.  And 
it would be verified on a monthly basis with ending balances, etc.


Has anyone put some thought into this technique?  Any roadblocks? Are 
any parts of such a processing flow already built?


Some sample data from emails is below.  I think account, amount, 
merchant, and date is all one needs?


Example 1:

You made a $5.36 transaction
Account     Visa (...1234)
Date     Jan 1, 2024 at 12:00 PM ET
Merchant     GOOGLE *SomeApp
Amount     $5.36

Example 2:

Amount: $16.07
Card Ending In 4321
Merchant ETSY, INC. 718-8557955 US
Date 01/02/2024
Time 10:19 AM E



--
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/f56658f7-92e0-4d2f-8646-a28e6117424a%40tario.org.


Re: Dealing with commodities priced in multiples currencies.

2024-01-04 Thread 'Patrick Ruckstuhl' via Beancount
Hi, 

Beancount doesn't automatically apply transitive rates. I created a plugin 
which does exactly that for the same use case.

https://tariochbctools.readthedocs.io/en/latest/plugins.html#generate-base-ccy-prices

Regards,
Patrick 


On January 4, 2024 11:13:01 PM GMT+01:00, "Timothée GROS" 
 wrote:
>Hi, 
>
>I am closing my fourth year of accounting with beancount. The learning 
>curve is steep, but i am loving it.
>I use mainly fava as my frontend for beancount.
>
>I am french, and as such, EUR is my main currency.
>
>I have various portfolios of stocks and or crypto monitored in beancount.
>For some of these assets, my price sources only provides prices in USD, not 
>in EUR .
>As a consequence, in my balance overview, even if i activate the "converted 
>to EUR" setting, i can't have a global total of my portfolio as som of the 
>prices are in USD. 
>Is there a way to compute the balance in euro ? technically, it should be 
>possible as there is a price for the commodity in USD, and a USD/EUR price.
>
>Thanks !
>Tim
>
>-- 
>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/147dfd98-352d-4580-92e8-422af5521742n%40googlegroups.com.

-- 
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/B2EA6052-9D1A-47B3-85B6-CD2BE0FC76D4%40tario.org.


Re: bean-query with commodity attributes?

2024-01-03 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

yes you can do that (at least the amounts, the percentage I don't think 
so),



  'COMMODITY_META(str)': Get the metadata dict of the commodity 
directive of the

    currency.

btw. bean-query has a help and help sub commands which are very handy.


Regards,

Patrick

On 03.01.2024 12:54, Matt McCormick wrote:
Hello, I'm a newbie to beancount having transferred over from ledger 
and trying it out.


Is it possible to use bean-query to filter accounts with commodities 
where those commodities match a commodity attribute?


For example, I've added attributes to commodities like so to 
distinguish asset classes:


1970-01-01 commodity FXNAX
name: "FID US BOND IDX"
asset: "bonds"
2011-05-04 commodity FXAIX
name: "FID 500 INDEX"
asset: "stock"
...
I would like to generate a report that provides a breakdown of the 
current balances in USD for the asset classes ie.


bonds: $250 25%
cash: $100 10%
stock: $650 65%

I have a feeling this may be too advanced for bean-query's syntax.  
I'm able to write a Python script if necessary but wanted to see if 
this would be possible using bean-query first.


Thank you
--
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/51c0dce1-2d75-4892-abc4-6ebe9432353en%40googlegroups.com 
.


--
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/133e32a0-be47-4062-a165-468aafdeeb3b%40tario.org.


Re: Labeling/ marking Accounts

2023-12-28 Thread 'Patrick Ruckstuhl' via Beancount

Hi nugget,


yes you can add metadata also on an account level. You add it on the 
open directive. There is even bean query support for it


OPEN_META(str)': Get the metadata dict of the open directive of the account.


2016-10-07 open Income:Foo  CHF
  tax_relevant: true


Regards,

Patrick


On 28.12.2023 13:34, nug get wrote:

Hi all
I started a basic tax-forecast plugin 
 
for Switzerland. One key ingredient is the providing of a list of all 
accounts that are subject to income and wealth taxation.


My current working prototype requires a lengthy config string to be 
passed to the plugin, listing, among other configurations, all 
accounts subject for income taxation, i.e.


plugin"drnukebean.plugins.tax_forecast""{'taxable_accounts': 
['Income:Jobs:Job1:TaxableSalary', 'Income:Jobs:Job1:TaxableBonus', 
'Income:Invest:.*:Dividends'], ...}"


I dont like it, but have not found a better way so far. Any Ideas?
Does beancount allow the tagging of individual accounts, or 
associating them with metadata similar to transactions, that can then 
be filtered for?


Thanks, merry Christmas and a happy new year!
-nugget
--
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/8d88fbf8-73c6-41e1-8bc9-2c6d5a6b44b4n%40googlegroups.com 
.


--
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/987d3e79-522f-4efb-9544-70ca9737eea3%40tario.org.


Re: Getting commodity tracking working for individual securities

2023-11-11 Thread 'Patrick Ruckstuhl' via Beancount

Hi Sagar,

you don't need to use the same symbol name in beancount as you use for 
lookup. You can define it in the commodity metadata



e.g. something like (I'm using alphavantage price source here, but yahoo 
should work the same way)


2010-01-01 commodity MYSUPERCOMMODITY
    price: "USD:alphavantage/price:TSLA:USD"


On 11.11.2023 11:38, Sagar Shankar wrote:
Well, looks like bean-price doesn't support Google Finance. That was a 
bit confusing since the documentation still refers to google finance 
and I had to go down the issues in the mailing list and the GitHub 
repo for bean-price to figure that part out.


The issue with Yahoo Finance is that for some Indian securities, it 
uses the format, 0PXVUH.BO, which bean count doesn't accept since 
it starts with a zero. Using the Yahoo Finance website and the 
ISIN, INF846K01EH3 works. But that doesn't work for bean-price and it 
returns an error with the ISIN.


So I'm a bit stumped on what to do. Appreciate any suggestions!

Thanks,
Sagar

On Saturday, November 11, 2023 at 5:23:00 PM UTC+8 Sagar Shankar wrote:

Hi Martin, sorry for the late reply. For some reason I never got
this digest in my email inbox.

OK, understood about the underscores and using dashes instead.
Problem is that the tickers for these funds in Google Finance use
underscores - which means updating the prices on a regular basis
won't work, if I understood the part of price fetching correctly

Thanks
Sagar

On Sunday, October 29, 2023 at 11:44:47 AM UTC+8 bl...@furius.ca
wrote:

The problem is not your currencies, it's the account names.
Account names do not support underscores. Use dashes instead.
(They probably should (mabe), but I'm not going to change the
syntax in stable/v2).

I'm not sure what the invalid currency error is, needs more detail

On Sat, Oct 28, 2023 at 11:34 PM Sagar Shankar
 wrote:

Hi,

I'm trying to import my mutual fund transactions into
Beancount. The mutual fund security names are in the
format, "ADIT_BSL_FRON_YK3Z7Z", which are the ticker names
from Google Finance.

Initially I had tried to create transactions like:
Assets:Broker:ADIT_BSL_FRON_YK3Z7Z  100
ADIT_BSL_FRON_YK3Z7Z {10 USD}
Assets:Broker:ADIT_BSL_NIFT_136TO8I
 100 ADIT_BSL_NIFT_136TO8I {9 USD}
and so and so forth.

This threw up a "Invalid Token" error. So I thought, maybe
Beancount has some restrictions on account names. So then
I moved to the following format:
Assets:Broker  100 ADIT_BSL_FRON_YK3Z7Z {10 USD}
Assets:Broker  100 ADIT_BSL_NIFT_136TO8I {9 USD}
and I'm now getting an "Invalid Currency" error.

I'm following the examples from this page -
https://beancount.github.io/docs/how_inventories_work.html,
as what I want to achieve is:
1. Track per security inventory
2. Track cost basis and networth, the latter by pulling
the latest market price from Google Finance.

Appreciate any advice on how to get this working

Thanks
Sagar

-- 
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+...@googlegroups.com.
To view this discussion on the web visit

https://groups.google.com/d/msgid/beancount/CAAP45exGz6rcYUAj5AgCgzQFn16DRKxprbse74R3bUJR2UuTTw%40mail.gmail.com

.

--
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/bf0a528b-a952-4aa4-9b75-f2d070fff3b9n%40googlegroups.com 
.


--
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/a6f1cd1b-737c-41dc-85a4-90e75596beb5%40tario.org.


Re: BQL: select only 1st level accounts

2022-01-13 Thread 'Patrick Ruckstuhl' via Beancount

Try something like

select root(account, 2), sum(position)


or if you need more things you can also do a group by root(account, 2)


On 13.01.2022 18:18, nug get wrote:

Dear all,
I'd like to make expenses statements on my 1st level accounts, e.g. 
accounts that look like "Expenses:Mainaccount" but none of their child 
accounts. This should sum up all the values of the individual child 
accounts.


The following query provides the total expenses of any leaf account, 
but not of the main accounts:


SELECT account, sum(position)
WHERE account ~ 'Expenses:[^:]*'
ORDER By account DESC

How do i need to modify this above query in order to get the balances 
of the main accounts?


Thanks!
nugget
--
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/cf33013e-dac9-430a-bea1-e5ec6d53d296n%40googlegroups.com 
.


--
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/81276fd0-eb0e-a224-397c-5ccc79f7f91b%40ch.tario.org.


Re: Balance in EUR when asset price is only available in USD

2022-01-03 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

there are no automated cross currencies calculated. I created a plugin 
that you can use which will take care of it. It will calculate "virtual" 
price entries based on commodity price and fx rates.



https://github.com/tarioch/beancounttools

https://tariochbctools.readthedocs.io/en/latest/plugins.html#generate-base-ccy-prices


Regards,

Patrick


On 03.01.2022 14:23, Timothée GROS wrote:

Hi!

I am not really sure if my question is related to beancount or Fava only.

I am european, and my main currency is EUR.
When display my balance sheet in Fava, i usually select "converted to 
EUR" in order to display the equivalent value in Euro rather than the 
number of assets (stocks funds, etc...) or the foreign currencies.
I have an issue, with some commodity for which i don't have price 
information in euros (typically some Cryptoassets, for which my price 
fetcher only provide price in USD).
Of course, i have also price directives in my beancount file to 
convert USD to EUR, so i would expect beancount to be able to compute 
the equivalent value from ASSET to USD and then from USD to EUR.


Apparently this is not the case and these assets are not converted in 
the balance sheet.

Is there a workaround ?
--
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/a3d3faa3-75df-40eb-938d-d6036c100e87n%40googlegroups.com 
.


--
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/68b4776f-a361-8596-349c-f4a0acf350a5%40ch.tario.org.


Re: Tracking property and shared expenses.

2021-11-28 Thread 'Patrick Ruckstuhl' via Beancount
Hi Jorge,

Yes having different income accounts makes sense if you are interested in 
knowing the details. Interest needs to go vs income/expenses as it's an 
outflow, you can't get it back when you sell the flat, so it shouldn't increase 
your loan.

Regards,
Patrick

On November 28, 2021 12:14:24 PM GMT+01:00, "Jorge Martínez López" 
 wrote:
>Hello Patrick,
>
>Thanks again!
>
>Is there any reason why the payment for the interest expenses cannot
>be done against the Liabilities (loan Jorge and Partner) instead of
>the Income accounts? That way the liability accounts would track the
>whole amount going into the flat (Asset + Mortgage Interest) while the
>Income accounts would track the 50%/50% contributions to the regular
>ongoing expenses.
>If the reason to use Income is to balance Assets and Liabilities, and
>Income and Expenses... would it be correct to have a separate account
>for Income to track each of our contributions towards paying the
>interest?
>
>Income:Jorge:Shared (<-- 50% ongoing expenses)
>Income:Jorge:Mortgage (<-- 70% of the interest expenses)
>Income:Partner:Shared (<-- 50% ongoing expenses)
>Income:Partner:Mortgage (<-- 30% if the interest expenses)
>
>(I'm hoping our lender breaks down how much goes into the interest and
>how much into the principal on a monthly basis, otherwise it's going
>to be interesting).
>
>Kind regards,
>Jorge
>
>On Sun, 28 Nov 2021 at 09:48, 'Patrick Ruckstuhl' via Beancount
> wrote:
>>
>> Hi Jorge,
>>
>>
>> If the monthly contributions are interest (so not reducing the principal
>> of the loan), they are expenses, so I would model it like this
>>
>> Income:Jorge -200
>> Income:Partner   -100
>> Expenses:Interest 300
>>
>>
>> If they are paying back some of the principal, I would model it like
>> this (basically you are shifting the loan from the bank to you and your
>> partner)
>>
>> Liabilities:LoanJorge-600
>> Liabilities:LoanPartner  -100
>> Liabilities:LoanBank  700
>>
>>
>> If it's a combination you will have both.
>>
>> Regards,
>> Patrick
>>
>> On 28.11.2021 10:15, Jorge Martínez López wrote:
>> > Hi Patrick,
>> >
>> > This is indeed quite useful and does exactly what I need, thanks a lot.
>> >
>> > For the sake of completeness, I assume that monthly contributions
>> > towards the mortgage would look like this on the shared ledger:
>> >
>> > Liabilities:LoanJorge-800
>> > Liabilities:LoanPartner -200
>> > Liabilities:LoanBank  700
>> > Expenses:Interest 300
>> >
>> > Kind regards,
>> > Jorge
>> >
>> > On Sat, 27 Nov 2021 at 19:21, 'Patrick Ruckstuhl' via Beancount
>> >  wrote:
>> >> Hi,
>> >>
>> >> It's always about splitting income/expense from asset flows
>> >>
>> >>
>> >> So to give a more complete example for buying a flat.
>> >>
>> >> My assumptions
>> >>
>> >> - deposit is 5000, you pay 3000, your partner 2000
>> >>
>> >> - you pay an additional 1 for the flat out of assets, you 8000,
>> >> partner 2000
>> >>
>> >> - you take on a common loan from a bank for 2
>> >>
>> >>
>> >> Jorge
>> >>
>> >> Assets:Receivable:LoanFlat
>> >>
>> >>   +3000 Deposit
>> >>
>> >>   +8000 Purchase
>> >>
>> >> Expenses:Common
>> >>
>> >>   + 1000
>> >>
>> >>
>> >> Partner
>> >>
>> >> Assets:Receivable:LoanFlat
>> >>
>> >>   +2000 Deposit
>> >>
>> >>   +2000 Purchase
>> >>
>> >> Expenses:Common
>> >>
>> >>   +1000
>> >>
>> >>
>> >> Common
>> >>
>> >> Assets:Flat
>> >>
>> >>   +3000 from Liabilities:LoanJorge (Deposit)
>> >>
>> >>   +2000 from Liabilities:LoanPartner (Deposit)
>> >>
>> >>   +8000 from Liabilities:LoanJorge (Purchase)
>> >>
>> >>   +2000 from Liabilities:LoanPartner (Purchase)
>> >>
>> >>   +2 from Liabilities:LoanBank
>> >>
>> >> Liabilities:LoanBank
>> >>
>> >>   -2
>> >>
>> >> Liabi

Re: Tracking property and shared expenses.

2021-11-28 Thread 'Patrick Ruckstuhl' via Beancount

Hi Jorge,


If the monthly contributions are interest (so not reducing the principal 
of the loan), they are expenses, so I would model it like this


Income:Jorge -200
Income:Partner   -100
Expenses:Interest 300


If they are paying back some of the principal, I would model it like 
this (basically you are shifting the loan from the bank to you and your 
partner)


Liabilities:LoanJorge-600
Liabilities:LoanPartner  -100
Liabilities:LoanBank  700


If it's a combination you will have both.

Regards,
Patrick

On 28.11.2021 10:15, Jorge Martínez López wrote:

Hi Patrick,

This is indeed quite useful and does exactly what I need, thanks a lot.

For the sake of completeness, I assume that monthly contributions
towards the mortgage would look like this on the shared ledger:

Liabilities:LoanJorge-800
Liabilities:LoanPartner -200
Liabilities:LoanBank  700
Expenses:Interest 300

Kind regards,
Jorge

On Sat, 27 Nov 2021 at 19:21, 'Patrick Ruckstuhl' via Beancount
 wrote:

Hi,

It's always about splitting income/expense from asset flows


So to give a more complete example for buying a flat.

My assumptions

- deposit is 5000, you pay 3000, your partner 2000

- you pay an additional 1 for the flat out of assets, you 8000,
partner 2000

- you take on a common loan from a bank for 2


Jorge

Assets:Receivable:LoanFlat

  +3000 Deposit

  +8000 Purchase

Expenses:Common

  + 1000


Partner

Assets:Receivable:LoanFlat

  +2000 Deposit

  +2000 Purchase

Expenses:Common

  +1000


Common

Assets:Flat

  +3000 from Liabilities:LoanJorge (Deposit)

  +2000 from Liabilities:LoanPartner (Deposit)

  +8000 from Liabilities:LoanJorge (Purchase)

  +2000 from Liabilities:LoanPartner (Purchase)

  +2 from Liabilities:LoanBank

Liabilities:LoanBank

  -2

Liabilities:LoanJorge

  -3000

  -8000

Liabilities:LoanPartner

  -2000

  -2000

Income:Jorge

  +1000

Income:Partner

  +1000

Expenses:Fees

  -2000




On 27.11.2021 10:20, Jorge Martínez López wrote:

Hello,

Thanks Patrick!

Your model makes sense. From the individual ledger point of view, do
you also include the interest paid in the transfer to
Assets:Receivable:LoanFlat? Or would you transfer it to
Expenses:Shared or Expenses:Interest?

In the common ledger I still have the issue that the one-off large
contribution to the deposit (from Income:Jorge and Income:Partner to
Assets:Home:Deposit) is significantly larger than our normal monthly
incomes and expenses, so the charts in the income statement are now a
bit unreadable. Is there any way around this? What about the monthly
contribution, would you create separate income accounts for regular
expenses (at 50%) and flat contributions?

Thanks again for your help!

Kind regards,
Jorge

On Fri, 26 Nov 2021 at 10:42, 'Patrick Ruckstuhl' via Beancount
 wrote:

Hi Jorge,


The way I would model this is, to model the flat itself as an asset and
the contributions to the flat as loans. Something like this


Jorge

Assets:Receivable:LoanFlat


Partner

Assets:Receivable:LoanFlat


Common

Assets:Flat

Liabilities:LoanJorge

Liabilities:LoanPartner


Because in the end this is not an expense, but a change of "assets". You
"converted" cash into a flat.

That should solve both your problems.

One time fees for the purchase would be modeled as expenses but the main
part of the money should be converted into the asset with the value of
the flat.



Regards,

Patrick


On 26.11.2021 11:32, Jorge Martínez López wrote:

Hi folks,

Just wanted to run this through the group to make sure I'm doing
things the right way.

I have been using Beancount for a couple of years. I started with a
single ledger but then moved to two: one to track my own income and
expenses, the other for shared expenses with my partner (bills and
groceries).

For the shared expenses every month I transfer some money from my
personal bank account to our joint account. In my personal ledger that
goes to "Expenses:Shared:Partner", and in the shared ledger that comes
from "Income:Jorge" (and Income:Partner for her transfers).

That has worked very well but now there is a slight complication as we
are going to buy a flat and while we will still pay the bills 50% /
50%, I'll be paying a slightly higher share of the flat.

The first hurdle is that now the "Income:Jorge" and "Income:Partner"
accounts in the shared ledger are not balanced 50% / 50%. I was
thinking about using separate "Income" accounts for contributions to
the flat or perhaps using tags to exclude tagged transactions in the
fava dashboards but I can't find the way to do it. Moreover, I guess
that I'd also need subaccounts on the "Expenses" and "Liabilities"
accounts (for interests and mortgage)?
The other thing that doesn't look entirely right is that as soon as we
transfer

Re: Tracking property and shared expenses.

2021-11-27 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

It's always about splitting income/expense from asset flows


So to give a more complete example for buying a flat.

My assumptions

- deposit is 5000, you pay 3000, your partner 2000

- you pay an additional 1 for the flat out of assets, you 8000, 
partner 2000


- you take on a common loan from a bank for 2


Jorge

Assets:Receivable:LoanFlat

    +3000 Deposit

    +8000 Purchase

Expenses:Common

    + 1000


Partner

Assets:Receivable:LoanFlat

    +2000 Deposit

    +2000 Purchase

Expenses:Common

    +1000


Common

Assets:Flat

    +3000 from Liabilities:LoanJorge (Deposit)

    +2000 from Liabilities:LoanPartner (Deposit)

    +8000 from Liabilities:LoanJorge (Purchase)

    +2000 from Liabilities:LoanPartner (Purchase)

    +2 from Liabilities:LoanBank

Liabilities:LoanBank

    -2

Liabilities:LoanJorge

    -3000

    -8000

Liabilities:LoanPartner

    -2000

    -2000

Income:Jorge

    +1000

Income:Partner

    +1000

Expenses:Fees

    -2000




On 27.11.2021 10:20, Jorge Martínez López wrote:

Hello,

Thanks Patrick!

Your model makes sense. From the individual ledger point of view, do
you also include the interest paid in the transfer to
Assets:Receivable:LoanFlat? Or would you transfer it to
Expenses:Shared or Expenses:Interest?

In the common ledger I still have the issue that the one-off large
contribution to the deposit (from Income:Jorge and Income:Partner to
Assets:Home:Deposit) is significantly larger than our normal monthly
incomes and expenses, so the charts in the income statement are now a
bit unreadable. Is there any way around this? What about the monthly
contribution, would you create separate income accounts for regular
expenses (at 50%) and flat contributions?

Thanks again for your help!

Kind regards,
Jorge

On Fri, 26 Nov 2021 at 10:42, 'Patrick Ruckstuhl' via Beancount
 wrote:

Hi Jorge,


The way I would model this is, to model the flat itself as an asset and
the contributions to the flat as loans. Something like this


Jorge

Assets:Receivable:LoanFlat


Partner

Assets:Receivable:LoanFlat


Common

Assets:Flat

Liabilities:LoanJorge

Liabilities:LoanPartner


Because in the end this is not an expense, but a change of "assets". You
"converted" cash into a flat.

That should solve both your problems.

One time fees for the purchase would be modeled as expenses but the main
part of the money should be converted into the asset with the value of
the flat.



Regards,

Patrick


On 26.11.2021 11:32, Jorge Martínez López wrote:

Hi folks,

Just wanted to run this through the group to make sure I'm doing
things the right way.

I have been using Beancount for a couple of years. I started with a
single ledger but then moved to two: one to track my own income and
expenses, the other for shared expenses with my partner (bills and
groceries).

For the shared expenses every month I transfer some money from my
personal bank account to our joint account. In my personal ledger that
goes to "Expenses:Shared:Partner", and in the shared ledger that comes
from "Income:Jorge" (and Income:Partner for her transfers).

That has worked very well but now there is a slight complication as we
are going to buy a flat and while we will still pay the bills 50% /
50%, I'll be paying a slightly higher share of the flat.

The first hurdle is that now the "Income:Jorge" and "Income:Partner"
accounts in the shared ledger are not balanced 50% / 50%. I was
thinking about using separate "Income" accounts for contributions to
the flat or perhaps using tags to exclude tagged transactions in the
fava dashboards but I can't find the way to do it. Moreover, I guess
that I'd also need subaccounts on the "Expenses" and "Liabilities"
accounts (for interests and mortgage)?
The other thing that doesn't look entirely right is that as soon as we
transfer the money for the deposit into the joint account the scaling
of the Fava charts went much higher so our normal income and expenses
are now almost invisible. Which makes me think... Perhaps I'm doing
this wrong and should track the flat on a separate third ledger?

I'm hoping this is a rather common scenario and most folks have
cracked this. I'd appreciate your thoughts on this.

Kind regards,
Jorge


--
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/13cfdb77-8fbc-d0e7-671c-867cbe158971%40ch.tario.org.


--
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/f3a65da9-5af7-f934-1a77-65569213d8bf%40ch.tario.org.


Re: Tracking property and shared expenses.

2021-11-26 Thread 'Patrick Ruckstuhl' via Beancount

Hi Jorge,


The way I would model this is, to model the flat itself as an asset and 
the contributions to the flat as loans. Something like this



Jorge

Assets:Receivable:LoanFlat


Partner

Assets:Receivable:LoanFlat


Common

Assets:Flat

Liabilities:LoanJorge

Liabilities:LoanPartner


Because in the end this is not an expense, but a change of "assets". You 
"converted" cash into a flat.


That should solve both your problems.

One time fees for the purchase would be modeled as expenses but the main 
part of the money should be converted into the asset with the value of 
the flat.




Regards,

Patrick


On 26.11.2021 11:32, Jorge Martínez López wrote:

Hi folks,

Just wanted to run this through the group to make sure I'm doing
things the right way.

I have been using Beancount for a couple of years. I started with a
single ledger but then moved to two: one to track my own income and
expenses, the other for shared expenses with my partner (bills and
groceries).

For the shared expenses every month I transfer some money from my
personal bank account to our joint account. In my personal ledger that
goes to "Expenses:Shared:Partner", and in the shared ledger that comes
from "Income:Jorge" (and Income:Partner for her transfers).

That has worked very well but now there is a slight complication as we
are going to buy a flat and while we will still pay the bills 50% /
50%, I'll be paying a slightly higher share of the flat.

The first hurdle is that now the "Income:Jorge" and "Income:Partner"
accounts in the shared ledger are not balanced 50% / 50%. I was
thinking about using separate "Income" accounts for contributions to
the flat or perhaps using tags to exclude tagged transactions in the
fava dashboards but I can't find the way to do it. Moreover, I guess
that I'd also need subaccounts on the "Expenses" and "Liabilities"
accounts (for interests and mortgage)?



The other thing that doesn't look entirely right is that as soon as we
transfer the money for the deposit into the joint account the scaling
of the Fava charts went much higher so our normal income and expenses
are now almost invisible. Which makes me think... Perhaps I'm doing
this wrong and should track the flat on a separate third ledger?

I'm hoping this is a rather common scenario and most folks have
cracked this. I'd appreciate your thoughts on this.

Kind regards,
Jorge



--
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/13cfdb77-8fbc-d0e7-671c-867cbe158971%40ch.tario.org.


Re: scripting: Is there a function to get value of an account on a given date?

2021-11-25 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

I would recommend to use BQL, that should allow you to easily do it.


https://beancount.github.io/docs/beancount_query_language.html


You can use bql also from your scripts


Regards,

Patrick

On 26.11.2021 08:15, vijayvithal jahagirdar wrote:
I am writing a bunch of python scripts to generate various compliance 
reports required by the India Govt.

As a part of this I am interested in getting
1. The value of all postings in an account on a give date,
2. The value of all postings in an account in a given date range,

Currently I am
1. Iterating through all entries ->Transactions ->posting
2. checking whether it matches account name and date range
3. Adding up the value.

Since It looks like a fairly common task for accounting, I am 
wondering whether I am reinventing the wheel? Does a similar function 
exist within beancount?

--
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/71818f11-e867-424e-9695-2c4d55e94d67n%40googlegroups.com 
.


--
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/d20afcbb-4a86-facf-c671-1796ad03ed5b%40ch.tario.org.


Re: Surprise loans, how to retroactively book them?

2021-10-14 Thread 'Patrick Ruckstuhl' via Beancount

Hi Casey,

I would book it like this

2019-11-30 * "Insurance provider" ""
  Assets:BankAccount -500.00 EUR
  Expenses:Insurance 500.00 EUR

2021-10-14 * "Alice Insurance Loan" "surprise loan from 2019-11-30"
  Assets:Receivable:Alice   100.00 EUR
  Expenses:Insurance   -100.00 EUR

2020-11-01 * "Alice" "she pays back her share"
  Assets:Receivable:Alice -100.00 EUR
  Assets:BankAccount   100.00 EUR


basically you reduce the expense and instead it becomes receivable assets.

Because from an Income/Expense calculation the 100 EUR should be 
transparent for you, only from an asset point of view they happen (until 
she pays it back)



Regards,

Patrick


On 14.10.2021 11:40, Casey Link wrote:

Hi there,
This is more of an accounting  question than a beancount technical 
question, but I've seen similar questions before, so I hope it's ok.


I use beancount to run the bookkeeping for a small local club.

We have insurance costs every year.

It turns out that a portion of these insurance expenses included 
"extra" coverage for certain members. These members are supposed to 
payback their share.


I need to amend the books to represent the fact that the club is owned 
money.


I know how we *should* have done it, something like this:

2019-11-30 * "Insurance provider" "payment for insurance"
  Assets:BankAccount -500.00 EUR
  Expenses:Insurance  400.00 EUR
  Assets:Receivable:Alice 100.00 EUR

2020-01-01 * "Alice" "she pays back her share"
  Assets:Receivable:Alice -100.00 EUR
  Assets:BankAccount   100.00 EUR



The problem is we only booked the expense as a simple expense.

Is there a way to enter these loans into the ledger such that I don't 
edit the past expense transactions?


I've been trying something like this

2019-11-30 * "Insurance provider" ""
  Assets:BankAccount -500.00 EUR
  Expenses:Insurance 500.00 EUR

2021-10-14 * "Alice Insurance Loan" "surprise loan from 2019-11-30"
  Assets:Receivable:Alice   100.00 EUR
  Assets:Loans -100.00 EUR

2020-11-01 * "Alice" "she pays back her share"
  Assets:Receivable:Alice -100.00 EUR
  Assets:Loans 100.00 EUR
  Assets:Loans    -100.00 EUR
  Assets:BankAccount   100.00 EUR

This balances, but I still have this Assets:Loans account hanging 
around with -100 EUR  :(


Would love some creative tips on how to manage this.

Thanks!

Casey

--
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/685c42fc-eacf-4aac-88b1-976040f5a132n%40googlegroups.com 
.


--
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/e89e723e-1b2a-399c-a476-a96f00662510%40ch.tario.org.


Re: Does anybody use (number, currency) amounts in metadata?

2021-09-23 Thread 'Patrick Ruckstuhl' via Beancount
Similar here, in my case I use already a string for it, this is only 
informational so a string is good enough.

On September 23, 2021 11:03:07 PM GMT+02:00, Ben Blount  wrote:
>I don't, and it seems like it would be fine to have a single valued
>metadata. I assume the grammar will require the key to be a string, but the
>values can be dates, bool, ints, floats etc?
>
>If there are folks that rely on this, there's a workaround of breaking it
>into 2 metadata where knowing the currency is important:
>  2021-01-02 * "Some transaction"
>real_value_number: 123.45
>real_value_currency: "USD"
>
>On Thu, Sep 23, 2021 at 1:55 PM Martin Blais  wrote:
>
>> e.g.
>>
>>   2021-01-02 * "Some transaction"
>> real_value: 123.45 USD
>> ...
>>
>> Does anyone use an Amount type as a metadata value?
>> (If I can remove it in the new version it'll simplify grammar.)
>>
>> --
>> 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%2BhOGZwDZAFvmaEQXiV4hmagdwAs6ya1gwQOJCW%3DgKw%2Bzag%40mail.gmail.com
>> 
>> .
>>
>
>-- 
>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/CACGEkZtwSyahmFbhzU4dSuaS_tauCZkZB4UVahhkeX4AisnrBA%40mail.gmail.com.

-- 
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/79F2B3AB-C8E4-4313-AA16-EFDD3EBD0B8F%40ch.tario.org.


Re: Price Conversion of Commodities

2021-08-27 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

There's no out of the box conversion of prices in different currencies.

I created a plugin that will automatically generate commodity prices 
based on fx


https://github.com/tarioch/beancounttools

e.g.

plugin "tariochbctools.plugins.generate_base_ccy_prices" "CHF"

If your commodity is priced in EUR and you have an exchange rate EUR -> 
CHF, then this will also add commodity prices in CHF.


There's also some possibilities to do conversions when doing the query.


Regards,

Patrick


On 27.08.2021 18:53, Toby wrote:

Hi,
Is this possible on Beancount? I am trying to convert commodities prices.

2021-01-01 * "Purchase 3 Apple"
   Assets:Inventory:Apple 3 Apple @@ 15 USD   ;5 USD per Apple.
   Assets:Cash

I want to know the price of the apples in EUR.

2021-02-01 price EUR 1.50 USD  ; hypothetical example.

It doesn't convert. Is this possible to do on Beancount?
I  also tried it with the plugin "beancount.plugins.implicit_prices" 
and it doesn't seem to convert the values to EUR.


Thanks


--
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/718c8283-1c34-4bcf-9eff-5b0f7083b38an%40googlegroups.com 
.


--
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/add11179-13f4-5f71-ef7b-d5dcff79becd%40ch.tario.org.


Re: Equivelent of not command in Beancount / Fava

2021-08-25 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


to change the price you can do

2021-08-25 price Apple 1.75 USD


See https://beancount.github.io/docs/beancount_language_syntax.html#prices


There are also a lot price fetchers, see 
https://github.com/beancount/beanprice (or other custom fetchers)



The last thing to be aware, that beancount has both prices and costs. 
Prices can change, but cost stays the same once you purchased a 
commodity, this will allow you to calculate capital gains.


See 
https://beancount.github.io/docs/beancount_language_syntax.html#costs-and-prices



Regards,

Patrick


On 25.08.2021 19:50, Toby wrote:

Hi
 Is there an equivalent command of 'not' in Beancount. hledger has 
not: function to filter accounts.
Ledger also has something similar. Does Fava (or Beancount) have 
something similar?


Also I am trying to use the commodity function but I am struggling to 
find a way to increase a price of a commodity. Is Beancount suitable 
for this ?


Following is an example:-

2021-01-01 * "Purchase Apple 10 Apples for 1.50 USD "
   Assets:Inventory:Apple   10 Apple @ 1.50 USD    ;
   Assets:Cash

2021-01-01 * "Cash Transaction for the Apple"
  Expenses:Cash  15.00
  Assets:Cash


Suppose I wanted to increase the price of the Apple. How would I go 
about doing so?
For example if I paid 5.00 USD for Fuel and wanted to factor that in 
to the inventory price.


Is it possible to do this on Beancount?

Thanks

--
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/29436d55-a2c1-4372-a64c-60ea75a7ea76n%40googlegroups.com 
.


--
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/21e671ed-13c3-c149-8d83-3ea6f977218a%40ch.tario.org.


Re: How do I book taxes that have to be paid due to capital income?

2021-06-19 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

Liabilities are on the same side as assets. Let me give you a couple of 
examples



Paying with a debit card

    Assets:MyBank           -5 CHF

    Expenses:Coffe 5 CHF



Paying with a credit card:

2021-01-01 "" "Bought a cup of Coffee"

    Liabilities:Creditcard  -5 CHF

    Expenses:Coffee     5 CHF



This is double book accounting, you have the Income/Expense side and you 
have the Asset/Liabilities side and that should always end up as zero.


Normally you want to book the expenses when they happen (e.g. when you 
buy the Coffee, not when you pay the credit card bill). At least that's 
what I do with most of it.


There are some cases where you might want to defer/spread expenses. Here 
I've used two different ways.



Amortizations (e.g. buying a car)

What I do here, is add the car as an asset of a certain value and each 
year I reduce the value of the car and book it as an expense (this is in 
line with my taxes, where the value of the car decreases each year)



Reserves

This is for things where I want to spread cost across multiple years 
(e.g. house renovations)


I have an Equity account called Equity:HouseReserves

Each month I book expenses against this Equity account (without actually 
moving any money around)


If I have an expense that counts against this, I book the actual 
movement against this Equity account instead of an expense




Regards,

Patrick



On 19.06.2021 16:36, Peter wrote:

Hi,

aren't expenses payable "immediately" and liabilities owed for a later 
time? That's why I booked it into a liabilities account, because the 
taxes are due at the end of the year.


pat...@ch.tario.org schrieb am Samstag, 19. Juni 2021 um 13:26:04 UTC+2:

Hi,

I think you're missing the expenses account for taxes. What you
move to liabilities should be balanced by a tax expenses account.

Regards,
Patrick


On June 19, 2021 12:57:20 PM GMT+02:00, Peter
 wrote:

Hi,

How do I book taxes that have to be paid due to capital
income, but will only be due in the future?

Let's take this posting as an example:

```
2021-06-18 * "" "Harvesting farmed crypto"
 

Assets:Crypto:Wallet:Polygon:Ledger-X:Staking:VERT0.675055007246049347VERT
{42.138USD} @ 42.138USD
Income:Crypto:Farming:Polygon:VERT
```

This makes me 28.45 USD in capital gains. I'd probably have to
pay a whopping 42% in taxes. That equals to 11.95 USD. I'd
like to keep track of the amount of taxes which will be due at
the end of the year—to avoid a bad surprise. How do I do that?
I tried:

```
2021-06-18 * "" "Harvesting farmed crypto"
Assets:Crypto:Wallet:Polygon:Ledger-X:Staking:VERT 0.675055007246049347 
VERT
{42.138 USD} @ 42.138 USD
Liablities:Taxes:Crypto -11.95 USD
Income:Crypto:Farming:Polygon:VERT
```

But bean-doctor tells me that just 16.50 USD get booked into
the income account. This seems wrong to me from a bookkeeping
point of view, because the income is still 28.45. How do I
book that correctly?

--
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/7c641723-0a4b-462c-a1fe-238c4ca1cc90n%40googlegroups.com 
.


--
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/88518d18-cab2-769c-e70d-9920bd572420%40ch.tario.org.


Re: How do I book taxes that have to be paid due to capital income?

2021-06-19 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

I think you're missing the expenses account for taxes. What you move to 
liabilities should be balanced by a tax expenses account.

Regards,
Patrick

On June 19, 2021 12:57:20 PM GMT+02:00, Peter  wrote:
>Hi,
>
>How do I book taxes that have to be paid due to capital income, but will 
>only be due in the future?
>
>Let's take this posting as an example:
>
>```
>2021-06-18 * "" "Harvesting farmed crypto"
>Assets:Crypto:Wallet:Polygon:Ledger-X:Staking:VERT 0.675055007246049347 
>VERT {42.138 USD} @ 42.138 USD
>Income:Crypto:Farming:Polygon:VERT
>```
>
>This makes me 28.45 USD in capital gains. I'd probably have to pay a 
>whopping 42% in taxes. That equals to 11.95 USD. I'd like to keep track of 
>the amount of taxes which will be due at the end of the year—to avoid a bad 
>surprise. How do I do that?
>I tried:
>
>```
>2021-06-18 * "" "Harvesting farmed crypto"
>
>Assets:Crypto:Wallet:Polygon:Ledger-X:Staking:VERT 0.675055007246049347 VERT 
>{42.138 USD} @ 42.138 USD
>Liablities:Taxes:Crypto -11.95 USD
>Income:Crypto:Farming:Polygon:VERT
>```
>
>But bean-doctor tells me that just 16.50 USD get booked into the income 
>account. This seems wrong to me from a bookkeeping point of view, because 
>the income is still 28.45. How do I book that correctly?
>
>-- 
>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/97393894-e2cd-4efd-836c-124ccbcbe27en%40googlegroups.com.

-- 
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/A2B36A84-237D-46D3-80E0-F97CDF4B68E0%40ch.tario.org.


Re: Query to give converted aggregate balance on date?

2021-05-29 Thread 'Patrick Ruckstuhl' via Beancount
This is part of my query


select
number(only("CHF", convert(sum(value(position, #"2020-12-31")), 
"CHF", #"2020-12-31"))) as value,
number(only("CHF", convert(sum(cost(position)), "CHF", 
#"2020-12-31"))) as cost,
account
where
account ~ "(Assets|Liabilities):"
and year <= 2020
  
That gives both cost as well as value on a specific date

On May 29, 2021 10:33:34 PM GMT+02:00, Ben Blount  wrote:
>Have you tried FROM CLOSE ON 
>
>See https://beancount.github.io/docs/beancount_query_language.html for more
>on how this works.
>
>On Sat, May 29, 2021, 13:12 Mark Lodato  wrote:
>
>> Oops, I sent out that email in haste. I didn't mean it for it to sound so
>> demanding.
>>
>> If anyone wouldn't mind helping construct such a query, I'd appreciate it!
>>
>> On Sat, May 29, 2021, 4:02 PM Mark Lodato  wrote:
>>
>>> I can't figure out how to write a query that prints the aggregate balance
>>> of an account subtree as of a given date, converted to USD using the price
>>> as of that date. Example data:
>>>
>>> $ cat >test.bean <>> plugin "beancount.plugins.auto_accounts"
>>> 2020-01-01 * "Open"
>>>   Assets:Bank:AAA 100 AAA
>>>   Assets:Bank:BBB 100 BBB
>>>   Income:Work
>>> 2021-01-01 price AAA 1 USD
>>> 2021-01-01 price BBB 10 USD
>>> 2021-01-02 price AAA 2 USD
>>> 2021-01-02 price BBB 20 USD
>>> 2021-01-03 price AAA 3 USD
>>> 2021-01-03 price BBB 30 USD
>>> EOF
>>> $ bean-query test.bean 'SELECT convert(units(sum(position)), "USD") AS
>>> value WHERE account ~ "Assets:Bank"'
>>>  value
>>> 
>>> 3300 USD
>>>
>>> I'd like to be able to specify a date and get the balance at the end of
>>> that date, e.g. 2021-01-02 => 2200 USD. I tried using "FROM DATE =
>>> 2021-01-02" or "FROM DATE <= 2021-01-02" but it doesn't affect the result.
>>>
>>> Thank you in advance,
>>> Mark
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Beancount" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/beancount/yCPa_tlF2-4/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> beancount+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/a1cfbd22-e495-40e8-b6ea-055fd9227d47n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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/CAHREChjkG%3Dy7pBKOuYMC4m6OzHfsx-4uTDdWx3DXLksFExdW2g%40mail.gmail.com
>> 
>> .
>>
>
>-- 
>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/CACGEkZsXDHc6g5H9ap4%2B8P5UocSA6PZBGPzr3vro9enoECK7tQ%40mail.gmail.com.

-- 
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/943AD439-FF54-4206-AE77-11BA51B086A9%40ch.tario.org.


Re: smart importer newbie question

2021-05-21 Thread 'Patrick Ruckstuhl' via Beancount
Created https://github.com/beancount/smart_importer/pull/109 to improve 
this a little bit


On 21.05.2021 15:26, kuba jamro wrote:

That's great news.

In my opinion I think the error message could be more helpful. If you
have time, it would be useful to raise an issue on GitHub requesting
an improved message for this case.

Jakub.

On Fri, 21 May 2021 at 06:07, Jonathan Goldman  wrote:

Hi Patrick and everyone,

I resolved the issue. It’s working well. The pointers to where to add print 
statements was very helpful. The problem was the account name for the existing 
transactions was not correct and I fixed it and now it is able to train and 
predict.

Thanks again.
Jonathan

On May 21, 2021, at 6:24 AM, 'Patrick Ruckstuhl' via Beancount 
 wrote:

Probably the easiest examples are for the data driven tests you can find here

https://github.com/beancount/smart_importer/tree/master/tests/data


The simples of them probably

https://github.com/beancount/smart_importer/blob/master/tests/data/multiaccounts.beancount



On 20.05.2021 19:03, Hawrylyshen, Alan wrote:

MIght it be simpler to (sorry for suggesting the obvious) try a toy example 
data set to get things up and working?
I didn't take too much effort to get the smart_importer wrapping my 
importers... so I imagine this is something relatively simple.
Ideally there'd be a test case in the smart_importer repository already?

Thanks
Alan

On Thu, 20 May 2021 at 13:34, 'Patrick Ruckstuhl' via Beancount 
 wrote:

So if I see this correctly, after the filtering of the training data, there is 
never any data left.

The logic looks like this

 def training_data_filter(self, txn):
 """Filter function for the training data."""
 found_import_account = False
 for pos in txn.postings:
 if pos.account not in self.open_accounts:
 return False
 if self.account == pos.account:
 found_import_account = True
 return found_import_account or not self.account


And from the printout you have something in self.account. So if I see this 
correctly, either none of your training data is matching the account or the 
account is actually no longer open.

Maybe worth printing out the self.open_accounts and maybe even 
debugging/logging some stuff in that training_data_filter code


Regards,

Patrick


On 20.05.2021 02:02, Jonathan Goldman wrote:

Hi Patrick,

Thanks for the suggestions. I started doing this. Here is what I'm seeing:

--CHECKPOINT1---
1353
1133
0
--CHECKPOINT2---
[]
---__call__
Assets:US:Banks:Checking:myBank
--CHECKPOINT1---
1353
1133
0
--CHECKPOINT2---
[]
---__call__
Assets:US:Banks:Checking:myBank

Here is the code I added to predictory.py:
#beg
 print('---__call__')
 print(self.account)
 #print(existing_entries)
#end
 with self.lock:
 self.define_pipeline()
 self.train_pipeline()
 return self.process_entries(imported_entries)

 def load_open_accounts(self, existing_entries):
 """Return map of accounts which have been opened but not closed."""
 account_map = {}
 if not existing_entries:
 return

 for entry in beancount_sorted(existing_entries):
 # pylint: disable=isinstance-second-argument-not-valid-type
 if isinstance(entry, Open):
 account_map[entry.account] = entry
 elif isinstance(entry, Close):
 account_map.pop(entry.account)

 self.open_accounts = account_map

 def load_training_data(self, existing_entries):
 """Load training data, i.e., a list of Beancount entries."""
training_data = existing_entries or []
 self.load_open_accounts(existing_entries)
#beg1
 print('--CHECKPOINT1---')
 print(len(training_data))
#end1
 training_data = list(filter_txns(training_data))
 print(len(training_data))
length_all = len(training_data)
 training_data = [
 txn for txn in training_data if self.training_data_filter(txn)
]
 print(len(training_data))
#beg2
 print('--CHECKPOINT2---')
 print(training_data)
#beg2


I'm trying to check now that every account in the config file is present in my 
beancount file. I noticed one missing and that changed what was in the 
training_data but still getting the warning about training data being empty. 
I'll keep digging as best I can but definitely can use any additional help.

On Wed, May 19, 2021 at 3:16 AM 'Patrick Ruckstuhl' via Beancount 
 wrote:

Hi Jonathan,


Let's try to figure this out. In smart importer can you printout the following 
stuff


in smart_importer/predictor.py


in __call__ around line 64

print(self.account)

print(existing_entries)


in load_training_data around line 91

print

Re: smart importer newbie question

2021-05-20 Thread 'Patrick Ruckstuhl' via Beancount
So if I see this correctly, after the filtering of the training data, 
there is never any data left.


The logic looks like this

    def training_data_filter(self, txn):
    """Filter function for the training data."""
    found_import_account = False
    for pos in txn.postings:
    if pos.account not in self.open_accounts:
    return False
    if self.account == pos.account:
    found_import_account = True
    return found_import_account or not self.account


And from the printout you have something in self.account. So if I see 
this correctly, either none of your training data is matching the 
account or the account is actually no longer open.


Maybe worth printing out the self.open_accounts and maybe even 
debugging/logging some stuff in that training_data_filter code



Regards,

Patrick


On 20.05.2021 02:02, Jonathan Goldman wrote:


Hi Patrick,

Thanks for the suggestions. I started doing this. Here is what I'm seeing:

--CHECKPOINT1---

1353

1133

0

--CHECKPOINT2---

[]

---__call__

Assets:US:Banks:Checking:myBank

--CHECKPOINT1---

1353

1133

0

--CHECKPOINT2---

[]

---__call__

Assets:US:Banks:Checking:myBank


Here is the code I added to predictory.py:

#beg

print('---__call__')

print(self.account)

#print(existing_entries)

#end

withself.lock:

self.define_pipeline()

self.train_pipeline()

returnself.process_entries(imported_entries)


defload_open_accounts(self, existing_entries):

"""Return map of accounts which have been opened but not closed."""

account_map= {}

ifnotexisting_entries:

return


forentry inbeancount_sorted(existing_entries):

# pylint: disable=isinstance-second-argument-not-valid-type

ifisinstance(entry, Open):

account_map[entry.account] = entry

elifisinstance(entry, Close):

            account_map.pop(entry.account)


self.open_accounts = account_map


defload_training_data(self, existing_entries):

"""Load training data, i.e., a list of Beancount entries."""

training_data= existing_entries or[]

self.load_open_accounts(existing_entries)

#beg1

print('--CHECKPOINT1---')

print(len(training_data))

#end1

training_data= list(filter_txns(training_data))

print(len(training_data))

length_all= len(training_data)

training_data= [

        txn fortxn intraining_data ifself.training_data_filter(txn)

]

print(len(training_data))

#beg2

print('--CHECKPOINT2---')

print(training_data)

#beg2




I'm trying to check now that every account in the config file is 
present in my beancount file. I noticed one missing and that changed 
what was in the training_data but still getting the warning about 
training data being empty. I'll keep digging as best I can but 
definitely can use any additional help.



On Wed, May 19, 2021 at 3:16 AM 'Patrick Ruckstuhl' via Beancount 
mailto:beancount@googlegroups.com>> wrote:


Hi Jonathan,


Let's try to figure this out. In smart importer can you printout
the following stuff


in smart_importer/predictor.py


in __call__ around line 64

print(self.account)

print(existing_entries)


in load_training_data around line 91

print(training_data)

and around line 95

print(training_data)


That should give an idea where the information is "lost".
Depending on where the information is lost, you can then dig a bit
deeper into what is happening.


Regards,

Patrick





On 18.05.2021 13:14, Jonathan Goldman wrote:

Thanks Red.

bean-query works fine on my input file which now has >1000
transactions .

Ready with 1344 directives (2266 postings in 1133 transactions).

beancount>

I still get the error. I'm not sure what is causing and not sure
how to debug it. The only other issue I recall seeing was some
error with fund_info or something in getting prices but I thought
it was an unrelated issue.

Do you or does anyone have some suggestions on where/how to
debug. E.g. I should print some variables to STDOUT at such and
such point inside smart_importer code or inside bean-extract.

thanks,
Jonathan



On Mon, May 17, 2021 at 9:34 PM redst...@gmail.com
<mailto:redst...@gmail.com> mailto:redstre...@gmail.com>> wrote:

A minimum of two transactions should suffice for
smart_importer. More will increase prediction quality, but
two should suffice. I can't tell what's happening at your
end, but you're likely ending up with zero transactions for
some reason. Run bean-query on the file you pass to "-f" of
bean-extract.

beancount-reds-importers supports smart_importer out of the
box for banking, that shouldn't be an issue AFAICT.



On Wednesday, May 12, 2021 at 10:23:14 PM UTC-7
jrgo..

Re: smart importer newbie question

2021-05-18 Thread 'Patrick Ruckstuhl' via Beancount

Hi Jonathan,


Let's try to figure this out. In smart importer can you printout the 
following stuff



in smart_importer/predictor.py


in __call__ around line 64

print(self.account)

print(existing_entries)


in load_training_data around line 91

print(training_data)

and around line 95

print(training_data)


That should give an idea where the information is "lost". Depending on 
where the information is lost, you can then dig a bit deeper into what 
is happening.



Regards,

Patrick





On 18.05.2021 13:14, Jonathan Goldman wrote:

Thanks Red.

bean-query works fine on my input file which now has >1000 transactions .

Ready with 1344 directives (2266 postings in 1133 transactions).

beancount>

I still get the error. I'm not sure what is causing and not sure how 
to debug it. The only other issue I recall seeing was some error with 
fund_info or something in getting prices but I thought it was an 
unrelated issue.


Do you or does anyone have some suggestions on where/how to debug. 
E.g. I should print some variables to STDOUT at such and such point 
inside smart_importer code or inside bean-extract.


thanks,
Jonathan



On Mon, May 17, 2021 at 9:34 PM redst...@gmail.com 
 > wrote:


A minimum of two transactions should suffice for smart_importer.
More will increase prediction quality, but two should suffice. I
can't tell what's happening at your end, but you're likely ending
up with zero transactions for some reason. Run bean-query on the
file you pass to "-f" of bean-extract.

beancount-reds-importers supports smart_importer out of the box
for banking, that shouldn't be an issue AFAICT.



On Wednesday, May 12, 2021 at 10:23:14 PM UTC-7 jrgo...@gmail.com
 wrote:

Thanks for suggestions @Patrick and Alan. My beancount file
has about 64 Asset accounts. It has about 41 expense accounts.
I have only 2 months of labelled banking transactions (about
42 transactions) all associated with one bank account and
various expense accounts.

I had thought that some transactions were relatively
deterministic (same $ amount and same description like
rent/mortgage) and I was under the impression that only a few
months of data are needed to get going.

Perhaps I'll just go back to manually labelling data for now
and trying again later or after I see more posts/explanation
of smart_importer. I'm not well-versed enough with
smart_importer to debug what is happening.

On Thu, May 13, 2021 at 3:04 AM Alan H  wrote:

I get this error when there are insufficient entries in
the journal to teach the smart_importer how to file new
transactions. Specifically there are no matches for payees
or narrations.

Is that the case? Try adding a dummy transaction that
matches the narration in the import file.

Alan


On Wednesday, May 12, 2021 at 12:24:55 PM UTC+1
pat...@ch.tario.org wrote:

Hm, actually that looks ok, it has the
existing_entries on the interface. But to be honest
I'm not super familiar with how the apply hook is
hooking this in, so there might be an issue.

Maybe someone more familiar with this can respond on that.


Otherwise if you could install smart_importer from git
and then maybe add a bit more debug output in

hooks.py and predictor.py to make sure that the
existing entries arrive, this would give a better idea
how to progress.


On 12.05.2021 13:17, jrgo...@gmail.com wrote:

Thank you. I think that is it.

I'm using reds-importers and I see
site-packages/beancount_reds_importers/libimport/banking.py
and it has this entry:

def extract(self, file, existing_entries=None):

I think this importer tool needs to be updated to
support the smart_importer.

On Wednesday, May 12, 2021 at 11:11:37 PM UTC+12
pat...@ch.tario.org wrote:

I just remembered something. The issue could be
that the importer you're trying to use does not
have the new interface and instead still uses the
old (legacy) interface.

the new one looks like this


def extract(self, file, existing_entries):

the old one looks like this

def extract(self, file):


Smart importer uses the existing_entries for
training its model.


Regards,

Patrick





Importer Adapter to import from mail (imap) account

2021-05-16 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


I created an importer adapter that allows to import statement files from 
an imap account instead of having the file locally.



My setup consists of running fava on a remote machine. I'm having 
several accounts where I get the statements per mail or can easily send 
myself a mail with the statements (e.g. from a mobile app).


Until now my process looked like this.

1) Statement is in mail account

2) Open mail on my computer and store it to local folder

3) Upload file to remote machine

4) Run importer through fava


Now my process looks like this


1) Statements i in mail account

2) Run (mail) importer through fava => will scan mails for attachments 
which are matching an importer and import it using that importer)



Thought this might be useful for someone else. You can find it as part 
of my https://github.com/tarioch/beancounttools



Regards,

Patrick

--
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/6a91bffa-db7c-35ec-ac10-9b918e056905%40tario.org.


Re: Importer: output total cost for a currency exchange

2021-05-14 Thread 'Patrick Ruckstuhl' via Beancount
As far as I know, this is currently not possible. The @@ notation is 
actually converted on an early stage of the parsing. The data model 
available for the importers doesn't support it



Regards,

Patrick

On 14.05.2021 22:41, Szabó Tibor wrote:


Hi all,

sorry if trivial: how do I achieve this output in an importer:

2021-04-16 * "TEST" "Test conversion"
  Assets:EUR  100.00 EUR
  Assets:USD -120.00 USD @@ 100.00 EUR

I have tried Cost and CostSpec, without success. Specifying per-unit 
cost (@) works.


Thanks a lot,
Tibor Szabó
--
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/8bc29851-3858-44cd-ac3e-2d7f40baa867n%40googlegroups.com 
.


--
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/515a54a2-87b4-7f04-5fe8-7b172d2c9ec8%40ch.tario.org.


Re: smart importer newbie question

2021-05-12 Thread 'Patrick Ruckstuhl' via Beancount
Hm, actually that looks ok, it has the existing_entries on the 
interface. But to be honest I'm not super familiar with how the apply 
hook is hooking this in, so there might be an issue.


Maybe someone more familiar with this can respond on that.


Otherwise if you could install smart_importer from git and then maybe 
add a bit more debug output in


hooks.py and predictor.py to make sure that the existing entries arrive, 
this would give a better idea how to progress.



On 12.05.2021 13:17, jrgo...@gmail.com wrote:

Thank you. I think that is it.

I'm using reds-importers and I see 
site-packages/beancount_reds_importers/libimport/banking.py and it has 
this entry:


def extract(self, file, existing_entries=None):

I think this importer tool needs to be updated to support the 
smart_importer.


On Wednesday, May 12, 2021 at 11:11:37 PM UTC+12 pat...@ch.tario.org 
wrote:


I just remembered something. The issue could be that the importer
you're trying to use does not have the new interface and instead
still uses the old (legacy) interface.

the new one looks like this


def extract(self, file, existing_entries):

the old one looks like this

def extract(self, file):


Smart importer uses the existing_entries for training its model.


Regards,

Patrick




On 12.05.2021 12:20, jrgo...@gmail.com wrote:

Just checked and I got the same result. I can add some debugging
code in the config file perhaps. I'm not very experienced with
beancount or smart_importer so not sure what to look for.

bean-extract -e journal/accounts.beancount jonathan_smart.import
~/staging/mydata.qfx  > ~/staging/dud.txt

gives 2 printouts of

Cannot train the machine learning model because the training data
is empty.

Cannot train the machine learning model because the training data
is empty.

On Wednesday, May 12, 2021 at 7:15:19 PM UTC+12
pat...@ch.tario.org wrote:

Can you try -e instead of -f that's what I use


On May 12, 2021 8:31:36 AM GMT+02:00, "jrgo...@gmail.com"
 wrote:

Thanks for the suggestion @Patrick. I just tried changing
that but still doesn't work. I get the exact same
behavior if I call it with an empty fileseems the -f
option doesn't make bean-extract behave as expected for
me. Here is my call:

bean-extract -f journal/myledger.beancount
jonathan_smart.import
~/staging/62090_818496_1013051ofxdl.qfx > ~/staging/dud.txt

I get these messages:

Cannot train the machine learning model because the
training data is empty.

Cannot train the machine learning model because the
training data is empty.


On Wednesday, May 12, 2021 at 5:31:25 PM UTC+12
pat...@ch.tario.org wrote:

Hi,

I think your setup looks good, the smart importer
hook is in there as otherwise you would not get the
errors about not able to train.

I think the issue is on your call


bean-extract jonathan_smart.import
~/staging/new_bank_data.qfx -f
journal/myledger.beancount > ~/staging/dud.txt


My guess is that the -f argument needs to come before
you specify the importconfig and the location, so


bean-extract -f journal/myledger.beancount
jonathan_smart.import ~/staging/new_bank_data.qfx >
~/staging/dud.txt


Regards,

Patrick


On 12.05.2021 01:58, jrgo...@gmail.com wrote:

Thanks for looking at this module even though you
aren't using it!

I followed the code that was further down on the
readme page
 that
describes how to convert an existing importer.
>>
from your_custom_importer import MyBankImporter
from smart_importer import apply_hooks,
PredictPayees, PredictPostings

my_bank_importer = MyBankImporter('whatever',
'config', 'is', 'needed')
apply_hooks(my_bank_importer, [PredictPostings(),
PredictPayees()])
CONFIG = [ my_bank_importer, ]
>>
(my code looks just like this example)

I had thought apply_hooks would operate on the
importer so when I call it in config I can just then
call the hookified bank_importer. Is this note the case?

On Wednesday, May 12, 2021 at 1:26:27 AM UTC+12
kuba@gmail.com wrote:

* Disclaimer * I have never actually run smart
importer.

 

Re: smart importer newbie question

2021-05-12 Thread 'Patrick Ruckstuhl' via Beancount
I just remembered something. The issue could be that the importer you're 
trying to use does not have the new interface and instead still uses the 
old (legacy) interface.


the new one looks like this


def extract(self, file, existing_entries):

the old one looks like this

def extract(self, file):


Smart importer uses the existing_entries for training its model.


Regards,

Patrick




On 12.05.2021 12:20, jrgo...@gmail.com wrote:
Just checked and I got the same result. I can add some debugging code 
in the config file perhaps. I'm not very experienced with beancount or 
smart_importer so not sure what to look for.


bean-extract -e journal/accounts.beancount jonathan_smart.import 
~/staging/mydata.qfx  > ~/staging/dud.txt


gives 2 printouts of

Cannot train the machine learning model because the training data is 
empty.


Cannot train the machine learning model because the training data is 
empty.


On Wednesday, May 12, 2021 at 7:15:19 PM UTC+12 pat...@ch.tario.org wrote:

Can you try -e instead of -f that's what I use


On May 12, 2021 8:31:36 AM GMT+02:00, "jrgo...@gmail.com"
 wrote:

Thanks for the suggestion @Patrick. I just tried changing that
but still doesn't work. I get the exact same behavior if I
call it with an empty fileseems the -f option doesn't make
bean-extract behave as expected for me. Here is my call:

bean-extract -f journal/myledger.beancount
jonathan_smart.import ~/staging/62090_818496_1013051ofxdl.qfx 
> ~/staging/dud.txt

I get these messages:

Cannot train the machine learning model because the training
data is empty.

Cannot train the machine learning model because the training
data is empty.


On Wednesday, May 12, 2021 at 5:31:25 PM UTC+12
pat...@ch.tario.org wrote:

Hi,

I think your setup looks good, the smart importer hook is
in there as otherwise you would not get the errors about
not able to train.

I think the issue is on your call


bean-extract jonathan_smart.import
~/staging/new_bank_data.qfx -f journal/myledger.beancount
> ~/staging/dud.txt


My guess is that the -f argument needs to come before you
specify the importconfig and the location, so


bean-extract -f journal/myledger.beancount
jonathan_smart.import ~/staging/new_bank_data.qfx >
~/staging/dud.txt


Regards,

Patrick


On 12.05.2021 01:58, jrgo...@gmail.com wrote:

Thanks for looking at this module even though you aren't
using it!

I followed the code that was further down on the readme
page  that
describes how to convert an existing importer.
>>
from your_custom_importer import MyBankImporter
from smart_importer import apply_hooks, PredictPayees,
PredictPostings

my_bank_importer = MyBankImporter('whatever', 'config',
'is', 'needed')
apply_hooks(my_bank_importer, [PredictPostings(),
PredictPayees()])
CONFIG = [ my_bank_importer, ]
>>
(my code looks just like this example)

I had thought apply_hooks would operate on the importer
so when I call it in config I can just then call the
hookified bank_importer. Is this note the case?

On Wednesday, May 12, 2021 at 1:26:27 AM UTC+12
kuba@gmail.com wrote:

* Disclaimer * I have never actually run smart importer.

Looking at the README on GitHub for smart importer it
looks like you need to use the return object of
apply_hooks in your CONFIG list.

CONFIG = [
apply_hooks(MyBankImporter(account='Assets:MyBank:MyAccount'),
[PredictPostings()]) ]

In your config you apply the hooks but are not using
the returned object.

Hope that helps.

On Tuesday, 11 May 2021 at 04:06:33 UTC+1
jrgo...@gmail.com wrote:

Hi,

I'm trying to get smart_importer to work and not
sure what I'm doing wrong.

*_1_*. I successfully have done all the required
beancount setup and created by own bank importer
and ran it on two months of data.
_*2.*_ I then manually labelled about 2 months of
data from one of my banks.
*_3._* I installed smart_importer using "pip
install smart_importer"

(base) MacBook-Air:beandata jonathan$ pip show
smart_importer

   

Re: smart importer newbie question

2021-05-12 Thread 'Patrick Ruckstuhl' via Beancount
Can you try -e instead of -f that's what I use

On May 12, 2021 8:31:36 AM GMT+02:00, "jrgo...@gmail.com"  
wrote:
>Thanks for the suggestion @Patrick. I just tried changing that but still 
>doesn't work. I get the exact same behavior if I call it with an empty 
>fileseems the -f option doesn't make bean-extract behave as expected 
>for me. Here is my call:
>
>bean-extract -f journal/myledger.beancount jonathan_smart.import 
>~/staging/62090_818496_1013051ofxdl.qfx  > ~/staging/dud.txt
>I get these messages:
>
>Cannot train the machine learning model because the training data is empty.
>
>Cannot train the machine learning model because the training data is empty.
>
>On Wednesday, May 12, 2021 at 5:31:25 PM UTC+12 pat...@ch.tario.org wrote:
>
>> Hi,
>>
>> I think your setup looks good, the smart importer hook is in there as 
>> otherwise you would not get the errors about not able to train.
>>
>> I think the issue is on your call
>>
>>
>> bean-extract jonathan_smart.import ~/staging/new_bank_data.qfx -f 
>> journal/myledger.beancount > ~/staging/dud.txt
>>
>>
>> My guess is that the -f argument needs to come before you specify the 
>> importconfig and the location, so 
>>
>>
>> bean-extract -f journal/myledger.beancount jonathan_smart.import 
>> ~/staging/new_bank_data.qfx > ~/staging/dud.txt
>>
>>
>> Regards,
>>
>> Patrick
>>
>> On 12.05.2021 01:58, jrgo...@gmail.com wrote:
>>
>> Thanks for looking at this module even though you aren't using it!
>>
>> I followed the code that was further down on the readme page 
>>  that describes how to 
>> convert an existing importer.  
>> >>
>> from your_custom_importer import MyBankImporter 
>> from smart_importer import apply_hooks, PredictPayees, PredictPostings 
>>
>> my_bank_importer = MyBankImporter('whatever', 'config', 'is', 'needed') 
>> apply_hooks(my_bank_importer, [PredictPostings(), PredictPayees()]) 
>> CONFIG = [ my_bank_importer, ]
>> >>
>> (my code looks just like this example)
>>
>> I had thought apply_hooks would operate on the importer so when I call it 
>> in config I can just then call the hookified bank_importer. Is this note 
>> the case?
>>
>> On Wednesday, May 12, 2021 at 1:26:27 AM UTC+12 kuba@gmail.com wrote:
>>
>>> * Disclaimer * I have never actually run smart importer. 
>>>
>>> Looking at the README on GitHub for smart importer it looks like you need 
>>> to use the return object of apply_hooks in your CONFIG list. 
>>>
>>> CONFIG = [ apply_hooks(MyBankImporter(account='Assets:MyBank:MyAccount'), 
>>> [PredictPostings()]) ]
>>>
>>> In your config you apply the hooks but are not using the returned object.
>>>
>>> Hope that helps.
>>>
>>> On Tuesday, 11 May 2021 at 04:06:33 UTC+1 jrgo...@gmail.com wrote:
>>>
 Hi, 

 I'm trying to get smart_importer to work and not sure what I'm doing 
 wrong. 

 *1*. I successfully have done all the required beancount setup and 
 created by own bank importer and ran it on two months of data.
 *2.* I then manually labelled about 2 months of data from one of my 
 banks. 
 *3.* I installed smart_importer using "pip install smart_importer"

 (base) MacBook-Air:beandata jonathan$ pip show smart_importer

 Name: smart-importer

 Version: 0.3

 Summary: Augment Beancount importers with machine learning functionality.

 Home-page: https://github.com/beancount/smart_importer

 Author: Johannes Harms

 Author-email: UNKNOWN

 License: MIT

 Location: /Users/jonathan/opt/miniconda3/lib/python3.8/site-packages

 Requires: scikit-learn, beancount, numpy, scipy

 *4.* I created a new config file I called Jonathan_smart.import


 base) MacBook-Air:beandata jonathan$ more jonathan_smart.import

 #!/usr/bin/env python3

 """Import configuration."""


 import sys

 from os import path


 sys.path.insert(0, path.join(path.dirname(__file__)))


 from beancount_reds_importers import vanguard

 from myimporters.bfsfcu import bfsfcu_bank

 from myimporters.anz import anz_bank

 from fund_info import *

 from smart_importer import apply_hooks, PredictPayees, PredictPostings


 myBank_smart_importer =my_bank.Importer({

 'main_account'   : 'Assets:US:Banks:Checking:myBank',

 'account_number' : ''xxx'',

 'transfer'   : 
 'Assets:US:Zero-Sum-Accounts:Transfers:Bank-Account',

 'income' : 'Income:US:Interest:myBank',

 'fees'   : 'Expenses:US:Bank-Fees:myBank',

 'rounding_error' : 'Equity:US:Rounding-Errors:Imports',

 })


 apply_hooks(myBank_smart_importer, [PredictPayees(), PredictPostings()])

 CONFIG = [myBank_smart_importer, ...(other importers)]


 *5*. I was following 

Re: smart importer newbie question

2021-05-11 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

I think your setup looks good, the smart importer hook is in there as 
otherwise you would not get the errors about not able to train.


I think the issue is on your call


bean-extract jonathan_smart.import ~/staging/new_bank_data.qfx -f 
journal/myledger.beancount > ~/staging/dud.txt



My guess is that the -f argument needs to come before you specify the 
importconfig and the location, so



bean-extract -f journal/myledger.beancount jonathan_smart.import 
~/staging/new_bank_data.qfx > ~/staging/dud.txt



Regards,

Patrick


On 12.05.2021 01:58, jrgo...@gmail.com wrote:

Thanks for looking at this module even though you aren't using it!

I followed the code that was further down on the readme page 
 that describes how to 
convert an existing importer.

>>
from your_custom_importer import MyBankImporter
from smart_importer import apply_hooks, PredictPayees, PredictPostings

my_bank_importer = MyBankImporter('whatever', 'config', 'is', 'needed')
apply_hooks(my_bank_importer, [PredictPostings(), PredictPayees()])
CONFIG = [ my_bank_importer, ]
>>
(my code looks just like this example)

I had thought apply_hooks would operate on the importer so when I call 
it in config I can just then call the hookified bank_importer. Is this 
note the case?


On Wednesday, May 12, 2021 at 1:26:27 AM UTC+12 kuba@gmail.com wrote:

* Disclaimer * I have never actually run smart importer.

Looking at the README on GitHub for smart importer it looks like
you need to use the return object of apply_hooks in your CONFIG list.

CONFIG = [
apply_hooks(MyBankImporter(account='Assets:MyBank:MyAccount'),
[PredictPostings()]) ]

In your config you apply the hooks but are not using the returned
object.

Hope that helps.

On Tuesday, 11 May 2021 at 04:06:33 UTC+1 jrgo...@gmail.com wrote:

Hi,

I'm trying to get smart_importer to work and not sure what I'm
doing wrong.

*_1_*. I successfully have done all the required beancount
setup and created by own bank importer and ran it on two
months of data.
_*2.*_ I then manually labelled about 2 months of data from
one of my banks.
*_3._* I installed smart_importer using "pip install
smart_importer"

(base) MacBook-Air:beandata jonathan$ pip show smart_importer

Name: smart-importer

Version: 0.3

Summary: Augment Beancount importers with machine learning
functionality.

Home-page: https://github.com/beancount/smart_importer


Author: Johannes Harms

Author-email: UNKNOWN

License: MIT

Location:
/Users/jonathan/opt/miniconda3/lib/python3.8/site-packages

Requires: scikit-learn, beancount, numpy, scipy

*_4._* I created a new config file I called Jonathan_smart.import


base) MacBook-Air:beandata jonathan$ more jonathan_smart.import

#!/usr/bin/env python3

"""Import configuration."""


import sys

from os import path


sys.path.insert(0, path.join(path.dirname(__file__)))


from beancount_reds_importers import vanguard

from myimporters.bfsfcu import bfsfcu_bank

from myimporters.anz import anz_bank

from fund_info import *

from smart_importer import apply_hooks, PredictPayees,
PredictPostings


myBank_smart_importer =my_bank.Importer({

        'main_account'   : 'Assets:US:Banks:Checking:myBank',

        'account_number' : ''xxx'',

        'transfer'       :
'Assets:US:Zero-Sum-Accounts:Transfers:Bank-Account',

        'income'         : 'Income:US:Interest:myBank',

        'fees'           : 'Expenses:US:Bank-Fees:myBank',

        'rounding_error' : 'Equity:US:Rounding-Errors:Imports',

    })


apply_hooks(myBank_smart_importer, [PredictPayees(),
PredictPostings()])

CONFIG = [myBank_smart_importer, ...(other importers)]


*_5_*. I was following the README documentation that said
write bean-extract -f to invoke it on existing data. So I
tried the following.*Is this right?*

bean-extract jonathan_smart.import ~/staging/new_bank_data.qfx
-f journal/myledger.beancount > ~/staging/dud.txt

Cannot train the machine learning model because the training
data is empty.

Cannot train the machine learning model because the training
data is empty.


The output is just like the normal output without all the
smart_importer stuff.  Seems I'm doing something wrong as the
staging/dud.txt doesn't have any predictions.


Appreciate any assistance on this!


thanks,

Jonathan

--
You received this message because you are subscribed to the Google 
Groups "Beancount" 

Re: Which currency exchange rate price source to use?

2021-05-09 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

my pr just got merged into beanprice. So you can use this

pip install git+https://github.com/beancount/beanprice.git

and then specify the commodity like this

2000-01-01 commodity USD
  price: "CHF:ratesapi/USD-CHF"

if you want to use EUR as base (instead of CHF) then it would be

2000-01-01 commodity USD
  price: "EUR:ratesapi/USD-EUR"


similar for other base currencies.


It's using https://ratesapi.io/documentation/ for the lookup. Data is 
coming from


https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

this should give you an idea which currency pairs you can use.


Regards,

Patrick


On 08.05.2021 15:30, Oon-Ee Ng wrote:
Currently exchangeratesapi. Am not really picky, just trying to 
automate the process rather than manually specifying flunctuations in 
my home currency.


On Sat, May 8, 2021 at 2:32 PM Patrick Ruckstuhl <mailto:patr...@ch.tario.org>> wrote:


Yes, what I meant which price source (e.g. exchangeratesapi,
alphabantage, ...) do you want to use?

On May 8, 2021 2:56:00 AM GMT+02:00, Oon-Ee Ng
mailto:ngoonee.t...@gmail.com>> wrote:

Well I don't really suggest you accommodate my own currency
since I may possibly be the only beancount user there. Really
should be something we specify ourselves somewhere (no idea
how that can be achieved).

On Sat, May 8, 2021 at 8:01 AM Patrick Ruckstuhl
mailto:patr...@ch.tario.org>> wrote:

Hi,

Thanks for getting back on this. There is the link to pypi
at the very top with the image but it makes sense to
describe this as well.
Sorry about the hardcoding to CHF, that's what I need and
I haven't made this flexible everywhere. I noticed this
when I started creating a pr for beanprice. I was thinking
to move my price fetchers there and planning to fix it as
part of the move. But I haven't heard back anything on my
pr for almost a month, so I should probably enhance them
in my repo. Which ones are you most interested?

Regards,
Patrick

On May 8, 2021 1:44:56 AM GMT+02:00, Oon-Ee Ng
mailto:ngoonee.t...@gmail.com>>
wrote:

Well it didn't show up on pypi with a search for
'beancounttools', and the github page doesn't list
this pypi package so I only found out about it from
your email (thanks!)

But... why is everything hardcoded to be CHF? Was so
confused with the initial results I was getting.

        On Tue, Apr 27, 2021 at 2:53 PM 'Patrick Ruckstuhl'
via Beancount mailto:beancount@googlegroups.com>> wrote:

Hi,

what issues did you encounter when installing
beancounttools? Should be a simple


pip install tariochbctools


As for the config, probably it's tied to the way
you setup your commodities. The way I have mine
configured are like this

2019-01-01 commodity EUR
   price: 
"CHF:tariochbctools.plugins.prices.exchangeratesapi/EUR"


So the symbol I use in beancount is EUR, but the
symbol for the price lookup might be something else


Regards,

Patrick

On 27.04.2021 05:17, Oon-Ee Ng wrote:

I've tried out
https://github.com/xuhcc/beancount-exchangerates
<https://github.com/xuhcc/beancount-exchangerates>
so far, and can't figure out installation for
https://github.com/tarioch/beancounttools
<https://github.com/tarioch/beancounttools>

Exchangerates gives me output looking like this:-

2021-04-27 price USD:CUR X. CUR

instead of (what I think is supposed to be) the
correct:-

2021-04-27 price USD X. CUR

I don't recognise the above syntax, should I be
doing a simple sed to get it into the format I'm
already using (the 2nd one)? What does it even
mean? Would using beancounttools be 'better'?
-- 
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
<mai

Re: Which currency exchange rate price source to use?

2021-05-08 Thread 'Patrick Ruckstuhl' via Beancount
Yes, what I meant which price source (e.g. exchangeratesapi, alphabantage, ...) 
do you want to use?

On May 8, 2021 2:56:00 AM GMT+02:00, Oon-Ee Ng  wrote:
>Well I don't really suggest you accommodate my own currency since I may
>possibly be the only beancount user there. Really should be something we
>specify ourselves somewhere (no idea how that can be achieved).
>
>On Sat, May 8, 2021 at 8:01 AM Patrick Ruckstuhl 
>wrote:
>
>> Hi,
>>
>> Thanks for getting back on this. There is the link to pypi at the very top
>> with the image but it makes sense to describe this as well.
>> Sorry about the hardcoding to CHF, that's what I need and I haven't made
>> this flexible everywhere. I noticed this when I started creating a pr for
>> beanprice. I was thinking to move my price fetchers there and planning to
>> fix it as part of the move. But I haven't heard back anything on my pr for
>> almost a month, so I should probably enhance them in my repo. Which ones
>> are you most interested?
>>
>> Regards,
>> Patrick
>>
>> On May 8, 2021 1:44:56 AM GMT+02:00, Oon-Ee Ng 
>> wrote:
>>>
>>> Well it didn't show up on pypi with a search for 'beancounttools', and
>>> the github page doesn't list this pypi package so I only found out about it
>>> from your email (thanks!)
>>>
>>> But... why is everything hardcoded to be CHF? Was so confused with the
>>> initial results I was getting.
>>>
>>> On Tue, Apr 27, 2021 at 2:53 PM 'Patrick Ruckstuhl' via Beancount <
>>> beancount@googlegroups.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> what issues did you encounter when installing beancounttools? Should be
>>>> a simple
>>>>
>>>>
>>>> pip install tariochbctools
>>>>
>>>>
>>>> As for the config, probably it's tied to the way you setup your
>>>> commodities. The way I have mine configured are like this
>>>>
>>>> 2019-01-01 commodity EUR
>>>>   price: "CHF:tariochbctools.plugins.prices.exchangeratesapi/EUR"
>>>>
>>>>
>>>> So the symbol I use in beancount is EUR, but the symbol for the price
>>>> lookup might be something else
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Patrick
>>>> On 27.04.2021 05:17, Oon-Ee Ng wrote:
>>>>
>>>> I've tried out https://github.com/xuhcc/beancount-exchangerates so far,
>>>> and can't figure out installation for
>>>> https://github.com/tarioch/beancounttools
>>>>
>>>> Exchangerates gives me output looking like this:-
>>>>
>>>> 2021-04-27 price USD:CURX. CUR
>>>>
>>>> instead of (what I think is supposed to be) the correct:-
>>>>
>>>> 2021-04-27 price USD X. CUR
>>>>
>>>> I don't recognise the above syntax, should I be doing a simple sed to
>>>> get it into the format I'm already using (the 2nd one)? What does it even
>>>> mean? Would using beancounttools be 'better'?
>>>> --
>>>> 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/CAGQ70evy9CBkxPQZL5dgV08YwnqiDF9Zr%3Dx%3DkZ%3Dujv5XoGBz6g%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/beancount/CAGQ70evy9CBkxPQZL5dgV08YwnqiDF9Zr%3Dx%3DkZ%3Dujv5XoGBz6g%40mail.gmail.com?utm_medium=email_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/a2b2242c-55a8-da04-e7bd-5ebe6fa8be3b%40ch.tario.org
>>>> <https://groups.google.com/d/msgid/beancount/a2b2242c-55a8-da04-e7bd-5ebe6fa8be3b%40ch.tario.org?utm_medium=email_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/8A9AAF12-82E0-4E65-880C-F1589693842B%40ch.tario.org.


Re: Which currency exchange rate price source to use?

2021-05-07 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

Thanks for getting back on this. There is the link to pypi at the very top with 
the image but it makes sense to describe this as well.
Sorry about the hardcoding to CHF, that's what I need and I haven't made this 
flexible everywhere. I noticed this when I started creating a pr for beanprice. 
I was thinking to move my price fetchers there and planning to fix it as part 
of the move. But I haven't heard back anything on my pr for almost a month, so 
I should probably enhance them in my repo. Which ones are you most interested?

Regards,
Patrick

On May 8, 2021 1:44:56 AM GMT+02:00, Oon-Ee Ng  wrote:
>Well it didn't show up on pypi with a search for 'beancounttools', and the
>github page doesn't list this pypi package so I only found out about it
>from your email (thanks!)
>
>But... why is everything hardcoded to be CHF? Was so confused with the
>initial results I was getting.
>
>On Tue, Apr 27, 2021 at 2:53 PM 'Patrick Ruckstuhl' via Beancount <
>beancount@googlegroups.com> wrote:
>
>> Hi,
>>
>> what issues did you encounter when installing beancounttools? Should be a
>> simple
>>
>>
>> pip install tariochbctools
>>
>>
>> As for the config, probably it's tied to the way you setup your
>> commodities. The way I have mine configured are like this
>>
>> 2019-01-01 commodity EUR
>>   price: "CHF:tariochbctools.plugins.prices.exchangeratesapi/EUR"
>>
>>
>> So the symbol I use in beancount is EUR, but the symbol for the price
>> lookup might be something else
>>
>>
>> Regards,
>>
>> Patrick
>> On 27.04.2021 05:17, Oon-Ee Ng wrote:
>>
>> I've tried out https://github.com/xuhcc/beancount-exchangerates so far,
>> and can't figure out installation for
>> https://github.com/tarioch/beancounttools
>>
>> Exchangerates gives me output looking like this:-
>>
>> 2021-04-27 price USD:CURX. CUR
>>
>> instead of (what I think is supposed to be) the correct:-
>>
>> 2021-04-27 price USD X. CUR
>>
>> I don't recognise the above syntax, should I be doing a simple sed to get
>> it into the format I'm already using (the 2nd one)? What does it even mean?
>> Would using beancounttools be 'better'?
>> --
>> 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/CAGQ70evy9CBkxPQZL5dgV08YwnqiDF9Zr%3Dx%3DkZ%3Dujv5XoGBz6g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beancount/CAGQ70evy9CBkxPQZL5dgV08YwnqiDF9Zr%3Dx%3DkZ%3Dujv5XoGBz6g%40mail.gmail.com?utm_medium=email_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/a2b2242c-55a8-da04-e7bd-5ebe6fa8be3b%40ch.tario.org
>> <https://groups.google.com/d/msgid/beancount/a2b2242c-55a8-da04-e7bd-5ebe6fa8be3b%40ch.tario.org?utm_medium=email_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/CAGQ70etkDjYqhFXLnEV%2BGV_hj4vAOV8d6qE0B9sps6esX53HRg%40mail.gmail.com.

-- 
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/309FF040-41AB-4864-A206-175FF0062DDE%40ch.tario.org.


Re: newbie question around getting going on smart_importer

2021-04-28 Thread 'Patrick Ruckstuhl' via Beancount

Hi Jonathan,

Yes the way you describe makes a lot of sense. That way it limits the 
amount of config you have to manually train.



Regards,

Patrick


On 28.04.2021 08:27, jrgo...@gmail.com wrote:

Hi,

I've finally gotten (a) account structure I want for now (b) importers 
working for my 3 core accounts. I now want to get smart_importer 
working and want to understand the best strategy to bring this into 
the process.


My understanding from the smart_importer data is that I can covert all 
my importers to be "smart importers" using the hooks that 
smart_importer provides as noted in the readme file. I think that is 
straightforward. I can use this on any importer type bank, cc, etc.


*So my core question *then, is it best to only manually label 1-2 
months of data and then use that labelled data to train the 
smart_importer and then run the smart_importer version on the rest of 
my data? For example, I have 1.5 years of OFX data from my bank in one 
OFX file. I can run the current non-smart importer on the entire file 
but then I have to manually label the entire thing. There isn't a 
totally different way to dynamically do this as I edit in emacs or use 
smart_importer in a different way? If I understand I should split into 
1.3 years and 0.2 years for example. Manually label the 0.2 years and 
then take the remaining 1.3 years and run through the smart_importer 
version of the importer? Or is there some other way I should go about 
this?


Also want to say, I really appreciate the beancount tool, so many 
amazing contributions (e.g. Reds importers), and the new 
smart_importer tool  and everyone helping answer questions.


thanks,
Jonathan
--
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/f21fac7a-5119-4ada-a1ae-01244768b2a6n%40googlegroups.com 
.


--
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/0dbd7de1-e544-3177-0b79-2c91f686110f%40ch.tario.org.


Re: Which currency exchange rate price source to use?

2021-04-27 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

what issues did you encounter when installing beancounttools? Should be 
a simple



pip install tariochbctools


As for the config, probably it's tied to the way you setup your 
commodities. The way I have mine configured are like this


2019-01-01 commodity EUR
  price: "CHF:tariochbctools.plugins.prices.exchangeratesapi/EUR"


So the symbol I use in beancount is EUR, but the symbol for the price 
lookup might be something else



Regards,

Patrick

On 27.04.2021 05:17, Oon-Ee Ng wrote:
I've tried out https://github.com/xuhcc/beancount-exchangerates 
 so far, and can't 
figure out installation for https://github.com/tarioch/beancounttools 



Exchangerates gives me output looking like this:-

2021-04-27 price USD:CUR    X. CUR

instead of (what I think is supposed to be) the correct:-

2021-04-27 price USD X. CUR

I don't recognise the above syntax, should I be doing a simple sed to 
get it into the format I'm already using (the 2nd one)? What does it 
even mean? Would using beancounttools be 'better'?

--
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/CAGQ70evy9CBkxPQZL5dgV08YwnqiDF9Zr%3Dx%3DkZ%3Dujv5XoGBz6g%40mail.gmail.com 
.


--
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/a2b2242c-55a8-da04-e7bd-5ebe6fa8be3b%40ch.tario.org.


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
>
>
>
>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 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 both the source can specify in
>> which base it returns the quote but there is also the first part of the
>> base specified on the source string.
>>
>> On April 11, 2021 9:23:43 PM GMT+02:00, Martin Blais 
>> wrote:
>>>
>>> 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 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/master/beanprice/source.py
>>>>
>>>> doesn't have a way where you can request prices in a certain base ccy,
>>>> the only thing the source can do is specify in which base ccy it did
>>>> return them.
>>>>
>>>> Should the source contract be extended to (optionally) allow to specify
>>>> the desired base ccy?
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Patrick
>>>>
>>>>
>>>> --
>>>> 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/dd26456f-bc40-356e-ada7-aa4729425355%40ch.tario.org
>>>> .
>>>>
>>>

-- 
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/99378488-EBA6-4C8A-9117-3CD6FBAF2631%40ch.tario.org.


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 both the source can specify in which 
base it returns the quote but there is also the first part of the base 
specified on the source string.

On April 11, 2021 9:23:43 PM GMT+02:00, Martin Blais  wrote:
>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 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/master/beanprice/source.py
>>
>> doesn't have a way where you can request prices in a certain base ccy,
>> the only thing the source can do is specify in which base ccy it did
>> return them.
>>
>> Should the source contract be extended to (optionally) allow to specify
>> the desired base ccy?
>>
>>
>> Regards,
>>
>> Patrick
>>
>>
>> --
>> 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/dd26456f-bc40-356e-ada7-aa4729425355%40ch.tario.org
>> .
>>
>
>-- 
>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%2BhNzf%2BdNsZgMOgzsPtmgOKAPd0_QT-AQhftcuby5NKOMGw%40mail.gmail.com.

-- 
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/138B2223-901B-442C-9242-B9554F6F7F65%40ch.tario.org.


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/master/beanprice/source.py

doesn't have a way where you can request prices in a certain base ccy, 
the only thing the source can do is specify in which base ccy it did 
return them.


Should the source contract be extended to (optionally) allow to specify 
the desired base ccy?



Regards,

Patrick


--
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/dd26456f-bc40-356e-ada7-aa4729425355%40ch.tario.org.


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_prices.py


Regards,

Patrick


On 11.04.2021 20:04, Martin Blais wrote:
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 at 1:38 PM Thomas den Hollander 
mailto:denhollander.tho...@gmail.com>> 
wrote:


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 in bean-price?

Op zondag 11 april 2021 om 17:39:18 UTC+2 schreef 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 library, here:
https://github.com/beancount/beanprice/tree/master/beanprice/sources



New ones are welcome. Minimal requirement for inclusion in
the library is a unit test covering basic usage and
mocked, that is, not connecting to the network.



On Sun, Apr 11, 2021 at 5:51 AM Thomas den Hollander
 wrote:


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 PYTHONPATH? Or maybe install it as a
module?

- Thomas

-- 
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+...@googlegroups.com.
To view this discussion on the web visit

https://groups.google.com/d/msgid/beancount/7604ca29-5482-41c2-8757-2fe11e5a3610n%40googlegroups.com

.

-- 
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/60ef01f5-b2fd-40f5-9274-68e088fcac3en%40googlegroups.com

.

--
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%2BhPXwEaJ1Yf0jV4TPsjSwNUxLSQTkMO%3DFHk0DmmoMVcitA%40mail.gmail.com 
.


--
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/b156638f-fe76-2162-f63b-b94112a5ce20%40ch.tario.org.


Re: Currency exchange rates sources

2021-04-10 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


you can use https://ratesapi.io/ same api as exchangeratesapi before, 
simply switching the host is enough.


Besides that, https://www.alphavantage.co/ free tier works also pretty 
well. Price fetchers available at https://github.com/tarioch/beancounttools




Regards,

Patrick



On 10.04.2021 17:25, Uwe Ziegenhagen wrote:



If in the meantime others have found viable alternatives, please
shout!


How about the fx rates from European Central Bank?

https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html 



XML interface, historic rates, etc. are available.

Uwe

--
Dr. Uwe Ziegenhagen
0179-7476050
>
--
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/CAML7JCj-KHMJXpiveDFgHxBXqkaAWv4hFx1Z%3DBns1h6mwWE8gA%40mail.gmail.com 
.


--
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/a7e6649f-3267-5a2c-526c-4a6923da191e%40ch.tario.org.


Re: Accounting for year-end income

2021-02-01 Thread 'Patrick Ruckstuhl' via Beancount
Hi Aaron,

This is a common practice, often the account is called receivable.

https://en.m.wikipedia.org/wiki/Accounts_receivable

Regards,
Patrick

On February 1, 2021 4:03:07 PM GMT+01:00, Aaron Stacy  
wrote:
>Hi everyone, I'd like to account for 2020 income at the end of the year
>that didn't show up in my bank account until 2021.
>
>Typically I use the date funds are available in my account as the
>source-of-truth for reconciling income and bank statements, since this
>kinda matters to me more than when my employer initiated the transfer.
>
>But I'd also like to be able to query calendar-yearly-income, and if I book
>these transactions in 2021, that won't match tax records.
>
>I'm thinking about splitting these into 2 transactions via a "transfer
>account
>,"
>i.e.:
>
>; Pay stub December 2020
>2020-12-31 * "Let's get that 稜" ^transfer-12345
>  Income:Hooli:Salary -20.00 USD
>  Expenses:Taxes:Y2020:US:Federal 5.00 USD
>  Assets:Hooli:Transfer
>
>; Bank statement January 2020
>2021-01-04 * "" ^transfer-12345
>  Assets:MyBank:Checking 15.00 USD
>  Assets:Hooli:Transfer
>
>Does this seem reasonable? Any thoughts on Assets:Hooli:Transfer vs
>Assets:MyBank:Checking:Transfer?
>
>Thanks!
>
>-- 
>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/CACjABkmeg%2BmGM1jCZo6H89Fnor6tO8vbmj5MeoCxFscvy2SAaw%40mail.gmail.com.

-- 
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/D9DDCB25-A982-469A-A8FD-427EA2514529%40ch.tario.org.


Re: InteractiveBrokers

2020-12-30 Thread 'Patrick Ruckstuhl' via Beancount
The other api is connecting to a locally running ib client, so that's a bit 
more setup.

On December 30, 2020 10:20:41 AM GMT+01:00, nug get  
wrote:
> >>Are these apis only available for IBKR Pro? 
>no, should be available for all.
>i use IBKR in it's basic product, no pro version or such. this report API 
>is not a premium service. there is anotehr API that allows you to 
>programmatically trade, but i have not looked into it thus far. i am 
>planning on
>Best,
>nugget
>
>On Wednesday, 30 December 2020 at 10:11:26 UTC+1 adrian...@gmail.com wrote:
>
>> I care :) 
>>
>> On Wed, 30 Dec 2020 at 09:47, Martin Blais  wrote:
>>
>>> No idea.
>>>
>>> Happy to share this importer if anyone cares.
>>>
>>>
>>>
>>> On Wed, Dec 30, 2020 at 3:26 AM Ben Blount  wrote:
>>>
 Are these apis only available for IBKR Pro?

 On Wed, Dec 30, 2020, 00:12 Martin Blais  wrote:

> Thank you!
>
> And actually, for the record, the statement of funds from the custom 
> reports doesn't provide any trade data.
> The statement of funds from the flex queries is the only one that 
> outputs a single table with all one needs.
>
>
> On Wed, Dec 30, 2020 at 2:42 AM nug get  wrote:
>
>> I also made a IB importer, based on the FLex Query API:
>> https://github.com/Dr-Nuke/drnuke-bean
>>
>>
>> https://www.interactivebrokers.com/en/software/singlefunds/topics/flexqueries.htm
>>
>> >> report of all balance-affecting transactions. 
>> without looking it up, i believe the flex query allows this. 
>>
>> Hope this is of help to you.
>> Best,
>> nugget
>>
>> On Wednesday, 30 December 2020 at 07:49:58 UTC+1 bl...@furius.ca 
>> wrote:
>>
>>> FWIW, it's buried under a custom report, you have to select 
>>> "Statement of Funds."
>>> That generates a single table including a balance column.
>>>
>>> On Wed, Dec 30, 2020 at 1:17 AM Martin Blais  wrote:
>>>
 Thx Martin.
 I was hoping to find something that works without having to access 
 the API.


 On Wed, Dec 30, 2020 at 1:10 AM Martin Michlmayr  
 wrote:

> * Martin Blais  [2020-12-30 00:56]:
> > Does anyone here have an importer for Interactive Brokers?
>
> https://github.com/tarioch/beancounttools
>
> -- 
> Martin Michlmayr
> https://www.cyrius.com/
>
> -- 
> 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+...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/20201230060958.GA31091%40jirafa.cyrius.com
> .
>
 -- 
>> 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+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/beancount/2a5a2b94-f787-4b93-9552-27ea898f7136n%40googlegroups.com
>>  
>> 
>> .
>>
> -- 
> 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+...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/CAK21%2BhP1TXna3-KRT6x43%3DLnjFROeoxYz93kkMW4s6axmK-_jA%40mail.gmail.com
>  
> 
> .
>
 -- 
 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+...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/beancount/CACGEkZtSvHybhKJy_FUdpQoUy5pLPp7rcX%3Dc0Jgr09C9RPLoKg%40mail.gmail.com
  
 
 .

>>> -- 
>>> 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+...@googlegroups.com.
>>>
>> To view this discussion on the web visit 
>>> 

Re: Get market price indirectly (convert via intermediary commodity)

2020-12-26 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

I created a plugin that should help you there. It calculates the missing cross 
rates to your base rate

https://github.com/tarioch/beancounttools

On December 26, 2020 11:53:39 AM GMT+01:00, Peter  
wrote:
>Hi all,
>
>is it possible to convert a lot/commodity to the current market value of my 
>base currency using an intermediary currency?
>
>Use case:
>I fetch prices for cryptocurrencies from binance. My base currency is EUR. 
>Binance supports EUR quotes only for a few big cryptos. Most other cryptos 
>have USDT (Tether, a stable coin representing a fixed value of 1 USD) 
>quotes.
>
>Is it possible to use that to convert a crypto to EUR, like: CoinXY is 
>currently 10 USDT; 1 USD(T) is currently 0.75 EUR; therefore CoinXY is 0.75 
>EUR? 
>
>E.g:
>
>2020-12-01 * "" "Opening"
>Equity:Opening-Balances -0.1 MKR {441 EUR} @ 441 EUR
>Assets:Crypto:MKR:Coinbase   0.1 MKR {441 EUR} @ 441 EUR
>
>2017-01-01 price USDT1.0 USD
>2020-12-25 price MKR  528.64 USDT
>2020-12-25 price USD 0.82 EUR
>2020-12-25 price USDT0.82 EUR
>
>Is there a way to convert the 0.1 MKR to EUR by calculating 0.1 MKR * 0.82 
>USDT using bean-query?
>
>Regards
>
>-- 
>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/56370f79-560d-41f2-8f8d-6fda6cf27e3cn%40googlegroups.com.

-- 
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/109C52D3-0542-4DB6-BAFF-2E249C628E58%40ch.tario.org.


Re: bean-query to get one single number

2020-11-30 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


this is bean-query, I just limited it to the select part, for your case 
it would be something like



number(only("CHF", convert(sum(value(position, #"2020-12-31")), "CHF", 
#"2020-12-31"))) WHERE account ~'Expenses'



Regards,

Patrick


On 30.11.2020 16:02, Chary Chary wrote:

Patrick,

thanks for the answer, but I am afraid I do not have enough knowledge 
to understand your answer.


What you shave show is not a bean-query language, this looks time 
elements of python code


Can you in this case give me some broader and complete source of code 
and I will try to get my head around


Regards.

On Sunday, November 29, 2020 at 4:58:33 PM UTC+1 pat...@ch.tario.org 
wrote:


Hi,

Do you have different currencies? Here is a (complex) example that
I run to value and convert with a specific year.

number(only("CHF", convert(sum(value(position, #"2020-12-31")),
"CHF", #"2020-12-31")))


Let's deconstruct that from the inner parts

sum(value(position, #"2020-12-31"))
this sums up the value of a position (using prices from 2020-12-31)

convert(..., "CHF", #"2020-12-31")
convert everything to CHF with FX as of 2020-12-31

number(only("CHF", ...))
Now take only the CHF out of this (as everything was converted to
CHF, this is actually only CHF)) and then take the number


If you don't have different currencies or prices involved it
becomes a lot simpler and you can drop those parts.


Regards,

Patrick



On 29.11.2020 16:50, Chary Chary wrote:

Hi, everybody

is there a way to get a single number report with bean-query

e.g. I want all Expenses for all the period in one number.

The maximum I got so far is listing all expense accounts and
their balance. To to get a total expenses I would have to dump it
all in Excel and sum there.

So, I want something like

SUM(COST(position)) WHERE account ~'Expenses'

But this does not work

Regards.

-- 
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+...@googlegroups.com.
To view this discussion on the web visit

https://groups.google.com/d/msgid/beancount/31497363-986a-4745-a202-526236c532d8n%40googlegroups.com

.


--
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/3ca0d4b1-d0ad-4d8c-be56-01a449ec4c90n%40googlegroups.com 
.


--
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/6c97fc31-07a4-a60a-65c0-c823a4438cf3%40ch.tario.org.


Re: bean-query to get one single number

2020-11-29 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

Do you have different currencies? Here is a (complex) example that I run 
to value and convert with a specific year.


number(only("CHF", convert(sum(value(position, #"2020-12-31")), "CHF", 
#"2020-12-31")))



Let's deconstruct that from the inner parts

sum(value(position, #"2020-12-31"))
this sums up the value of a position (using prices from 2020-12-31)

convert(..., "CHF", #"2020-12-31")
convert everything to CHF with FX as of 2020-12-31

number(only("CHF", ...))
Now take only the CHF out of this (as everything was converted to CHF, 
this is actually only CHF)) and then take the number



If you don't have different currencies or prices involved it becomes a 
lot simpler and you can drop those parts.



Regards,

Patrick



On 29.11.2020 16:50, Chary Chary wrote:

Hi, everybody

is there a way to get a single number report with bean-query

e.g. I want all Expenses for all the period in one number.

The maximum I got so far is listing all expense accounts and their 
balance. To to get a total expenses I would have to dump it all in 
Excel and sum there.


So, I want something like

SUM(COST(position)) WHERE account ~'Expenses'

But this does not work

Regards.

--
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/31497363-986a-4745-a202-526236c532d8n%40googlegroups.com 
.


--
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/891fdfdc-ef39-8224-4c83-795683486bc8%40ch.tario.org.


Re: Importing Python dicts?

2020-11-28 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

Maybe a stupid question but, what do you want to put into the inline 
comments? Maybe you can put them as metadata, that way it could even be 
queryable if needed.


Regards,

Patrick

On 28.11.2020 20:09, Chary Chary wrote:

Martin,

is my understanding correct, that by following your example from 
Ameritrade 
one 
cannot create a beancount file, which contains inline comments for 
postings, like that?


*2015-01-01 * "Taxi home from concert in Brooklyn"
  Assets:Cash      -20 USD ; inline comment
  Expenses:Taxi*

Reasons:

 1. There seems to be no place for comment in the *Posting

*class
(only may be in meta-data?)
 2. As far as I can see, printer.print_entries() cannot print posting
comment


If this is the case, what is the best way to create a custom script 
for converting data into beancount format with possibility to preserve 
inline comments for postings?



On Saturday, October 10, 2020 at 3:23:56 AM UTC+2 bl...@furius.ca wrote:

You can either write a custom script and just print out to stdout,
or use the ingest framework.

Here's an example of a custom standalone script that converts from
Ameritrade:

https://github.com/blais/ameritrade/blob/master/examples/ameritrade2beancount.py



The ingest library only provides a framework to help you automate
some of the process of automatically identifying the files in your
downloads directory, run the extraction of transactions (that you
write) and file  away the downloads. You don't necessarily have to
use it. http://furius.ca/beancount/doc/ingest


Hope this helps,




On Fri, Oct 9, 2020 at 7:32 AM Sam Bragg  wrote:

Hi all,

I'm completely new to beancount, but I want to use it to
manage my trading/investing activities. I have already written
a library to download transactions from my broker's API, which
returns a list of dicts.

I have looked at the beancount documentation and I can't even
seem to get started. Many of the example importers given,
assume that one has a file which they wish to import, which in
my particular case is not relevant(?).

Here's the process as I envision it:

 1. Get a given date's transactions from my broker, using the
library I made
 2. Implement some logic to classify each transaction
(Account:[fees/PnL] etc.)
 3. Append the new transactions as directives in my beancount file

All I am really seeking to know at the moment is how I would
even get started. Looking at beancount.ingest.importer - it
needs a FileMemo instance, but in this case I won't be reading
from a file - this is where most of my confusion is coming from.

Truly grateful for any response received. Thank you so much
for producing this awesome software!

Sam

-- 
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+...@googlegroups.com.
To view this discussion on the web visit

https://groups.google.com/d/msgid/beancount/c38aefcb-0af3-4591-9905-b5f8fcc79fcan%40googlegroups.com

.

--
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/2a32d0fe-3fd0-4098-a092-83e94ce5fdeen%40googlegroups.com 
.


--
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/b0d0fbda-9edb-2e24-dc0e-84d158c55e1d%40ch.tario.org.


Re: access to metadata with bean-query

2020-11-04 Thread 'Patrick Ruckstuhl' via Beancount

Hi François,

There are a couple of targets available for querying metadata. What I 
usually use, is the help commands in bean-query.


Run bean-query with your file and then enter "help" or for what you're 
mostly interested "help targets", this should list



  'META(str)': Get some metadata key of the Posting.

Which should do what you want.

Regards,

Patrick


On 04.11.2020 16:01, François wrote:

Hello,

I would like to add a column on some query filled by the content of a
posting metadata.

I can't find anything in the documentation. What is the way to do it ?

François



--
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/9e48d315-e29a-d416-af62-f826d90fb808%40ch.tario.org.


Re: FIFO mode for Stock Sell

2020-07-27 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


Did you indicate Fifo when opening the account?

2020-01-01 open Assets:US:Schwab:ETF:VTI VTI "FIFO"

Regards,

Patrick



On 27.07.2020 17:21, Ghanashyam Prabhu wrote:
I have the following in my beancount file. However it seems like I 
will always have to indicate sell transactions against an buy lot by 
filling in the exact price that lot was bought at.
Doesn't bean count support FIFO mode where whenever there is a SELL 
transaction beancount figures the lot that was bought first and 
executes a SELL on that transaction? If not, can you please suggest 
how are folks handling these SELL transactions especially if you have 
a long ledger files?


2020-01-07 * "BUY" "VANGUARD TOTAL STOCK MARKET ETF: VTI"
Assets:US:Schwab:ETF:VTI      12. VTI {164.1090 USD}
  Assets:US:Schwab:Cash

2020-01-17 * "BUY" "VANGUARD TOTAL STOCK MARKET ETF: VTI"
Assets:US:Schwab:ETF:VTI       6. VTI {168.6290 USD}
  Assets:US:Schwab:Cash

2020-03-18 * "SELL" "VANGUARD TOTAL STOCK MARKET ETF: VTI"
Assets:US:Schwab:ETF:VTI     -24. VTI {} @ 125.9050 USD
Assets:US:Schwab:Cash         3021.65 USD
  Income:US:Schwab:PnL

Thanks
Ghanashyam
--
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/468a55fc-a2da-4bce-8279-ec4fb3f39f92n%40googlegroups.com 
.


--
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/f17508b6-1a25-fe8e-93ef-93017dd7c274%40ch.tario.org.


Re: looking up prices by ISIN [Was: bean-price has now moved to https://github.com/beancount/beanprice]

2020-07-26 Thread 'Patrick Ruckstuhl' via Beancount

Hi Stefano,

It's unfortunately quite painful to find free pricing information for 
stocks and etf.


I'm using https://www.alphavantage.co/ for some of it, but it got worse 
lately (the don't have Swiss Traded Stocks/ETF anymore).


What I now did was switch to take the prices from my broker (which 
provides an api) but this only works with credentials.



For currencies and crypto currencies it's easier as there are more 
public apis available for that.



My price sources are here https://github.com/tarioch/beancounttools


Regards,

Patrick


On 26.07.2020 10:36, Stefano Zacchiroli wrote:

This announcement by Martin made me look again into bean-price (at the
moment I'm using horrible hand-written scrapers for my bank websites).

What I'd be interested in is (1) a service that allow to fetch prices
based on ISINs (as in:
https://en.wikipedia.org/wiki/International_Securities_Identification_Number
) and (2) a bean-price data source for it.

(2) would be trivial to add, but I haven't found a solution for (1) yet.
It seems that neither Google Finance nor Yahoo Finance offer that
service, although I found that very surprising.

Does anyone know of a (free) service allowing to lookup current prices
by ISIN?

Thanks in advance,
Cheers

On Sat, Jul 25, 2020 at 01:14:36PM -0400, Martin Blais wrote:

Hi,
As discussed prior on this mailing-list, bean-price has now moved away from
the beancount repository to a new repository under the same umbrella
organization:

https://github.com/beancount/beanprice

The code has been removed from beancount/master, yet it lingers in
beancount/v2 (where the plan is to minimize disruption).
All new tickets related to bean-price will be redirected to this new
repository; existing tickets in Beancount will be migrated.

New price sources are welcome into the new repo. Barrier to entry is a bit
lower (since I'm not planning to do all the maintenance work myself),
basically if you can write unit tests for a new price source that call both
the latest and historical functions (without actually making requests to
the network), compliant with the API and the style guide, your new price
source is likely welcome, send a PR. This may be a good time to consolidate
some of your custom price sources into one place if you want.

Note that in terms of code dependencies bean-price still depends on
beancount.ops.find_prices, where routines to enumerate commodities for
price enumeration remain. I plan to keep maintaining code the enumerates
prices required from a Beancount ledger there, as they are purely
processing Beancount directives. If they need to be extended for
bean-price, patches are welcome. I'm not too sure how importing from the v3
Bazel build will work yet, but I've kept the BUILD files for now, as they
will perhaps become necessary when the C++ build becomes the norm there.

Note that the new beanprice repo could be extended to work for Ledger and
HLedger as well; after all, the output is just text to be inserted in one's
ledger file, and only a change of output syntax.

--
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%2BhO98B71fjdp6RmH5z2e9-aSGntrJjnzceSesEkavavurA%40mail.gmail.com.


--
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/0255ed13-ce1c-1f78-40d5-239736bbb4fd%40ch.tario.org.


Re: Beancount v3

2020-07-04 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

I have to say I really like the vision and I see a lot of good ideas and points 
in there.

A couple of thoughts from my side.

I think splitting this up into different projects will be helpful and allow 
easier contributions. I think we should also have some "packaging" of the 
different parts together as a "distribution" for "pure users" e.g. as a docker 
container or maybe other formats.

I see a danger of trying to do too much. If possible I would try to have a 
smaller first step that converts over to the new architecture/project setup and 
then tries to add new and additional features.

Regards,
Patrick

On July 4, 2020 8:34:35 AM GMT+02:00, Martin Blais  wrote:
>Hi,
>Today I'm starting development on Beancount v3.
>
>This is going to be a pretty big change and will take a while.
>I've laid down the details in this document:
>https://docs.google.com/document/d/1qPdNXaz5zuDQ8M9uoZFyyFis7hA0G55BEfhWhrVBsfc/
>
>
>This file describes the new set of dependencies for it:
>https://docs.google.com/document/d/10R-msZljuqFY8nckUnR1jVxMX1ol7rJUCMZo7w7QUQs/
>
>
>And there is a dedicated installation file for the in-development version:
>https://docs.google.com/document/d/1WwZYqsp28Uuk5eFqHQ1u1zqdjghymy8S_Yo-OJENoa4/
>
>
>The short version is that v3's core is going to be ported to C++ using a
>Bazel build, and the codebase will be sectioned between core and the rest.
>I just merged the new build definition in master.
>
>The current head will be branched as "v2" and maintained stable.
>It will build with both setup.py and Bazel.
>Backward compatible fixes to it will be done there and merged into v3.
>v3 development will occur on branch "master" and breaking changes will
>occur there.
>
>Comments appreciated (on the docs, or here if you prefer),
>
>-- 
>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%2BhOvJGCG%2B2DORWHV73wDABP9oNYAS_6oijzd6fGV-mPKZA%40mail.gmail.com.

-- 
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/EA089F2D-4F0C-4542-B1F9-C36C4B611239%40ch.tario.org.


Re: importers and get going

2020-06-24 Thread 'Patrick Ruckstuhl' via Beancount

Hi Jonathan,

Q1

I would say whenever you have both (or more) sides of a transactions 
then it's the best to import all legs. The thing is that in most cases 
you don't have them. On thing that I also do quite often is, that if I 
can import both sides of a transaction form two different sources (e.g. 
two different banks), then I use the transaction ids of each bank to add 
them to the same transaction, so I know that I have it imported from 
both sides.



Q2

Not sure if you've come across smart importer 
https://github.com/beancount/smart_importer, this is a wrapper around 
your importer that uses existing transactions to guess what the missing 
other leg could be. For me this works extremely well.


I use it together with the web ui fava https://github.com/beancount/fava

when you then run an importer you get basically the list of all your 
transactions and you can still modify if the smart importer guess wrong.


What I also started doing more and more (and also works quite nicely), 
is to actually not even have a file to import but instead directly use 
an available api (e.g. truelayer, revolut, transferwise, interactive 
brokers, ...), you can see some examples in my beancounttools 
https://github.com/tarioch/beancounttools



Q3

There were some enhancements done for hooks: 
https://github.com/beancount/beancount/issues/458



Regards,

Patrick



On 25.06.2020 07:15, Jonathan Goldman wrote:

Hi,

I have done a bunch of exploration of beancount over the last few 
months and really like its capabilities and now ready to get serious 
about getting it working for me. So far this is what I have done:


  * Used the sample files to familiarize myself with the commands and
beancount's capabilities.
  * Created accounts and manually entered some real data for my
personal finances.
  * Tried this 
sem-auto-categorization web-based import tool. It's good but I
think I'll mostly go the manual route.
  * Tried various import methods
  o Tried importing a quicken file...have had some trouble with this.
  o Tried a csv2ofx  tool
  o Used reds_importers


for Vanguard. This has worked successfully. This generates
output that has two-sided.
  o Wrote my own csv importer for my bank that is based on this
csv


importer.. (I'm not a software engineer by training so this
took me some time but I'm very happy with this now and
understand the code much more). This generates output that is
only one-sided.

My own conclusion is that I want go the route suggested by Martin and 
effectively have my own importers for each source and with text-based 
editor with auto-completion do the categorization. For the brokerages 
there are a limited number of accounts/categories you can have so 
doing the two-sided entry can be done here so it is 
auto-categorization if you will. (e.g. dividends from account xyz 
always go to this income account, etc). For credit cards and banks it 
rarely helps as there are so many expense categories.**Perhaps a 
subset (e.g. interest income from the bank can be autocategorized or 
mortgage payment of specific amount) can be automated.

*
*
*Q1. Is doing two-side entry for brokerages and single-side for 
banks/credit cards a good approach the general practice that most here 
use? *
*Q2. Is there other import approaches to consider? I think I'm finding 
this the hardest part to get going on and that is why other tools like 
Quicken/Mint/GnuCash are easier to get going. So not sure how, but 
perhaps data collection and import is something already solved that is 
not beancount specific?*

*
*
I also noticed that Martin mentioned this in the import documentation 
:


A list of things I’d really want to add, beyond fortifying what’s
already there:

 *

A generic, configurable CSV importer which you can
instantiate. I plan to play with this a bit and build a
sniffer that could automatically figure out the role of each
column.

 *

A hook to allow you to register a callback for post-processing
transactions that works across all importers.


*Q3. Is there any update/development on these two items?*

thanks,
Jonathan
--
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 

Re: account structure for spouse and children

2020-05-31 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


I'm actually separating it at the root level. e.g. I have


Assets:Joint:US:Fidelity:Brokerage
Assets:Spouse1:US:Fidelity:HSA
Assets:Spouse2:US:Fidelity:HSA


I haven have income/expenses tracked that way


Income:Joint:Food
Income:Spouse1:BankFees
Income:Spouse2:BankFees


That way I can with a simple prefix where statement limit it.


Regards,

Patrick

On 31.05.2020 09:10, Jonathan Goldman wrote:
I saw in the cookbook 
 
document this mention of how to organize accounts:



Over time, I’ve iterated over many ways of defining my account
names and I have converged to the following convention for Assets,
Liabilities, and Income accounts: Type : Country : Institution :
Account : SubAccount

My question is what are recommendations for handling spouse accounts 
and children. Specifically, if you have a spouse and kid and have IRAs 
or HSAs what is the a good structure to follow?

Suppose these are the accounts you have:
Asset:US:Fidelity:Brokerage:...(joint)
Asset:US:Fidelity:HSA:Spouse1
Asset:US:Fidelity:HSA:Spouse2
Asset:US:Fidelity:IRA:Spouse1
Asset:US:Fidelity:IRA:Spouse2
Asset:US:Fidelity:529:Child1
Asset:US:Fidelity:529:Child2
Asset:US:Schwab:IRA:Spouse1
Asset:US:Schwab:IRA:Spouse2
I can imagine one kind of analysis is to aggregate by IRA and spouse 
but maybe not include children and look across institutions. This is 
possible with the right SQL query but just wondering if this structure 
is ok or if there is a better/simpler structure when building accounts 
to track all finances for a family.

thanks in advance!

--
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/396e3d7b-f9d0-4955-86a4-0498a2f5ca2f%40googlegroups.com 
.


--
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/170a38cb-368c-0b83-458a-1ff7a470f3b6%40ch.tario.org.


Re: Beancount Revisited

2020-05-19 Thread 'Patrick Ruckstuhl' via Beancount

On 19.05.2020 15:44, Justus Pendleton wrote:

On Sunday, May 17, 2020 at 10:01:12 AM UTC+7, Runar Petursson wrote:

My real mental block was around how to organize my beans.  Single
file? Where do I put new transactions? What about staging
transactions from imports? Auto-match/tag/payee?  What about
other entities (wholly owned companies, partially owned
companies).  How would I track passive income, trading income
etc.  There seem to be about as many workflows as users.


I have things split into multiple files. When I first started I saw 
that beancount supported that and it appealed to my OCDness along with 
vague "well, I wouldn't put all my source code in a single file..." 
feelings.


I mostly regret it. Beancount has a few admittedly work-aroundable 
unresolved bugs around supporting multiple files (like plugins having 
to be defined in the main file; options have to be redefined in every 
sub-file; possibly others since per Martin's own statement "File 
includes were bolted on as per a quick request a long time ago") and 
most 3rd party tooling definitely doesn't understand the concept and 
won't work as expected. The sub-files have no reference to the 
containing file. So any file-centric tooling will struggle to figure 
out what is going on.


As an example: say you have main.bean, accounts.bean, 
commodities.bean, prices.bean, and balance-statements.bean. If you 
open up balance-statements.bean in an editor it won't find any 
open/close statements and won't be able to provide any tooling 
support. Open up prices.bean and it won't find any commodity statements.


Worse, you have to understand enough about beancount to know that this 
kind of multiple-file approach is a bad idea and why your editor isn't 
working the way you think it should. Luckily, beancount makes thing 
easy to move around, so this isn't exactly the end of the world.


There is something theoretically appealing about having each 
automated/external data source going into its own file. Yahoo prices 
quote go here; IBKR imports go there. But it doesn't actually matter 
in practice and the downside is running into some corner case issue in 
beancount or external tooling with multiple files.


In practice, I think just using code folding is easier & better than 
splitting things into multiple files. If there were a "smart" 
beancount file sorter (that kept comments and whatnot) it would make 
this approach even better. I've been meaning to write something like 
that for a long time and justhaven't.




I'm splitting up things quite a bit and it works quite well for me.

I have lots of automatic price updates which get written into an own 
file each and also most importers use their own file.


Fava works very well with multiple files and it has support for 
automatically placing new transactions in the correct file.



Regards,

Patrick

--
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/edd00740-b6fb-eefc-9c01-6cc8e1c4aafe%40ch.tario.org.


Re: Categorizing transactions automatically on import

2020-04-09 Thread 'Patrick Ruckstuhl' via Beancount

H

On 09.04.2020 12:20, Martin Michlmayr wrote:

* Stefano Zacchiroli  [2020-04-09 11:13]:

It can also be a wrapper class around any importer that turns a
"dumb" importer into a "smart" one, that enriches transactions as
you please.

Is that what you're looking for here?

Right, this is exactly what I'm trying to do.  Write a wrapper so
I can do:

CONFIG = [
 mywrapper(ofx.Importer('1234', 'Assets:ABC')),
...

and then mywrapper would exactly act like any importer (i.e. it would
just call the original importer) except that extract() would first
call the original importer and then iterate over the entries and
fix them up.

I'm sure this is basic Python stuff but unfortunately I can't figure
out how to do it.  Has anyone done this and can give an example of
such a wrapper?



In smart importer it's done in 
https://github.com/beancount/smart_importer/blob/master/smart_importer/hooks.py



and then applied like this in the import config


apply_hooks(my_bank_importer, [PredictPostings(), PredictPayees()])


Where the hooks PredictPostings and PredictPayees extend the 
ImporterHook and implement def__call__(self, importer, file, 
imported_entries, existing_entries):


Regards,

Patrick

--
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/4f6b9a67-ec49-fad4-9d42-8d59eaab5f2e%40ch.tario.org.


Re: Categorizing transactions automatically on import

2020-04-08 Thread 'Patrick Ruckstuhl' via Beancount
Hi Martin,

Smart importer works by learning from your existing transactions. You configure 
it as an wrapper around your importers.

The workflow I'm using is to run my importers through fava. That way I see the 
new trx and can adjust them if needed and afterwards they are placed in the 
right location in the right file based on favas config.

If you want to do it just from the cmd line you need to run bean-extract with 
the option to pass your existing beancount file so smart importer can use it to 
train its model.

Regards,
Patrick

On April 9, 2020 4:15:23 AM GMT+02:00, Martin Michlmayr  wrote:
>The "Importing External Data in Beancount" document says:
>
>"Beancount does not currently provide a mechanism to automatically
>categorize transactions. You can build this into your importer code. I
>want to provide a hook for the user to register a completion function
>that could run across all the importers where you could hook that code
>in."
>
>I have several importer scripts now that work as as well as
>beancount's OFX import, but I'd like to assign account names, payees,
>narrations and meta-data automatically.
>
>At the moment I pipe the output of bean-extract to a Perl file to
>add the data, but there must be a better way.
>
>What would be an elegant way to wrap the importers into code that
>can run over the entries and improve the transactions?
>
>I looked at some importers on GitHub and I haven't seen anything.
>I believe smart_importer does something like that, but I couldn't
>figure out how it works or how I could do the same (without
>smart_importer). (My Python isn't fantastic.)
>

-- 
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/75B0729A-3B19-4525-A702-7BA04AA9E403%40ch.tario.org.


Re: Split yearly bill to monthly: scheduled transactions? chronjob?

2020-04-03 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


I created an importer for this in my tools 
https://github.com/tarioch/beancounttools



Works also together with fava. Basically whenever you run it it will add 
the missing transactions.



Regards,

Patrick

On 03.04.2020 09:25, nug get wrote:

Dear all,
does beancount have a scheduled transaction creator or has anyone 
implemented something like it? For example a chronjob that inserts 
some predefined transaction every first day of the month?


I'd like to smooth out yearly bills over the 12 months, like in the 
following way:


2020-01-01 * "Insuerer" "Health insurance"
Expenses:Medical:HealthInsurance  300.00 CHF ; 3600 per year
Liabilities:HealthInsurance
2020-02-01 * "Insuerer" "Health insurance"
Expenses:Medical:HealthInsurance  300.00 CHF ; 3600 per year
Liabilities:HealthInsurance
...
; when Bill is due
2020-12-01 * "Insuerer" "Health insurance bill"
Assets:Checkings    -3600.00 CHF
Liabilities:HealthInsurance


and for this generate the according transaction at a specific point in 
time.


Any ideas/ working examples?

--
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/df2f259b-1f4d-4c86-80fa-0e048265ed25%40googlegroups.com 
.


--
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/e5140daa-3f11-9665-fa26-391ed47ef624%40ch.tario.org.


Re: BQL query for transfers between assets?

2019-12-29 Thread 'Patrick Ruckstuhl' via Beancount
What I've done before that might work in your case is something like

where joinstr(other_accounts) ~ ".*;Foo"

Basically use a regexp against the joined string of the other accounts.

On December 29, 2019 11:35:07 AM GMT+01:00, Red S  wrote:
>Could you replace "X in other_accounts" with "number > 0"?
>

-- 
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/853DCCA4-B50D-48CC-B6B2-60C01B3769D5%40ch.tario.org.


Re: Docker container for beacount

2019-12-20 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


are you using "Docker desktop" (requires win10 professional) or the 
(old) "Docker Toolbox" which also runs on windows 10 home edition.


I've had issues with docker toolbox where I then needed to use the ip 
address that is used in the virtualbox (|192.168.99.100|) instead of 
localhost


Regards,

Patrick

On 20.12.2019 14:59, nug get wrote:
I am not able to see the fava frontend on my host system's (win10) 
browser (firefox) on http://localhost:5000/:


|>>docker run -v hostPath:/containerPath --publish 5000:5000 
mybeanimage:v1|

>>[...] [shelling into the container] [...]
>>Running Fava on http://localhost:5000


did anyone have similar problems? anyone solved them or found a 
workaround?

https://forums.docker.com/t/docker-container-on-windows-host-system-how-to-access-mapped-ports/86034

Thanks!
-nugget

On Wednesday, 27 November 2019 08:42:48 UTC+1, yegle wrote:

If you are looking for something more compact/properly versioned,
you can try https://hub.docker.com/r/yegle/fava


On Tue, Nov 26, 2019 at 2:25 PM Jason Chu > wrote:

Check out
https://github.com/beancount/fava/tree/master/contrib/docker
 .
It should have everything you need.

On Tue, Nov 26, 2019 at 11:12 AM nug get > wrote:

Hello,
is there a "official standard docker container" around
here, or could someone set it up, such that I just plug it
in and have everything installed?
This would circumvent all the hassle i had and still having.

It should contain all the beancount and related ackages
like the importers, fava, etc.
Thanks!
-- 
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 bean...@googlegroups.com
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/beancount/3b13da18-cf72-470e-88fb-7c52a1bc9829%40googlegroups.com

.

-- 
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 bean...@googlegroups.com .
To view this discussion on the web visit

https://groups.google.com/d/msgid/beancount/CAFFHUgsEJg_09we6rVDkv48bA%3DHKxy%3D5irYPxK%3DN06t9jyU%3DDw%40mail.gmail.com

.



-- 
Yuchen Ying

https://about.me/yegle

--
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/fff1f5f2-70bc-4f53-8c62-3a9a37c97de0%40googlegroups.com 
.


--
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/aae7c428-163a-4f7d-6913-c89963c39f47%40ch.tario.org.


Track cost/value of external portfolio

2019-12-16 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

I'm looking at how I can track an "external" portfolio in an easy way. With 
external I mean that I can add money to it and see it's current total value but 
not dig into the details of how it is invested.

For example:

today put 6000CHF into it, worth is 6000CHF

tomorrow total worth is 7000CHF and cost 6000CHF

day after put 500CHF into it, worth is now 7500CHF, cost 6500CHF

Is there a good way to track this? If possible I would like to reflect cost as 
cost and value as price but I don't see how that would work with the additional 
deposits.

Thanks and regards,
Patrick

-- 
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/43c99c3d-811a-42ca-a4e6-db25a57bf8c1%40googlegroups.com.


Re: Release my plugins/importers to github and pypi

2019-12-09 Thread 'Patrick Ruckstuhl' via Beancount
Hi Dan,

I can choose between pdf and csv when I get the monthly statement.

Regards,
Patrick

On December 9, 2019 7:53:10 PM GMT+01:00, Daniele Nicolodi  
wrote:
>On 08-12-2019 13:52, 'Patrick Ruckstuhl' via Beancount wrote:
>> Hi,
>> 
>> I just release a first version of my plugins, price fetchers and
>> importers to github and pypi. Maybe they might be useful for someone
>> else as well
>
>Hello Patrick,
>
>how do you obtain a CSV data export from Transfewrwise? The last time I
>looked closely (a few months ago) the only data I could get were a PDF
>statement for the individual transactions. Are the CVS files relative to
>something else than Transferwise "bank transfers"?
>
>Thank you!
>
>Cheers,
>Dan
>

-- 
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/BB44F67B-89D3-4F8F-9E71-4760A5CE8325%40ch.tario.org.


Release my plugins/importers to github and pypi

2019-12-08 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

I just release a first version of my plugins, price fetchers and 
importers to github and pypi. Maybe they might be useful for someone 
else as well



https://pypi.org/project/tariochbctools/

https://github.com/tarioch/beancounttools


Regards,

Patrick

--
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/7dd37ea1-aeea-b26d-2b01-12c7a0ab6853%40ch.tario.org.


Re: Revolut Creditcard - Statement (CSV) Importer?

2019-11-16 Thread 'Patrick Ruckstuhl' via Beancount
Sure, should be possible to do that. I'm using smart importer 
(https://github.com/beancount/smart_importer) for that.


It's assigning the right accounts based on existing data.


On 16.11.2019 18:10, mrbur...@gmail.com wrote:

Thanks :)

It works now ( bean-extract config.py Revolut-CHF.myname.csv) with 
this config.py:


import os, sys

# beancount doesn't run from this directory
sys.path.append(os.path.dirname(__file__))

# importers located in the importers directory
from importers import revolut

CONFIG = [
    revolut.Importer('/Revolut-CHF.*\.csv', 
'Assets:MyName:Liquidity:Revolut:CHF', 'CHF'),

]

Would it be possible the use some regex to change the category if in 
the revolut statement is a description with "*Restaurant *"?


Thanks for the help:)


On Saturday, November 16, 2019 at 5:03:15 PM UTC+1, Patrick Ruckstuhl 
wrote:


Hi,


sure. I'm using smart_importer so you can leave that out if you
don't use it


import sys
from os import path
sys.path.insert(0, path.join(path.dirname(__file__)))

from importers.revolut import importer as revolutimp

from beancount.ingest import extract
from smart_importer import apply_hooks, PredictPostings
from smart_importer.detector import DuplicateDetector

CONFIG = [
    apply_hooks(revolutimp.Importer('/Revolut-CHF.*\.csv',
'Assets:Patrick:Liquidity:Revolut:CHF', 'CHF'),
[PredictPostings(), DuplicateDetector()]),
    apply_hooks(revolutimp.Importer('/Revolut-GBP.*\.csv',
'Assets:Patrick:Liquidity:Revolut:GBP', 'GBP'),
[PredictPostings(), DuplicateDetector()]),
    apply_hooks(revolutimp.Importer('/Revolut-USD.*\.csv',
'Assets:Patrick:Liquidity:Revolut:USD', 'USD'),
[PredictPostings(), DuplicateDetector()]),
    apply_hooks(revolutimp.Importer('/Revolut-EUR.*\.csv',
'Assets:Patrick:Liquidity:Revolut:EUR', 'EUR'),
[PredictPostings(), DuplicateDetector()]),
    ]

extract.HEADER = ''


On 16.11.2019 16:52, mrbu...@gmail.com  wrote:

Thanks :)
This is for "bean-extract", right?
Can you also provide me the correct entry for the config.py?



On Saturday, November 16, 2019 at 3:58:14 PM UTC+1, Patrick
Ruckstuhl wrote:

Hi,


That's what I'm currently using. It stores original values as
meta information in original key and conversions as
originalIn and originalOut

|
||from dateutil.parser import parse
from io import StringIO

from beancount.ingest import importer
from beancount.core import data
from beancount.core import amount
from beancount.core.number import D
from beancount.ingest.importers.mixins import identifier

import csv

class Importer(identifier.IdentifyMixin,
importer.ImporterProtocol):
    """An importer for Revolut CSV files."""

    def __init__(self, regexps, account, currency):
    identifier.IdentifyMixin.__init__(self, matchers=[
    ('filename', regexps)
    ])
    self.account = account
    self.currency = currency

    def name(self):
    return super().name() + self.account

    def file_account(self, file):
    return self.account

    def extract(self, file, existing_entries):
    entries = []

    with StringIO(file.contents()) as csvfile:
    reader = csv.DictReader(csvfile, ['Date',
'Reference','PaidOut', 'PaidIn', 'ExchangeOut', 'ExchangeIn',
'Balance', 'Category', 'Notes'], delimiter=';',
skipinitialspace=True)
    next(reader)
    for row in reader:
    metakv = {
    'category': row['Category'].strip(),
    }
    exchangeIn = row['ExchangeIn'].strip()
    exchangeOut = row['ExchangeOut'].strip()
    if exchangeIn and exchangeOut:
    metakv['originalIn'] = exchangeIn
    metakv['originalOut'] = exchangeOut
    elif exchangeIn:
    metakv['original'] = exchangeIn
    elif exchangeOut:
    metakv['original'] = exchangeOut

    meta = data.new_metadata(file.name
, 0, metakv)
    entry = data.Transaction(
    meta,
    parse(row['Date'].strip()).date(),
    '*',
    '',
    (row['Reference'].strip() + ' ' +
row['Notes'].strip()).strip(),
    data.EMPTY_SET,
    data.EMPTY_SET,
    [
    data.Posting(self.account,
  

Re: Revolut Creditcard - Statement (CSV) Importer?

2019-11-16 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


sure. I'm using smart_importer so you can leave that out if you don't use it


import sys
from os import path
sys.path.insert(0, path.join(path.dirname(__file__)))

from importers.revolut import importer as revolutimp

from beancount.ingest import extract
from smart_importer import apply_hooks, PredictPostings
from smart_importer.detector import DuplicateDetector

CONFIG = [
    apply_hooks(revolutimp.Importer('/Revolut-CHF.*\.csv', 
'Assets:Patrick:Liquidity:Revolut:CHF', 'CHF'), [PredictPostings(), 
DuplicateDetector()]),
    apply_hooks(revolutimp.Importer('/Revolut-GBP.*\.csv', 
'Assets:Patrick:Liquidity:Revolut:GBP', 'GBP'), [PredictPostings(), 
DuplicateDetector()]),
    apply_hooks(revolutimp.Importer('/Revolut-USD.*\.csv', 
'Assets:Patrick:Liquidity:Revolut:USD', 'USD'), [PredictPostings(), 
DuplicateDetector()]),
    apply_hooks(revolutimp.Importer('/Revolut-EUR.*\.csv', 
'Assets:Patrick:Liquidity:Revolut:EUR', 'EUR'), [PredictPostings(), 
DuplicateDetector()]),

    ]

extract.HEADER = ''


On 16.11.2019 16:52, mrbur...@gmail.com wrote:

Thanks :)
This is for "bean-extract", right?
Can you also provide me the correct entry for the config.py?



On Saturday, November 16, 2019 at 3:58:14 PM UTC+1, Patrick Ruckstuhl 
wrote:


Hi,


That's what I'm currently using. It stores original values as meta
information in original key and conversions as originalIn and
originalOut

|
||from dateutil.parser import parse
from io import StringIO

from beancount.ingest import importer
from beancount.core import data
from beancount.core import amount
from beancount.core.number import D
from beancount.ingest.importers.mixins import identifier

import csv

class Importer(identifier.IdentifyMixin, importer.ImporterProtocol):
    """An importer for Revolut CSV files."""

    def __init__(self, regexps, account, currency):
    identifier.IdentifyMixin.__init__(self, matchers=[
    ('filename', regexps)
    ])
    self.account = account
    self.currency = currency

    def name(self):
    return super().name() + self.account

    def file_account(self, file):
    return self.account

    def extract(self, file, existing_entries):
    entries = []

    with StringIO(file.contents()) as csvfile:
    reader = csv.DictReader(csvfile, ['Date',
'Reference','PaidOut', 'PaidIn', 'ExchangeOut', 'ExchangeIn',
'Balance', 'Category', 'Notes'], delimiter=';', skipinitialspace=True)
    next(reader)
    for row in reader:
    metakv = {
    'category': row['Category'].strip(),
    }
    exchangeIn = row['ExchangeIn'].strip()
    exchangeOut = row['ExchangeOut'].strip()
    if exchangeIn and exchangeOut:
    metakv['originalIn'] = exchangeIn
    metakv['originalOut'] = exchangeOut
    elif exchangeIn:
    metakv['original'] = exchangeIn
    elif exchangeOut:
    metakv['original'] = exchangeOut

    meta = data.new_metadata(file.name
, 0, metakv)
    entry = data.Transaction(
    meta,
    parse(row['Date'].strip()).date(),
    '*',
    '',
    (row['Reference'].strip() + ' ' +
row['Notes'].strip()).strip(),
    data.EMPTY_SET,
    data.EMPTY_SET,
    [
    data.Posting(self.account,
amount.Amount(D(row['PaidIn'].strip()) -
D(row['PaidOut'].strip()), self.currency), None, None, None, None),
    ]
    )
    entries.append(entry)
    return entries
|


On 16.11.2019 14:45, mrbu...@gmail.com  wrote:

Hi

Does anybody has a Revolut statement (csv) parser to import the
transactions to beancounts?

Example rows:

Completed Date ; Description ; Paid Out (CHF) ; Paid In (CHF) ;
Exchange Out; Exchange In; Balance (CHF); Category; Notes
Nov 16, 2019 ; Top-Up by *8753  ;  ; 600.00 ;  ;  ; 703.83; general;
Nov 16, 2019 ; Paypal *collintanaw FX Rate Fr1 = US$1.0066 ;
403.30 ;  ;  USD 405.96 ;  ; 103.83; services;

Thanks for help :)
-- 
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 bean...@googlegroups.com .
To view this discussion on the web visit

https://groups.google.com/d/msgid/beancount/90613531-9c08-45a5-8dfc-7be50029c224%40googlegroups.com


Re: Revolut Creditcard - Statement (CSV) Importer?

2019-11-16 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


That's what I'm currently using. It stores original values as meta 
information in original key and conversions as originalIn and originalOut


|
||from dateutil.parser import parse
from io import StringIO

from beancount.ingest import importer
from beancount.core import data
from beancount.core import amount
from beancount.core.number import D
from beancount.ingest.importers.mixins import identifier

import csv

class Importer(identifier.IdentifyMixin, importer.ImporterProtocol):
    """An importer for Revolut CSV files."""

    def __init__(self, regexps, account, currency):
    identifier.IdentifyMixin.__init__(self, matchers=[
    ('filename', regexps)
    ])
    self.account = account
    self.currency = currency

    def name(self):
    return super().name() + self.account

    def file_account(self, file):
    return self.account

    def extract(self, file, existing_entries):
    entries = []

    with StringIO(file.contents()) as csvfile:
    reader = csv.DictReader(csvfile, ['Date', 
'Reference','PaidOut', 'PaidIn', 'ExchangeOut', 'ExchangeIn', 'Balance', 
'Category', 'Notes'], delimiter=';', skipinitialspace=True)

    next(reader)
    for row in reader:
    metakv = {
    'category': row['Category'].strip(),
    }
    exchangeIn = row['ExchangeIn'].strip()
    exchangeOut = row['ExchangeOut'].strip()
    if exchangeIn and exchangeOut:
    metakv['originalIn'] = exchangeIn
    metakv['originalOut'] = exchangeOut
    elif exchangeIn:
    metakv['original'] = exchangeIn
    elif exchangeOut:
    metakv['original'] = exchangeOut

    meta = data.new_metadata(file.name, 0, metakv)
    entry = data.Transaction(
    meta,
    parse(row['Date'].strip()).date(),
    '*',
    '',
    (row['Reference'].strip() + ' ' + 
row['Notes'].strip()).strip(),

    data.EMPTY_SET,
    data.EMPTY_SET,
    [
    data.Posting(self.account, 
amount.Amount(D(row['PaidIn'].strip()) - D(row['PaidOut'].strip()), 
self.currency), None, None, None, None),

    ]
    )
    entries.append(entry)
    return entries
|


On 16.11.2019 14:45, mrbur...@gmail.com wrote:

Hi

Does anybody has a Revolut statement (csv) parser to import the 
transactions to beancounts?


Example rows:

Completed Date ; Description ; Paid Out (CHF) ; Paid In (CHF) ; 
Exchange Out; Exchange In; Balance (CHF); Category; Notes

Nov 16, 2019 ; Top-Up by *8753  ;  ; 600.00 ;  ;  ; 703.83; general;
Nov 16, 2019 ; Paypal *collintanaw FX Rate Fr1 = US$1.0066 ; 403.30 ;  
;  USD 405.96 ;  ; 103.83; services;


Thanks for help :)
--
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/90613531-9c08-45a5-8dfc-7be50029c224%40googlegroups.com 
.


--
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/a586c6b4-e090-c6f5-1775-9f315b541575%40ch.tario.org.


Re: Booking Company Reimbursements from a Pre-Loaded Debit Card

2019-06-30 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

the bookings should be between 

Assets:US:Hooli:CommuterDebitCard

and your receivable account. As this wasn't an expense for you. Basically it's 
moving from one kind of assets (money on your card) to another kind of assets 
(money you should receive from your company).

Regards,
Patrick


On July 1, 2019 3:47:40 AM GMT+02:00, Scott Colby  wrote:
>I am able to be reimbursed for the costs of public transit through my 
>company. This is done in two manners, either by direct reimbursement in
>my 
>paycheck or a pre-loaded debit card. I utilized the former option for
>the 
>first couple months until the debit card was issued to me.
>
>What kind of account should I use for the "expense" leg of the public 
>transit purchases? I've previously booked public transit costs under 
>`Expenses:Travel:PublicTransit`, but in this case this isn't my
>expense, 
>it's my company's.
>
>Below is an example of my beancount file. The two legs marked with
>`<--` 
>are those I have questions about.
>
>2019-01-01 open Income:US:Hooli:Reimbursements:CommuterBenefit USD  ; 
>started work on New Years?
>
>2019-01-01 open Assets:AccountsReceivable:Hooli USD
>2019-03-01 open Assets:US:Hooli:CommuterDebitCard USD  ; finally got
>the 
>debit card in March
>
>2019-01-03 open Assets:US:MetroCardEsqueStoredValue USD  ; got my
>stored 
>value card a soon after starting work
>
>; the process of using a receivable for the reimbursement makes sense
>
>2019-01-03 * "Public Transit Authority" "card purchase and add value" ^
>commute-benefit-jan-19
>Assets:AccountsReceivable:Hooli 1.00 USD  ; the card cost $1
> Assets:US:MetroCardEsqueStoredValue 20.00 USD  ; and I added $20 to it
>Liabilities:MyCreditCard
>
>2019-01-11 * "Public Transit Authority" "bus fare 2019-01-03 --
>2019-01-11" 
>^commute-benefit-jan-19
>Assets:US:MetroCardEsqueStoredValue -20.00 USD
>Assets:AccountsReceivable:Hooli
>
>2019-01-20 * "Hooli Payroll" ^commute-benefit-jan-19
>Assets:US:MyBank:Checking 21.00 USD
>Assets:AccountsReceivable:Hooli
>; etc.
>
>; ...
>
>; however the process for using the debit card does not make sense to
>me at 
>the moment
>
>2019-03-01 * "Commuter Debit Card" "load of value"
>^commute-benefit-mar-19
>Assets:US:Hooli:CommuterDebitCard 100.00 USD
>Income:US:Hooli:Reimbursements:CommuterBenefit
>
>2019-03-01 * "Public Transit Authority" "add value"
>^commute-benefit-mar-19
>Assets:US:MetroCardEsqueStoredValue 20.00 USD
>Assets:US:Hooli:CommuterDebitCard
>
>2019-03-08 * "Public Transit Authority" "bus fare 2019-03-01 --
>2019-03-08" 
>^commute-benefit-mar-19
>Assets:US:MetroCardEsqueStoredValue -20.00 USD
>Expenses:Travel:PublicTransit  ; <-- this is my question
>
>2019-03-10 * "Public Transit Authority" "bought weekly pass" ^commute-
>benefit-mar-19
>Assets:US:Hooli:CommuterDebitCard -15.00 USD
>Expenses:Travel:PublicTransit  ; <-- same question
>
>(I realize tracking the exact value on my transit card is a
>bit...pedantic 
>and, to be honest, I'm considering ignoring it entirely but now that
>I'm 
>wrestling with the problem of how to book these I'm interested in
>finding 
>out how to do so.)
>
>
>-- 
>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 post to this group, send email to beancount@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/beancount/bb010f55-1972-4d84-8d63-f3fa46fc7124%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/3BA77CC3-46E7-4D18-9439-021B85A49553%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: beancount.prices.sources.iex.IEXError: Invalid response (403): Forbidden

2019-06-19 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

sorry, I was not clear on this. I created my own plugin, it depends on 
an environment variable ALPHAVANTAGE_API_KEY and only supports latest price



from beancount.prices import source
import datetime
from dateutil import tz
from dateutil.parser import parse
from beancount.core.number import D
import requests
from os import environ
from time import sleep

class Source(source.Source):
    def get_latest_price(self, ticker):
    params = {
    'function': 'GLOBAL_QUOTE',
    'symbol': ticker,
    'apikey': environ['ALPHAVANTAGE_API_KEY'],
    }

    resp = requests.get(url='https://www.alphavantage.co/query', 
params=params)

    data = resp.json()
    if 'Note' in data:
    sleep(60)
    resp = 
requests.get(url='https://www.alphavantage.co/query', params=params)

    data = resp.json()

    priceData = data['Global Quote']

    price = D(priceData['05. price'])
    date = parse(priceData['07. latest trading day'])

    us_timezone = tz.gettz("Europe/Zurich")
    time = date.astimezone(us_timezone)
    return source.SourcePrice(price, time, 'USD')

    def get_historical_price(self, ticker, time):
    return None

On 19.06.2019 01:56, matthew.piz...@gmail.com wrote:
I don't see that in `beancount.prices.sources`. I only see `iex`, 
`oanda`, `quandl`, and `yahoo`. I'm on 2.2.1.


On Monday, June 17, 2019 at 2:10:03 PM UTC-4, Patrick Ruckstuhl wrote:

Hi,

On 17.06.2019 19:20, matthe...@gmail.com  wrote:
>
> What's the go-to price sources these days? I'm guessing that
Yahoo and
> Google sources don't work anymore. What should I migrate to?


I'm using https://www.alphavantage.co/ they have a free offering
and has
also data from different countries.


Regards,

Patrick


--
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 post to this group, send email to beancount@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/807e2284-fc44-4531-a4fd-5c0999d29b18%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/158c0a6b-5fec-54e6-2ae5-7672ad08ee29%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: beancount.prices.sources.iex.IEXError: Invalid response (403): Forbidden

2019-06-17 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

On 17.06.2019 19:20, matthew.piz...@gmail.com wrote:


What's the go-to price sources these days? I'm guessing that Yahoo and 
Google sources don't work anymore. What should I migrate to?



I'm using https://www.alphavantage.co/ they have a free offering and has 
also data from different countries.



Regards,

Patrick


--
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/e789bf7c-2397-43ef-2ac1-89c519bf83a4%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Separate files

2019-05-02 Thread 'Patrick Ruckstuhl' via Beancount

There's an include directive


1. include "subdir/file.beancount"

https://docs.google.com/document/d/1wAMVrKIA2qtRGmoVDSUBJGmYZSygUaR0uOMW1GV3YE0/edit#heading=h.86lelow4097r


Regards,

Patrick

On 02.05.2019 11:57, Alen Šiljak wrote:
You're right. I meant to ask, since looking at historical posts is a 
bit confusing, whether Beancount now supports multiple files and what 
is the correct syntax. Do the files need to be specified on the 
command line? Is there an include directive? If I split my exported 
file into several, how can I select which ones get loaded. That's 
basically the question. Thanks!


On Thursday, 2 May 2019 03:52:24 UTC+2, Justus Pendleton wrote:


On Thursday, May 2, 2019 at 8:07:37 AM UTC+7, Alen Šiljak wrote:

A quick question regarding the current statet of multiple (or
include) files and Beancount.


There's no actual question in your post that I can see.

I keep things split into 9 files, so if you have a question about
it, I'm happy to try to answer.

--
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 post to this group, send email to beancount@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/f946e5da-22fd-419b-aa72-8eed1b53f947%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/df6e9769-a55a-248c-61c5-54825aeb11e7%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Create a balance from the API

2019-05-02 Thread 'Patrick Ruckstuhl' via Beancount


On 02.05.2019 10:26, Florian Lindner wrote:

Hello,

I would like to create a balance assertion

-MM-DD balance Account  Amount

program,atically: 
https://aumayr.github.io/beancount-docs-static/api_reference/beancount.core.html#beancount.core.data.Balance


The parameter description in the API docs is only "Alias for field X". 
The source code reveals some more information:


# Attributes:
#   meta: See above.
#   date: See above.
#   account: A string, the account whose balance to check at the given 
date.

#   amount: An Amount, the number of units of the given currency you're
# expecting 'account' to have at this date.
#   diff_amount: None if the balance check succeeds. This value is set to
# an Amount instance if the balance fails, the amount of the 
difference.

#   tolerance: A Decimal object, the amount of tolerance to use in the
# verification.
Balance = new_directive('Balance', [
    ('account', Account),
    ('amount', Amount),
    ('tolerance', Optional[Decimal]),
    ('diff_amount', Optional[Amount])])


Just omitting the optional arguments doesn't work and gives a TypeError.

Using this piece of code:

value = desc.split(" ")[-1]  # value = "1.522,43H"
sign = 1 if value[-1] == "H" else -1
units = sign * amount.Amount(D(value[:-1].replace(".", 
"").replace(",", ".")), "EUR")

print(units)
txn = data.Balance(meta,
   datetime.datetime.strptime(row["Datum/Zeit"], 
"%d.%m.%Y %H:%M").date(),

   account = self.file_account(),
   amount = units,
   tolerance = D(0), diff_amount = amount
    )

gives:

(Decimal('12415.79'), 'EUR')

Traceback (most recent call last):
  File "/usr/bin/bean-extract", line 4, in 
    from beancount.ingest.extract import main; main()
  File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", 
line 257, in main

    return scripts_utils.trampoline_to_ingest(sys.modules[__name__])
  File 
"/usr/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
line 174, in trampoline_to_ingest

    return run_import_script_and_ingest(parser)
  File 
"/usr/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
line 224, in run_import_script_and_ingest

    return ingest(importers_list)
  File 
"/usr/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
line 116, in ingest

    detect_duplicates_func=detect_duplicates_func)
  File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", 
line 252, in run

    detect_duplicates_func=detect_duplicates_func)
  File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", 
line 218, in extract

    print_extracted_entries(new_entries, output)
  File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", 
line 140, in print_extracted_entries

    entry_string = printer.format_entry(entry)
  File "/usr/lib/python3.7/site-packages/beancount/parser/printer.py", 
line 339, in format_entry

    return EntryPrinter(dcontext, render_weights)(entry)
  File "/usr/lib/python3.7/site-packages/beancount/parser/printer.py", 
line 117, in __call__

    method(obj, oss)
  File "/usr/lib/python3.7/site-packages/beancount/parser/printer.py", 
line 254, in Balance

    amount=entry.amount.to_string(self.dformat),
AttributeError: 'tuple' object has no attribute 'to_string'

when attached to the list of statements that is returned from the 
extract() function.


Also, I am obviosuly still having some problems crasping beancounts 
type system, esp. with optional parameters, like creating a transaction:


  txn = data.Transaction(meta, date, "*", payee, desc, set(), set(), [
    data.Posting("Assets:Checking", units, None, 
None, None, None),
    data.Posting("Expenses:Unknown", None, None, 
None, None, None)])


took me some time to find out, that I need to pass set() to some empty 
arguments, None to others.


My questions:

* How can I programmatically create a balance assertion?



Here's what I'm using

data.Balance(

    data.new_metadata(myFile, myLine),
    myDate,
    myAccount,
    amount.Amount(D(myAmount), myCurrency),
    None,
    None,
    )



* How do the parameters diff_amount and tolerance reflect in the 
produced statements? The balance statement does not seem to have these 
fields.


* What is the meaning of the diff_amount?

* And finally: Is there something I don't understand regarding 
beancount's API? So far, it feels a bit unpythonic.



Thanks a lot,
Florian

--
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 post to this group, send email to beancount@googlegroups.com 
.
To view this discussion on the web visit 

Re: Portfolio returns calculator

2019-04-21 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


another way (that I'm doing) is to link the interest/dividens to the 
security by a 0 amount transaction on the security, that way I can 
easily query them.



e.g.


2014-07-15 * "Dividend"
  Assets:Broker:FooStock   0 FooStock

  Assets:Broker:Liquidity   100 CHF

  Income:Interest  -100 CHF


and then I can fetch out the interest for FooStock by a query like


1. select
2. sum(number) as amount
3. from
4. has_account("Assets:Broker:FooStock")
5. where
6. account="Income:Interest" 



Regards,

Patrick

On 21.04.2019 18:54, Alen Šiljak wrote:
Why do you think it is over the top? Wouldn't that be the cleanest way 
to categorize the income?

The accounts are free.
In any case, this is a recommendation from GnuCash docs which I've 
been following and found it quite easy to track income per each 
security, and also to compare to the same security held at another broker.

On Monday, 21 January 2019 02:53:32 UTC+1, Justus Pendleton wrote:


Similarly, income like interest/dividends isn't explicitly
attributed to a security -- unless you go out of your way to make
separate income accounts for each security, which feels a bit
over-the-top.

--
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 post to this group, send email to beancount@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/4feea5ba-a8db-4ed8-a926-2eecef8e3e7b%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/c52eba85-864e-b0b0-15d7-6f077f960865%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Portfolio returns calculator

2019-01-20 Thread 'Patrick Ruckstuhl' via Beancount

Hi,


That looks very interesting. I'm doing something similar right now.

Two things that I found necessary/helpful:

* I have one interest account and I just tie it to the security by 
adding an empty posting.


e.g.

2015-01-22 * "Dividend"
  Assets:Investment:CHCORP   0 CHCORP
  Assets:Liquidity:CHF  20.00 CHF
  Income:Patrick:Interest   -20.00 CHF


That way I can tie all the flows together for CHCORP



* Another thing is to make sure to prevent transactions between 
different investments in the same transaction as this confuses my logic, 
so I'm preventing this by



import collections

from beancount.core import getters
from beancount.core import data

__plugins__ = ['check']

MixedInvestAssets = collections.namedtuple('MixedInvestAssets', 'source 
message entry')


def check(entries, options_map):
    errors = []

    commodity_map = getters.get_commodity_map(entries, create_missing=True)
    commodity_type_map = getters.get_values_meta(commodity_map, 'type')

    for entry in data.filter_txns(entries):
    ccys = set()
    for posting in entry.postings:
    ccy = posting.units.currency
    if commodity_type_map[ccy] == 'invest':
    ccys.add(ccy)

    if len(ccys) > 1:
    errors.append(MixedInvestAssets(
    entry.meta,
    "Transaction with two or more different investment 
postings",

    entry
    ))

    return entries, errors


Regards,

Patrick


On 19-Jan-19 05:22, Justus Pendleton wrote:
Here's my take at a script that will calculate the money-weighted 
return for a portfolio (i.e. the XIRR function in spreadsheets).


https://github.com/hoostus/portfolio-returns

All it does it output a single number -- the rate of return. The only 
real work this script does is crawl through beancount files and figure 
out what cashflows in & out of the account there were over the 
specified time period. Then it feeds those cashflows into an IRR 
calculation.


Here's the return over the past 1 year.

> python irr.py --account Assets:US:Vanguard:Roth --1year 
/Volumes/my_docs/beancount/my.beancount --internal 
Income:TaxFree:Dividends

0.72%

(Apparently not a fantastic year for my Roth IRA!)
Here's the return year-to-date.

> python irr.py --account Assets:US:Vanguard:Roth --ytd 
/Volumes/my_docs/beancount/my.beancount --internal 
Income:TaxFree:Dividends

115.86%

(All numbers are annualised, so even a tiny increase after 19 days 
results in a huge annual rate of return.)


It seems to work the way I expect on my own beancount file and a few 
other small test cases I put together. Feel free to email me or post 
here if you have problems, suggestions, etc.

--
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 post to this group, send email to beancount@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/bba922da-b960-480e-9e0c-9aececcf39b1%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/9616f1d1-e938-db10-a294-0f0541f9941a%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about price sources

2018-12-04 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

I'm now mostly done with the price imports. Thanks to the info you guys 
provided I think I'm able to solve my issues.


Maybe interesting for others could be the way I solved my "prices in 
base ccy" issue. I'm now going to store the price entries in the ccy as 
fetched from the price source and then created a very simple plugin, 
which takes that price, takes the fx rate and creates a new price entry 
in the base ccy.



Thanks again for the help,

Patrick


On 30-Nov-18 14:23, Justus Pendleton wrote:
On Thursday, November 29, 2018 at 10:09:22 PM UTC+7, Patrick Ruckstuhl 
wrote:


I would like to have a local price database. I do this with
beancount files with price directives. What I'm now looking at is
how to update this price files. They basically contain one entry
per day and are updated daily. But on a daily run it can return a
price date which already exists and I'm looking at a way to update
(or maybe ignore) that entry.


bean-price has a --clobber flag "Do not skip prices which are already 
present in input files; fetch them anyway." I'm not sure that's 
exactly what you're looking for, though. I think you'll need to write 
a script to what you're looking for.

--
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 post to this group, send email to beancount@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/fd11025b-ded6-481e-bd5c-868c58836e3c%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/b5c973e3-0c77-81ab-0496-840f4aa6b2de%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Roll-your-own importer?

2018-11-30 Thread 'Patrick Ruckstuhl' via Beancount



Probably also worth pointing out is that using the ingest framework allows to 
further share and reuse functionality.
E.g. smart predictions 
https://github.com/beancount/smart_importer

Or using importers through fava 
https://github.com/beancount/fava

On December 1, 2018 6:14:39 AM GMT+01:00, Jeremy Maitin-Shepard 
 wrote:
>Note: I also created an alternative importing framework (
>https://github.com/jbms/beancount-import) which operates under a
>somewhat
>different model and provides additional functionality, like a web
>interface, automatic prediction of the account, and matching against
>other
>transactions.
>
>On Fri, Nov 30, 2018 at 5:50 PM TF  wrote:
>
>> I have to admit, bean-import and accompanying modules have me a
>little
>> flummoxed. If I'm not mistaken, the idea is to take CSV and translate
>it
>> into beancount ledger entries.
>>
>> I'm pretty sure I could write a python script of my own to import and
>> convert entries and append them to my .beancount file. It wouldn't do
>any
>> of the math, but beancount does that; if I get errors, I'll fix them
>by
>> hand and/or adjust my importer. I could also have my importer move
>the
>> original documents to the correct directory to file it away.
>>
>> But am I missing something that I'd get from the usual approach?
>(Other
>> than unit testing -- I'd definitely lose that, but I don't fully
>understand
>> unit testing anyway; I'm a self-taught coder.)
>>
>> Thanks!
>>
>> --
>> 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 post to this group, send email to beancount@googlegroups.com.
>> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/beancount/c9c015f4-2741-41bc-8505-174e338661fe%40googlegroups.com
>>
>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/453F72E6-EAA2-4D92-BDB4-5867B15F7785%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about price sources

2018-11-29 Thread 'Patrick Ruckstuhl' via Beancount



On November 29, 2018 3:13:13 PM GMT+01:00, Martin Blais  wrote:
>On Thu, Nov 29, 2018 at 9:06 AM Justus Pendleton 
>wrote:
>
>> On Thursday, November 29, 2018 at 6:49:30 PM UTC+7, Patrick Ruckstuhl
>> wrote:
>>>
>>> Not really I'm accessing different markets which have different
>times and
>>> some don't have a price every day, so the price date might be a
>previous
>>> day.
>>>
>>
>> Sure, I do that, too. I'm still not seeing the problem. Run
>bean-price and
>> use the price at that time. Why does it matter if you store an
>intraday
>> price? What do you think happens when you buy or sell something in
>> beancount? The intraday price gets added to the price map. I don't
>think
>> beancount is really meant for use cases where the difference between
>the
>> price at 3pm and 4:30pm is material.
>>
>
>That's correct.
>(Well, the correct price will be attached to the Posting object, but
>for
>computing market value, there's one price/day.)
>
>
>Anyway, it is really bothers you to have intraday prices then wait a
>day,
>> or a week, and then use bean-price to get the prices from 2 or 3 days
>using
>> the -d parameter once everything is closed & finalized.
>>
>
>For intra-day values you can upload your portfolio contents to a google
>sheets doc and feed live prices.
>That's what I do.
>My code for it is located here (it's a little bit custom, you may need
>to
>add similar metadata fields):
>https://bitbucket.org/blais/beancount/src/tip/beancount/projects/export.py
>
>
>>
>> Or run bean-price twice a day (or four times a day) and only fetch
>prices
>> for markets that are closed when you run it.
>>
>> I'm honestly kind of struggling to understand what explicit support
>you're
>> looking for from bean-price here. Can you elaborate on that a bit?
>What's
>> the exact usage you envision from beancount?
>>
>
>I'm also a little bit confused.
>

Let my try to explain what I'm trying to do, 
maybe I'm looking at things wrongly.
I would like to have a local price database. I do this with beancount files 
with price directives. What I'm now looking at is how to update this price 
files. They basically contain one entry per day and are updated daily. But on a 
daily run it can return a price date which already exists and I'm looking at a 
way to update (or maybe ignore) that entry.

I would also like all the price directives be in my base ccy as this then 
allows me simple reports as I know that I have prices to base ccy for 
everything. Here the problem is that some price sources will return the price 
in another ccy and I have to first convert it into my base ccy before creating 
the price entry.

I can create a script which does all that thing, I wad just wondering if there 
is a better/easier way than to create my own script.

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/47B71B9B-C082-41A7-AB6B-67E40504D6C5%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Questions about price sources

2018-11-27 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

I'm starting to look into using the bean-price infrastructure and have a couple 
points/questions.

1) I specify the price ccy twice, on the one hand in the lookup expression and 
on the other hand the Source needs to also fill this in when creating the 
SourcePrice. As far as I can tell only the one from the lookup is used, which 
makes sense for me as often the source will not know the price ccy. Should this 
get dropped from SourcePrice?

2) I would like to convert all my prices into a base ccy. Is there any 
infrastructure around for something like this? I'm not talking about transitive 
prices, all I would need is to be able to convert a price into my base ccy 
based on an other conversion. What I'm thinking is something like
* fetch price from Source in USD
* using existing price data convert USD price into CHF

If the Source would get the existing prices I could do it in there but that's 
not the case and I think somewhere outside would make more sense as it should 
be independent of the Source. Did anyone tackle such a problem? Am I going at 
it the right way?

3) I'm planing to fetch prices on a daily basis and write them out as price 
directives so that if a price source disappears I still have all the previously 
fetched prices, does that make sense? Any easy way to do this with bean-price? 
Especially with updated intraday prices where I can't simply append the output 
of bean-price

Thanks for this great tool,
Patrick

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/B2E17654-528F-4C56-94D9-D89B7565D5CE%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: smart_importer

2018-04-18 Thread 'Patrick Ruckstuhl' via Beancount
Yes this is one way to use it. The other ways which are still in progress are 
about getting the list of possible candidates in fava

On April 18, 2018 9:57:04 PM GMT+02:00, mplo...@gmail.com wrote:
>Smart importer inserts payees learned from previous transactions in 
>beancount file?
>
>So we are getting:
>
>2013-12-11 * "WHOLEFDS HOU 10236 02124201320 / 042002720272124201320"
>  Liabilities:US:CreditCard  -14.47 USD
>  Expenses:Personal:Food
>
>2013-12-14 * "MACY'S #003 HERALD SNEW YORK / 00307963916 MACY'S"
>  Liabilities:US:CreditCard  -56.43 USD
>  Expenses:Personal:Clothes
>
>Instead of 
>
>2013-12-11 * "WHOLEFDS HOU 10236 02124201320 / 042002720272124201320"
>  Liabilities:US:CreditCard  -14.47 USD
>
>2013-12-14 * "MACY'S #003 HERALD SNEW YORK / 00307963916 MACY'S"
>  Liabilities:US:CreditCard  -56.43 USD
>
>which we get with default bean-extract command. Did i understand it
>right?
>
>On Tuesday, April 17, 2018 at 8:12:13 PM UTC-4, Martin Blais wrote:
>>
>> Works great on my credit card account!
>> https://github.com/johannesjh/smart_importer
>>
>> Another way I'm finding I'd like to invoke this is by invocation of
>an 
>> Emacs binding to auto-complete one particular transaction based on a
>stored 
>> model.
>> Basically put the cursor over an incomplete transaction and have it
>be 
>> completed by the ML classification.
>> Just an idea.
>>
>> Awesome work! :-)
>>
>>
>
>-- 
>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 post to this group, send email to beancount@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/beancount/693ce320-8741-4fe0-8ccb-a912a1746929%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/31628B66-C535-4739-A832-5EBBE65BA8EC%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: smart_importer

2018-04-18 Thread 'Patrick Ruckstuhl' via Beancount
Created https://github.com/johannesjh/smart_importer/issues/31 for this. We're 
already filtering the training data, forgot to also filter the ones where we do 
the predictions.

On April 18, 2018 1:38:32 PM GMT+02:00, Zhuoyun Wei  wrote:
>I got it working, as well. Currently I am using (hard-coded) Python
>dict to add a second posting to an newly extracted transaction based on
>Trasaction.narration.
>
>This ML is the far more advanced technology!
>
>(There is a bug: If there is a Balance entry, or any other
>non-Trasaction entry in the entries returned by the importer, the ML
>crashes with a cryptic traceback.)
>
>
>2018-04-17 20:11:50 Martin Blais :
>> Works great on my credit card account!
>> https://github.com/johannesjh/smart_importer
>> 
>> Another way I'm finding I'd like to invoke this is by invocation of
>an Emacs binding to auto-complete one particular
>> transaction based on a stored model.
>> Basically put the cursor over an incomplete transaction and have it
>be completed by the ML classification.
>> Just an idea.
>> 
>> Awesome work! :-)
>> 
>> 
>> --
>> 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 post to this group, send email to beancount@googlegroups.com.
>> To view this discussion on the web visit
>https://groups.google.com/d/msgid/beancount/
>>
>CAK21%2BhM-FDXwjM%2BtwCDDZUWpFyeFLBJpdtbVjbiF9VmqFT%2BD9A%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/375FCCC4-C14F-4DD2-8173-F8BC081C4992%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: CI [Was: moving to GitHub?]

2018-03-31 Thread 'Patrick Ruckstuhl' via Beancount


Did some searching and came up with


https://semaphoreci.com

As an option. It supports bitbucket and is free for open source.

Regards,
Patrick

On March 31, 2018 11:02:48 AM GMT+02:00, Stefano Zacchiroli  
wrote:
>On Thu, Mar 29, 2018 at 08:30:30PM -0400, Martin Blais wrote:
>> You speak as if a little bit of untested code is worth anything. It's
>> not. Let me explain.
>
>Oh, no, I agree it's not worth it. And it's great that you, as
>Beancount
>maintainer, have high standards for code acceptance that encompass: (1)
>not breaking existing tests, and (2) having thorough unit tests for the
>new code being contributed.
>
>But it seems to me that that is almost completely unrelated to the
>choice of hosting platform, isn't it? Aren't you in fact just saying
>that what you want is continuous integration (CI) integrated with the
>contribution work-flow for proposed patches?
>
>Both GitLab and GitHub have integrated CI offerings, and IME they go a
>long way in avoiding wasting maintainer time in "complaining" about
>breaking existing tests. You make the CI run on incoming patches, if
>existing tests get broken by it, submitters get immediate feedback
>about
>it and can iterate by themselves to fix that, without any need of your
>intervention.  And, in fact, you can do the same for missing tests.
>Just
>enable the nose (or equivalent) code coverage plugin and make it fail
>if
>the coverage is not up to a given standard or threshold, and there too
>you automatically send the ball back in the camp of code contributors
>if
>they don't show up with tests.
>
>I don't know if BitBucket has any CI integration, but I'd be surprised
>if it doesn't. Aside from that aspect, this seem unrelated to the
>"lower
>barriers for contribution due to what is well-known out there". (But is
>an interesting discussion anyway!)
>
>Cheers

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/3571DDD2-2092-448D-A141-4B77C57A7182%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Issue #257: Create a section classifier for new transactions (blais/beancount)

2018-03-31 Thread 'Patrick Ruckstuhl' via Beancount
I think the date might actually have a meaning. E.g. if you split files by year 
you might have one marker in one file and another in the other and based on the 
date of the transaction it should go to the right one.

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/4d84116e-6b3a-4210-9c6d-9b2514c0c5a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about ledger to beancount

2018-03-29 Thread 'Patrick Ruckstuhl' via Beancount


5) I created a simple importer which takes care of this for me. It runs and 
creates real entries based on the schedule.



On March 29, 2018 5:02:07 PM GMT+02:00, Martin Michlmayr  
wrote:
>I have a few question about moving from ledger to beancount:
>
>1) Ledger has a "D" directive (e.g. D 1000.00 EUR).  It sets the
>default currency (operating_currency in beancount) but it also
>sets the format (so if I use D as above and then write 10 it would be
>printed as 10.00).  I don't think there's an equivalent for
>beancount, right?
>
>2) "N" says that pricing information for that commodity should be
>ignored (and no price quotes are downloaded).  It's basically your
>"home currency" (operating_currency).  I don't think there's
>an equivalent, right?
>
>3) C AMOUNT1 = AMOUNT2: Specifies a commodity conversion, e.g. "C 1.00
>Kb = 1024 bytes".  Is that somehow possible in beancount?
>
>4) Can you "define" variables and then use them in transactions?
>e.g.
>define foo=$100
>Expenses:Purchase $foo
>
>5) Has anyone done plugins for ledger's automated transactions and
>periodic postings?
>
>6) Has anyone done a table comparing ledger and beancount syntax, and
>if not, would that be of interest?

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/56BB091D-1D2C-464D-A908-DDCA6F5421E3%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Importing CSV Transaction with Categories?

2018-03-01 Thread 'Patrick Ruckstuhl' via Beancount
One way to do this is adding it as metadata. This will allow you to filter and 
query with it.

On March 1, 2018 8:08:34 PM GMT+01:00, Omar Sandoval  wrote:
>Hmm, nevermind. I was going about this incorrectly. Since I already
>know 
>the categories I could just insert this data as a separate posting on
>the 
>transaction, correct? 
>
>On Thursday, March 1, 2018 at 10:37:40 AM UTC-8, Omar Sandoval wrote:
>>
>> Hi everyone,
>>
>> My bank provides CSV files with categories. Here's a sample dataset;
>>
>> Date,Amount,Activity,Raw description,Description,Category
>folder,Category
>>
>> 2/14/2018,-41.16,Signature purchase,MARUFUKU RAMEN,Marufuku
>Ramen,Food & 
>>> Drink,Restaurants
>>> 2/12/2018,-41.75,Signature purchase,SQ *PAPITO HAYES,Papito
>Hayes,Food & 
>>> Drink,Restaurants
>>> 2/11/2018,-13.8,Signature purchase,SQ *RITUAL COFFEE ROAST,Ritual
>Coffee 
>>> Roast,Food & Drink,Coffee & Tea
>>> 2/9/2018,-35.77,Pin 
>>> purchase,CHEVRON/CSI-302550/1760,Chevron,Transportation,Gas
>>
>>
>> Is there a way to include this data when creating a transaction? I
>noticed 
>> a recent commit 
>>
>
>that 
>> seems to address this but I'm not sure how to get it working. 
>>
>> If I have a list of transactions like so;
>>  
>>
>>> 2018-02-09 * "Chevron" ""
>>>   Assets:US:Simple:Checking  -35.77 USD
>>
>>
>>> 2018-02-11 * "Ritual Coffee Roast" "" 
>>
>>   Assets:US:Simple:Checking  -13.8 USD
>>>
>>  
>>
>> 2018-02-12 * "Papito Hayes" ""
>>>   Assets:US:Simple:Checking  -41.75 USD
>>>
>>  
>>
>> 2018-02-14 * "Marufuku Ramen" ""
>>>   Assets:US:Simple:Checking  -41.16 USD
>>
>>
>> Can I iterate through this list with the categorizer callable and
>append 
>> each category?
>>

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/AAE9E2F4-E9B3-46FE-A0F0-8C2D64CCA7E5%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: A couple questions about importers

2018-02-04 Thread 'Patrick Ruckstuhl' via Beancount

>
> >- 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
>> >prices
>> >> in beancount, so prices are available in the beancount file but I'm
>> >not
>> >> 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
>> >Google
>> >Finance APIs disabled.)
>> >
>> >These are two separate processes at the moment; run one, then the
>> >other.
>> >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?
>>
>
> Yes.
> 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__ 
meta

* 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 
method:

importer.extract(file, existing_entries)


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 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/6f03b0d2-eb20-41f2-a030-2a109753d9a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A couple questions about importers

2018-02-03 Thread 'Patrick Ruckstuhl' via Beancount
Just got an idea for the api import (always getting those ideas after 
asking about it on a mailing list). I just create a dummy file for the 
importer, this file can actually even be the config with api key and so on 
for doing the import

On Saturday, February 3, 2018 at 6:21:14 PM UTC+1, Patrick Ruckstuhl wrote:
>
> Hi, 
>
> I'm looking at some specific cases for importers and wondering what the 
> best way to tackle this is: 
>
>
> -API based import 
>
> For some transactions there's a REST api I can use to fetch the 
> transactions. 
>
> So there is no file to use with the bean-extract framework. 
>
> I currently created a custom script which works but I would like to 
> unify the different importers if possible. 
>
>
> - 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 prices 
> in beancount, so prices are available in the beancount file but I'm not 
> sure what the best way to hook this into the importer framework is 
>
>
> How do you deal with things like that? Do you ignore bean-extract tools 
> and just create independent scripts? 
>
>
> Regards, 
>
> Patrick 
>
>
>

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/718b5cc7-7298-4b42-8a48-28cca610f4f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


A couple questions about importers

2018-02-03 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

I'm looking at some specific cases for importers and wondering what the
best way to tackle this is:


-API based import

For some transactions there's a REST api I can use to fetch the
transactions.

So there is no file to use with the bean-extract framework.

I currently created a custom script which works but I would like to
unify the different importers if possible.


- 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 prices
in beancount, so prices are available in the beancount file but I'm not
sure what the best way to hook this into the importer framework is


How do you deal with things like that? Do you ignore bean-extract tools
and just create independent scripts?


Regards,

Patrick


-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/29e70aca-b985-5291-38fc-93c2d80956d4%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Transaction does not Balance when it should

2018-01-26 Thread 'Patrick Ruckstuhl' via Beancount
Great, that solves it.

Thank you very much
> I think if you use integer for the amount (6739 CHF), the precision
> will be unlimited. Try use a float like 6739.00 CHF
>
> On Fri, Jan 26, 2018 at 1:22 PM, 'Patrick Ruckstuhl' via Beancount
> <beancount@googlegroups.com <mailto:beancount@googlegroups.com>> wrote:
>
> Hi,
>
> I have the following transaction:
>
>
> 2014-01-13 * "Buy"
>   Assets:Foo:BAR   45.8 BAR {{6739 CHF}}
>   Assets:Foo:CHF -6739 CHF
>
>
> and I'm getting the error Transaction does not balance: (1E-24 CHF)
>
>
> Is there any way (except of adding a "rounding error" account) to
> solve this?
>
> It seems that what's happening is that the per share price is
> calculated and then there's rounding errors happening.
>
>
> Thanks and Regards,
> Patrick
>
> -- 
> 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
> <mailto:beancount+unsubscr...@googlegroups.com>.
> To post to this group, send email to beancount@googlegroups.com
> <mailto:beancount@googlegroups.com>.
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/beancount/4a06ef34-eb3e-d28f-d2e4-d6596513e539%40ch.tario.org
> 
> <https://groups.google.com/d/msgid/beancount/4a06ef34-eb3e-d28f-d2e4-d6596513e539%40ch.tario.org?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
>
>
> -- 
> Yuchen Ying
> https://about.me/yegle
> -- 
> 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
> <mailto:beancount+unsubscr...@googlegroups.com>.
> To post to this group, send email to beancount@googlegroups.com
> <mailto:beancount@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFL5w3UztwGejFLG9jWh-7SQLcejHv6%2BVWkH4-fuA5TQ9OKEwQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAFL5w3UztwGejFLG9jWh-7SQLcejHv6%2BVWkH4-fuA5TQ9OKEwQ%40mail.gmail.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/46d83ea5-3bcf-9e07-e325-5a8659f124a1%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Transaction does not Balance when it should

2018-01-26 Thread 'Patrick Ruckstuhl' via Beancount
Hi,

I have the following transaction:


2014-01-13 * "Buy"
  Assets:Foo:BAR   45.8 BAR {{6739 CHF}}
  Assets:Foo:CHF -6739 CHF


and I'm getting the error Transaction does not balance: (1E-24 CHF)


Is there any way (except of adding a "rounding error" account) to solve
this?

It seems that what's happening is that the per share price is calculated
and then there's rounding errors happening.


Thanks and Regards,
Patrick

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/4a06ef34-eb3e-d28f-d2e4-d6596513e539%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


How to have custom plugin picked up automatically.

2018-01-06 Thread 'Patrick Ruckstuhl' via Beancount

Hi,

I'm trying to write my first custom plugin and I'm wondering if there is a 
way to set things up so the plugin will be picked up automatically without 
having to adjust any environment variables.

Currently the plugin is in the same location as the beancount files.

e.g.

main.beancount
plugins/__init__.py
plugins/my_plugin.py

if I do 
export PYTHONPATH=.

this works fine

plugin "plugins.my_plugin"

But I'm wondering if there is a better way to do this. Ideally something 
without requiring to adjust PYTHONPATH.

How are you dealing with custom plugins?

Thanks and Regards,
Patrick

-- 
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 post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/47d3216c-20f8-4522-9eb7-c87519af1fa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Realized and unrealized currency gain

2017-09-19 Thread 'Patrick Ruckstuhl' via Beancount
Looks like I was too quick, seems like * is not yet implemented, this fails:

2017-06-01 *
    Assets:CHF                            -30 CHF
    Assets:USD                            20 USD { 1.5 CHF }

2017-06-01 *
    Assets:CHF                            -30 CHF
    Assets:USD                            20 USD { 1.6 CHF }

2017-07-01 price USD 1.7 CHF

2017-08-01 *
    Assets:USD                    -10 USD { * } @ 2 CHF
    Assets:CHF   40 CHF
    Income:USD:Realized


So will I have to go through the manual steps of converting the lots to
an average cost booking or is there something I'm missing?

> Hi,
>
> Thank you very much, I got confused by this:
> https://docs.google.com/document/d/1dW2vIjaXVJAf9hr7GlZVe3fJOkM-MtlVjvCO1ZpNLmg/edit
> (Beancount - Comparison / Differences)
> which made me think that currency transactions should never use the
> cost functionality.
>
> It looks like the average cost booking method has also been
> implemented in the mean time, so I can do it like this without having
> to bother about lots (which I don't care about)
>
> 2017-06-01 *
>     Assets:CHF                            -30 CHF
>     Assets:USD                            20 USD { 1.5 CHF }
>
> 2017-07-01 price USD 1.7 CHF
>
> 2017-08-01 *
>     Assets:USD                    -10 USD { * } @ 2 CHF
>     Assets:CHF   40 CHF
>     Income:USDTrading
>
>
>
>> Hi Patrick,
>>
>> in order to compute PnL, you need to provide cost instead of price:
>>
>>
>> 2017-06-01 * "Buy USD"
>>   Assets:CHF -30 CHF
>>   Assets:USD 20 USD { 1.5 CHF }
>>
>> 2017-07-01 price USD 1.7 CHF
>>
>> 2017-08-01 * "Sell USD"
>>   Assets:USD -20 USD { 1.5 CHF } @ 2 CHF
>>   Assets:CHF 40 CHF
>>   Income:PnL
>>
>>
>> This way you could see a realized PnL of (2 CHF - 1.5 CHF) * 10 = 5 CHF
>> in the account Income:PnL.
>>
>> To compute unrealized PnL, you could enable a built-in plugin:
>>
>>
>> plugin "beancount.plugins.unrealized" "Unrealized"
>>
>>
>> This way you could see an unrealized PnL in Assets:CHF:Unrealized.
>>
>>
>> See official documentation for more information: 
>> https://docs.google.com/document/d/1WjARst_cSxNE-Lq6JnJ5CC41T3WndEsiMw4d46r2694/edit
>>
>>
>>
>> 2017-09-18 11:14:22 patrick via Beancount :
>>> Hi,
>>>
>>> I've now tried to search for this for quite a bit but somehow I'm not 
>>> finding the right stuff or maybe not
>>> understanding it right and I hope someone can help me.
>>>
>>> I would like to separate the currency gains from other income and would 
>>> like to also differentiate between realized and
>>> unrealized gain.
>>>
>>> Let's take the following example
>>>
>>> 2017-06-01 * "Buy USD"
>>> Assets:CHF -30 CHF
>>> Assets:USD 20 USD @ 1.5 CHF
>>>
>>> 2017-07-01 price USD 1.7 CHF
>>>
>>> 2017-08-01 * "Sell USD"
>>> Assets:USD -20 USD @ 2 CHF
>>> Assets:CHF           40 CHF
>>>
>>>
>>>   • On 2017-07-01 I would have an unrealized currency gain of 4 CHF, how 
>>> would I see this?
>>>   • On 2017-08-02 I would have a realized currency gain of 10 CHF, how 
>>> would I set this up to see this as income?
>>>
>>>
>>> One thing I found was
>>> http://www.mathstat.dal.ca/~selinger/accounting/tutorial.html
>>>
>>> Which looked quite interesting to me and seems to have a solution for this 
>>> but I'm struggling with implementing some of
>>> the details of it.
>>> I think in my case the concept of "adjusted cost base" seems to be the 
>>> simplest and make sense. 
>>>
>>> So if I understood that correct I would need to do the following:
>>>
>>> 2017-06-01 *
>>> Assets:CHF -30 CHF
>>> Income:USDTrading       30 CHF
>>> Income:USDTrading       -20 USD
>>> Assets:USD 20 USD
>>>
>>> 2017-07-01 price BTC 0.30 CHF
>>>
>>> 2017-08-01 *
>>> Assets:USD -20 USD
>>> Income:USDTrading       20 USD
>>> Income:USDTrading       -30 CHF
>>> Income:USDTradingRealized       -10 CHF
>>> Assets:CHF           40 CHF
>>>
>>> What I get out of this
>>>
>>>   • If I take the balance of Income:USDTradingRealized with the current 
>>> exchange rate this should reflect my unrealized
>>> gain
>>>
>>>
>>> A couple of things that confuse me
>>>
>>>   • This feels somehow "wrong" as I'm no longer using the @ price 
>>> annotation and have this price implicit in the
>>> difference between the amounts in one currency going into the 
>>> USDTrading and and out of the USDTrading in the other
>>> currency.
>>>   • I need to manually calculate the -10 CHF realized gain
>>>   • Income:USDTradingRealized could actually be an income or an expense, 
>>> depending on current exchange rates
>>>
>>>
>>> Can anyone help me with this or point me in the right direction?
>>>
>>>
>>> Thanks and Regards,
>>> Patrick
>>>
>>>
>>>
>>> --
>>> 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 post to this group, send email to