This commit is contained in:
dsyoon
2022-08-05 01:06:37 +09:00
parent a3e390ab70
commit e0a336c8cc

View File

@@ -135,25 +135,25 @@ class Simulation (HTS):
if method == "answer":
bsLine, data = self.labelMaker.makeCandidate(stock_code, today, view=True)
elif method == "ml":
LAST_DATA = self.stock2Vector.getLastData(stock_code, today, n=10)
result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA)
df, minmax_df = self.stock2Vector.preprocessData(result)
bsLine, data = self.stockPredictor.predict(df, minmax_df, isRealTime=False)
else:
LAST_DATA = self.stock2Vector.getLastData(stock_code, today)
result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA)
if method == "ml":
LAST_DATA = self.stock2Vector.getLastData(stock_code, today, n=10)
result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA)
# 이동평균, RSI, MACD, 일목균형, 볼린저밴드 상/하단을 계산한다.
data = self.buySellChecker.analyze(result)
# 사야 할 시점과 팔아야 할 시점을 체크한다.
bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, isRealTime=False)
df, minmax_df = self.stock2Vector.preprocessData(result)
bsLine, data = self.stockPredictor.predict(df, minmax_df, isRealTime=False)
else:
LAST_DATA = self.stock2Vector.getLastData(stock_code, today)
result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA)
if data is not None:
# 그래프를 그린다.
self.draw(stock_code, today, data, bsLine)
# 이동평균, RSI, MACD, 일목균형, 볼린저밴드 상/하단을 계산한다.
data = self.buySellChecker.analyze(result)
# 사야 할 시점과 팔아야 할 시점을 체크한다.
bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, isRealTime=False)
if data is not None:
# 그래프를 그린다.
self.draw(stock_code, today, data, bsLine)
return
@@ -166,13 +166,14 @@ if __name__ == "__main__":
stock_codes = {
# 252670
# 122630
"122630": ['20220803'],
"252670": ['20220804'],
}
method = "answer" # "ml", "answer"
for stock_code in stock_codes:
simulation = Simulation(RESOURCE_PATH)
for given_day in stock_codes[stock_code]:
simulation.simulate(stock_code, given_day, method='ml')
simulation.simulate(stock_code, given_day, method=method)
print ("done...")