Added fix for old stock symbols, eg: APPL
This commit is contained in:
parent
f589133d80
commit
20dd9968b3
|
@ -2,13 +2,12 @@ import random
|
||||||
|
|
||||||
from util import hook, http
|
from util import hook, http
|
||||||
|
|
||||||
|
url = 'http://www.google.com/ig/api'
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def stock(inp):
|
def stock(inp):
|
||||||
"stock <symbol> -- Gets information about stock symbol <symbol>."
|
"stock <symbol> -- Gets information about stock symbol <symbol>."
|
||||||
|
|
||||||
url = 'http://www.google.com/ig/api?stock=%s'
|
|
||||||
|
|
||||||
parsed = http.get_xml(url, stock=inp)
|
parsed = http.get_xml(url, stock=inp)
|
||||||
|
|
||||||
if len(parsed) != 1:
|
if len(parsed) != 1:
|
||||||
|
@ -22,6 +21,9 @@ def stock(inp):
|
||||||
if results['company'] == '':
|
if results['company'] == '':
|
||||||
return "error: unknown ticker symbol (%s)" % inp
|
return "error: unknown ticker symbol (%s)" % inp
|
||||||
|
|
||||||
|
if results['last'] == '0.00':
|
||||||
|
return "%s - last known stock value was 0.00 %s" % (results['company'], results['currency'])
|
||||||
|
|
||||||
if results['change'][0] == '-':
|
if results['change'][0] == '-':
|
||||||
results['color'] = "5"
|
results['color'] = "5"
|
||||||
else:
|
else:
|
||||||
|
|
Reference in a new issue