PureBytes Links
Trading Reference Links
|
Hi Herman,
I have a solution using Python not the AFL.
There are a couple of problems you will have to deal with.
1. The IB webpage uses javascript so just grabbing the page won't
work, you need to use something that knows javascript.
2. There are some embedded html characters to translate.
I used links, a text based browser that knows javascript to get the
file and BeautifulSoup to parse it.
www.python.org
www.crummy.com/software/BeautifulSoup/
links.twibright.com/
The Python script is below, no guarantees it doesn't have errors.
#!/usr/bin/env python
"""
getIBshortable.py
"""
import os
from BeautifulSoup import BeautifulSoup
cmd = 'links -source
"http://www.interactivebrokers.com/en/trading/ViewShortableStocks.php?cntry=usa&tag=United%20States&ib_entity=llc"
'
shortableStocks = os.popen(cmd)
soup=BeautifulSoup(shortableStocks)
tdList=[t.string for t in soup('td') if t.string != None]
i=iter(tdList)
symbol=i.next()
output="symbol,currency,name\n"
while not symbol.startswith('3IN'): symbol=i.next()
stockList={}
while True:
output+=symbol[:-1]+','
currency=i.next()
output+=currency+','
name=i.next()
output+=name+'\n'
if name.startswith('Sealy Corp'):break
symbol=i.next()
s=output.replace(r' ','
').replace(r'&','&').replace(r'/','/')
file('IBshortable.csv','w').write(s)
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|