This commit is contained in:
dosang.yoon
2022-08-02 15:48:28 +09:00
parent 8d1c4ae041
commit a191fba93a
11 changed files with 279 additions and 53 deletions

View File

@@ -3,7 +3,6 @@ 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
@@ -98,7 +97,7 @@ class Simulation (HTS):
# 그래프를 그린다.
"""
fig = go.Figure(hts=candle_data)
fig = go.Figure(data=candle_data)
fig.update_layout(title=stock_code + "_" + given_day)
fig.show()
"""
@@ -127,8 +126,8 @@ class Simulation (HTS):
return
def getData(self):
return
def analyzeAutoMode(self, data):
return data, None
def simulate(self, stock_code, today, type="rule"):
LAST_DATA = self.stock2Vector.getLastData(stock_code, today)
@@ -136,14 +135,14 @@ class Simulation (HTS):
result = self.stock2Vector.getRealTime(stock_code, today, LAST_DATA)
if type == "rule":
# 규칙 기반의 분석을 통해서 볼린저밴드 상/하단을 계산한다.
data = self.buySellChecker.analyzeByRule(result)
# 이동평균, RSI, MACD, 일목균형, 볼린저밴드 상/하단을 계산한다.
data = self.buySellChecker.analyze(result)
# 사야 할 시점과 팔아야 할 시점을 체크한다.
bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, False)
elif type == "labeltest":
data = self.getData(result)
bsLine, data = self.buySellChecker.checkTransaction(data, stock_code, isRealTime=False)
elif type == "auto":
data, bsLine = self.analyzeAutoMode(result)
else:
data = None
data, bsLine = None, None
if data is not None:
# 그래프를 그린다.