Bug 492038 - Currency conversion from EUR to BTC fails at yahoo.com
Summary: Currency conversion from EUR to BTC fails at yahoo.com
Status: REPORTED
Alias: None
Product: kmymoney
Classification: Applications
Component: importer (show other bugs)
Version: git (master)
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks: 488491
  Show dependency treegraph
 
Reported: 2024-08-22 10:53 UTC by Ralf Habacker
Modified: 2024-08-24 10:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
testcase (4.84 KB, text/xml)
2024-08-22 10:53 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2024-08-22 10:53:44 UTC
Created attachment 172854 [details]
testcase

SUMMARY

Currency conversion rates can be found e.g. from yahoo with the following url https://query1.finance.yahoo.com/v7/finance/download/%1-%2?events=history&includeAdjustedClose=true.  An example of this is BTC -> EUR.
The problem, however, is that it does not work the other way around, as can be seen in the attached example.

STEPS TO REPRODUCE
1.  start kmymoney
2. Add  an new online quote named "User" (systems with english language) or "Benutzer" (german language) with 

URL: https://query1.finance.yahoo.com/v7/finance/download/%1-%2?events=history&includeAdjustedClose=true
Download mode: Default
Data format: CSV
Identifier: 
Select by: Symbol
Price: Close
Price decimal separator: Period (.)
Date: Date
Date format: %y-%m-%d
Default identifier: EUR-USD
Remote source: not checked

2. load appended test case
3. add account 
Name: "checking (BTC)"
select "Online quotes"

OBSERVED RESULT
A message box appears that the update failed. 

EXPECTED RESULT
This message should not appear and the update should finish without errors.

SOFTWARE/OS VERSIONS
Linux: openSUSE Leap 15.5  
KDE Frameworks Version: 5.102
Qt Version: 5.15.8

ADDITIONAL INFORMATION
The problem is that the desired direction EUR -> BTC is not supported by the remote source. The reverse direction, on the other hand, is available. There should be a possibility that after a failed request, a new request is made with a reversed direction and, if successful, the returned price is inverted.
Comment 1 Ralf Habacker 2024-08-24 10:19:37 UTC
(In reply to Ralf Habacker from comment #0)
> ADDITIONAL INFORMATION
> The problem is that the desired direction EUR -> BTC is not supported by the
> remote source. The reverse direction, on the other hand, is available. There
> should be a possibility that after a failed request, a new request is made
> with a reversed direction and, if successful, the returned price is inverted.

To add such a function, the following points should be noted:
1. should online listings allow reverse search by default ?
2. adding the reverse search after the first search has failed requires an internal refactoring so that errors that occur during the first search are not forwarded directly to the application and thus already trigger error processing.
3. a simpler alternative to 2. would be to manage a list of currency assignments in the online source, which is used to control the direction of a query.