<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#2e3436" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><font face="Tahoma">On 2/7/25 6:43 AM,
        Thomas Baumgart via KMyMoney-devel wrote:<br>
      </font></div>
    <blockquote type="cite" cite="mid:3553472.sQuhbGJ8Bu@sy-346-nb">
      <pre wrap="" class="moz-quote-pre"><font face="Tahoma">On Mittwoch, 5. Februar 2025 20:56:44 CET Brendan Coupe via KMyMoney-devel wrote:

</font></pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre"><font face="Tahoma">I've been running the master branch on Fedora 41 for several months. I 
compile it on my system.

When I import my CD transactions from my broker via a downloaded ofx 
file, the price is listed as $100 when is should be $1. This has been an 
issue in 5.1 for several years and I think it started when I switched 
brokers. I have not asked about it since the developers are busy working 
on 5.2 and it was easy to correct in 5.1.

Since I switched to the master branch, the problem appears to be much 
deeper. The $100 price appears to be stored and used for some of the 
value calculations. As I bought new CDs, they were all valued at 100 
times their actual price. I corrected this by doing a manual price 
update in the investment section and changing it from 100 to 1. The 
dialog that opens says I'm adjusting the exchange rate for the stock xxx 
to USD which seems odd. I leave the date alone but it appears to be the 
purchase date. This is far from ideal since i have more than 100 
securities / CDs in several investment accounts so it's hard to find the 
ones that need to be fixed.

Ideally KMM would recognize the discrepancy and adjust the price from 
$100 to $1 when importing the OFX file. I'm guessing this is due to the 
broker not following the OFX standard.

I think these are the relevant lines in the OFX file when I purchase a CD.

<UNITS>12345
<UNITPRICE>100
<MKTVAL>12345

The UNITPRICE should be 1 and it's obvious the math does not work if you 
assume 100 is correct.
</font></pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre"><font face="Tahoma">
Yes, and the OFX spec ver. 2.3 states that:

Unitprice: Use decimal notation. Unless specifically noted, prices should always be positive.

Unfortunately, the same spec contains a few odd examples:

  <UNITS>1</UNITS> <!--100 shares-->
  <UNITPRICE>5</UNITPRICE><!--Latest price-->
  <MKTVAL>500</MKTVAL><!--Current market value $500.00-->

The comments are correct, the values don't match them. Another example
is shown as

  <UNITS>1560.18
  <UNITPRICE>1
  <MKTVAL>156.18

which also does not calculate correctly as the price would be 10.


UNITPRICE is defined as follows:

- Price per commonly-quoted unit. Does not include markup/markdown. 
- Share price for stocks, mutual funds, and others
- Percentage of par for bonds 
- Per share (not contract) for options


To work around all this, I could imagine to add an OFX specific option
that selects the price source:

a) Price field in transaction
b) Calculate by value and units

Thoughts? This seems easy to implement.</font></pre>
    </blockquote>
    <p>Not sure how I would specify this, I assume on an account basis,
      but this would fix this problem.</p>
    <p>It appears to have changed part of the way this has been handled
      since 5.1. Do you understand why it's behaving differently?<br>
    </p>
    <blockquote type="cite" cite="mid:3553472.sQuhbGJ8Bu@sy-346-nb">
      <pre wrap="" class="moz-quote-pre"><font face="Tahoma">

</font></pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre"><font face="Tahoma">Oddly enough, the Quantity, Value and Balance columns in the ledger for 
the investment account are all correct and the Price column is wrong. 
When I update the price in the transaction from 100 to 1, all of the 
columns are correct. The Investment Value at the bottom of the ledger is 
clearly not based on the total of the Balance column since it appears to 
be using the 100 imported from the OFX file. The only way I can fix this 
is to find the CD in the investment section and manually change the 
price (exchange rate?) from 100 top 1.
</font></pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre"><font face="Tahoma">
Would it help to sort the investment ledger by security (in case you
have multiple of them in one investment account)? At least that can
be done in master (5.2).

</font></pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre"><font face="Tahoma">This extra step was not required in 5.1. When I adjusted the price in 
the transaction, the Investment Value at the bottom of the ledger was 
correct.

I'm also having a problem when I sell CDs. The transaction only shows in 
the Brokerage account, not the investment account. I have to find the 
original purchase in the Investment account, duplicate it, switch it 
from buy to sell and correct the date. Then I match the newly created 
transaction in the brokerage account to the imported one. Unless this 
triggers a quick fix, lets figure out the first problem and I will come 
back to CD sales later since this is not a new problem in the master branch.
</font></pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre"><font face="Tahoma">
An example would help. Please feel free to send it via PM if needed.
</font></pre>
    </blockquote>
    <font face="Tahoma">I will send you the OFX and Test KMM files
      directly. I suggest you import the OFX into 2 new test files using
      5.1 and the master to see the difference. let me know if I need to
      clarify anything.</font><br>
    <blockquote type="cite" cite="mid:3553472.sQuhbGJ8Bu@sy-346-nb">
      <pre wrap="" class="moz-quote-pre"><font face="Tahoma">
</font></pre>
    </blockquote>
    <div class="moz-signature"><font face="Tahoma">-- <br>
      </font>
      <font face="Tahoma"><br>
      </font>
      <font color="#000000" face="Tahoma"><b>Brendan Coupe</b></font><font
        face="Tahoma"> <br>
      </font>
      <font color="#000000" face="Tahoma"><b><a class="moz-txt-link-abbreviated" href="mailto:3@Coupe7.com">3@Coupe7.com</a></b></font><font
        face="Tahoma"> <br>
      </font>
      <font face="Tahoma"><br>
      </font>
      <font face="Tahoma"><br>
      </font>
    </div>
  </body>
</html>