An example for Stocks on MMEX (v2)

Let's Get Started from the Securities (Equity + ETF) and Tangible Assets

Moderator: Renato

Post Reply
guangong
Developer
Posts: 646
Joined: Wed Dec 21, 2011 5:58 am
Are you a spam bot?: No
Contact:

An example for Stocks on MMEX (v2)

Post by guangong »

guys,

After spending some time for Stocks on MMEX, I wanted to use a detailed example to illustrate how to get started with Stocks v2 (still in development).

Assume I have investments in both HKEX and NASDAQ.
- HKEX: bought 100 XIAMI(1080.HK) shares on Monday(3/3), and sold all on Friday(3/7), it would gain some profits
- NASDAQ: bought 100 Nvidia(NVDA) shares on Monday(3/3), and bought 200 shares on Friday(3/7)

0: Cash Account setup with 1m as initial balance on Sunday(3/2)
cash_account_setup.png
(269.2 KiB) Downloaded 12398 times
1: Investment account setup and operations
create an investment account for each, NASDSQ with an initial balance in proper currency and HKEX with transferred amount from the cash account
Nasdaq_inv.png
(277.75 KiB) Downloaded 13256 times
HKEX_inv.png
(282.05 KiB) Downloaded 12398 times
cash_to_hkex.png
(280.76 KiB) Downloaded 12398 times
2: Initial buy/purchase, NOTE: you can specify whah ever category and payee you want
xiaomi_initial_buy.png
(355.86 KiB) Downloaded 12392 times
nvda_initial_buy.png
(369.5 KiB) Downloaded 12392 times
3: Followup sell and buy, NOTE: you can specify whah ever category and payee you want
xiaomi_sell.png
(357.18 KiB) Downloaded 12392 times
nvda_extra_buy.png
(359.84 KiB) Downloaded 12392 times

4: Clicking the investment(exchange) under Stock Portfolios, we can get the key position metrics, and its trade history.
HKEX_position.png
(198.97 KiB) Downloaded 13256 times
NASDAQ_position.png
(253.23 KiB) Downloaded 13256 times
5. Clicking the Cash Ledger under each investment (exchange), we will see its detailed cash movements
HKEX_cash_ledger.png
(209.87 KiB) Downloaded 13256 times
NASDAQ_cash_ledger.png
(210.26 KiB) Downloaded 13256 times
6. finally, all these results will be reflected in the MMEX dashboard.
MMEX_dashboard.png
(290.39 KiB) Downloaded 13256 times
7.furtherly, you can move the cash between these investment account and other regular accounts
Attachments
stockv2.mmb
(272 KiB) Downloaded 34 times
Last edited by guangong on Tue Mar 11, 2025 1:52 am, edited 5 times in total.
MlinMMEX
Super User
Posts: 119
Joined: Wed Jul 24, 2024 6:16 pm
Are you a spam bot?: No

Re: An example for Stocks on MMEX (v2)

Post by MlinMMEX »

Thank you very much for the info, the effort and the sharing of the data.
I would like to stop for a second and try to understand...What do you mean by "v2"?

Isn't MMEX a personal finance software in which, apart from income and expenses, tagged and assigned to categories, apart from that... also goes "beyond"? Is this a revamp of the investment manger feature, as the GRM is also being reviewed?

My point is that there are lots of specific and specialized software for investment tracking... And not sure if your example is just a validation of the simplest use case, or would be the start of a whole new development on the investments module.

For example, did you remember how software packages were advertised with "modules" and features?
See MS Money matching http://moneymvps.org/faq/article/499.aspx
Or Quicken editions selection according to personal goals... https://www.quicken.com/products/pricing-comparison/
What is the scope of MMEX "investment manager"? What is the automation expected? Is this in GitHub yet?

Sorry if I am taking the role of "product manager" to discuss the effort and the features... but it is hard to rely in a software in work.

So... Are you thinking in a new rework on the investment accounts? and on the data managed?
guangong
Developer
Posts: 646
Joined: Wed Dec 21, 2011 5:58 am
Are you a spam bot?: No
Contact:

