<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 10/3/23 03:25, Thomas Baumgart
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:2253352.iZASKD2KPV@sy-346-nb">
      <pre class="moz-quote-pre" wrap="">On Dienstag, 3. Oktober 2023 01:37:32 CEST Jack via KMyMoney-devel wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">TL;DR at some point in the past day or two (during my monthly  
reconciliation of my Merrill Lynch investment accounts) a stray  
</KMYMONEY-FILE> ended up in the middle of the <PRICES> section of my  
xml data file.  I noticed this because I started getting the  
consistency-check message about no price on or before the first use of  
a security.  That led to noticing that many prices were missing, and I  
ended up actually looking in the xml file.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">That looks weird. As usual, the first question is: which version of KMM
(stable or master)? The logic to write the XML file differs significantly
between the two.</pre>
    </blockquote>
    Master, compiled within the past few days.  Although I do on
    occasion use 5.1, I don't recall doing so in the past few weeks.  It
    might be interesting if there were some  hint in the file about
    which version saved it.<br>
    <blockquote type="cite" cite="mid:2253352.iZASKD2KPV@sy-346-nb">
      <pre class="moz-quote-pre" wrap="">A few other questions come to my mind:
- do you switch between those versions?
- do you have auto saving enabled?</pre>
    </blockquote>
    Only autosave on close if file is changed, 10 versions.<br>
    <blockquote type="cite" cite="mid:2253352.iZASKD2KPV@sy-346-nb"><br>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">I'm in process (after making several copies of all saved backups from  
the past two days) of splicing the missing <PRICEPAIRS> sections the  
the whole <REPORTS> section from the last good file into the current  
one (I have no budgets or onlinejobs, so those sections are empty.)   
I'd love to know how this might have happened, as well as any things to  
look for that this type of data surgery might introduce.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">I have done this in the past when my ONLINEJOBS were gone. Not that I
needed them, but I'd like to keep them around. For me this was caused
by a faulty implementation of the XML writer for onlinejobs. That was
when I re-wrote the XML logic a few months ago.

I don't expect any problems if you proceed your surgery. It could be,
that a couple of prices are missing in case you have added some in the
meantime. Any modification on the reports would also have to be made
again. That's all.</pre>
    </blockquote>
    Good.  That matches what I thought.<span
    style="white-space: pre-wrap">
</span>
    <blockquote type="cite" cite="mid:2253352.iZASKD2KPV@sy-346-nb">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">-------

I'm doing my monthly reconciliation of all my Merrill Lynch investment  
accounts, and I started getting the "no price for first use date" for  
one security.  The equity exists, and there are security accounts for  
it in two different investmant accounts.  In both cases, the initial  
presence was from an Add Shares transaction (it was a dividend from a  
related stock) and was all sold over the past few months.  However,  
there are currently NO prices for this equity in my file.  Searching  
through explicit backups and my autosave backups, the prices are in all  
files prior to 17:15 this evening, but missing from all files after  
that time.

Further looking shows that in the earliest bad file, within the  
<PRICES>......</PRICES> section there is clearly a problems:

     <PRICEPAIR from="E000520" to="USD">
       <PRICE date="2023-09-01" price="5159/50" source="Yahoo Finance"/>
       <PRICE date="2023-09-30" price="10287/100" source="Yahoo  
Finance"/>
     </PRICEPAIR>
   </PRICES>
</KMYMONEY-FILE>
<PRICEPAIR from="E000525" to="USD">
    <PRICE date="2022-06-22" price="2367/50" source="User"/>
   <PRICE date="2022-09-11" price="2597/50" source="Yahoo Finance"/>
....

Where did that </KMYMONEY-FILE> come from?  I have not been editing the  
file manually (at least not today :-).
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">It's not only the </KMYMONEY-FILE> but also the </PRICES> entry. And the
<REPORTS> sections is missing completely. Does that file have a REPORTS
section later on or is it missing completely?</pre>
    </blockquote>
    <p>What I quoted was not all the way to the end of the file.  I'm
      not at home right now, but I believe all the files saved after the
      event included <REPORTS /> and <ONLINEJOBS /> which I
      read as KMM aborting the reading on hitting </KMYMONEY-FILE>
      and writing a complete file including empty sections where it had
      no data.  However, that does not account for the those
      <PRICEPAIR ...> sections with correct Ennnnn and date but
      wrong amount.  I need to review the autosave files more carefully
      to see what is actually after the </KMYMONEY-FILE><span
      style="white-space: pre-wrap">
</span><span style="white-space: pre-wrap">
</span></p>
    <blockquote type="cite" cite="mid:2253352.iZASKD2KPV@sy-346-nb">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Stranger, the current file at that point is
     <PRICEPAIR from="E000520" to="USD">
       <PRICE date="2022-05-24" price="25080049/380000"  
source="Transaction"/>
       <PRICE date="2022-06-03" price="3653/50" source="Yahoo Finance"/>
... all these PRICEs are correct
       <PRICE date="2023-09-30" price="10287/100" source="Yahoo  
Finance"/>
     </PRICEPAIR>
     <PRICEPAIR from="E000525" to="USD">
       <PRICE date="2022-06-22" price="89971/1940" source="User"/>
     </PRICEPAIR>
     <PRICEPAIR from="E000526" to="USD">
       <PRICE date="2022-06-24" price="20697/380" source="User"/>
     </PRICEPAIR>

So it seems to have kept one pricepair for most but not all the  
following equities, and the prices kept are for the first date of the  
existing pairs, but the price itself seems totally unrelated.

Of course since everything past that point is gone, I now have no  
custom reports either.

Do I just chalk this up to haveing a bad day, or perhaps sunspots, or  
is there any hope of figuring out what might have ac tually happened.
   <REPORTS/>
One odd thing is that I've got several files with </KMYMONEY-FILE> in  
the middle of a <PRICEPAIRS> section, so KMM persisted in writing bad  
files.  All the accounts and transactions seem fine, it's just the  
prices which are messed up (and the reports missing.)

Any thoughts or suggestions?

(The reason I don't want to simply revert to the last known good file  
is that I'd have to redo over an hour of importing and reconciliation  
work, although I know I may yet need to resort to that.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">The reconciliation data is part of the ACCOUNT elements, so it seems
to be in good condition.</pre>
    </blockquote>
    It's not so much the actual reconciliation record but my having
    cleared all the transaction, after editing some of them, and
    actually having had to create a few do to having had to remove them
    manually from the qfx file because of wrong security name.<br>
    <blockquote type="cite" cite="mid:2253352.iZASKD2KPV@sy-346-nb">
      <pre class="moz-quote-pre" wrap="">Can you reproduce the problem by using the last good file and repeat what
you have done to get to the first faulty one (in case you remember/can find
out what that was)?</pre>
    </blockquote>
    I wish I knew what I had done.  I suppose I can try using the last
    good file and jsut redoing all the reconciliation work since that
    point.<span style="white-space: pre-wrap">
</span>
    <blockquote type="cite" cite="mid:2253352.iZASKD2KPV@sy-346-nb">
      <pre class="moz-quote-pre" wrap="">Doesn't KMyMoney complain in case you load a faulty file?</pre>
    </blockquote>
    I don't recall any complaints, but then when I'm doing that monthly
    reconciliation, I might do over a dozen saves during the process -
    not only one after finishing each account (separate for investment
    and brokerage) but often after clearing all of each different
    activity type.  I'll try again opening a bad file when I get home.<br>
  </body>
</html>