From cd440ab59e6b77dd8ebc01e486accc618c1a01ac Mon Sep 17 00:00:00 2001 From: dsyoon Date: Mon, 16 Oct 2023 17:13:28 +0900 Subject: [PATCH] init --- Simulation.py | 8 ++++---- hts/BuySellChecker.py | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Simulation.py b/Simulation.py index 7d2d707..03b643c 100644 --- a/Simulation.py +++ b/Simulation.py @@ -253,10 +253,10 @@ if __name__ == "__main__": #"122630": ['20230930'], #"122630": ['20210901','20210902','20210903','20210906','20231012','20231013'] #"122630": ['20210901', '20210902', '20210903', '20210906', '20210907', '20210908', '20210909', '20210910', '20210913', '20210914', '20210915', '20210916', '20210917', '20210923', '20210924', '20210927', '20210928', '20210929', '20210930', '20211001', '20211005','20231012','20231013'], - "252670": ['20231012', '20231013'], - "251340": ['20231012', '20231013'], - "122630": ['20231012', '20231013'], - "233740": ['20231012', '20231013'], + "233740": ['20231016'], + "252670": ['20231016'], + "251340": ['20231016'], + "122630": ['20231016'] } #simulation.simulate(stock_codes) simulation.simulate(stock_codes) diff --git a/hts/BuySellChecker.py b/hts/BuySellChecker.py index d989fcf..bde95e8 100644 --- a/hts/BuySellChecker.py +++ b/hts/BuySellChecker.py @@ -256,14 +256,15 @@ class BuySellChecker: if i > 30 and data['macd'][i] < min_macd + (-min_macd * 0.4): buy, weight = data['close'][i], 1 """ - if stock_code == '252670' or stock_code == '251340': - if data['macd'][i] < -4: - if data['open'][i - 1] < data['close'][i - 1] and data['volume'][i - 1] < data['volume'][i]: - buy, weight = data['close'][i], 1 - elif stock_code == '122630' or stock_code == '233740': - if data['macd'][i] < -10: - if data['open'][i - 1] < data['close'][i - 1] and data['volume'][i - 1] < data['volume'][i]: - buy, weight = data['close'][i], 1 + if 10 < int(data.index[i].strftime('%H')): + if stock_code == '252670' or stock_code == '251340': + if data['macd'][i] < -4: + if data['open'][i - 1] < data['close'][i - 1] and data['volume'][i - 1] < data['volume'][i]: + buy, weight = data['close'][i], 1 + elif stock_code == '122630' or stock_code == '233740': + if data['macd'][i] < -10: + if data['open'][i - 1] < data['close'][i - 1] and data['volume'][i - 1] < data['volume'][i]: + buy, weight = data['close'][i], 1 return buy, weight