init
This commit is contained in:
@@ -374,8 +374,10 @@ class Analyzer:
|
||||
bottom = stock[i]['close']
|
||||
price = stock[i]['close']
|
||||
|
||||
if len(stock) > 350:
|
||||
for i in range(2, 350):
|
||||
for i in range(180, 540):
|
||||
if i > len(stock) or not stock[-i]:
|
||||
break
|
||||
|
||||
if top < stock[-i]["close"]:
|
||||
top = stock[-i]["close"]
|
||||
|
||||
@@ -385,12 +387,17 @@ class Analyzer:
|
||||
if top - bottom == 0:
|
||||
energy = 100
|
||||
else:
|
||||
energy = (price - bottom) / (top - bottom)
|
||||
energy = round(((price - bottom) / (top - bottom)), 2)
|
||||
|
||||
return round(energy, 2)
|
||||
return energy
|
||||
|
||||
def writeFile(self, fig, state, isbuy, buy_price, bolingerband_score, stochastic_score, positionalEnergy, item_name, item_code):
|
||||
|
||||
if state != "":
|
||||
fileName = self.status_path
|
||||
fileName = "%s/%d__%s__p(%.2f)__b(%.2f)__s(%.2f)__%d__%s_%s.html" % (fileName, isbuy, state, positionalEnergy, bolingerband_score, stochastic_score, buy_price, item_name.replace(" ", ""), item_code)
|
||||
po.write_html(fig, file=fileName, auto_open=False)
|
||||
|
||||
count = 0
|
||||
if bolingerband_score < 0.15:
|
||||
fileName = self.bolingerband_path
|
||||
@@ -414,11 +421,6 @@ class Analyzer:
|
||||
fileName = "%s/%d__p(%.2f)__b(%.2f)__s(%.2f)__%s__%d__%s_%s.html" % (fileName, isbuy, positionalEnergy, bolingerband_score, stochastic_score, state, buy_price, item_name.replace(" ", ""), item_code)
|
||||
po.write_html(fig, file=fileName, auto_open=False)
|
||||
|
||||
if state != "":
|
||||
fileName = self.outPath
|
||||
fileName = "%s/%d__%s__p(%.2f)__b(%.2f)__s(%.2f)__%d__%s_%s.html" % (fileName, isbuy, state, positionalEnergy, bolingerband_score, stochastic_score, buy_price, item_name.replace(" ", ""), item_code)
|
||||
po.write_html(fig, file=fileName, auto_open=False)
|
||||
|
||||
return
|
||||
|
||||
def makeDirectory(self, outPath):
|
||||
@@ -442,6 +444,11 @@ class Analyzer:
|
||||
os.rmdir(self.positionalEnergy_path)
|
||||
os.mkdir(self.positionalEnergy_path)
|
||||
|
||||
self.status_path = outPath + "/status"
|
||||
if os.path.isdir(self.status_path):
|
||||
os.rmdir(self.status_path)
|
||||
os.mkdir(self.status_path)
|
||||
|
||||
return
|
||||
|
||||
# 그래프 출력
|
||||
|
||||
Reference in New Issue
Block a user