From 8d1c4ae041d2a3e93dd2e7c095e238a072db697d Mon Sep 17 00:00:00 2001 From: dsyoon Date: Tue, 2 Aug 2022 13:10:37 +0900 Subject: [PATCH] init --- Simulation.py | 25 +++++++++++++++++-------- stock/util/LabelMaker.py | 8 ++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 stock/util/LabelMaker.py diff --git a/Simulation.py b/Simulation.py index 5c6eeec..37c3b03 100644 --- a/Simulation.py +++ b/Simulation.py @@ -3,6 +3,7 @@ import pandas as pd import plotly.graph_objects as go from plotly import subplots import os +import sqlite3 from hts.HTS import HTS from stock.util.Stock2Vector import Stock2Vector @@ -126,19 +127,27 @@ class Simulation (HTS): return - def simulate(self, stock_code, today): + def getData(self): + return + + def simulate(self, stock_code, today, type="rule"): LAST_DATA = self.stock2Vector.getLastData(stock_code, today) result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA) - # 규칙 기반의 분석을 통해서 볼린저밴드 상/하단을 계산한다. - data = self.buySellChecker.analyzeByRule(result) + if type == "rule": + # 규칙 기반의 분석을 통해서 볼린저밴드 상/하단을 계산한다. + data = self.buySellChecker.analyzeByRule(result) + # 사야 할 시점과 팔아야 할 시점을 체크한다. + bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, False) + elif type == "labeltest": + data = self.getData(result) + else: + data = None - # 사야 할 시점과 팔아야 할 시점을 체크한다. - bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, False) - - # 그래프를 그린다. - self.draw(stock_code, today, data, bsLine) + if data is not None: + # 그래프를 그린다. + self.draw(stock_code, today, data, bsLine) return diff --git a/stock/util/LabelMaker.py b/stock/util/LabelMaker.py new file mode 100644 index 0000000..50a5e09 --- /dev/null +++ b/stock/util/LabelMaker.py @@ -0,0 +1,8 @@ +import sqlite3 + +class LabelMaker: + def __init__(self): + return + +if __name__ == "__main__": + labelMaker = LabelMaker() \ No newline at end of file