Re: An example for Stocks on MMEX (v2)

Post by guangong »

v2 is to iterate the existing stock v1. Great if you can try it and find out the answer as it is there.

You just reminded me that unrealized p/l is also available in grm
1. https://grm.moneymanagerex.org/?report=StockSummary
2. http://grm.moneymanagerex.org/?report=CashLedger
3. http://grm.moneymanagerex.org/?report=TradeHistory
Nickallington
Senior User
Posts: 28
Joined: Sat Dec 22, 2018 3:00 pm
Are you a spam bot?: No

Re: An example for Stocks on MMEX (v2)

Post by Nickallington »

Hi all
I looked at the link below for the V2 version, and thought it was a good start. I had a lot of comments, mostly around the financial processing and accounting part. I will reply to that message too so that my comments are the same in both places, and it may be easier for people to read.

COPIED
Thanks for the screenshot proposals. They look interesting. However, I think it is worth clarifying some of the process and financial logic to make sure everyone is on the same page. I have commented on each part of the process based on your numbered sections below.
1. MMEX setup and operations. From a financial standpoint, when you create your new account, the opening balance is (almost) always zero. Then you move money into it, which is normally a transfer from either your bank account, or more unusually, a cash account. This account is for buying and selling shares, and is probably a Broker or other Intermediary account.
2. Initial Buy/Purchase. The Edit Transaction part is not very clear, but basically if it is a Buy transaction, your purchase is a Withdrawal from your Broker account (into which you have just put your deposit), and a payment to the Share Issuer. The Category can’t be Income, as it is a direct cost (not tax-deductible), and would need to go into a Category hierarchy of something like Investments: Shares: Purchases, though different people will want it displayed differently.
3. Follow-up Sell/Buy. Again, this is not investment income; it is a sale which will generate either a capital gain or a capital loss. That will have to be calculated by MMEX based on Lots and purchase prices. The accounting transaction is a deposit to the Broker account, and that will be the gross value of the sale (Investments: Shares: Sales), and any taxes, fees and charges that have been deducted as part of the sales transaction (shown as negative values under Category Investment Income), so that the net value of the transaction is equal to the amount of cash arriving in the Broker account. Those funds can then be used to purchase other Securities, or to be transferred to a user bank account. The only income part is the capital gain (+ive) or loss (-ive), which has to be calculated separately.
4. Portfolios. I think this is OK, though I have some trouble reading it, but the label Commission is insufficient. It may only be one part of a buy/sell transaction, as while commission as such will almost always be payable, there are also other fees like Stamp Duties and purchase or sale taxes, and really those should be accounted for separately (though you could change the label to Transaction Costs, and make it a total of all 3, as long as they can be displayed somehow by clicking on it, or hovering over it).
5. Cash ledger. This is a confusion of different concepts. There is a Cash Position, which is the amount of cash in the account at the time of viewing. That is the funds available for investment, so the immediately important bit. I think that is in the Header, but I can’t read it clearly, so that’s fine. There is also a Statement, which shows all the individual transactions on that account. So it would show the opening deposit of 100,000, the outgoing payment to the Broker for the purchase, and the incoming payment to the Broker for the sale. That way, it reconciles properly with the header and the bank account where the money came from in the first place.
6. Dashboard. I can’t read it properly, but I think the display is correct.
guangong
Developer
Posts: 646
Joined: Wed Dec 21, 2011 5:58 am
Are you a spam bot?: No
Contact:

Re: An example for Stocks on MMEX (v2)

Post by guangong »

Thanks @Nickallington for detailed reply.

the initial balance could be zero and transfer from other accounts as well, and sure thing we can specify what ever category and payee you prefer. these current values are just for demo purpose. (just added a note in-place).

for #4, all misc-fees are counted as commission so far. and yes, it is an accumulated value.
for #5, Cash ledger, this is the detailed cash movement (triggered by trade, and transfer). do you have a good name if cash ledger is not common.

great if you can try it with some real examples.
Nickallington
Senior User
Posts: 28
Joined: Sat Dec 22, 2018 3:00 pm
Are you a spam bot?: No

