Updates to pricing snapshots via python don't survive restart

george.dobbs's Avatar


29 Aug, 2020 03:09 PM

I've been updating prices for securities via Python scripts for some time. I recently noticed that these updates don't (or maybe its don't always) stick after the Moneydance restarts. They seem to work fine during the session though. In other words, I take a look at the historical prices and the updates are there. Close down and restart Moneydance, though and they are gone. I've reviewed the code which was based on the sample in the bot console. I don't see any problems there.

It occurs to me that it could be caused by the most recent update which is 2020 (1919). Or maybe its something about my file. The file seems large to me as it has grown to 201.7MB over the years.

The update code is attached.

Any assistance would be appreciated.

  1. Support Staff 1 Posted by Sean Reilly on 30 Aug, 2020 12:15 PM

    Sean Reilly's Avatar

    Hi George,

    Great question! It looks like you're calling .syncItem() on the security's currency object instead of on the individual snapshots. If you call snap.syncItem() once you have all of the data in your snapshot then that's all you should need to do. I'd avoid calling syncItem on the currency/security object itself since the changes were only made to the snapshot.


  2. 2 Posted by george.dobbs on 30 Aug, 2020 07:03 PM

    george.dobbs's Avatar

    Thank you Sean,
    That fixed it.  Now I see that it makes sense to sync the individual
    rows (snapshots).

    I've attached the corrected code.  I appreciate the help.


  3. Support Staff 3 Posted by Sean Reilly on 30 Aug, 2020 07:51 PM

    Sean Reilly's Avatar

    Hi George,

    The new code looks great, although I think I gave you bad advice about not calling .syncItem() on the overall security. Since you are setting the "current price" of the security it looks like you should still call syncItem() on it after that, otherwise the new current price might not be preserved.


  4. System closed this discussion on 29 Nov, 2020 08:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac