From 82063b100623c868ab962e09cfa3de1647c8f515 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Tue, 7 Jan 2020 17:36:21 +0000 Subject: [PATCH] - improved git-svn-id: http://moon:8086/svn/projects/Stock@346 fda53097-d464-4ada-af97-ba876c37ca34 --- robot.py | 18 ++++++++++++------ stock.py | 6 +++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/robot.py b/robot.py index d6523c0..b76ba1e 100644 --- a/robot.py +++ b/robot.py @@ -11,7 +11,7 @@ # https://www.investopedia.com/articles/technical/02/050602.asp # https://ntguardian.wordpress.com/2016/09/19/introduction-stock-market-data-python-1 -import matplotlib.pyplot as plt +#import matplotlib.pyplot as plt from stock import Stock params = { @@ -26,6 +26,7 @@ params = { show_symbols = ['OHB.DE', 'ITMPF', 'PLUG', 'MOR.DE', 'CSCO', 'ERCA.DE', 'AVGO', 'DIS', 'UBSFF', 'DHER.DE', 'AIR'] show_symbols = ['CSCO'] +#show_symbols = ['PCELF'] #show_symbols = ['OHB.DE'] #show_symbols = ['UBSFF'] #show_symbols = ['DHER.DE'] @@ -34,6 +35,9 @@ show_symbols = ['CSCO'] show_symbols = [] symbols = { + 'KEP' : {'name' : 'Korea Electric Power Corporation', 'currency' : '$'}, + 'MRK.DE' : {'name' : 'Merck', 'currency' : '€'}, + 'TOM.F' : {'name' : 'Toyota Motor Corporation', 'currency' : '€'}, 'SSHPF' : {'name' : 'Scanship Holding ASA', 'currency' : '$'}, 'RIG' : {'name' : 'Transocean Ltd.', 'currency' : '$'}, 'BBIO' : {'name' : 'BridgeBio Pharma, Inc.', 'currency' : '$'}, @@ -132,7 +136,7 @@ def buy_callback(data): buy_list[name]['items'].append(item) print(data) - +do_plot = 0 figNum = 1 if len(show_symbols) > 0: for symbol in show_symbols: @@ -142,7 +146,8 @@ if len(show_symbols) > 0: title.statistics() try: ind = title.analyze(buy_callback, range_days=params['show_range_days']) - title.show(ind, figNum=figNum) + if do_plot: + title.show(ind, figNum=figNum) figNum += 1 except: print ("Exception occurred for {}".format(symbol)) @@ -156,7 +161,8 @@ else: ind = title.analyze(buy_callback, range_days=params['show_range_days']) if Stock.has_candidate(ind, 'BTFD'): print('-----------------------------------------------') - title.show(ind, figNum=figNum) + if do_plot: + title.show(ind, figNum=figNum) figNum += 1 except: print ("Exception occurred for {}".format(symbol)) @@ -174,6 +180,6 @@ for symbol in buy_list: if num_stocks > 0: print ('Gain total = {} %'.format(gain_accum/num_stocks)) - -plt.show() +if do_plot: + plt.show() diff --git a/stock.py b/stock.py index 835a654..f5ab686 100644 --- a/stock.py +++ b/stock.py @@ -7,10 +7,10 @@ import os import time import agent from functions import * -import matplotlib.pyplot as plt -import matplotlib as mpl +#import matplotlib.pyplot as plt +#import matplotlib as mpl -mpl.rc('figure', max_open_warning = 0) +#mpl.rc('figure', max_open_warning = 0) key = '0UO7Z2MVZ2YSQSVE'