GNOME Bugzilla – Bug 501490
Balance Sheet: Incorrect in presence of stock sale
Last modified: 2018-06-29 21:55:31 UTC
Please describe the problem: A simple set of accounts in INR currency with stock buy and sale transactions at different prices (split as advised in the tutorial) give wrong value of asset and unrealised capital gains using weighted average price source. Steps to reproduce: 1. Load the below enclosed gnucash file. 2. Generate Balance Sheet report using Weighted average as price source Actual results: It shows value of asset HDFC.NS as 5000 It shows value of unrealised capital gains as 2500 Expected results: I would expect value of asset HDFC.NS as 2500. I would expect value of unrealised capital gains as 0 Does this happen every time? yes Other information: <?xml version="1.0" encoding="utf-8" ?> <gnc-v2 xmlns:gnc="http://www.gnucash.org/XML/gnc" xmlns:act="http://www.gnucash.org/XML/act" xmlns:book="http://www.gnucash.org/XML/book" xmlns:cd="http://www.gnucash.org/XML/cd" xmlns:cmdty="http://www.gnucash.org/XML/cmdty" xmlns:price="http://www.gnucash.org/XML/price" xmlns:slot="http://www.gnucash.org/XML/slot" xmlns:split="http://www.gnucash.org/XML/split" xmlns:sx="http://www.gnucash.org/XML/sx" xmlns:trn="http://www.gnucash.org/XML/trn" xmlns:ts="http://www.gnucash.org/XML/ts" xmlns:fs="http://www.gnucash.org/XML/fs" xmlns:bgt="http://www.gnucash.org/XML/bgt" xmlns:recurrence="http://www.gnucash.org/XML/recurrence" xmlns:lot="http://www.gnucash.org/XML/lot" xmlns:cust="http://www.gnucash.org/XML/cust" xmlns:job="http://www.gnucash.org/XML/job" xmlns:addr="http://www.gnucash.org/XML/addr" xmlns:owner="http://www.gnucash.org/XML/owner" xmlns:taxtable="http://www.gnucash.org/XML/taxtable" xmlns:tte="http://www.gnucash.org/XML/tte" xmlns:employee="http://www.gnucash.org/XML/employee" xmlns:order="http://www.gnucash.org/XML/order" xmlns:billterm="http://www.gnucash.org/XML/billterm" xmlns:bt-days="http://www.gnucash.org/XML/bt-days" xmlns:bt-prox="http://www.gnucash.org/XML/bt-prox" xmlns:invoice="http://www.gnucash.org/XML/invoice" xmlns:entry="http://www.gnucash.org/XML/entry" xmlns:vendor="http://www.gnucash.org/XML/vendor"> <gnc:count-data cd:type="book">1</gnc:count-data> <gnc:book version="2.0.0"> <book:id type="guid">e78dff7d671713eed651eed1302e9dc8</book:id> <book:slots> <slot> <slot:key>options</slot:key> <slot:value type="frame"> <slot> <slot:key>Business</slot:key> <slot:value type="frame"> <slot> <slot:key>Fancy Date Format</slot:key> <slot:value type="frame"> <slot> <slot:key>month</slot:key> <slot:value type="string">number</slot:value> </slot> <slot> <slot:key>custom</slot:key> <slot:value type="string">%A %d %B %Y</slot:value> </slot> <slot> <slot:key>years</slot:key> <slot:value type="integer">1</slot:value> </slot> <slot> <slot:key>fmt</slot:key> <slot:value type="string">locale</slot:value> </slot> </slot:value> </slot> </slot:value> </slot> </slot:value> </slot> </book:slots> <gnc:count-data cd:type="commodity">5</gnc:count-data> <gnc:count-data cd:type="account">40</gnc:count-data> <gnc:count-data cd:type="transaction">5</gnc:count-data> <gnc:commodity version="2.0.0"> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> <cmdty:get_quotes/> <cmdty:quote_source>currency</cmdty:quote_source> <cmdty:quote_tz/> </gnc:commodity> <gnc:commodity version="2.0.0"> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>USD</cmdty:id> <cmdty:get_quotes/> <cmdty:quote_source>currency</cmdty:quote_source> <cmdty:quote_tz/> </gnc:commodity> <gnc:commodity version="2.0.0"> <cmdty:space>NYSE</cmdty:space> <cmdty:id>AMZN</cmdty:id> <cmdty:name>AMZN (Amazon Ltd)</cmdty:name> <cmdty:fraction>10000</cmdty:fraction> <cmdty:get_quotes/> <cmdty:quote_source>yahoo</cmdty:quote_source> <cmdty:quote_tz/> </gnc:commodity> <gnc:commodity version="2.0.0"> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>101978</cmdty:id> <cmdty:name>HDFC Prudence Fund</cmdty:name> <cmdty:fraction>10000</cmdty:fraction> <cmdty:get_quotes/> <cmdty:quote_source>amfiindia</cmdty:quote_source> <cmdty:quote_tz/> </gnc:commodity> <gnc:commodity version="2.0.0"> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>102962</cmdty:id> <cmdty:name>Fidelity Equity Fund</cmdty:name> <cmdty:fraction>10000</cmdty:fraction> <cmdty:get_quotes/> <cmdty:quote_source>amfiindia</cmdty:quote_source> <cmdty:quote_tz/> </gnc:commodity> <gnc:commodity version="2.0.0"> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>HLL</cmdty:id> <cmdty:name>HLL Limited</cmdty:name> <cmdty:fraction>10000</cmdty:fraction> </gnc:commodity> <gnc:commodity version="2.0.0"> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> <cmdty:name>HDFC.NS</cmdty:name> <cmdty:fraction>10000</cmdty:fraction> <cmdty:get_quotes/> <cmdty:quote_source>yahoo</cmdty:quote_source> <cmdty:quote_tz/> </gnc:commodity> <gnc:pricedb version="1"> <price> <price:id type="guid">5487734f8e3fb9c5eebe2eab7231dcfe</price:id> <price:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>USD</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-12-04 12:55:16 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>394350000/10000000</price:value> </price> <price> <price:id type="guid">4845c9d4792bd875dc318fd84625ac24</price:id> <price:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>USD</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-12-03 10:40:26 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>395250000/10000000</price:value> </price> <price> <price:id type="guid">2fdee051863444050cff877e6af43126</price:id> <price:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>USD</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-29 14:44:32 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>397550000/10000000</price:value> </price> <price> <price:id type="guid">a903029517edc52846d656dd68da4451</price:id> <price:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>USD</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-29 14:41:53 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>397670000/10000000</price:value> </price> <price> <price:id type="guid">14eaabe5340d81f5692731ad6f258639</price:id> <price:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>USD</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-29 12:10:23 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>397570000/10000000</price:value> </price> <price> <price:id type="guid">118cede0396d6adbed02ea25886ca19a</price:id> <price:commodity> <cmdty:space>NYSE</cmdty:space> <cmdty:id>AMZN</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>USD</cmdty:id> </price:currency> <price:time> <ts:date>2007-12-03 16:00:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>909100000/10000000</price:value> </price> <price> <price:id type="guid">dd4eded14a9a0d19049c590d5819f3df</price:id> <price:commodity> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>101978</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-12-03 00:00:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>nav</price:type> <price:value>362980000/10000000</price:value> </price> <price> <price:id type="guid">d6bcae313d1e3dd2a4da9b33f660c21e</price:id> <price:commodity> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>101978</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-30 00:00:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>nav</price:type> <price:value>359670000/10000000</price:value> </price> <price> <price:id type="guid">651f076089543482758e538cce783706</price:id> <price:commodity> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>101978</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-28 00:00:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>nav</price:type> <price:value>354070000/10000000</price:value> </price> <price> <price:id type="guid">011a5136b04f0269a1c9be915b126167</price:id> <price:commodity> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>102962</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-12-03 00:00:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>nav</price:type> <price:value>234430000/10000000</price:value> </price> <price> <price:id type="guid">da23852c3b03e0c20c7482a595ec043e</price:id> <price:commodity> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>102962</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-30 00:00:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>nav</price:type> <price:value>231560000/10000000</price:value> </price> <price> <price:id type="guid">44b69cf4adaeb7186175bd7ff2b48892</price:id> <price:commodity> <cmdty:space>amfiIndia</cmdty:space> <cmdty:id>102962</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-28 00:00:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>nav</price:type> <price:value>226810000/10000000</price:value> </price> <price> <price:id type="guid">a9d84a3b8ddbd6f78ff58714fe83eb91</price:id> <price:commodity> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-12-04 02:21:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>274389990/100000</price:value> </price> <price> <price:id type="guid">c935632aa6a079257e158accbab66cac</price:id> <price:commodity> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-12-03 00:06:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>281114990/100000</price:value> </price> <price> <price:id type="guid">61a7eb536fc5c535fe570ba46a6744f1</price:id> <price:commodity> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-29 04:11:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>273100000/100000</price:value> </price> <price> <price:id type="guid">f884c8cab6f381c504075587fc3383a5</price:id> <price:commodity> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-29 04:11:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>272750000/100000</price:value> </price> <price> <price:id type="guid">a1414f45f3d8e1e07cbb64b51cc1c8f5</price:id> <price:commodity> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-29 01:36:00 +0530</ts:date> </price:time> <price:source>Finance::Quote</price:source> <price:type>last</price:type> <price:value>276980000/100000</price:value> </price> <price> <price:id type="guid">9d9e452aceb159f0a39fa3e18699e0f9</price:id> <price:commodity> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> </price:commodity> <price:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </price:currency> <price:time> <ts:date>2007-11-04 00:00:00 +0530</ts:date> </price:time> <price:source>user:price-editor</price:source> <price:type>unknown</price:type> <price:value>25000000/1000000</price:value> </price> </gnc:pricedb> <gnc:account version="2.0.0"> <act:name>Root Account</act:name> <act:id type="guid">687a56efb4f98d43746f1adf47a45494</act:id> <act:type>ROOT</act:type> <act:commodity-scu>0</act:commodity-scu> </gnc:account> <gnc:account version="2.0.0"> <act:name>Assets</act:name> <act:id type="guid">dda49e537d7252d18b8dfc62e59086d0</act:id> <act:type>ASSET</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Assets</act:description> <act:slots> <slot> <slot:key>placeholder</slot:key> <slot:value type="string">true</slot:value> </slot> </act:slots> <act:parent type="guid">687a56efb4f98d43746f1adf47a45494</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Investments</act:name> <act:id type="guid">8b8c54b5b5504cafd33ea9b729df10fe</act:id> <act:type>ASSET</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Investments</act:description> <act:slots> <slot> <slot:key>placeholder</slot:key> <slot:value type="string">true</slot:value> </slot> </act:slots> <act:parent type="guid">dda49e537d7252d18b8dfc62e59086d0</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>MK</act:name> <act:id type="guid">80e6c57012daf3af520caae8257e3240</act:id> <act:type>BANK</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Market Based</act:description> <act:parent type="guid">8b8c54b5b5504cafd33ea9b729df10fe</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Stock</act:name> <act:id type="guid">f6f7e1ecba941dd7d6958d0b9c7f12fe</act:id> <act:type>STOCK</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Stock</act:description> <act:parent type="guid">80e6c57012daf3af520caae8257e3240</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>HDFC</act:name> <act:id type="guid">8674f4b04dabf88703e52474789d9f6a</act:id> <act:type>STOCK</act:type> <act:commodity> <cmdty:space>yahoo asia</cmdty:space> <cmdty:id>HDFC.NS</cmdty:id> </act:commodity> <act:commodity-scu>10000</act:commodity-scu> <act:description>HDFC Limited</act:description> <act:parent type="guid">f6f7e1ecba941dd7d6958d0b9c7f12fe</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Current Assets</act:name> <act:id type="guid">73aa9eb9f2126497b6abde8a55bdd648</act:id> <act:type>ASSET</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Current Assets</act:description> <act:slots> <slot> <slot:key>placeholder</slot:key> <slot:value type="string">true</slot:value> </slot> </act:slots> <act:parent type="guid">dda49e537d7252d18b8dfc62e59086d0</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Savings Accounts</act:name> <act:id type="guid">66fbaee4823c3d84f038216b1908a9aa</act:id> <act:type>BANK</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Savings Accounts Bank</act:description> <act:parent type="guid">73aa9eb9f2126497b6abde8a55bdd648</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>HDFC Bank</act:name> <act:id type="guid">6ee70083badeca8f10667c659db18663</act:id> <act:type>BANK</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:slots> <slot> <slot:key>reconcile-info</slot:key> <slot:value type="frame"> <slot> <slot:key>include-children</slot:key> <slot:value type="integer">0</slot:value> </slot> <slot> <slot:key>postpone</slot:key> <slot:value type="frame"> <slot> <slot:key>balance</slot:key> <slot:value type="numeric">20000000/100</slot:value> </slot> <slot> <slot:key>date</slot:key> <slot:value type="integer">1196274599</slot:value> </slot> </slot:value> </slot> </slot:value> </slot> </act:slots> <act:parent type="guid">66fbaee4823c3d84f038216b1908a9aa</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Income</act:name> <act:id type="guid">aca60b7c91c412f100be1b87ce34db35</act:id> <act:type>INCOME</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Income</act:description> <act:slots> <slot> <slot:key>placeholder</slot:key> <slot:value type="string">true</slot:value> </slot> </act:slots> <act:parent type="guid">687a56efb4f98d43746f1adf47a45494</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Other Income</act:name> <act:id type="guid">44c041d828a265c0a3991b8de5d5dbea</act:id> <act:type>INCOME</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:code>-30</act:code> <act:description>Other Income</act:description> <act:parent type="guid">aca60b7c91c412f100be1b87ce34db35</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Investment Income</act:name> <act:id type="guid">7bab503b0ba7b2d2ddd25c9ab4d9d253</act:id> <act:type>INCOME</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:code>-50</act:code> <act:description>Investment Income</act:description> <act:parent type="guid">aca60b7c91c412f100be1b87ce34db35</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Share Dividend</act:name> <act:id type="guid">6837cce2a8f7b43f1f3d70f5598b290e</act:id> <act:type>INCOME</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Share Dividend Income</act:description> <act:parent type="guid">7bab503b0ba7b2d2ddd25c9ab4d9d253</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>CG</act:name> <act:id type="guid">df63531c9d0490c718c6874710e7ae9a</act:id> <act:type>INCOME</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Capital Gains</act:description> <act:parent type="guid">aca60b7c91c412f100be1b87ce34db35</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Share CG Long Term</act:name> <act:id type="guid">23e9e5c640dbcc8c91af1e5d9847cd76</act:id> <act:type>INCOME</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Share CG Long Term</act:description> <act:parent type="guid">df63531c9d0490c718c6874710e7ae9a</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Expenses</act:name> <act:id type="guid">adedb16d48a950bce9bb885bd1b2b093</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Expenses</act:description> <act:slots> <slot> <slot:key>placeholder</slot:key> <slot:value type="string">true</slot:value> </slot> </act:slots> <act:parent type="guid">687a56efb4f98d43746f1adf47a45494</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Commissions</act:name> <act:id type="guid">04a0f625830be357e7bd610471efdb14</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Commissions</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Home Repair</act:name> <act:id type="guid">36ff7432033f101e1985d28d9d930d9e</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Home Repair</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Insurance</act:name> <act:id type="guid">d939c7c9cc9a3e3566af2e26c4f48e7a</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Insurance</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Home Insurance</act:name> <act:id type="guid">dd3bdc8dc664f87d228a83095d9144b6</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Home Insurance</act:description> <act:parent type="guid">d939c7c9cc9a3e3566af2e26c4f48e7a</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Auto Insurance</act:name> <act:id type="guid">ab7e16f631aa02f0c80aa0032f92335e</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Auto Insurance</act:description> <act:parent type="guid">d939c7c9cc9a3e3566af2e26c4f48e7a</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Health Insurance</act:name> <act:id type="guid">0f876b26e016fb6d1e3bb1c764ea0afd</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Health Insurance</act:description> <act:parent type="guid">d939c7c9cc9a3e3566af2e26c4f48e7a</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Life Insurance</act:name> <act:id type="guid">7ba372886439f5ecce113f6ed5edf9d1</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Life Insurance</act:description> <act:parent type="guid">d939c7c9cc9a3e3566af2e26c4f48e7a</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Taxes</act:name> <act:id type="guid">62ef1af483b6e4f00ee33d8b645c15b9</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Taxes</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Income Tax</act:name> <act:id type="guid">d23b8bc04133849eb8ac9cbe76e5fcff</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Income Tax</act:description> <act:parent type="guid">62ef1af483b6e4f00ee33d8b645c15b9</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Other Tax</act:name> <act:id type="guid">8024567f7dc8f427957b541a8d36af9b</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Other Tax</act:description> <act:parent type="guid">62ef1af483b6e4f00ee33d8b645c15b9</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Adjustment</act:name> <act:id type="guid">7db5be9504ed1d4324ed5999750f374a</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Adjustment</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Bank Service Charge</act:name> <act:id type="guid">bce5ae5f4c4151d1465e1e70d1a8b069</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Bank Service Charge</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Charity 80G</act:name> <act:id type="guid">d50fb70d557aaa99180bcb71d51b1fc0</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Charity 80G deductible</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Household</act:name> <act:id type="guid">8907fd8ad97b2dca75dba06a3b3491a5</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Household Expenses</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Gifts</act:name> <act:id type="guid">6b113d400982d49192abee5822934856</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Gifts</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Luxary</act:name> <act:id type="guid">6b7dd98fb6adbbfc6462d9b89a868fe7</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Luxary expenses</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Miscellaneous</act:name> <act:id type="guid">8bcc2afcdf558264096d15f4a8d1ea11</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Miscellaneous</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Credit Card Bills</act:name> <act:id type="guid">3b768ca511709fdda2a2aa3c325e9b7a</act:id> <act:type>EXPENSE</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Credit Card Bills</act:description> <act:parent type="guid">adedb16d48a950bce9bb885bd1b2b093</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Liabilities</act:name> <act:id type="guid">fcaa37e7a62a96f551de2119f6901357</act:id> <act:type>LIABILITY</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Liabilities</act:description> <act:slots> <slot> <slot:key>placeholder</slot:key> <slot:value type="string">true</slot:value> </slot> </act:slots> <act:parent type="guid">687a56efb4f98d43746f1adf47a45494</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Credit Card</act:name> <act:id type="guid">6234234768209e6960a02a121556d90a</act:id> <act:type>CREDIT</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Credit Card</act:description> <act:parent type="guid">fcaa37e7a62a96f551de2119f6901357</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Equity</act:name> <act:id type="guid">572405f0e05a1035f0b72dba336e5db1</act:id> <act:type>EQUITY</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Equity</act:description> <act:slots> <slot> <slot:key>placeholder</slot:key> <slot:value type="string">true</slot:value> </slot> </act:slots> <act:parent type="guid">687a56efb4f98d43746f1adf47a45494</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Opening Balances</act:name> <act:id type="guid">2203933f2f0297529f851e142bd20ac0</act:id> <act:type>EQUITY</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:description>Opening Balances</act:description> <act:parent type="guid">572405f0e05a1035f0b72dba336e5db1</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Orphan-INR</act:name> <act:id type="guid">28813da21f8b4a57ebbb2739cd19d35b</act:id> <act:type>BANK</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:parent type="guid">687a56efb4f98d43746f1adf47a45494</act:parent> </gnc:account> <gnc:account version="2.0.0"> <act:name>Imbalance-INR</act:name> <act:id type="guid">23d7865c6e27e1783455e14eddeb803c</act:id> <act:type>BANK</act:type> <act:commodity> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </act:commodity> <act:commodity-scu>100</act:commodity-scu> <act:parent type="guid">687a56efb4f98d43746f1adf47a45494</act:parent> </gnc:account> <gnc:transaction version="2.0.0"> <trn:id type="guid">eab863f76794b94f244d9f845c239d59</trn:id> <trn:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </trn:currency> <trn:date-posted> <ts:date>2007-10-03 00:00:00 +0530</ts:date> </trn:date-posted> <trn:date-entered> <ts:date>2007-12-04 16:37:03 +0530</ts:date> </trn:date-entered> <trn:description>HDFC Ltd Purchase</trn:description> <trn:splits> <trn:split> <split:id type="guid">f415b3e77bf3557f9d87103f71b3785a</split:id> <split:action>Buy</split:action> <split:reconciled-state>n</split:reconciled-state> <split:value>312500/100</split:value> <split:quantity>1250000/10000</split:quantity> <split:account type="guid">8674f4b04dabf88703e52474789d9f6a</split:account> </trn:split> <trn:split> <split:id type="guid">374ba779dc90323853d9572a6c76d210</split:id> <split:reconciled-state>n</split:reconciled-state> <split:value>-312500/100</split:value> <split:quantity>-312500/100</split:quantity> <split:account type="guid">6ee70083badeca8f10667c659db18663</split:account> </trn:split> </trn:splits> </gnc:transaction> <gnc:transaction version="2.0.0"> <trn:id type="guid">96bd717a26787046c7e670acfc7ecf54</trn:id> <trn:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </trn:currency> <trn:date-posted> <ts:date>2007-11-04 00:00:00 +0530</ts:date> </trn:date-posted> <trn:date-entered> <ts:date>2007-12-04 16:41:03 +0530</ts:date> </trn:date-entered> <trn:description>Sell HDFC shares</trn:description> <trn:splits> <trn:split> <split:id type="guid">140bd7b761e478572c40deba9c481666</split:id> <split:reconciled-state>n</split:reconciled-state> <split:value>250000/100</split:value> <split:quantity>250000/100</split:quantity> <split:account type="guid">6ee70083badeca8f10667c659db18663</split:account> </trn:split> <trn:split> <split:id type="guid">eda88847469adefb765c8564bb5ee262</split:id> <split:memo>Profit </split:memo> <split:reconciled-state>n</split:reconciled-state> <split:value>187500/100</split:value> <split:quantity>0/10000</split:quantity> <split:account type="guid">8674f4b04dabf88703e52474789d9f6a</split:account> </trn:split> <trn:split> <split:id type="guid">e0d64506b1f9af5373438decace58d50</split:id> <split:action>Sell</split:action> <split:reconciled-state>c</split:reconciled-state> <split:value>-250000/100</split:value> <split:quantity>-250000/10000</split:quantity> <split:account type="guid">8674f4b04dabf88703e52474789d9f6a</split:account> </trn:split> <trn:split> <split:id type="guid">9abf2102d4a59b648dd17d32302b1102</split:id> <split:reconciled-state>n</split:reconciled-state> <split:value>-187500/100</split:value> <split:quantity>-187500/100</split:quantity> <split:account type="guid">23e9e5c640dbcc8c91af1e5d9847cd76</split:account> </trn:split> </trn:splits> </gnc:transaction> <gnc:transaction version="2.0.0"> <trn:id type="guid">40411892effea69eb0ba9e7555f446af</trn:id> <trn:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </trn:currency> <trn:date-posted> <ts:date>2007-04-01 00:00:00 +0530</ts:date> </trn:date-posted> <trn:date-entered> <ts:date>2007-12-04 16:31:48 +0530</ts:date> </trn:date-entered> <trn:description>Opening Balance</trn:description> <trn:splits> <trn:split> <split:id type="guid">b12fe89e550662fe7e7a3dd223cccaaf</split:id> <split:reconciled-state>n</split:reconciled-state> <split:value>30000000/100</split:value> <split:quantity>30000000/100</split:quantity> <split:account type="guid">6ee70083badeca8f10667c659db18663</split:account> </trn:split> <trn:split> <split:id type="guid">44c8322af08f0f4e8221c54446980b07</split:id> <split:reconciled-state>n</split:reconciled-state> <split:value>-30000000/100</split:value> <split:quantity>-30000000/100</split:quantity> <split:account type="guid">2203933f2f0297529f851e142bd20ac0</split:account> </trn:split> </trn:splits> </gnc:transaction> <gnc:transaction version="2.0.0"> <trn:id type="guid">d1b60df63266f135f66d06d45bcafda3</trn:id> <trn:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </trn:currency> <trn:date-posted> <ts:date>2007-12-01 00:00:00 +0530</ts:date> </trn:date-posted> <trn:date-entered> <ts:date>2007-12-03 10:32:05 +0530</ts:date> </trn:date-entered> <trn:description>Fidelity Equity Dividend</trn:description> <trn:splits> <trn:split> <split:id type="guid">5cc030a12b8dd4788cbdcd9d08b1a405</split:id> <split:reconciled-state>n</split:reconciled-state> <split:value>0/100</split:value> <split:quantity>0/100</split:quantity> <split:account type="guid">23d7865c6e27e1783455e14eddeb803c</split:account> </trn:split> </trn:splits> </gnc:transaction> <gnc:transaction version="2.0.0"> <trn:id type="guid">74d5427b217ea4ecb5cc10d374801e02</trn:id> <trn:currency> <cmdty:space>ISO4217</cmdty:space> <cmdty:id>INR</cmdty:id> </trn:currency> <trn:date-posted> <ts:date>2007-12-03 00:00:00 +0530</ts:date> </trn:date-posted> <trn:date-entered> <ts:date>2007-12-03 10:34:35 +0530</ts:date> </trn:date-entered> <trn:description>US 64 Redemption and Interest</trn:description> <trn:splits> <trn:split> <split:id type="guid">2309d900f7a86969609a1c7cfaa0eec3</split:id> <split:reconciled-state>n</split:reconciled-state> <split:value>0/100</split:value> <split:quantity>0/100</split:quantity> <split:account type="guid">23d7865c6e27e1783455e14eddeb803c</split:account> </trn:split> </trn:splits> </gnc:transaction> </gnc:book> </gnc-v2> <!-- Local variables: --> <!-- mode: xml --> <!-- End: -->
I checked the price scatterplot for HDFC.NS using weighted average price source which computes "weighted average" as 50. In this case the balance sheet and unrealized gains are correct. So this may not be a bug!! Unfortunately, 1. The investment portfolio report with weighted price method gives ERROR. Surely this is a bug. 2. I am very puzzled why weighted average price in the following is 50. Buy 125 of HDFC.NS at 25. Sell 25 HDFC.NS at 100. Is there a definition? Gnucash is a great software. Sadly, I have difficulty with following nagging issues. 3. Is there a way in which Investment Portfolio report would lists buy value of my stocks rather than current value? 4. Is there a way to value assets to get balance sheet with unrealized capital gains as zero? (Why count chicken before they have hatched!!) Thanks. Paritosh Pandya
I see how it comes up with the average price. With the way the capital gains are recorded, you really have 3 exchanges: 125 HDFC.NS at 25 = INR 3125 25 HDFC.NS at 100 = INR 2500 0 HDFC.NS at 0 = INR 1875 Weighted Avg = (3125 + 2500 + 1875) / (125 + 25 + 0) = 50 So it seems that either the sell transaction should be recorded differently, or the average price algorithm should discard exchanges with a rate of zero. If you had recorded your sale this way, the average price would be 25 instead: Basis (25/share) Assets:Investments:MK:Stock:HDFC 625 Realized Gain Income:CG:Share CG Long Term 1875 Deposit proceeds Assets:Current Assets:Savings Accounts:HDFC Bank 2500 But as soon as you add another buy or sell, the average price is inappropriate again. So average price is not really a good way to value unsold holdings.
Regarding questions 3 & 4, I believe the answer currently is "no". That feature has been requested in bug 521403. The Advanced Portfolio report is supposed to show a Basis column, however, and that is what you are talking about.
A have added a new "Average Cost" price source for reporting. Committed as r17266. Requesting backport for 2.2.
Applied to branches/2.2 as r17283 for inclusion in GnuCash 2.2.6. Thanks!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=501490. Please update any external references or bookmarks.