diff --git a/HTS_daily.py b/HTS_daily.py index d098522..df58018 100644 --- a/HTS_daily.py +++ b/HTS_daily.py @@ -13,8 +13,6 @@ from hts.OrderChecker import OrderChecker class HTS_DAILY (HTS): RESOURCE_PATH = None - stock_code = None - buy_count = None orderChecker = None buySellChecker = None labelChecker = None @@ -44,20 +42,21 @@ class HTS_DAILY (HTS): jangoDic = self.requstJango() if jangoDic and len(jangoDic.keys()) > 0: for code in jangoDic: - if jangoDic[code]['매도가능'] > 0: - if check: - if jangoDic[code]['장부가']*0.05 < jangoDic[code]['장부가'] - final_price: - sell_price = jangoDic[code]['장부가'] - if code == "A" + stock_code: + if code == "A" + stock_code: + if jangoDic[code]['매도가능'] > 0: + if check: + if jangoDic[code]['장부가']*0.05 < jangoDic[code]['장부가'] - final_price: + sell_price = jangoDic[code]['장부가'] + orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], sell_price) print("ORDER_SELL", stock_code, log_time.strftime('%Y%m%d %H%M%S'), jangoDic[code]['매도가능'], sell_price) - else: - #max_price = max(jangoDic[code]['장부가'], final_price) - # 10% 이상 수익이어야 매도한다. - max_price = int(jangoDic[code]['장부가'] * 1.10) - if max_price <= final_price: - sell_price = (int(max_price) - int(max_price) % 5) - if code == "A"+stock_code: + else: + #max_price = max(jangoDic[code]['장부가'], final_price) + # 10% 이상 수익이어야 매도한다. + max_price = int(jangoDic[code]['장부가'] * 1.10) + if max_price <= final_price: + sell_price = (int(max_price) - int(max_price) % 5) + orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], sell_price) print("ORDER_SELL", stock_code, log_time.strftime('%Y%m%d %H%M%S'), jangoDic[code]['매도가능'], sell_price) return orderNum @@ -140,7 +139,7 @@ class HTS_DAILY (HTS): last_index = len(bsLine['sell']) - 1 if bsLine['sell'][last_index] > 0: bs_sell_price = bsLine['sell'][last_index] - orderNum = self.getSellingPrice(THIS_TIME, self.stock_code, bs_sell_price) + orderNum = self.getSellingPrice(THIS_TIME, stock_code, bs_sell_price) self.orderChecker.delete(today, stock_code) # 로그 출력