- added convenient adding of symbols

git-svn-id: http://moon:8086/svn/projects/Stock@357 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2020-01-07 22:04:13 +00:00
parent ee99228dfd
commit 7fe381c801
2 changed files with 10 additions and 5 deletions
+5 -4
View File
@@ -45,15 +45,16 @@ symbols = json.loads(s)
f.close() f.close()
if args.symbol is not None: if args.symbol is not None:
show_symbols = [args.symbol] symbol, fullname, currency = args.symbol.split('|')
if args.symbol not in symbols: show_symbols = [symbol]
symbols[args.symbol] = {'name' : 'Full name here', 'currency' : 'USD'} if symbol not in symbols:
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(args.symbol)) print ("{} is already 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
+4
View File
@@ -418,5 +418,9 @@
"ZIL2.DE": { "ZIL2.DE": {
"currency": "EUR", "currency": "EUR",
"name": "ElringKlinger" "name": "ElringKlinger"
},
"ZNGA": {
"currency": "USD",
"name": "Zynga Inc."
} }
} }