Hi Vasily,

thank you as well for your help and the pointer to the other tools! I will 
need a bit time to look at lazy-beancount, but it looks quite helpful.

Thank you!
Best Regards
Fabian

On Saturday, March 22, 2025 at 1:10:23 PM UTC+1 Vasily M wrote:

> Hi Fabian,
>
> I was interested in tracking trip expenses on a high level as well and 
> recently solved this for myself, at least to the point I'm satisfied with.
> The starting point was the awesome 
> https://github.com/andreasgerstmayr/fava-dashboards plugin for Fava that 
> already had "Travel" tab in examples but it wasn't clear to me how to use 
> it without much friction. I ended up slightly altering it and finding some 
> practices that make it straightforward.
> It's all included in https://github.com/Evernight/lazy-beancount and I've 
> also described various tips at the guide's section here: 
> https://lazy-beancount.xyz/docs/stage4_improvements/overview/#tracking-trips-and-travel-expenses
>  
> (of course, you don't have to use the whole package and can just reproduce 
> the bits separately). Well, this point is currently just a single sentence 
> but hopefully other tips and context make it more understandable. In any 
> case, happy to expand on technical details.
>
> 1. Adding #trip-trip-id-maybe-also-date-05-24 and #travel tags make all 
> transactions appear in the dashboard. This allows to view them in Fava 
> views and indeed write BQL queries, etc. The Expenses breakdown dashboard 
> tab then also becomes useful but I had to patch Fava (pull request pending) 
> to make it work.
>
> 2. Usually trips happen over continuous period of time and most of 
> transactions happening within this period can be automatically categorized 
> into this trip. I use / wrote filter_map plugin to avoid manual tagging.
>
> 3. You also may be interested in 
> https://github.com/Akuukis/beancount_interpolate plugin to use, for 
> example, with transactions related to booking accommodation. For dashboards 
> and other analytics you can virtually move transaction to a different date 
> than a date of payment and spread the cost across number of days.
>
> 4. Indeed, metadata is a good mechanism for further customization. I guess 
> the only point to add here is that you can easily plug queries into your 
> customized dashboards for more visual representation.
>
> Best regards,
> Vasily
>
> On Friday, March 21, 2025 at 5:24:44 PM UTC+1 Patrick Ruckstuhl wrote:
>
>> 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+...@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/1f24b955-1e2b-46b6-b34c-96b77a87d343n%40googlegroups.com.

Reply via email to