From 1219edc7c7c2f63547c5b743dc3824d78391258d Mon Sep 17 00:00:00 2001 From: dsyoon Date: Sun, 21 May 2023 10:41:36 +0900 Subject: [PATCH] init --- stock/analysis/AnalyzerSqlite.py | 12 ++---------- stock/analysis/Common.py | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/stock/analysis/AnalyzerSqlite.py b/stock/analysis/AnalyzerSqlite.py index af1993b..294ca80 100644 --- a/stock/analysis/AnalyzerSqlite.py +++ b/stock/analysis/AnalyzerSqlite.py @@ -444,7 +444,6 @@ class AnalyzerSqlite: self.makeDir("monthly_env_상단_volume") self.makeDir("monthly_mv_5_20") self.makeDir("monthly_mv_20_60") - self.makeDir("monthly_이격도") self.makeDir("weekly_env_상단_volume") self.makeDir("weekly_mv_5_20") @@ -534,13 +533,6 @@ class AnalyzerSqlite: log = "RSI_" + "{:.2f}".format(stock_monthly['rsi'][0]) self.writeFile(dir_name, CODE, NAME, top, stock_monthly, log) - # monthly_이격도 - check = self.common.check_disparity(stock_monthly) - if check: - dir_name = "monthly_이격도" - log = "이격도_" + str(top) - self.writeFile(dir_name, CODE, NAME, top, stock_monthly, log) - # Weekly 체크 if len(stock_weekly['volume']) > 40: @@ -569,7 +561,7 @@ class AnalyzerSqlite: self.writeFile(dir_name, CODE, NAME, top, stock_weekly, log) # monthly_이격도 - check = self.common.check_disparity(stock_weekly) + check = self.common.check_disparity(stock_weekly, 'weekly') if check: dir_name = "weekly_이격도" log = "이격도_" + str(top) @@ -594,7 +586,7 @@ class AnalyzerSqlite: self.writeFile(dir_name, CODE, NAME, top, stock_daily, log) # daily_이격도 - check = self.common.check_disparity(stock_daily) + check = self.common.check_disparity(stock_daily, 'daily') if check: dir_name = "daily_이격도" log = "이격도_" + str(top) diff --git a/stock/analysis/Common.py b/stock/analysis/Common.py index 4f6d8ec..9ae2c7b 100644 --- a/stock/analysis/Common.py +++ b/stock/analysis/Common.py @@ -555,11 +555,22 @@ class Common: return False, "" # 이격도 체크 - def check_disparity(self, stock): - if (99 < stock['disparity_avg5'][0] < 101 and 98.7 < stock['disparity_avg10'][0] < 101.3 and - 98.5 < stock['disparity_avg20'][0] < 101.5 and 98.3 < stock['disparity_avg60'][0] < 101.7 and - 98 < stock['disparity_avg120'][0] < 102): - return True + def check_disparity(self, stock, type="daily"): + if type == "weekly": + if (90 < stock['disparity_avg5'][0] < 97 and 89 < stock['disparity_avg10'][0] < 93.5 and + 99 < stock['disparity_avg20'][0] < 102 and 101 < stock['disparity_avg60'][0] < 106 and + 100 < stock['disparity_avg120'][0] < 104.5): + return True + if (98 < stock['disparity_avg5'][0] < 10.5 and 98 < stock['disparity_avg10'][0] < 100 and + 102 < stock['disparity_avg20'][0] < 104 and 99 < stock['disparity_avg60'][0] < 102 and + 97 < stock['disparity_avg120'][0] < 99): + return True + else: + if (99 < stock['disparity_avg5'][0] < 101 and 98.7 < stock['disparity_avg10'][0] < 101.3 and + 98.5 < stock['disparity_avg20'][0] < 101.5 and 98.3 < stock['disparity_avg60'][0] < 101.7 and + 98 < stock['disparity_avg120'][0] < 102): + return True + return False # 낙폭 과대 체크