From 918f90dc444bdc68d03795f0248e4c3e6ff0c8cf Mon Sep 17 00:00:00 2001 From: dsyoon Date: Fri, 4 Feb 2022 15:26:08 +0900 Subject: [PATCH] init --- hts/BuySellChecker.py | 16 ++++++++-------- hts/HTS_252670.py | 16 +++++++--------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/hts/BuySellChecker.py b/hts/BuySellChecker.py index 6f7e5de..4555850 100644 --- a/hts/BuySellChecker.py +++ b/hts/BuySellChecker.py @@ -207,20 +207,20 @@ class BuySellChecker: ########################## if i < 40: if data["low"][i] < data["lower"][i]+5: - if data["slow_k"][i] <= 20: - if data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i] and data["slow_k"][i-1] <= data["slow_k"][i]: + if data["slow_k"][i-1] < 20 and data["slow_k"][i] < 25: + if data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i] and data["slow_k"][i-1] < data["slow_k"][i]: if data["close"][i] < data["avg5"][i]: - buy = data["close"][i] + buy = data["close"][i] - 5 else: - buy = data["low"][i] + buy = data["low"][i] - 5 else: if data["low"][i] < data["lower"][i]+5: - if data["slow_k"][i-1] < 30 and data["slow_k"][i] < 30: - if data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i] and data["slow_k"][i-1] <= data["slow_k"][i]: + if data["slow_k"][i-1] < 20 and data["slow_k"][i] < 25: + if data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i] and data["slow_k"][i-1] < data["slow_k"][i]: if data["close"][i] < data["avg5"][i]: - buy = data["close"][i] + buy = data["close"][i] - 5 else: - buy = data["low"][i] + buy = data["low"][i] - 5 ############################# ### STOCHASTIC weight 분석 ### diff --git a/hts/HTS_252670.py b/hts/HTS_252670.py index 7a8a788..bc99889 100644 --- a/hts/HTS_252670.py +++ b/hts/HTS_252670.py @@ -586,18 +586,16 @@ class HTS_252670: # 매수를 주문한다. - """""" - ###orderNum = self.requestOrder(OrderType.buy, self.stock_code, BUY_COUNT , bs_buy_price) + orderNum = self.requestOrder(OrderType.buy, self.stock_code, BUY_COUNT , bs_buy_price) # 미체결 기록을 가져온다. - ###ORDER_LIST = self.requestOrderList() + ORDER_LIST = self.requestOrderList() # 매수 주문을 기록한다. - ###orderListToCancel = orderChecker.add(self.stock_code, OrderType.buy, orderNum, BUY_COUNT, bs_buy_price, ORDER_LIST) + orderListToCancel = orderChecker.add(self.stock_code, OrderType.buy, orderNum, BUY_COUNT, bs_buy_price, ORDER_LIST) # 두 시간 이전 미체결을 모두 취소한다. - ###self.cancelOrderList(orderListToCancel) + self.cancelOrderList(orderListToCancel) # 로그 출력 - ###print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), BUY_COUNT, bs_buy_price, len(orderListToCancel), len(ORDER_LIST)) - print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), BUY_COUNT, bs_buy_price) + print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), BUY_COUNT, bs_buy_price, len(orderListToCancel), len(ORDER_LIST)) """ if bs_sell_price > 0: @@ -619,8 +617,8 @@ class HTS_252670: print("SELL", THIS_TIME.strftime('%Y%m%d %H%M%S'), selling_count, selling_price, len(orderListToCancel), len(ORDER_LIST)) """ # 로그 출력 - print("TIMECHECK: %s, price: %d, low: %d, lower: %.2f, slow_k_1: %.2f, slow_d_1: %.2f, slow_k: %.2f, slow_d: %.2f, rsi: %.2f, rsis: %.2f" % - (str(THIS_TIME), final_price, data["low"][data_size-1], data["lower"][data_size-1], + print("TIMECHECK: %s, price: %d, low: %d, lower: %.2f, avg5: %.2f, slow_k_1: %.2f, slow_d_1: %.2f, slow_k: %.2f, slow_d: %.2f, rsi: %.2f, rsis: %.2f" % + (str(THIS_TIME), final_price, data["low"][data_size-1], data["lower"][data_size-1], data["avg5"][data_size-1], data["slow_k"][data_size-2], data["slow_d"][data_size-2], data["slow_k"][data_size-1], data["slow_d"][data_size-1], data["rsi"][data_size-1], data["rsis"][data_size-1])) timecheck[THIS_TIME] = True