Hello all.
I have an excel file http://www.bankofengland.co.uk/markets/ ... esults.htmthat has loads of ISIN numbers in them. I need to find out which company the ISIN numbers are from so i can see if the purchase of there bonds have impacted on there share price.
The aim is to be able to put all the ISIN in a text file. Then python run all the ISIN codes and get the company name back in a text file.
This would be done by querying the London stock exchange website with the following format
http://www.londonstockexchange.com/exch ... 7ZZGBPCWTR" onclick="window.open(this.href);return false;
with the XS0418995907 being the ISIN which would need to change in each qurey.
Then to get the company name i would need to prase the html to just grab the company name so this is from <h1 class="tesummary">
<a class="title_page_blue" href="/exchange/prices-and-markets/stocks/summary/company-summary.html?fourWayKey=XS0418995907ZZGBPCWTR" title="Go to Company Summary"> 88JL</a>
REED ELSEVIER (INVESTMENTS) PLC 7% GTD NTS 11/12/17 GBP (BR)
</h1>
I would need to get just "REED ELSEVIER (INVESTMENTS) PLC 7% GTD NTS 11/12/17 GBP (BR)"
I don't want someone to code this just some directions on how to do.
Thanks
HP
Python Script
- hpprinter100
- Fame ! Where are the chicks?!
- Posts: 214
- Joined: 19 Oct 2007, 16:00
- 16
- Contact:
Re: Python Script
xlrd, urllib/urllib2 and BeautifulSoup. In that order.
I can elaborate if needed, but I'll go and write the script myself first
Sounds like interesting stuff you're working on.
I can elaborate if needed, but I'll go and write the script myself first
Sounds like interesting stuff you're working on.
Re: Python Script
Alright, done in 13 lines. Took some thought, though.
You know some of them don't return any results, right? For example XS0182188366 (second ISIN in the spreadsheet) gives you null on that website.
Let me know if you need any help and post your script when you're done
You know some of them don't return any results, right? For example XS0182188366 (second ISIN in the spreadsheet) gives you null on that website.
Let me know if you need any help and post your script when you're done
- hpprinter100
- Fame ! Where are the chicks?!
- Posts: 214
- Joined: 19 Oct 2007, 16:00
- 16
- Contact:
Re: Python Script
Yeah that is because some of the bonds are not listed on the london stock exchange
Should of used yahoo really ops so XS0182188366
http://uk.finance.yahoo.com/q?s=XS0182188366&m=L&d=" onclick="window.open(this.href);return false;
buying bonds in British American Tobacco how unethical -.-
Should of used yahoo really ops so XS0182188366
http://uk.finance.yahoo.com/q?s=XS0182188366&m=L&d=" onclick="window.open(this.href);return false;
buying bonds in British American Tobacco how unethical -.-
Re: Python Script
Haha.
That source performs a lot better indeed. You could even write a program that tries multiple sources if one doesn't work.
Have you got your script written?
That source performs a lot better indeed. You could even write a program that tries multiple sources if one doesn't work.
Have you got your script written?
- hpprinter100
- Fame ! Where are the chicks?!
- Posts: 214
- Joined: 19 Oct 2007, 16:00
- 16
- Contact:
Re: Python Script
No. I have just realised i got to get some applications in so will be doing that, i will have a go later. Please post any interesting companies that are on the list