From c1eb4c8fc888e665abe2f8c00e08fd07071b6594 Mon Sep 17 00:00:00 2001 From: dosangyoon Date: Sat, 16 Oct 2021 15:05:29 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A7=A4=EC=88=98=EB=A7=8C=20=EC=B7=A8?= =?UTF-8?q?=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hts/BuySellChecker.py | 23 ++++++++++++++++++++--- stockpredictor/analysis/RSI.py | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hts/BuySellChecker.py b/hts/BuySellChecker.py index b2bcd61..d0191e3 100644 --- a/hts/BuySellChecker.py +++ b/hts/BuySellChecker.py @@ -200,10 +200,27 @@ class BuySellChecker: ### buy 분석 ### ################ # 1. slow_k가 25 아래 있으면 매수한다. - if data["slow_k"][i] <= 20: - buy = data["Low"][i] + if i < 30: + if data["slow_k"][i] <= 19: + if data["Close"][i] < data["avg5"][i]: + buy = data["Close"][i] + else: + buy = data["Low"][i] + else: + if data["slow_k"][i] <= 20: + if data["Close"][i] < data["avg5"][i]: + buy = data["Close"][i] + else: + buy = data["Low"][i] + if data["rsi"][i-1] < 10 and data["rsi"][i-1] < data["rsis"][i-1] and data["rsis"][i] < data["rsi"][i]: + if data["Close"][i] < data["avg5"][i]: + buy = data["Close"][i] + else: + buy = data["Low"][i] - # weight 분석 + ################## + ### weight 분석 ### + ################## # rsi가 rsis 위로 올라오며 15 이하일 경우 10배로 주문함 (14:30 이전) if data["rsi"][i] < 15 and data["rsis"][i] < 15 and data["rsi"][i - 1] < data["rsis"][i - 1] and data["rsis"][i] < data["rsi"][i]: buy = data["Low"][i] diff --git a/stockpredictor/analysis/RSI.py b/stockpredictor/analysis/RSI.py index a0db0f9..f4f51b2 100644 --- a/stockpredictor/analysis/RSI.py +++ b/stockpredictor/analysis/RSI.py @@ -17,7 +17,7 @@ class RSI: self.common = Common() return - def apply(sefl, df, period=14): + def apply(sefl, df, period=10): # df.diff를 통해 (기준일 종가 - 기준일 전일 종가)를 계산하여 0보다 크면 증가분을 감소했으면 0을 넣어줌 U = np.where(df.close.diff(1) > 0, df.close.diff(1), 0)