This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KMyMoney & no stock quotes

Tags: None
(comma "," separated)
mcarpino
Registered Member
Posts
81
Karma
0
OS

Re: KMyMoney & no stock quotes

Mon Nov 13, 2017 9:33 pm
mbeenham wrote:I've populated my online stock quote field as per mcarpino (many thanks), but get the following error when trying an online update:
Fetching URL https://finance.google.com/finance?q=AZN.L...
Unable to update price for AZN.L (no price or no date)

I am running Linux, but cannot identify a "Google fix" from the URL provided.
I'm happy to dig in and try to find the cause of this issue, but if anybody has solved this problem already I'd appreciate a steer.


mbeenham Google recognizes AstraZeneca plc with a different symbol than yahoo. Yahoo requires the symbol AZN.L and it appears that Google looks for this symbol LON:AZN Try changing the trading symbol to LON:AZN I think it will work. Here's the web link for the stock as a reference https://finance.google.com/finance?q=LON:AZN
mbeenham
Registered Member
Posts
95
Karma
0
OS

Re: KMyMoney & no stock quotes

Tue Nov 14, 2017 12:31 am
mcarpino wrote:
mbeenham Google recognizes AstraZeneca plc with a different symbol than yahoo. Yahoo requires the symbol AZN.L and it appears that Google looks for this symbol LON:AZN Try changing the trading symbol to LON:AZN I think it will work. Here's the web link for the stock as a reference https://finance.google.com/finance?q=LON:AZN


I tried your suggestion but with the same result. From the browser the result of using LON:AZN and AZN.L are identical, both give a good report of AZN. I suspect the problem is in the parsing of the regular expressions, either date or price so I'll check those manually.

Thanks for your help.


Linux Mint 17.2
KMyMoney Version 4.7.2
Using KDE Development Platform 4.14.2
mbeenham
Registered Member
Posts
95
Karma
0
OS

Re: KMyMoney & no stock quotes

Tue Nov 14, 2017 2:55 am
My problem - when I copied and pasted the price REGEX I accumulated an extra character at the end...
All OK now, just got to go through and set all stocks to Google.


Linux Mint 17.2
KMyMoney Version 4.7.2
Using KDE Development Platform 4.14.2
aperali
Registered Member
Posts
33
Karma
0

Re: KMyMoney & no stock quotes

Tue Nov 14, 2017 10:00 pm
Is it possible to use %1 in Price and Date parameters? Im asking this because I have a HTLM source which has MANY mutual funds prices and dates inside it. All of them are grouped by their mutual fund codes (Symbol) which have the format like this 22.222.222/2222-22 followed by their prices and dates.
Example:
<td>22.222.222/2222-22</td>
<td>100.00000</td>
<td>2017-11-11</td>
<td>33.333.333/3333-33</td>
<td>111.11111</td>
<td>2017-11-11</td>

And for the Price should be something like this (I think):
<td>%1<\/td>\r?<td>(\d+.\d+)<\/td>
And for the Date:
<td>%1<\/td>\r?<td>\d+.\d+<\/td>\r?<td>(\d{4}-\d{2}-\d{2})<\/td>

Im trying to do this but it returns "Fetching URL http://teste.pythonanywhere.com/static/cotacoes.html...
Unable to update price for 22.222.222/2222-22 (no price or no date)"

Is it something related to "." or "/" in the fund code? Tried to use only numbers but doesn't work either.

If I replace the %1 by the fund code everything runs perfect.

Thank you,
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: KMyMoney & no stock quotes

Wed Nov 15, 2017 6:47 am
aperali wrote:Is it possible to use %1 in Price and Date parameters?


The short answer: no, that is not supported. :( Please file a wish on our bugtracker, so that it does not get lost. Maybe link back to this forum entry.


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

Re: KMyMoney & no stock quotes

Wed Nov 15, 2017 9:04 am
ipwizard wrote:Please file a wish on our bugtracker, so that it does not get lost. Maybe link back to this forum entry.


Done! Do you have an idea when they are planning to release a new version of KMM (for Windows included)?
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: KMyMoney & no stock quotes

Wed Nov 15, 2017 9:18 am
aperali wrote:
ipwizard wrote:Please file a wish on our bugtracker, so that it does not get lost. Maybe link back to this forum entry.

Done! Do you have an idea when they are planning to release a new version of KMM (for Windows included)?

For reference: the following link shows the entry 386939 on the tracker. Regarding the question about the next release: 4.8.x with x>0 has some momentum and includes a Windows build (since the main developer working on this branch of the software is using Windows). The KF5 port is still ongoing. A few things are still missing. Btw: they includes me ;) .


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

Re: KMyMoney & no stock quotes

Wed Nov 15, 2017 5:36 pm
I applied the "google fix" and was pleased to see the quotes update. However, I did this on Nov. 3, and the date reported in the list was Nov. 2. The quotes had not been updated since the last working Yahoo update. Today (Nov 6) I ran the update again. No errors were reported. However, the date associated with the quotes was still Nov 2, and from all appearances, nothing was updated.


I'm seeing a similar issue. For Vanguard mutual funds I get the correct price but the prior day's date.
dhochmuth
Registered Member
Posts
4
Karma
0

Re: KMyMoney & no stock quotes

Fri Feb 16, 2018 8:06 pm
This may have been stated earlier in the thread but it bears repeating:

In mcarpino's solution, make sure you have NO trailing spaces in the expressions entered into the KMyMoney Google online quote form. Unfortunately I did have a trailing space in the price or date line and kept getting errors. Wasted more than a bit of time figuring that out.

