Reply to topic

Currency Quotes

jsalatas
Registered Member
Posts
51
Karma
2
OS

Currency Quotes

Fri Nov 03, 2017 6:38 am
It seems that yahoo's currency quotes are not available any more. If for example you visit

http://download.finance.yahoo.com/d/quo ... =X&f=sl1d1

You are getting a 403 Error: "It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance.yahoo.com."

Is there any way to change the default online quotes provider to something else? :\

Thanks!
User avatar ipwizard
KDE Developer
Posts
455
Karma
1
OS

Re: Currency Quotes

Fri Nov 03, 2017 7:19 am
Sure it is. Please see the section on "Online Price Quotes" in the manual. It explains how to setup a source quote from the set of the provided ones, edit an existing entry or create a new one (at the bottom of the page).

Hope that helps.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 42.2 64bit, KF5
alainpetit
Registered Member
Posts
10
Karma
0

Re: Currency Quotes

Fri Nov 03, 2017 10:36 am
Well this sucks ... I've been using kmymoney and with yahoo currency by default for 10 years without any issues... and all of the sudden, yahoo pulling the service for "third-party"

As ipwizard stated ... online quotes configuration can change it ... however what source to use now ?
----------------------------------
EDIT : I'm trying to figure out how to use https://finance.google.com/finance?q=%1%2, however I'm having a bit difficulties figuring out the REGEX for price, date ... One user on stackoverflow (https://stackoverflow.com/questions/446 ... n-kmymoney) suggest the fol :

Symbol: %1 Price: "l_fix" : "(\d+.\d+)" Date: "lt_dts" : "(.\d+-\d\d-\d\d) Date format: %y %m %d

though I would assume that for currency we have to change the symbol to %1%2

However, all I get from the above is :

Fetching URL https://finance.google.com/finance?q=USDCAD...
Unable to update price for USD > CAD (no price or no date)

----------------------------------
EDIT 2: Alright, almost got it! I'm sorry I'm answering my own post lol. Hope that this knowledge would be useful for others
it seem that these set of parameters works :

Change Yahoo Currency in Online quotes with :
URL : https://finance.google.com/finance?q=%1%2
Symbol : %1%2
Price : "price"\n content="(\d+.\d+)
Date : "quoteTime"\n content="(.\d+-\d\d-\d\d)
Date Format : %y-%m-%d
SKIP HTML Stripping : CHECKED !!

My only isssue with Google currency vs Yahoo ... is that it does not support ETH cryptocurrency
alainpetit
Registered Member
Posts
10
Karma
0

Re: Currency Quotes

Fri Nov 03, 2017 11:22 am
alainpetit wrote:Well this sucks ... I've been using kmymoney and with yahoo currency by default for 10 years without any issues... and all of the sudden, yahoo pulling the service for "third-party"

As ipwizard stated ... online quotes configuration can change it ... however what source to use now ?
----------------------------------
EDIT : I'm trying to figure out how to use https://finance.google.com/finance?q=%1%2, however I'm having a bit difficulties figuring out the REGEX for price, date ... One user on stackoverflow (https://stackoverflow.com/questions/446 ... n-kmymoney) suggest the fol :

Symbol: %1 Price: "l_fix" : "(\d+.\d+)" Date: "lt_dts" : "(.\d+-\d\d-\d\d) Date format: %y %m %d

though I would assume that for currency we have to change the symbol to %1%2

However, all I get from the above is :

Fetching URL https://finance.google.com/finance?q=USDCAD...
Unable to update price for USD > CAD (no price or no date)

----------------------------------
EDIT 2: Alright, almost got it! I'm sorry I'm answering my own post lol. Hope that this knowledge would be useful for others
it seem that these set of parameters works :

Change Yahoo Currency in Online quotes with :
URL : https://finance.google.com/finance?q=%1%2
Symbol : %1%2
Price : "price"\n content="(\d+.\d+)
Date : "quoteTime"\n content="(.\d+-\d\d-\d\d)
Date Format : %y-%m-%d
SKIP HTML Stripping : CHECKED !!

My only isssue with Google currency vs Yahoo ... is that it does not support ETH cryptocurrency


Well ... for some reason the forum post does not display properly some spaces .... we should see \n[8 spaces]content
User avatar ipwizard
KDE Developer
Posts
455
Karma
1
OS

Re: Currency Quotes

Fri Nov 03, 2017 12:59 pm
It might help, if you place that part in a code block (see the Code Button above the edit field when posting to the forum). So entering it as

Code: Select all
[code]
URL : https://finance.google.com/finance?q=%1%2
Symbol : %1%2
Price : "price"\n        content="(\d+.\d+)
Date : "quoteTime"\n content="(.\d+-\d\d-\d\d)
Date Format : %y-%m-%d
SKIP HTML Stripping : CHECKED !!
[/code]

will yield the following result:
Code: Select all
URL : https://finance.google.com/finance?q=%1%2
Symbol : %1%2
Price : "price"\n        content="(\d+.\d+)
Date : "quoteTime"\n content="(.\d+-\d\d-\d\d)
Date Format : %y-%m-%d
SKIP HTML Stripping : CHECKED !!


Another possibility to check for 8 blanks is to write
Code: Select all
Price : "price"\n {8}content="(\d+.\d+)

in case the number of spaces is significant.

Hope that helps.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 42.2 64bit, KF5
alainpetit
Registered Member
Posts
10
Karma
0

Re: Currency Quotes

Fri Nov 03, 2017 1:14 pm
Thank you Ipwizard for your advice on code block ... honestly i dont interact much online ...

While I got your attention here, I do have another question with that sudject that matter : I can't seem to find where to change the currency source. I was able to edit "Yahoo Currency" and change the URL to Google .... but it seem to be hard-coded to "Yahoo Currency" make the udpate fail if I change the label to "Google Currency".

My intent is to create a Google Currency source for USD CAD etc.

and another source with similar REGEX through QuadrigaCX for Cryptocurrency to CAD quotes (BTC, ETH, LTC, etc.) and assign different currencies with different sources.
User avatar fordtaunus
Registered Member
Posts
4
Karma
0

Re: Currency Quotes

Fri Nov 03, 2017 2:09 pm
Also if you want to get the quotes for Bitcoin (BTC), we have the problem that Google Finance uses a thousand-separator. I was quite surprised to see that my BTC was only worth 6 Euro :-D A better RegEx fixing this is
Code: Select all
"price"\n        content="((\d+|\d{1,3}(?:[,]\d{3})).\d+)


@alainpetit Regarding the alternative source for currencies I also got stuck. I even checked in the KMY file, there is no obvious reference to this in currencies :-(
User avatar ipwizard
KDE Developer
Posts
455
Karma
1
OS

Re: Currency Quotes

Fri Nov 03, 2017 2:30 pm
alainpetit wrote:My intent is to create a Google Currency source for USD CAD etc.

and another source with similar REGEX through QuadrigaCX for Cryptocurrency to CAD quotes (BTC, ETH, LTC, etc.) and assign different currencies with different sources.

Scroll down to the bottom in Settings/Configure KMyMoney/Onine Quotes and you will find a New button. Use it to create a new entry. Once you rename an entry, you need to press the Update button also at the bottom on the right side.

It can be, that you cannot remove the default entries that come with the application. We will remove Yahoo in the source so this can be done in future releases.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 42.2 64bit, KF5
User avatar fordtaunus
Registered Member
Posts
4
Karma
0

Re: Currency Quotes

Fri Nov 03, 2017 2:37 pm
ipwizard wrote:
alainpetit wrote:My intent is to create a Google Currency source for USD CAD etc.

and another source with similar REGEX through QuadrigaCX for Cryptocurrency to CAD quotes (BTC, ETH, LTC, etc.) and assign different currencies with different sources.

Scroll down to the bottom in Settings/Configure KMyMoney/Onine Quotes and you will find a New button. Use it to create a new entry. Once you rename an entry, you need to press the Update button also at the bottom on the right side.

It can be, that you cannot remove the default entries that come with the application. We will remove Yahoo in the source so this can be done in future releases.


I found how I can change to any of those for securities. But how do I do this for currencies? Even though I can check the "Show national currencies" box in the securities list, the edit button is always inactive for currencies.
jsalatas
Registered Member
Posts
51
Karma
2
OS

Re: Currency Quotes

Fri Nov 03, 2017 8:55 pm
ipwizard wrote:Sure it is. Please see the section on "Online Price Quotes" in the manual. It explains how to setup a source quote from the set of the provided ones, edit an existing entry or create a new one (at the bottom of the page).

Hope that helps.


I have seen that but for some reason I cannot figure out how to set it up for currencies (I want to be able to get the EUR/USD rate) :\

In the manual it says

To assign a quote source to an investment, navigate to the investment summary view for the account in which the security is held. Edit the security by right-clicking it and selecting Edit Investment .... In the Investment Detail Wizard, click Next twice, for the Online Update section. In the Online source dropdown box, select the online source.


Where is that "investment summary view"? :\

Notice that I don't have any stock or other type of investments. I just have bank accounts and cash to either EUR or USD. My base currency is USD and what I want is to be able to get the EUR/USD rate. :\

I guess a screenshot would be helpful :\
User avatar fordtaunus
Registered Member
Posts
4
Karma
0

Re: Currency Quotes

Fri Nov 03, 2017 9:41 pm
The "Investments" view can be reached from the left hand icon bar. But your suspicion is right, it won't help you with currencies.
jsalatas
Registered Member
Posts
51
Karma
2
OS

Re: Currency Quotes

Fri Nov 03, 2017 9:45 pm
fordtaunus wrote:The "Investments" view can be reached from the left hand icon bar. But your suspicion is right, it won't help you with currencies.


Yeah! I tried that after my previous post. If you have no investments, it is disabled. I created a dummy investment and I got that view enabled but still cannot modify currencies :'(
alainpetit
Registered Member
Posts
10
Karma
0

Re: Currency Quotes

Sat Nov 04, 2017 4:01 am
@fordtaunus ... Oops yes the thousant separator ... I was so happy to see it running that I didn't even noticed it ! you'r a REGEX god !
User avatar ipwizard
KDE Developer
Posts
455
Karma
1
OS

Re: Currency Quotes  Topic is solved

Sat Nov 04, 2017 7:12 am
Well, bad news: the source is tied to "Yahoo Currency" since a long time. In case someone is interested: here is the change. We see, that this was introduced 12 years ago and worked ever since. While looking further into the source code of KMyMoney, I noticed, that one cannot change the quote source for currency exchange rates. That is tied to the name Yahoo Currency (see above code change).

What this comes down to:
  • KMyMoney only supports a single price source for currency exchange rates at the moment and it must be named Yahoo Currency.
  • As a workaround, simply modify the values of the Yahoo Currency entry but do not change the name. Once that is changed, the original version will be recreated by KMyMoney.
I verified, that the following configuration is working (in KMyMoney master):
Code: Select all
URL : https://finance.google.com/finance?q=%1%2
Identifier: "name"\s+content="([^"]+)"
Price : "price"\s+content="((\d+|\d{1,3}(?:[,]\d{3})).\d+)
Date : "quoteTime"\s+content="(\d{4}-\d{2}-\d{2})T
Date Format : %y-%m-%d
SKIP HTML Stripping : CHECKED !!


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 42.2 64bit, KF5
jsalatas
Registered Member
Posts
51
Karma
2
OS

Re: Currency Quotes

Sat Nov 04, 2017 7:20 am
ipwizard wrote:[*]As a workaround, simply modify the values of the Yahoo Currency entry but do not change the name. Once that is changed, the original version will be recreated by KMyMoney.[/list]
I verified, that the following configuration is working (in KMyMoney master):
Code: Select all
URL : https://finance.google.com/finance?q=%1%2
Identifier: "name"\s+content="([^"]+)"
Price : "price"\s+content="((\d+|\d{1,3}(?:[,]\d{3})).\d+)
Date : "quoteTime"\s+content="(\d{4}-\d{2}-\d{2})T
Date Format : %y-%m-%d
SKIP HTML Stripping : CHECKED !!


Yeay! Just tried in 4.8.0 in ubuntu 16.04 from ppa:claydoh/kmymoney2-kde4 and it works as well.

Thanks!!!

 
Reply to topic

Bookmarks



Who is online

Registered users: Bing [Bot], Exabot [Bot], Google [Bot], jackdinn, kde-cfeck, La Ninje, lueck, ramdanifajar, slumpgod, Sogou [Bot], Yahoo [Bot]