From 7fe381c80101a867579e0810cbddf6c678d4c968 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Tue, 7 Jan 2020 22:04:13 +0000 Subject: [PATCH] - added convenient adding of symbols git-svn-id: http://moon:8086/svn/projects/Stock@357 fda53097-d464-4ada-af97-ba876c37ca34 --- robot.py | 9 +++++---- stocks.json | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/robot.py b/robot.py index 52047d6..4a6b932 100644 --- a/robot.py +++ b/robot.py @@ -45,15 +45,16 @@ symbols = json.loads(s) f.close() if args.symbol is not None: - show_symbols = [args.symbol] - if args.symbol not in symbols: - symbols[args.symbol] = {'name' : 'Full name here', 'currency' : 'USD'} + symbol, fullname, currency = args.symbol.split('|') + show_symbols = [symbol] + if symbol not in symbols: + 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(args.symbol)) + print ("{} is already in database".format(symbol)) if args.analyze_range is not None: params['analyze_range_days'] = args.analyze_range diff --git a/stocks.json b/stocks.json index 8d7abac..a888987 100644 --- a/stocks.json +++ b/stocks.json @@ -418,5 +418,9 @@ "ZIL2.DE": { "currency": "EUR", "name": "ElringKlinger" + }, + "ZNGA": { + "currency": "USD", + "name": "Zynga Inc." } -} +} \ No newline at end of file