- improved
git-svn-id: http://moon:8086/svn/projects/Stock@346 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
# https://www.investopedia.com/articles/technical/02/050602.asp
|
# https://www.investopedia.com/articles/technical/02/050602.asp
|
||||||
# https://ntguardian.wordpress.com/2016/09/19/introduction-stock-market-data-python-1
|
# 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
|
from stock import Stock
|
||||||
|
|
||||||
params = {
|
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 = ['OHB.DE', 'ITMPF', 'PLUG', 'MOR.DE', 'CSCO', 'ERCA.DE', 'AVGO', 'DIS', 'UBSFF', 'DHER.DE', 'AIR']
|
||||||
show_symbols = ['CSCO']
|
show_symbols = ['CSCO']
|
||||||
|
#show_symbols = ['PCELF']
|
||||||
#show_symbols = ['OHB.DE']
|
#show_symbols = ['OHB.DE']
|
||||||
#show_symbols = ['UBSFF']
|
#show_symbols = ['UBSFF']
|
||||||
#show_symbols = ['DHER.DE']
|
#show_symbols = ['DHER.DE']
|
||||||
@@ -34,6 +35,9 @@ show_symbols = ['CSCO']
|
|||||||
show_symbols = []
|
show_symbols = []
|
||||||
|
|
||||||
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' : '$'},
|
'SSHPF' : {'name' : 'Scanship Holding ASA', 'currency' : '$'},
|
||||||
'RIG' : {'name' : 'Transocean Ltd.', 'currency' : '$'},
|
'RIG' : {'name' : 'Transocean Ltd.', 'currency' : '$'},
|
||||||
'BBIO' : {'name' : 'BridgeBio Pharma, Inc.', 'currency' : '$'},
|
'BBIO' : {'name' : 'BridgeBio Pharma, Inc.', 'currency' : '$'},
|
||||||
@@ -132,7 +136,7 @@ def buy_callback(data):
|
|||||||
buy_list[name]['items'].append(item)
|
buy_list[name]['items'].append(item)
|
||||||
|
|
||||||
print(data)
|
print(data)
|
||||||
|
do_plot = 0
|
||||||
figNum = 1
|
figNum = 1
|
||||||
if len(show_symbols) > 0:
|
if len(show_symbols) > 0:
|
||||||
for symbol in show_symbols:
|
for symbol in show_symbols:
|
||||||
@@ -142,7 +146,8 @@ if len(show_symbols) > 0:
|
|||||||
title.statistics()
|
title.statistics()
|
||||||
try:
|
try:
|
||||||
ind = title.analyze(buy_callback, range_days=params['show_range_days'])
|
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
|
figNum += 1
|
||||||
except:
|
except:
|
||||||
print ("Exception occurred for {}".format(symbol))
|
print ("Exception occurred for {}".format(symbol))
|
||||||
@@ -156,7 +161,8 @@ else:
|
|||||||
ind = title.analyze(buy_callback, range_days=params['show_range_days'])
|
ind = title.analyze(buy_callback, range_days=params['show_range_days'])
|
||||||
if Stock.has_candidate(ind, 'BTFD'):
|
if Stock.has_candidate(ind, 'BTFD'):
|
||||||
print('-----------------------------------------------')
|
print('-----------------------------------------------')
|
||||||
title.show(ind, figNum=figNum)
|
if do_plot:
|
||||||
|
title.show(ind, figNum=figNum)
|
||||||
figNum += 1
|
figNum += 1
|
||||||
except:
|
except:
|
||||||
print ("Exception occurred for {}".format(symbol))
|
print ("Exception occurred for {}".format(symbol))
|
||||||
@@ -174,6 +180,6 @@ for symbol in buy_list:
|
|||||||
|
|
||||||
if num_stocks > 0:
|
if num_stocks > 0:
|
||||||
print ('Gain total = {} %'.format(gain_accum/num_stocks))
|
print ('Gain total = {} %'.format(gain_accum/num_stocks))
|
||||||
|
if do_plot:
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import os
|
|||||||
import time
|
import time
|
||||||
import agent
|
import agent
|
||||||
from functions import *
|
from functions import *
|
||||||
import matplotlib.pyplot as plt
|
#import matplotlib.pyplot as plt
|
||||||
import matplotlib as mpl
|
#import matplotlib as mpl
|
||||||
|
|
||||||
mpl.rc('figure', max_open_warning = 0)
|
#mpl.rc('figure', max_open_warning = 0)
|
||||||
|
|
||||||
key = '0UO7Z2MVZ2YSQSVE'
|
key = '0UO7Z2MVZ2YSQSVE'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user