This commit is contained in:
dsyoon
2023-12-20 09:21:58 +09:00
parent 54a9392248
commit 2f079bad9e

View File

@@ -25,16 +25,23 @@ if __name__ == "__main__":
if not os.path.exists(os.path.join(RESOURCE_PATH, "log")): if not os.path.exists(os.path.join(RESOURCE_PATH, "log")):
os.mkdir(os.path.join(RESOURCE_PATH, "log")) os.mkdir(os.path.join(RESOURCE_PATH, "log"))
print("START...") BUY_LIST = {}
#while datetime.strptime(today + " 060000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(today + " 153100", '%Y%m%d %H%M%S'):
#if datetime.strptime(today + " 090000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(today + " 151500", '%Y%m%d %H%M%S'):
THIS_TIME = datetime.now()
for stock in stocks: for stock in stocks:
with open("config.json", "r", encoding="utf-8") as f: with open("config.json", "r", encoding="utf-8") as f:
config = json.load(f) config = json.load(f)
MAX_BUY_PRICE = config['MAX_BUY_PRICE']
BUY_LIST_1 = config['BUY_LIST_1'] if stock['stock_code'] not in BUY_LIST:
BUY_LIST_1["disparity"] = hts.getDisparityLimit(stock, RESOURCE_PATH) BUY_LIST[stock['stock_code']] = {}
BUY_LIST[stock['stock_code']]['MAX_BUY_PRICE'] = config['MAX_BUY_PRICE']
BUY_LIST[stock['stock_code']]['BUY_LIST_1'] = config['BUY_LIST_1']
BUY_LIST[stock['stock_code']]['BUY_LIST_1']["disparity"] = hts.getDisparityLimit(stock, RESOURCE_PATH)
print("START...")
while datetime.strptime(today + " 060000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(today + " 153100", '%Y%m%d %H%M%S'):
if datetime.strptime(today + " 090000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(today + " 151500", '%Y%m%d %H%M%S'):
THIS_TIME = datetime.now()
for stock in stocks:
if datetime.strptime(today + " 090000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(today + " 090100", '%Y%m%d %H%M%S'): if datetime.strptime(today + " 090000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(today + " 090100", '%Y%m%d %H%M%S'):
hts.bot.sendMsg("START... {} ({}) SLOW_K: {}".format(stock['stock_code'], stock['stock_name'], MAX_BUY_PRICE)) hts.bot.sendMsg("START... {} ({}) SLOW_K: {}".format(stock['stock_code'], stock['stock_name'], MAX_BUY_PRICE))
@@ -46,7 +53,7 @@ if __name__ == "__main__":
data_signal = hts.analyze(result_tic_m30) data_signal = hts.analyze(result_tic_m30)
# data.drop(data.index[:len(data) - analyzed_day], inplace=True) # data.drop(data.index[:len(data) - analyzed_day], inplace=True)
hts.buyRealTime(stock, data, data_signal, MAX_BUY_PRICE, BUY_LIST_1) hts.buyRealTime(stock, data, data_signal, BUY_LIST[stock['stock_code']]['MAX_BUY_PRICE'], BUY_LIST[stock['stock_code']]['BUY_LIST_1'])
if (int(THIS_TIME.strftime("%M")) % 50 == 0 or int(THIS_TIME.strftime("%M")) % 20 == 0): if (int(THIS_TIME.strftime("%M")) % 50 == 0 or int(THIS_TIME.strftime("%M")) % 20 == 0):
vm = psutil.virtual_memory() vm = psutil.virtual_memory()