init
This commit is contained in:
@@ -223,7 +223,7 @@ if __name__ == "__main__":
|
||||
hts.connect2DB("hts.db")
|
||||
|
||||
today_str = today.strftime('%Y%m%d')
|
||||
hts.buyRealTime(today_str, analyzed_day=1000, MAX_PRICE=10000)
|
||||
hts.buyRealTime(today_str, analyzed_day=1000, MAX_PRICE=20000)
|
||||
|
||||
db_filename = os.path.join(RESOURCE_PATH, "hts.db")
|
||||
hts.insertStockData(today, stock_code, stock_name)
|
||||
|
||||
@@ -250,10 +250,11 @@ if __name__ == "__main__":
|
||||
#"252670": ['20210930'],
|
||||
#"252670": ['20210903','20210910','20210913'],
|
||||
#"252670": ['20210901', '20210902', '20210903', '20210906', '20210907', '20210908', '20210909', '20210910', '20210913', '20210914', '20210915', '20210916', '20210917', '20210923', '20210924', '20210927', '20210928', '20210929', '20210930', '20211001', '20211005','20231012','20231013'],
|
||||
"251340": ['20231012','20231013'],
|
||||
#"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'],
|
||||
"251340": ['20231012', '20231013'],
|
||||
"233740": ['20231012', '20231013'],
|
||||
}
|
||||
#simulation.simulate(stock_codes)
|
||||
simulation.simulate(stock_codes)
|
||||
|
||||
@@ -218,7 +218,7 @@ class BuySellChecker:
|
||||
|
||||
|
||||
|
||||
def getBuyPriceAndWeight(self, i, data):
|
||||
def getBuyPriceAndWeight(self, stock_code, i, data):
|
||||
buy, weight = -1, -1
|
||||
|
||||
if i < 40:
|
||||
@@ -256,13 +256,19 @@ 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
|
||||
|
||||
return buy, weight
|
||||
|
||||
|
||||
def getSellPriceAndWeight(self, i, data):
|
||||
def getSellPriceAndWeight(self, stock_code, i, data):
|
||||
sell, weight = -1, -1
|
||||
|
||||
# 1) 스토캐스틱 과매수
|
||||
@@ -408,8 +414,8 @@ class BuySellChecker:
|
||||
# isRealTime=True, 실시간 적용
|
||||
last_index = size - 1
|
||||
|
||||
buy, buy_weight = self.getBuyPriceAndWeight(last_index, data)
|
||||
sell, sell_weight = self.getSellPriceAndWeight(last_index, data)
|
||||
buy, buy_weight = self.getBuyPriceAndWeight(stock_code, last_index, data)
|
||||
sell, sell_weight = self.getSellPriceAndWeight(stock_code, last_index, data)
|
||||
if data.index[last_index].strftime('%H:%M:%S') > datetime.strptime(datetime.today().strftime("%Y-%m-%d 15:10:00"), "%Y-%m-%d %H:%M:%S").strftime('%H:%M:%S'):
|
||||
buy, buy_weight = -1, -1
|
||||
|
||||
@@ -427,8 +433,8 @@ class BuySellChecker:
|
||||
|
||||
for last_index in range(size):
|
||||
|
||||
buy, buy_weight = self.getBuyPriceAndWeight(last_index, data)
|
||||
sell, sell_weight = self.getSellPriceAndWeight(last_index, data)
|
||||
buy, buy_weight = self.getBuyPriceAndWeight(stock_code, last_index, data)
|
||||
sell, sell_weight = self.getSellPriceAndWeight(stock_code, last_index, data)
|
||||
|
||||
bsLine['buy'][last_index] = buy
|
||||
bsLine['buy_weight'][last_index] = buy_weight
|
||||
|
||||
Reference in New Issue
Block a user