Re: An example for Stocks on MMEX (v2)

Post by Nickallington »

I think my main points are really as highlighted previously: firstly,that it would be beneficial to show the various fees and charges that are associated with purchases and sales as part of the entry transaction, rather than consolidating them into a single Commission element; and secondly, that the example screens should reflect the accounting flow accurately. Normally the only time an account starts with a balance other than zero is when you are setting up MMEX for the first time. If you are already a user, then a new account starts with a balance of zero, and your first action on that account is to transfer money into it so you can actually use it. If you open an account with a balance without a corresponding debit, you have just increased your net worth by that amount, and tax authorities will want to know where that money came from.

It would be good to create some examples that show the whole process flow, as one of the necessary outcomes will be for income and capital gains tax reporting, hence the need for splitting up purchase, sales and income-related costs. I tried opening the 2.0 version but it failed for me so perhaps I don't have the right app engine.
guangong
Developer
Posts: 646
Joined: Wed Dec 21, 2011 5:58 am
Are you a spam bot?: No
Contact:

Re: An example for Stocks on MMEX (v2)

Post by guangong »

with the development build, it would be functioned as the post.

The whole trade process flow is ready to create a cash account after step 0 is added. We can set up investment accounts both with zero balance(HKEX) and some initial balance (NASDAQ). Cash Ledger is for cash flow.

there is a limit to support the various fees that are associated with purchases and sales.
a workaround is to set up a BUY trade with ZERO shares and your desired category. In the future, a commission split might be more helpful
HKEX_xfee.png
(369.21 KiB) Downloaded 11293 times
MlinMMEX
Super User
Posts: 119
Joined: Wed Jul 24, 2024 6:16 pm
Are you a spam bot?: No

Re: An example for Stocks on MMEX (v2)

Post by MlinMMEX »

FYI. See how can this get bigger... https://www.gnucash.org/docs/v5/C/gnuca ... sell1.html
Nickallington
Senior User
Posts: 28
Joined: Sat Dec 22, 2018 3:00 pm
Are you a spam bot?: No

Re: An example for Stocks on MMEX (v2)

Post by Nickallington »

I think one of the base problems is in the Edit Share Transaction screen. There are two separate transactions there, and they shouldn't really be combined. You have a Purchase transaction which would be categorised as Investment: Share: Purchase, or something like that, and a commission or set of charges that are a transaction cost. I get that the Asset transaction is on the left, and the accounting transaction on the right, but that isn't quite correct as the commission is actually a transaction cost, not an asset cost. It may be a tax deductible cost, and may contain multiple elements (Taxes, Fees and Charges; none, some or all of which may be deductible).

Rather than mess everything around (as minimum cost and effort has to be a focus), is it feasible to put a Split Transaction option on Commission? That way, the user can allocate each part of the transaction cost to either a cost centre, or to a tax deductible account. That way, the Payee Broker is valid for the asset purchase, with Category Investments: Shares: Purchase, or whatever, and the Commision (Taxes, Fees and Charges) get allocated properly. And it would possibly be useful to have a total cost displayed somewhere, so that the user can make sure that the total entered corresponds to what he has on the transaction confirmation from the broker (there are two ways to look at it: Asset purchased + transaction costs = Amount debited, or Anount debited - transaction costs = Asset purchased). It would depend on how your relationship with the Broker works. In the first, you pay more, to get the specified number of shares, and cover the commission; in the second you get a reduced number of shares so that the asset value plus commission equals the amount of cash authorised.

I haven't yet read all the (lengthy) spec linked below, but using +ive for purchases and -ive for sales works, though I am not sure whether the user community would prefer to see things that way? I did use that logic to cover Dividend processing in the Investments spec as you have credits in the form of dividends and negatives in the form of processing costs or taxes related to that Dividend, and the only way you can do that in one transaction is to show the costs as negative incomes, but there was some adverse feedback about it.
guangong
Developer
Posts: 646
Joined: Wed Dec 21, 2011 5:58 am
Are you a spam bot?: No
Contact:

Re: An example for Stocks on MMEX (v2)

Post by guangong »

