[Kmymoney] Re: Exchange Rate from Yahoo Finance

timothy timboyle at afrihost.co.za
Mon May 9 19:51:56 CEST 2011


Many thanks, exactly what I needed.
Regards

On Mon, 2011-05-09 at 19:29 +0200, Thomas Baumgart wrote:
> Hi,
> 
> on Monday 09 May 2011 19:08:06 timothy wrote:
> 
> > Hi
> > I am running KMM 1.0.5 on KDE 3.5.10 on Ubuntu Maverick.
> > I am writing a program to output QIF from input PDF from my investment
> > web site. The statement is in GBP (British Pounds) and I need to add the
> > exchange rate to my QIF file to convert to South African Rands.
> > 
> > I have used the string from 'Settings/Configure-KmyMoney/Online Quotes'
> > and get a file from yahoo, but it just gives a message 'Missing Format
> > Variable'.
> > This is using wget
> > http://finance.yahoo.com/d/quotes.csv?s=GBPZAR=X&f=sl1d1.
> > 
> > Strangely enough when I put the same string into my browser as an URL, I
> > get the correct information downloaded to /var/tmp/kdecache namely
> > "GBPZAR=X",10.9798,"5/6/2011".
> > 
> > As I need to request and extract the exchange rate in a program or
> > script, I require the wget solution or something similar. Could someone
> > help with how I would add the format variable which is missing. Where I
> > got the URL in KMM  also gives format filters for Symbol; Price and
> > Date. Presumably these should be added in some way. I have tried various
> > combinations, but obviously with no success.
> 
> You're missing, that the URL contains a few special characters which are 
> interpreted by the shell, like '&'. Here's how I do it (make sure to use 
> single quotes around the URL which keeps the shell from interpreting them as 
> special):
> 
> thb at thb-nb:~> wget --output-document=quotes.csv 
> 'http://finance.yahoo.com/d/quotes.csv?s=GBPZAR=X&f=sl1d1'
> asking libproxy about url 
> 'http://finance.yahoo.com/d/quotes.csv?s=GBPZAR=X&f=sl1d1'
> libproxy suggest to use 'direct://'
> --2011-05-09 19:27:04--  
> http://finance.yahoo.com/d/quotes.csv?s=GBPZAR=X&f=sl1d1
> Resolving finance.yahoo.com... 76.13.115.116
> Connecting to finance.yahoo.com|76.13.115.116|:80... connected.
> HTTP request sent, awaiting response... 301 Redirect
> Location: http://download.finance.yahoo.com/d/quotes.csv?s=GBPZAR=X&f=sl1d1 
> [following]
> asking libproxy about url 
> 'http://download.finance.yahoo.com/d/quotes.csv?s=GBPZAR=X&f=sl1d1'
> libproxy suggest to use 'direct://'
> --2011-05-09 19:27:05--  
> http://download.finance.yahoo.com/d/quotes.csv?s=GBPZAR=X&f=sl1d1
> Resolving download.finance.yahoo.com... 76.13.114.90
> Connecting to download.finance.yahoo.com|76.13.114.90|:80... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: unspecified [application/octet-stream]
> Saving to: “quotes.csv”
> 
>     [ <=>                                   ] 31          --.-K/s   in 0s      
> 
> 2011-05-09 19:27:05 (1.75 MB/s) - “quotes.csv” saved [31]
> 
> thb at thb-nb:~> cat quotes.csv
> "GBPZAR=X",11.0368,"5/9/2011"
> 
> 




More information about the KMyMoney mailing list