- added convenient adding of symbols
git-svn-id: http://moon:8086/svn/projects/Stock@359 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -45,16 +45,26 @@ symbols = json.loads(s)
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if args.symbol is not None:
|
if args.symbol is not None:
|
||||||
symbol, fullname, currency = args.symbol.split('|')
|
sfc = args.symbol.split('|')
|
||||||
|
symbol = sfc[0]
|
||||||
show_symbols = [symbol]
|
show_symbols = [symbol]
|
||||||
if symbol not in symbols:
|
if symbol not in symbols:
|
||||||
|
try:
|
||||||
|
fullname = sfc[1]
|
||||||
|
except:
|
||||||
|
fullname = 'Enter full name here'
|
||||||
|
try:
|
||||||
|
currency = sfc[2]
|
||||||
|
except:
|
||||||
|
currency = 'USD'
|
||||||
|
|
||||||
symbols[symbol] = {'name' : fullname, 'currency' : currency}
|
symbols[symbol] = {'name' : fullname, 'currency' : currency}
|
||||||
s = json.dumps(symbols, sort_keys=True, indent=4)
|
s = json.dumps(symbols, sort_keys=True, indent=4)
|
||||||
f = open('stocks.json', 'w')
|
f = open('stocks.json', 'w')
|
||||||
f.write(s)
|
f.write(s)
|
||||||
f.close()
|
f.close()
|
||||||
else:
|
else:
|
||||||
print ("{} is already in database".format(symbol))
|
print ("{} is in database".format(symbol))
|
||||||
|
|
||||||
if args.analyze_range is not None:
|
if args.analyze_range is not None:
|
||||||
params['analyze_range_days'] = args.analyze_range
|
params['analyze_range_days'] = args.analyze_range
|
||||||
|
|||||||
Reference in New Issue
Block a user