diff --git a/robot.py b/robot.py index b76ba1e..fc18877 100644 --- a/robot.py +++ b/robot.py @@ -11,12 +11,18 @@ # 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 +do_plot = 1 + +if do_plot: + import matplotlib.pyplot as plt + import matplotlib as mpl + mpl.rc('figure', max_open_warning = 0) + from stock import Stock params = { - 'show_range_days' : 5, - 'btfd' : {'thresh_max' : -10, 'thresh_min' : 1, 'cand_window' : 5}, + 'show_range_days' : 10, + 'btfd' : {'thresh_max' : -7, 'thresh_min' : 1, 'cand_window' : 5}, 'k_euro' : 1 / 1.11, 'ema_alpha' : 0.75, 'sma_days' : 10, @@ -136,7 +142,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: @@ -180,6 +186,7 @@ for symbol in buy_list: if num_stocks > 0: print ('Gain total = {} %'.format(gain_accum/num_stocks)) + if do_plot: plt.show() diff --git a/stock.py b/stock.py index f5ab686..2313b06 100644 --- a/stock.py +++ b/stock.py @@ -7,10 +7,7 @@ import os import time import agent from functions import * -#import matplotlib.pyplot as plt -#import matplotlib as mpl - -#mpl.rc('figure', max_open_warning = 0) +import matplotlib.pyplot as plt key = '0UO7Z2MVZ2YSQSVE'