- 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:
2020-01-07 22:24:07 +00:00
parent fffbbc2c4d
commit 29d82dab69
+12 -2
View File
@@ -45,16 +45,26 @@ symbols = json.loads(s)
f.close()
if args.symbol is not None:
symbol, fullname, currency = args.symbol.split('|')
sfc = args.symbol.split('|')
symbol = sfc[0]
show_symbols = [symbol]
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}
s = json.dumps(symbols, sort_keys=True, indent=4)
f = open('stocks.json', 'w')
f.write(s)
f.close()
else:
print ("{} is already in database".format(symbol))
print ("{} is in database".format(symbol))
if args.analyze_range is not None:
params['analyze_range_days'] = args.analyze_range