Revisiting problems with price updates

Thomas Baumgart thb at net-bembel.de
Tue Feb 22 07:34:13 GMT 2022


On Dienstag, 22. Februar 2022 01:47:21 CET Jack via KMyMoney-devel wrote:

> The latest is https://bugs.kde.org/show_bug.cgi?id=450426.  I think  
> this is just another example of an issue that has been mentioned before  
> on the mailing list, forum, and bug reports.  The common complaint is  
> that the price updater fails - but if you look carefully, it seems to  
> be trying to retrieve a pair that doesn't make sense - it is reversed  
> from what you would expect - the value of a currency in terms of a  
> stock, instead of the price of the stock in the currency.

Indeed, that does not make sense and it is what is causing the failure during
online download. As of now, I have no idea how these entries get created.
In terms of the reported "I was able to delete them but once I ran
the update they appeared again" I think the downloader checks which
combinations are on file and creates them as it goes. I have to investigate
this.

> When i started looking into my own kmy file, I've found things I can't  
> explain, that I think are related.  Hopefully something here will  
> trigger some thought and give a hint where we might look for the  
> underlying problem..
> 
> As one example, I have an equity E0000416 for symbol CARR (Carrier  
> Global Corp.)
> If I look in the Price Editor for CARR, I see two entries - one is from  
> KMyMOney Currency and the other from Yahoo Finance.  It is not clear  
> why there are two en tries for the same ID and Name.

See below. What are the dates of these entries?

> If I show all  
> stored prices, the sources include Transaction, User, Yahoo Finance,  
> Finance::Quote yahoo_json, Statement Importer, and KMyMoney Currency.   
> All make sense to me except for the last.  In addition, if I look in my  
> kmy file, I have five entries for <PRICEPAIR from="USD" to="E000416">  
> including one User and four KMyMoney Currency.

Those are the ones causing the trouble (I think). The User one seems to
be entered by the user (either directly as price or by a transaction).
Do you see a relationship between this price entry and a transaction? The
ones showing KMyMoney Currency are a cause of this if they have a later
date. Can you confirm?

> <PRICEPAIR  
> from="E000416" to="USD"> includes all the rest.  I had almost expected  
> all the KMyMoney Currency entries to be in one group.  Can anyone  
> explain why a stock price would ever get looked up through KMyMoney  
> Currency?  If I sort those price entries by date, all the KMyMoney  
> Currency entries are in the latter half of the list.  In a few cases  
> where there is also another entry on the same date, they differ by a  
> few cents - in only one case are they identical.
> 
> Then, in the Price Editor, the Stock name for CARR is "Carrier Global  
> Corp,Carrier Global Corp,Carrier Global Corp,Carrier Global  
> Corp,Carrier Global Corp".  How did the name get repeated five times?

Good question. I don't have an answer (yet).

> It only appears once in the Investment Views (once under Securities,  
> and once under Equities tab for each account which held that stock (all  
> not closed except one.)  If I scroll through the complete Price Editor,  
> there are several other entries with the Stock Name repeated multiple  
> times, but I see no pattern.
> 
> Then, if I look in the Price Updater, I see an entry for ID: CARR with  
> Internal ID: E000416 and Source: Yahoo Finance.  However, if I scroll  
> down, I see ID: USD > E000416 with internal ID: "USE E000416" a price  
> of "CARR0.0218 and Source KMyMOney Currency.

The internal ID should probably be "USD E000416" and is a typo on your end.
The price of "CARR0.0218" is certainly weird.


Regarding the names Yahoo Finance and KMyMoney Currency I can point to
https://invent.kde.org/office/kmymoney/-/commit/8559f9ec which we changed
when Yahoo was not available a few years ago. Still, I don't understand
why the currency exchange rate source is used for an investment price
update.

> Searching my kmy file for E000416 shows only the Security definition,  
> the five Accounts holding that stock, and the two PRICEPAIR entries  
> already mentioned.  In particular, I don't see what generates that  
> USD > E000416 entry in the price updater.  My currency list includes  
> only USD and EUR.
> 
> Any thoughts or suggestions for further troubleshooting?

I scanned the term "KMyMoney Currency" and only found it in a few spots:

in WebPriceQuote::launchCSV it is only used as reference:

    // for historical exchange rates we switch to Stooq
    if (sourcename == QLatin1String("KMyMoney Currency"))
        sourcename = QLatin1String("Stooq Currency");

and for the generation of the source information to select from:

    result["KMyMoney Currency"] = WebPriceQuoteSource("KMyMoney Currency",
                                  "https://fx-rate.net/%1/%2",
                                  QString(),
                                  "https://fx-rate.net/([^/]+/[^/]+)",

the third location is the one introduced by above mentioned commit and
it is the only location that actively sets the name. From there it seems
to be used for price entries during the update.


-- 

Regards

Thomas Baumgart

https://www.signal.org/       Signal, the better WhatsApp
-------------------------------------------------------------
We can't solve problems by using the same kind of thinking we
used when we created them. - Albert Einstein
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20220222/56567fd0/attachment-0001.sig>


More information about the KMyMoney-devel mailing list