This commit is contained in:
dsyoon
2022-08-02 13:10:37 +09:00
parent b94f2ff01a
commit 8d1c4ae041
2 changed files with 25 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ import pandas as pd
import plotly.graph_objects as go import plotly.graph_objects as go
from plotly import subplots from plotly import subplots
import os import os
import sqlite3
from hts.HTS import HTS from hts.HTS import HTS
from stock.util.Stock2Vector import Stock2Vector from stock.util.Stock2Vector import Stock2Vector
@@ -126,17 +127,25 @@ class Simulation (HTS):
return 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) LAST_DATA = self.stock2Vector.getLastData(stock_code, today)
result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA) result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA)
if type == "rule":
# 규칙 기반의 분석을 통해서 볼린저밴드 상/하단을 계산한다. # 규칙 기반의 분석을 통해서 볼린저밴드 상/하단을 계산한다.
data = self.buySellChecker.analyzeByRule(result) data = self.buySellChecker.analyzeByRule(result)
# 사야 할 시점과 팔아야 할 시점을 체크한다. # 사야 할 시점과 팔아야 할 시점을 체크한다.
bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, False) bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, False)
elif type == "labeltest":
data = self.getData(result)
else:
data = None
if data is not None:
# 그래프를 그린다. # 그래프를 그린다.
self.draw(stock_code, today, data, bsLine) self.draw(stock_code, today, data, bsLine)

8
stock/util/LabelMaker.py Normal file
View File

@@ -0,0 +1,8 @@
import sqlite3
class LabelMaker:
def __init__(self):
return
if __name__ == "__main__":
labelMaker = LabelMaker()