Thanks again for the fix mcarpino. ;D

ipwizard wrote:Btw: they includes me .


ipwizard: Thanks for your and everyone else's work. I'm very happy with 4.8.1 so far. :) Online quote capability will continue to change, maybe frequently, as websites change. I spent a lot of time messing with the choices provided but did not get them to work. The documentation pushes yahoo, but that is already obsolete. Finally tracked this post down. Given this situation, is there a way to:

  • Remove obsolete choices from future releases?
  • Add new working choices in future releases?
  • Provide a list of new or alternate choices like mcarpino's solution in a standard location between releases?

Any insight would be appreciated.
mcarpino
Registered Member
Posts
81
Karma
0
OS

Re: KMyMoney & no stock quotes

Fri Feb 16, 2018 10:09 pm
This isn't my fix. I don't remember who actually originally shared this solution. I just passed it along so that is the only credit I can take. Someone much smarter than me shared it and I literally copied their work. I don't and won't take any credit for coming up with the solution nor am I trying to take anything away from the original author. Their solution is awesome and I am extremely grateful for their work. If I knew who came up with it I would be sharing their name and giving them credit and I am sorry I don't know who it is.
mdolnik
Registered Member
Posts
14
Karma
0

Re: KMyMoney & no stock quotes

Sat Mar 17, 2018 8:26 pm
It looks like the https://finance.google.com/finance?q=%1 link is no longer working as Google has updated their Finance site.

I haven't been able to figure out how to get google working anymore with its new changes, but I have found a way to get stock quotes and currency working with Yahoo (working as of 2018-03-17).

New / EDIT Online Stock Quote
Add a new Online Stock Quote and rename to "Yahoo API" (or edit the existing "Yahoo API" entry if it exists)
Settings > Configure KMyMoney... > Online Quotes
Set values to the following:
Code: Select all
URL: https://query1.finance.yahoo.com/v7/finance/quote?fields=regularMarketPrice&symbols=%1
Symbol: %1
Price: "regularMarketPrice":((\d+|\d{1,3}(?:[,]\d{3})).\d+)
Date: "regularMarketTime":([\d]+)
Date Format: [empty]
Skip HTML stripping: [checked]


EDIT Online Currency Quote
Edit the "Yahoo Currency" Online Currency Quote (It looks like you cannot change the currency source so you have to modify the Yahoo Currency entry)
Settings > Configure KMyMoney... > Online Quotes
Set values to the following:
Code: Select all
URL: https://query1.finance.yahoo.com/v7/finance/quote?fields=regularMarketPrice&symbols=%1%2=X
Symbol: %1
Price: "regularMarketPrice":((\d+|\d{1,3}(?:[,]\d{3})).\d+)
Date: "regularMarketTime":([\d]+)
Date Format: [empty]
Skip HTML stripping: [checked]


Update: Looks like "Yahoo Currency" no longer comes with KMyMoney, a newer version I installed has "KMyMoney Currency" as the default option which uses the url "https://fx-rate.net/%1/%2" which seems to work for now without modifying anything. I still needed to add the custom "Yahoo API" entry explained above.

Last edited by mdolnik on Sat Oct 19, 2019 7:01 pm, edited 1 time in total.
mbeenham
Registered Member
Posts
95
Karma
0
OS

Re: KMyMoney & no stock quotes

Sun Mar 18, 2018 10:57 am
mdolnik wrote:It looks like the https://finance.google.com/finance?q=%1 link is no longer working as Google has updated their Finance site.

I haven't been able to figure out how to get google working anymore with its new changes, but I have found a way to get stock quotes and currency working with Yahoo (working as of 2018-03-17).

...
[/code]


Many thanks for this mdolnik. It saved me searching around.
Working well as of today.


Linux Mint 17.2
KMyMoney Version 4.7.2
Using KDE Development Platform 4.14.2
empenoso
Registered Member
Posts
31
Karma
0

Re: KMyMoney & no stock quotes

Mon Mar 19, 2018 5:55 am
mdolnik wrote:
Code: Select all
URL: https://query1.finance.yahoo.com/v7/finance/quote?fields=regularMarketPrice&symbols=%1
Symbol: %1
Price: "regularMarketPrice":((\d+|\d{1,3}(?:[,]\d{3})).\d+)
Date: "regularMarketTime":([\d]+)
Date Format: [empty]
Skip HTML stripping: [checked]


It works! Thank you!
I'm thinking about the "regularMarketTime" field. How to get date from this field?
Code: Select all
%Y-%m-%d %H:%M:%S
akoolwine
Registered Member
Posts
1
Karma
0

Re: KMyMoney & no stock quotes

Wed Mar 21, 2018 3:03 pm
Used revised format for Yahoo to get quotes - works like a charm for equities and ETFs on US and Canadian exchanges! ^-^
mdolnik
Registered Member
Posts
14
Karma
0

Re: KMyMoney & no stock quotes

Wed Mar 21, 2018 3:22 pm
empenoso wrote:I'm thinking about the "regularMarketTime" field. How to get date from this field?
Code: Select all
%Y-%m-%d %H:%M:%S


I don't know much about how kmymoney deals with dates, but I am under the assumption that the settings I mentioned above are using the dates correctly.

The yahoo url (eg https://query1.finance.yahoo.com/v7/fin ... mbols=goog) returns a json string of information and the regularMarketTime (or any date fields for that matter) appear to have their values in a unix timestamp format.

My assumption is that kmymoney stores dates as unix timestamps anyways so we don't need to provide it with date patterns as we are providing it with the raw value.

Someone please correct me if I'm wrong.


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]