From 0d615270ad4b16fb0ab25a5b8bd92a3177639361 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Tue, 19 Oct 2021 23:47:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=86=A0=EC=BA=90=EC=8A=A4=ED=8B=B1,?= =?UTF-8?q?=20RSI=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hts/BuySellChecker.py | 26 ++++++++++++++------------ hts/HTS_252670.py | 2 +- hts/Simulation.py | 5 +++-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/hts/BuySellChecker.py b/hts/BuySellChecker.py index 65dd04e..85d36c0 100644 --- a/hts/BuySellChecker.py +++ b/hts/BuySellChecker.py @@ -200,19 +200,21 @@ class BuySellChecker: ### STOCHASTIC buy 분석 ### ########################## if i < 40: - if data["slow_k"][i] <= 20: - if data["slow_k"][i - 2] < data["slow_d"][i - 2] and data["slow_k"][i - 1] < data["slow_d"][i - 1] and data["slow_d"][i] < data["slow_k"][i]: - if data["Close"][i] < data["avg5"][i]: - buy = data["Close"][i] - else: - buy = data["Low"][i] + if data["Low"][i] - 3 < data["lower"][i]: + if data["slow_k"][i] <= 20: + if data["slow_k"][i - 2] < data["slow_d"][i - 2] and data["slow_k"][i - 1] < data["slow_d"][i - 1] and data["slow_d"][i] < data["slow_k"][i]: + if data["Close"][i] < data["avg5"][i]: + buy = data["Close"][i] + else: + buy = data["Low"][i] else: - if data["slow_k"][i] <= 35: - if data["slow_k"][i-2] < data["slow_d"][i-2] and data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i]: - if data["Close"][i] < data["avg5"][i]: - buy = data["Close"][i] - else: - buy = data["Low"][i] + if data["Low"][i] - 3 < data["lower"][i]: + if data["slow_k"][i] <= 35: + if data["slow_k"][i-2] < data["slow_d"][i-2] and data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i]: + if data["Close"][i] < data["avg5"][i]: + buy = data["Close"][i] + else: + buy = data["Low"][i] ############################# ### STOCHASTIC weight 분석 ### diff --git a/hts/HTS_252670.py b/hts/HTS_252670.py index ea8fc0e..9f72b1d 100644 --- a/hts/HTS_252670.py +++ b/hts/HTS_252670.py @@ -547,7 +547,7 @@ class HTS_252670: def buyRealTime(self, stock_code, GIVEN_DAY): orderChecker = OrderChecker(stock_code) - BASE_COUNT = 250 + BASE_COUNT = 200 timecheckList = pd.read_csv("timecheck.csv").values.tolist() timecheck = {GIVEN_DAY + " " + str(second).zfill(6):False for second, check in timecheckList} diff --git a/hts/Simulation.py b/hts/Simulation.py index 249b68e..3978046 100644 --- a/hts/Simulation.py +++ b/hts/Simulation.py @@ -172,11 +172,12 @@ if __name__ == "__main__": stock_codes = ["252670", "122630"] given_days = ['20210901','20210902','20210903','20210906','20210907','20210908','20210909','20210910','20210913', '20210914','20210915','20210916','20210917','20210923','20210924','20210927','20210928','20210929', - '20210930','20211001', '20211005','20211006', '20211007','20211008', '20211012','20211013', '20211014', '20211018'] + '20210930','20211001', '20211005','20211006', '20211007','20211008', '20211012','20211013', '20211014', + '20211018', '20211019'] simulation = Simulation() given_days = sorted(given_days, reverse=True) for given_day in given_days: - simulation.simulate(stock_codes[0], given_day) + simulation.simulate(stock_codes[1], given_day) print ("done...")