Retrieving a stock quote using Python?
Kevin Altis
altis at semi-retired.com
Wed May 21 21:33:11 EDT 2003
Th PythonCard stockprice sample uses SOAP.py
http://pythoncard.sourceforge.net/samples/stockprice.html
The actual work is pretty simple. You could pick a different SOAP quote
service or use something other than SOAP with an XML-RPC service, but I
would recommend avoiding a screen scraping solution. Yes this function could
use better error handling...
def getStockPrice(symbol):
price = -1
try:
server = SOAP.SOAPProxy('http://services.xmethods.net/soap', \
namespace='urn:xmethods-delayed-quotes')
price = server.getQuote(symbol)
except:
pass
return price
ka
"David Lees" <abcdebl2nonspammy at verizon.net> wrote in message
news:fJSya.32517$Hy3.11289 at nwrddc02.gnilink.net...
I would like to write a utility in Python that takes a stock symbol as
an input and returns a current price. Suggestions on how to do this are
welcome. I was thinking of an approach that would go out to a page like
finance.yahoo.com, entering the stock symbol and then collecting the
results and parsing them for the price. But it has been awhile since I
used pythton and I'm not sure I ever really knew how to do this.
TIA
David Lees
More information about the Python-list
mailing list