Great if we could have some transactions with numbers to show what it looks like in your mind.

there is no asset or stock cost as the whole is the transaction.
1. On the left are the figures with detailed share numbers, price, and commission if any
2. On the right are the final figures to affect your Investment account's cash balance.

for a given LOT, saying $100 per share * 100 shares, the gross amount would be $10,000 and the net amount depends
1. in the buy case, the final figure to impact your investment account would be negative($100,000 + commission)
2. in the sale case, the final figure to impact your investment account would be positive ($100,000 - commission)
3. any fee before flowing into your investment account, will be included in the commission.
4. any fee after flowing into your investment account, would be considered in a separate non-asset (stock) related transaction.

this trade-off or abstraction should work for major cases and will result in losing the details, especially for #3.
Nickallington
Senior User
Posts: 28
Joined: Sat Dec 22, 2018 3:00 pm
Are you a spam bot?: No

Re: An example for Stocks on MMEX (v2)

Post by Nickallington »

So for a simple buy, the transaction would be as follows, assuming the broker already had sufficient funds in his client account:

1. User decides to buy 100 shares in XXX at price 10, and instructs the broker accordingly
2. Broker buys shares for 1000, adds commission of 5% (50), purchase tax of 1.5% (15) and stamp duty of 4 (fixed rate). Total charge to user is 1069.
3. Broker reports the purchase via a contract note.
4. In MMEX, user debits 1069 from Boker account as follows:
a. 1000, payee XXX as share issuer (Category Investments: Shares: Purchase)
b. 50, payee Broker, for commission (Category Investments: Commissions
c. 15, payee government authority, for tax (Category Investments: Purchase taxes)
d. 4, payee probably also government, for stamp duty (Category Investments: Fees and duties)

You could do this the other way around, and say that User calls broker, and says to invest 1000 in shares of XXX, in which case he gets 93 shares in XXX, and pays 46.5 in commission, 13.95 in purchase tax, and 4 in stamp duty, for a total of 994.45, being the maximum he can pay within his instruction to invest 1000. The residual of 5.55 remains on the account (unless fractional shares apply).

What the user has to decide, based on his jurisdiction, is whether the 3 charges are permitted investment costs, and therefore tax deductible (a negative income), or whether they are not, in which case they go to a Category not included in his tax reporting output. And it may be that one or two may be deductible, but the third not. It is variable.

What does need to be clear is where the Commission as shown in MMEX is accounted, as that is an expense, whether tax deductible or not. It is not normally a reduction in asset value (though there are cases where it can be, and then it should be treated accordingly). I covered that in the draft Investments doc.
MlinMMEX
Super User
Posts: 119
Joined: Wed Jul 24, 2024 6:16 pm
Are you a spam bot?: No

Re: An example for Stocks on MMEX (v2)

Post by MlinMMEX »

@Nickallington I like your approach. thank you for your explanation.
guangong
Developer
Posts: 646
Joined: Wed Dec 21, 2011 5:58 am
Are you a spam bot?: No
Contact:

Re: An example for Stocks on MMEX (v2)

Post by guangong »

your case is great.
Commission in MMEX today supports this Fixed Amount buy (or Net Yuy) and the final purchased price would be $10.69. permitted investment costs, and therefore tax deductible as it is in the left panel so far...
Commission split is tbd.

Leaving the commission as zero might be a workaround to support the other way (Fixed Investment or Gross Buy), and the final purchased price would be $10.00.
additionally, the 3 charges would be tracked separately in the Investment Cash Ledger. NOT permitted investment costs, and NO tax deductible.

so two standalone tasks:
1. check Fixed Amount or Fixed Investment
2. commission split


@MlinMMEX and @Nickallington , how your country deal with #1
guangong
Developer
Posts: 646
Joined: Wed Dec 21, 2011 5:58 am
Are you a spam bot?: No
Contact:

Re: An example for Stocks on MMEX (v2)

Post by guangong »

I just added deductible commission splits during sell/buy, hope this will address the detailed tracking usage.
with the development build, we can verify it.
Deductible_Comm.png
(313.57 KiB) Downloaded 6567 times
Post Reply