Trading Accounts

101 views
Skip to first unread message

Alen Šiljak

unread,
Apr 19, 2019, 2:49:08 AM4/19/19
to Ledger
Martin (and others), FYI,

Ledger Wiki contains the article on how to implement Selinger's method:


There, simple "Currency:EUR" account names are used. GnuCash uses "Trading:Currency:EUR" or whatever other commodity is used.

To me this makes sense only for currencies or such. I fail to see the point of using this method for shares as the profit/loss there is accounted for in Capital Gains account.
Thinking, for example, about strawberries, makes an interesting case. Seeing some people use ledger for tracking inventories is impressive.
And going into time is even more interesting and fluid but I digress.

Just wanted to share that link to the Trading Accounts. I mean, the title clearly states "Currency Trading Accounts" but I believe, like in GnuCash, the concept can be used for (almost) any commodity.

On Wednesday, 17 April 2019 12:59:27 UTC+2, Martin Michlmayr wrote:

I don't know what a trading account is, ...

Pranesh Prakash

unread,
Jul 2, 2019, 1:27:24 PM7/2/19
to Ledger
I just wanted to note that trading accounts are a very powerful idea, usable with all commodities (not just currencies).  While they are great for unrealized gain/loss and can calculate that on the basis of price declarations, they leave realized loss/gain calculation up to the user.  

Trading accounts make it very easy for me to know how much I invested in a set of shares, how many of those shares I bought, and how much those shares are currently worth.

Some examples:
$ ledger -f unified.journal bal equity:trading:mf
-738.108 INF200K01180
 -7.937 INF200K01MO2
-580.030 INF209K01793
          ₹58,400.00  Equity:Trading:MF
-738.108 INF200K01180    INF200K01180:INR
 -7.937 INF200K01MO2    INF200K01MO2:INR
-580.030 INF209K01793    INF209K01793:INR
          ₹58,400.00    INR
          ₹25,000.00      INF200K01180
          ₹16,700.00      INF200K01MO2
          ₹16,700.00      INF209K01793
--------------------
-738.108 INF200K01180
 -7.937 INF200K01MO2
-580.030 INF209K01793
          ₹58,400.00

$ ledger -f unified.journal bal equity:trading:mf -X '₹'
          ₹-9,755.93  Equity:Trading:MF
         ₹-29,903.71    INF200K01180:INR
         ₹-19,527.87    INF200K01MO2:INR
         ₹-18,724.35    INF209K01793:INR
          ₹58,400.00    INR
          ₹25,000.00      INF200K01180
          ₹16,700.00      INF200K01MO2
          ₹16,700.00      INF209K01793
--------------------
          ₹-9,755.93


(This shows that I have an unrealized gain of ₹-9,755.93.)

Around a month ago, I revised the wiki entry to include the ordered commodity pair method, since that allows you to gain more insight during reporting:

You can extend this with dates as sub-accounts as well to manage lots (if you're using the commodities for investment/speculation rather than as a purchasing currency).

Pranesh Prakash

unread,
Jul 2, 2019, 1:49:27 PM7/2/19
to Ledger
Here's an example of a reverse stock split (and lots) using trading accounts:

2019/05/05 * Macrosoft
   
Assets:Investment:Shares:Macrosoft:20190505         40 MSFT
   
Trading:Shares:Macrosoft:INR:20190505              -40 MSFT
   
Trading:Shares:INR:Macrosoft:20190505            25,000.00
   
Assets:Savings:Bank                             ₹-25,000.00

2019/06/05 * Macrosoft
   
Assets:Investment:Shares:Macrosoft:20190605         20 MSFT
   
Trading:Shares:Macrosoft:INR:20190605              -20 MSFT
   
Trading:Shares:INR:Macrosoft:20190605            15,000.00
   
Assets:Savings:Bank                             ₹-15,000.00

2019/07/05 * Macrosoft | Reverse stock split 10->1
   
Assets:Investment:Shares:Macrosoft:20190705               6 MSFT
   
Trading:Shares:MacrosoftSplit:Macrosoft:20190705         -6 MSFT
   
Trading:Shares:Macrosoft:MacrosoftSplit:20190705         60 MSFT
   
Assets:Investment:Shares:Macrosoft:20190505             -40 MSFT
   
Assets:Investment:Shares:Macrosoft:20190605             -20 MSFT

Reply all
Reply to author
Forward
0 new messages