Hi Fab,

welcome to your journey with beancount :)


First for your journey questions. I think if you need/want the days, having it as a special currency instead of just metadata might be useful.

This allows you to do calculations/aggregations on them, which I think you can't do with the metadata. I use here a separate expense account for the "NIGHTS", because I don't like to mix "Currencies", but you could keep it in the same one as you keep the monetary expenses.

I'm modeling the other side of the nights as Equity, personally that feels cleaner than putting in Assets/Liabilities.

I'm guessing this is just for your own interest, not for reimbursing, otherwise I would model it differently.


```
option "operating_currency" "EUR"

2025-01-01 open Expenses:Travel:Accommodation:Hotel EUR
2025-01-01 open Assets:Bank:Checking EUR
2025-01-01 open Expenses:Travel:Nights NIGHTS
2025-01-01 open Equity:Nights NIGHTS

2025-03-11 * "Hotel in Berlin (3 nights)"
  date: "2025-03-08"                   ; Booking date
  purpose: "Conference"
  Expenses:Travel:Accommodation:Hotel    300.00 EUR
  Expenses:Travel:Nights                      3 NIGHTS
  Assets:Bank:Checking                  -300.00 EUR
  Equity:Nights                              -3 NIGHTS

2025-03-08 * "Hotel in Berlin (3 nights)"
  firstNightDate: "2025-03-11"                   ; date of 1st night
  purpose: "Conference"
  Expenses:Travel:Accommodation:Hotel    300.00 EUR
  Expenses:Travel:Nights                      3 NIGHTS
  Assets:Bank:Checking                  -300.00 EUR
  Equity:Nights                              -3 NIGHTS

```

Without even doing any special queries, you'll already get a lot of information (e.g. in Fava)


and you can query that information like


```
SELECT sum(filter_currency(position, 'EUR')) as Cost, sum(filter_currency(position, 'NIGHTS')) as Nights, entry_meta('purpose') as Purpose
WHERE account ~ '^Expenses:Travel' GROUP BY entry_meta('purpose')
```


As for dealing with investments from IBKR, I'm doing this as well.

My use case is pretty simple and boring, mostly buy and hold. For this I have built two things which are useful for me

An importer which pulls, buys and dividends directly from IBKR

https://tariochbctools.readthedocs.io/en/latest/importers.html#interactivebrokers

A price import which pulls the price information for securities from IBKR

https://tariochbctools.readthedocs.io/en/latest/price_fetchers.html


For general documentation about investments, this part of the official beancount doc is a very good starting point

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


Regards,

Patrick


On 20.03.2025 19:33, Fabian Braennstroem wrote:
Hi all,

I am quite new to beancount (and in accounting in general) and are testing a few
minor things at the moment with version 3.

At the moment I am planing to use it for two topics. One is for travelling and
another one is for calculating tax relevant gains from
investing (with interarctive brokers), which needs to be converted to EUR
currency gain. For my understanding that is possible with beancount, but I missed up to now a good example case for it. Maybe someone can point me to one? This would
be great!

As mentioned, in addition to these investing tasks, I would like to track my business trips and also count days abroad or days in a hotel.

For my understanding I am having different options to track this.
I saws this: https://groups.google.com/g/beancount/c/NGt2BRHR6LE
and understand, that I can use tags, meta or links for additional information.
It seems that meta is a good option.
Maybe I could even use a special NIGHT-currency also for tracking it.

But I am not sure yet, what the best way is to get e.g. the number of nights which I stayed in a hotel in a certain time frame and what I paid for this.

E.g. I could state a stay of 3 night in these two ways:
```
2025-03-11 * "Hotel in Berlin (3 nights)"
  date: "2025-03-08"                   ; Booking date
  nights: 3                            ; Number of nights
  purpose: "Conference"
  Expenses:Travel:Accommodation:Hotel    300.00 EUR
  Assets:Bank:Checking                  -300.00 EUR

2025-03-08 * "Hotel in Berlin (3 nights)"
  firstNightDate: "2025-03-11"                   ; date of 1st night
  nights: 3                            ; Number of nights
  purpose: "Conference"
  Expenses:Travel:Accommodation:Hotel    300.00 EUR
  Assets:Bank:Checking                  -300.00 EUR
```

With this query:

```
bean-query uow_test3.beancount "
SELECT SUM(position), entry.meta['nights'] as nights
WHERE account ~ '^Expenses:Travel'
GROUP BY nights
"
```


I get something like this:

```
SUM(positi  n
----------  -
600.00 EUR  3
```

I.e. I am summing the cost for all stays with 3 nights, but the number of
nights.

Do you have an advice how I can adjust my query for this?
Thank you in advance!
Best Regards
Fab

--
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 visit https://groups.google.com/d/msgid/beancount/fb28e70a-7ee3-4d56-9dcc-081de1ecc923n%40googlegroups.com <https://groups.google.com/d/msgid/beancount/fb28e70a-7ee3-4d56-9dcc-081de1ecc923n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/5fdeffe5-a259-4213-92d9-bbc186b9f02b%40tario.org.

Reply via email to