Hello everybody!I stumbled on Beancount in my search for finance bookkeeping system, as Excel does not really satisfy all my needsI first tested gnucash but I was told it can't do what I need. So I am just wondering whether Beancount can do this:
Sorry, if express what I need in gnucash terms, I am just not familiar with Beancount terminology yetWhat I need is following:======================================I am looking for Income Statement" aka "Profit/Loss Statement" report which would show unrealized gain due to changes in stock and currency exchange rateSay at the beginning of the year I have produced a Balance Sheet report.
This report shows how much assets I have, which liabilities and delta
between them. Suppose at begging of the year I had checking accounts in USD
and Euro and some stock.
Throughout the year I was getting salary, paying expenses, at the same time
exchange rate was changing, stock price was changing etc. My be I sold some
stock, moved money between USD and Euro accounts
Now at the end of the year I have produced a new balance sheet.
So, I want to be able to explain a delta between a balance sheet at the
beginning of the ear and at the end.
E.g.:
I got so much salary
I paid so much costs
But also:
Lost so much due to exchange rate change
Gained to much due to stock price increase etc.
So, effectively I need to be able to drill down in the delta in Balance
Sheet report
Regards.
Chary
--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/2cef9db8-20b9-49d3-b91b-ec3591e10a3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Martin,ok, thanks. I will look at Fava (looks cool) and possibly will see whether I can do some extra development myself there.
But I must say, I still have a sneaky feeling, that I may be missing something, because I just don't understand how people who deal with several currencies and who have stock can possibly live without such report, which would show unrealized gains.
Without report with unrealized gains you have a situation, that you have some balance at the beginning, balance at the end, but you have no report, which would show how you got from balance at the beginning to balance at the end. Even though all your individual transactions are balanced, if you add them all together they will not produce a delta between balance sheets, in case you deal with more then one currency or have stock / gold (anything).
In a very simple situation:Say I want to report in EUR, but I keep money in USD. Say I have 1000 USD and exchange rate was 1:1 at the beginning.So, starting balance sheet will say, that I have 1000 EURThen exchange rate changed and now 1 USD costs 2 EUR. So, all of a sudden balance sheet at the closing will show, that I now have 2000 EUR.But how did happen?I would then expect some line, saying something like: "unrealized gain due to USD/EUR" exchange rate changes" - 1000 EURO.The same applies to stock changes.Am I talking some nonsense? How do people manage their finance without such analysis in our modern world?
P.S. buy the way, please accept congratulation with a very thorough documentation, on beancount. Very, very well done.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/dbda210e-356c-4eed-ba44-0d353c5b6c23%40googlegroups.com.
An elegant way to handle this is to use the Selinger trading accounts method.It would be easy to write a Beancount plugin to do this automatically.
--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/73b3eb60-39b3-3d64-37e4-0b82543fe40e%40gmail.com.
Martin,just for my understanding.Q1) Why did you have to implement the currency_accounts plugin if you already have beancount.plugins.unrealizedIsn't the latter supposed to do exactly what I asked for in my starting topic?
In the description, of the beancount.plugins.unrealized you write thatThis will create a synthetic transaction at the date of the last of directives, that reflects the unrealized P/L.
Q2) You write that"beancount.plugins.unrealized" "Unrealized" will create a synthetic transaction at the date of the last of directives, that reflects the unrealized P/L. It books one side as Income and the other side as a change in Asset.Is my understanding correct, that this will be a virtual transaction, kept only in memory and not to be seen in a text format anywhere?
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/33ac0b66-aa2f-4a5f-924a-a1aaa0ca5b6f%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/939fe47e-382a-4272-94e6-dd29f660d519%40googlegroups.com.
select account, SUM(convert(position, 'CurrencyCode',<Date A>)) from close on <Date A> WHERE account ~'Assets' OR account ~'Liabilities'
account sum_convert
---------------------- -----------------
Assets:US:PaymentUSD 12300.0 EUR
Assets:Broker:stock:XYZ 2100.0 EUR
Liabilities:DE:creditCard -3000.0 EUR
Expenses and Incomes are tracked at the historical exchange rate (e.i. at the exchange rate, available during transaction). When exchange rate changes, Expenses and Income do not get re-calculated.
This is believed to be inline with conventional wisdom , that if you have consumed pizza for 100 USD, there is no reason to re-calculate how much this pizza is worth now in EUR, when USD/EUR exchange rate changed. It only makes sense to know how much that pizza was worth in EUR, when you consumed it.
Assets and Liabilities on the other side are recalculated with every event of exchange rate change.
This is also inline with conventional wisdom. If instead of consuming 100 USD in a form of pizza, you put them in a bank account and all of a sudden this USD currency became more expensive vs EUR, this means you actually got reacher in terms on EUR and you want to see it.
The exchange rate changes are taken care in the following way:
A special Commodity Revaluation transaction is logged. Following the principle of double-entry accounting
one shoulder of transaction is logged to corresponding Asset and / or Liability accounts to adjust these accounts to new exchange rate.
2014-02-17 * "Selling some IBM"
Assets:US:ETrade:IBM -3 IBM {160.00 USD} @ 170.00 USD
Assets:US:ETrade:Cash 500.05 USD
Expenses:Financial:Commissions 9.95 USD
Income:GainDueToCommodityPriceChange:realized -30 USD
Income:GainDueToCommodityPriceChange:unrealized 30 USD
Martin,I think I have now done enough reading and testing (both beancount and ledger), that I can continue conversation without sounding too stupid (forgive me, if it is still the case)So, effectively what I think I wantStep 1: I run a report, which shows my Net Worth, converted to single currency at certain date, using all exchange rates valid for that date. Let us call it Day A Net Worth ReportI think in beancount query language such report will look like this
select account, SUM(convert(position, 'CurrencyCode',<Date A>)) from close on <Date A> WHERE account ~'Assets' OR account ~'Liabilities'This query will give me some output, similar to:
account sum_convert
---------------------- -----------------
Assets:US:PaymentUSD 12300.0 EUR
Assets:Broker:stock:XYZ 2100.0 EUR
Liabilities:DE:creditCard -3000.0 EURSo my net worth is 11400.00 Euro (I didn't find a way how to make beancount query to put a total)
Step 2 I run the same report, but for day B (which is after day A).Step 3: And now I want a single report, which will show how I got from Day A net Worth to Day B Net Worth. I want to have a set of numbers, which, when I add them together, will give me exactly the difference in Net Worth between pints A and B
I even have written a document, which describes how I think this can be achieved, document contains example spreadsheet with formulas, for very simple caseI think it shall work like this:
Expenses and Incomes are tracked at the historical exchange rate (e.i. at the exchange rate, available during transaction). When exchange rate changes, Expenses and Income do not get re-calculated.
This is believed to be inline with conventional wisdom , that if you have consumed pizza for 100 USD, there is no reason to re-calculate how much this pizza is worth now in EUR, when USD/EUR exchange rate changed. It only makes sense to know how much that pizza was worth in EUR, when you consumed it.
Assets and Liabilities on the other side are recalculated with every event of exchange rate change.
This is also inline with conventional wisdom. If instead of consuming 100 USD in a form of pizza, you put them in a bank account and all of a sudden this USD currency became more expensive vs EUR, this means you actually got reacher in terms on EUR and you want to see it.
The exchange rate changes are taken care in the following way:
A special Commodity Revaluation transaction is logged. Following the principle of double-entry accounting
another shoulder is logged to special Gain due to commodity price change (trading account, using Peter Selinger’s terminology).
one shoulder of transaction is logged to corresponding Asset and / or Liability accounts to adjust these accounts to new exchange rate.
In my example I do not distinguish realized and unrealized gain. I just create some virtual income account "Gain due to commodity price change". this term shall cover everything: gain due to stock price change as well as due to currency exchange rate. This is because from one side, the term "realized gain" is closely linked to the term "taxable gain", hence depends on local legislation. From the other side, for the gain first becomes unrealized and only then, one can realize it (say by selling the stock). Gain due to commodity price change the same.So, using example from beancount documentation converting unrealized gain to realized shall look like this
2014-02-17 * "Selling some IBM"
Assets:US:ETrade:IBM -3 IBM {160.00 USD} @ 170.00 USD
Assets:US:ETrade:Cash 500.05 USD
Expenses:Financial:Commissions 9.95 USD
Income:GainDueToCommodityPriceChange:realized -30 USD
Income:GainDueToCommodityPriceChange:unrealized 30 USDDoes it make any sense?
Once again, this is all driven by idea to have an explanation on how I got from Day A net Worth to Day B Net Worth.I must say I still don't understand how people who do trading and spend and get paid in different currencies live without such report. I just wouldn't trust calculation, if I can't see how I got from A to B.
Note: In my document you can see, that I have tested ledger, and It looks like ledger does calculation as per desired calculation method, however it seems not to be possible to produce a single income statement-like report. One would have to query ledger is different ways and paste together different parts of different reports, to get the situation as presented in Appendix A
It has been later found however, that on more complex example, ledger produces results with unrealized gains, which appear to be wrong. See more details here.
--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/d3086e02-6ce7-4b0e-b7ee-d45da5877a96%40googlegroups.com.
2014-02-17 * "Selling some IBM"
Assets:US:ETrade:IBM -3 IBM {160.00 USD} @ 170.00 USD
Assets:US:ETrade:Cash 500.05 USD
Expenses:Financial:Commissions 9.95 USD
Income:GainDueToCommodityPriceChange:realized -30 USD
Income:GainDueToCommodityPriceChange:unrealized 30 USDDoes it make any sense?There's a lot to read and I have too little time to get deep into the weeds, but I did notice that your transaction above does not balance.Don't forget that the first posting weights for 3 x 160, not 3 x 170Typically - without your special currency consideration - you would write something like this:2014-02-17 * "Selling some IBM"
Assets:US:ETrade:IBM -3 IBM {160.00 USD} @ 170.00 USD
Assets:US:ETrade:Cash 500.05 USD
Expenses:Financial:Commissions 9.95 USD
Income:Gains -30 USDIf I understand what you're trying to do, it is that rather than recognize a 30 USD income, you want to recognize that in EUR, but you want to split the gain into two postings: one for the USD gain, and one for the difference in currency (both in EUR).
Note that you *could* write a plugin that post-processed your transactions and hits the price table to fetch the rates and split up all those capital gains postings automatically.
Once again, this is all driven by idea to have an explanation on how I got from Day A net Worth to Day B Net Worth.I must say I still don't understand how people who do trading and spend and get paid in different currencies live without such report. I just wouldn't trust calculation, if I can't see how I got from A to B.People ignore the currency components, and think in terms of their home currency (folding in the change in currency into their P/L).
2014-02-17 * "Selling some IBM"
Assets:US:ETrade:IBM -3 IBM {160.00 USD} @ 170.00 USD
Assets:US:ETrade:Cash 500.05 USD
Expenses:Financial:Commissions 9.95 USD
Income:GainDueToCommodityPriceChange:realized -30 USD
Income:GainDueToCommodityPriceChange:unrealized 30 USDDoes it make any sense?There's a lot to read and I have too little time to get deep into the weeds, but I did notice that your transaction above does not balance.Don't forget that the first posting weights for 3 x 160, not 3 x 170Typically - without your special currency consideration - you would write something like this:2014-02-17 * "Selling some IBM"
Assets:US:ETrade:IBM -3 IBM {160.00 USD} @ 170.00 USD
Assets:US:ETrade:Cash 500.05 USD
Expenses:Financial:Commissions 9.95 USD
Income:Gains -30 USDIf I understand what you're trying to do, it is that rather than recognize a 30 USD income, you want to recognize that in EUR, but you want to split the gain into two postings: one for the USD gain, and one for the difference in currency (both in EUR).OK, I see my mistake. In beancount model you show gain once you sell commodity. In fact it does say this in your documentation (and I am sure I read about this): "The answer is often surprising to many users: the price is not used by the balancing algorithm if there is a cost basis; the cost basis is the number used to balance the postings."And in my model gain happens when commodity price goes up. When one sells commodity gain only changes from unrealized to realized, but the total amount of gain stays the same. I need to think how to work around this
Note that you *could* write a plugin that post-processed your transactions and hits the price table to fetch the rates and split up all those capital gains postings automatically.Is there a way to write plugin, which converts all postings to one single commodity at a historical price? I am thinking if I could do such conversion and then add extra transactions, related to gains due to commodity price changes then I could use all logic and reporting of beancount to further process it. I guess to achieve this I would need
- some provision in current design to convert posting to another commodity
- preferably function to pull commodity price from price database? Do you have some function like get_relative_commodity_price(commodity, referenced_commodity, date))
Once again, this is all driven by idea to have an explanation on how I got from Day A net Worth to Day B Net Worth.I must say I still don't understand how people who do trading and spend and get paid in different currencies live without such report. I just wouldn't trust calculation, if I can't see how I got from A to B.People ignore the currency components, and think in terms of their home currency (folding in the change in currency into their P/L).I understand, that people ignore currency components. But even if you do investments in stock you still want to know how you got from A to B, when you measure both A and B and B-A in one single currency.
--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/1921b8af-d39d-4f8e-b5ee-aa706f2b61f5%40googlegroups.com.