2021-08-11 GnuCash IRC logs

01:00:11 *** Mechtilde has joined #gnucash
01:28:44 *** fell has quit IRC
01:30:02 *** fell has joined #gnucash
01:30:02 *** ChanServ sets mode: +o fell
01:48:43 *** sbluhm has joined #gnucash
01:49:19 *** CDB-Man has quit IRC
01:50:08 *** bertbob has quit IRC
01:52:03 *** CDB-Man has joined #gnucash
01:52:03 *** ChanServ sets mode: +v CDB-Man
01:53:24 *** bertbob has joined #gnucash
01:53:24 *** ChanServ sets mode: +v bertbob
04:18:44 *** qwer has joined #gnucash
04:44:37 *** User has joined #gnucash
05:41:18 *** NoobAlice has quit IRC
05:42:36 *** NoobAlice has joined #gnucash
05:46:48 *** storyjesse has joined #gnucash
06:00:12 *** storyjesse has quit IRC
07:25:16 *** kcin has joined #gnucash
07:41:17 *** kcin has quit IRC
07:59:44 *** tonysoar has joined #gnucash
08:01:04 *** tonysoar has quit IRC
08:08:04 *** FH_thecat has joined #gnucash
08:11:32 *** Mechtilde has quit IRC
08:20:04 *** Jimraehl1 has joined #gnucash
08:20:35 *** Jimraehl1 has quit IRC
09:10:10 *** Hrisfur has joined #gnucash
09:10:10 *** ChanServ sets mode: +v Hrisfur
09:20:34 <Hrisfur> A while ago, April 10th, I asked about currency conversion and the inner workings of xaccAccountGetBalanceAsOfDateInCurrency. I got a nice answer but still have issues. I want to achieve the following:
09:20:34 <Hrisfur> Inputs: account (Account pointer), date (time64), commodity (gnc_comodity pointer)
09:20:34 <Hrisfur> Output: Balance of account and children at the specified date and convert to commodity using the price closest to the said date.
09:20:34 <Hrisfur> The advice was to look at gnc:exchange-by-pricedb-nearest (https://github.com/Gnucash/gnucash/blob/b1c1272f35bb4495a8f480cb10cd442184c2af93/gnucash/report/commodity-utilities.scm#L721), but the issue is that not all my accounts are in the same commodity.
09:20:57 <Hrisfur> (sorry I pressed enter to early, let me finish my question first) :-)
09:28:48 <chris> Hrisfur: you want the amount in C or scheme?
09:29:50 <chris> scratch that;
09:30:46 <chris> if you want to convert an account balance into any currency you can use gnc_pricedb_convert_balance_nearest_before_price_t64
09:31:09 <chris> or gnc_pricedb_convert_balance_nearest_price_t64
09:31:25 <chris> and grab the account balance in its own currency
09:32:19 <chris> oh you want children as well: use xaccAccountGetBalanceAsOfDateInCurrency
09:49:34 *** mydogsnameisrudy has joined #gnucash
10:00:47 *** FH_thecat has quit IRC
10:09:43 *** sbluhm has quit IRC
10:20:02 *** jervin has joined #gnucash
10:21:23 *** chris has quit IRC
10:23:32 *** jervin has quit IRC
10:28:58 *** jervin has joined #gnucash
10:36:20 *** Hrisfur1 has joined #gnucash
10:36:20 *** ChanServ sets mode: +v Hrisfur1
10:36:21 *** Hrisfur has quit IRC
10:36:21 *** Hrisfur1 is now known as Hrisfur
10:54:57 *** Hrisfur has quit IRC
11:22:53 *** chris has joined #gnucash
11:22:53 *** ChanServ sets mode: +v chris
11:22:53 *** gncbot sets mode: +o chris
11:24:39 <chris> instead of webkit1: https://docs.microsoft.com/en-us/microsoft-edge/webview2/get-started/win32 ???
11:29:16 *** Hrisfur has joined #gnucash
11:29:16 *** ChanServ sets mode: +v Hrisfur
11:32:32 <Hrisfur> chris: Thanks for the advice, it is for a report, hence I'm writing it in scheme. Currently I use xaccAccountGetBalanceAsOfDateInCurrency, but I was told that the currency conversion takes the latest (current) price. I want the conversion based upon the prices at that specific day (or closest to that day).
11:43:11 *** guak has joined #gnucash
11:44:50 <Hrisfur> From what I get:
11:44:50 <Hrisfur> xaccAccountGetBalanceAsOfDateInCurrency (https://code.gnucash.org/docs/MAINT/Account_8cpp_source.html#l03819) calls xaccAccountGetXxxBalanceAsOfDateInCurrencyRecursive (https://code.gnucash.org/docs/MAINT/Account_8cpp_source.html#l03628), which then gets the balance of all different child accounts, through xaccAccountBalanceAsOfDateHelper (https://code.gnucash.org/docs/MAINT/Account_8cpp_source.html#l03663).
11:44:50 <Hrisfur> Somehow this last function must deal with the currency, as it is entirely possible that the child accounts are not in the same currency as the 'motheraccount'. But I'm entirely unclear what the function does exactly as it is quite cryptic (parts like cb-fn and the gpointer called 'data' are unclear to me), and my understanding of C is mediocre at best. So what does it do exactly with respect to the currency conversion?
11:44:51 <Hrisfur> static void
11:44:52 <Hrisfur> xaccAccountBalanceAsOfDateHelper (Account *acc, gpointer data)
11:44:53 <Hrisfur> {
11:44:54 <Hrisfur> CurrencyBalance *cb = static_cast<CurrencyBalance*>(data);
11:44:55 <Hrisfur> gnc_numeric balance;
11:44:56 <Hrisfur>
11:44:57 <Hrisfur> g_return_if_fail (cb->asOfDateFn && cb->currency);
11:44:58 <Hrisfur>
11:44:59 <Hrisfur> balance = xaccAccountGetXxxBalanceAsOfDateInCurrency (
11:45:00 <Hrisfur> acc, cb->date, cb->asOfDateFn, cb->currency);
11:45:01 <Hrisfur> cb->balance = gnc_numeric_add (cb->balance, balance,
11:45:02 <Hrisfur> gnc_commodity_get_fraction (cb->currency),
11:45:04 <Hrisfur> GNC_HOW_RND_ROUND_HALF_UP);
11:45:05 <Hrisfur> }
11:45:42 <chris> xaccAccountGetXxxBalanceAsOfDateInCurrency will handle the conversion
11:45:43 <chris> gtg
11:45:59 <chris> or, xaccAccountConvertBalanceToCurrencyAsOfDate
11:47:22 <Hrisfur> I probably misunderstood something, but what prices do these functions take for the currency conversion? Last price or price closest to the date that is specified in the balance call?
11:48:19 <chris> xaccAccountConvertBalanceToCurrencyAsOfDate takes the price nearest before the desired date
11:48:29 <Hrisfur> <3
11:49:00 <Hrisfur> I feel kinda dumb that I spend so much time on this, but it is nice to confirm. Thanks for helping me out.
11:49:07 <chris> yw
11:55:34 *** Hrisfur has quit IRC
12:30:47 *** jralls_afk has joined #gnucash
12:30:47 *** ChanServ sets mode: +o jralls_afk
12:31:47 *** jralls has quit IRC
12:33:16 *** jralls_afk is now known as jralls
12:34:25 <jralls> chris The problem with Edge's webkitwebview is that it wants a Win32 native widget to draw to, not a Gtk3 one.
12:37:49 *** Mechtilde has joined #gnucash
13:00:39 *** sbluhm has joined #gnucash
13:04:43 *** Mechtilde has quit IRC
13:19:20 *** Mechtilde has joined #gnucash
13:49:41 *** kcin has joined #gnucash
14:04:43 *** Mechtilde has quit IRC
14:05:00 *** Mechtilde has joined #gnucash
14:46:12 *** qwer has quit IRC
14:49:25 *** mikee has quit IRC
14:49:49 *** mikee has joined #gnucash
14:51:48 *** David has quit IRC
14:51:57 *** David has joined #gnucash
15:02:38 *** qwer has joined #gnucash
15:27:27 *** mikee has quit IRC
15:28:58 *** mikee has joined #gnucash
15:30:57 *** default_1 has joined #gnucash
15:34:26 *** default_1 has quit IRC
15:36:12 *** Mechtilde has quit IRC
16:26:41 *** ArtGravity has joined #gnucash
16:26:41 *** ChanServ sets mode: +v ArtGravity
16:46:23 *** sbluhm has quit IRC
17:09:21 *** sbluhm has joined #gnucash
17:10:42 *** kcin has quit IRC
17:44:36 *** sbluhm has quit IRC
18:14:46 *** User has quit IRC
18:29:19 *** NoobAlice has quit IRC
18:38:52 *** NoobAlice has joined #gnucash
19:02:11 *** raeburn has quit IRC
20:02:10 *** qwer has quit IRC
20:08:36 *** guak has quit IRC
21:19:18 *** ArtGravity has quit IRC
21:28:03 *** Guest62 has quit IRC
22:24:04 *** jervin has quit IRC
23:03:36 *** phebus has quit IRC
23:04:09 *** mikee has quit IRC
23:04:22 *** mikee has joined #gnucash
23:24:35 *** phebus has joined #gnucash
23:24:35 *** ChanServ sets mode: +v phebus
23:28:05 *** phebus has quit IRC
23:37:27 *** phebus has joined #gnucash
23:37:27 *** ChanServ sets mode: +v phebus
23:38:10 *** fell has quit IRC
23:59:29 *** fell has joined #gnucash
23:59:29 *** ChanServ sets mode: +o fell