diff --git a/hts/HTS.py b/hts/HTS.py index 9347596..2c0dc8c 100644 --- a/hts/HTS.py +++ b/hts/HTS.py @@ -237,7 +237,7 @@ class HTS: return False cnt = objRq.GetHeaderValue(7) - if cnt > 10: + if cnt > 3: return jangoDic for i in range(cnt): @@ -262,10 +262,10 @@ class HTS: key = code jangoDic[key] = item - if len(jangoDic) >= 10: # 최대 200 종목만, + if len(jangoDic) >= 3: # 최대 3 종목만, break - if len(jangoDic) >= 10: + if len(jangoDic) >= 3: break if (objRq.Continue == False): @@ -632,7 +632,7 @@ class HTS: "high": [], "low": [], "vol": []} - price = 0 + while datetime.strptime(given_day + " 083000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(given_day + " 151500", '%Y%m%d %H%M%S'): second = datetime.now().strftime('%Y%m%d %H%M%S') @@ -659,12 +659,12 @@ class HTS: logFp.write("%s,%s, %d\n" % ("BUY", second, price)) logFp.flush() - count = 3 + count = 5 # 매수 주문 self.requestOrder("2", stock_code, count, price) ## 매도 주문 (아래 잔고를 체킇서 매도를 호출하는 것으로 시도한다.) - time.sleep(60) - self.requestOrder("1", stock_code, count, price + 5) + #time.sleep(60) + #self.requestOrder("1", stock_code, count, price + 5) # 가져온 만큼 데이터를 누적해서 파일로 작성한다. self.write(given_day, result) @@ -676,15 +676,11 @@ class HTS: logFp.flush() # 만약 잔고가 있으면 장부가보다 5원 높게 매도한다. - """ jangoDic = self.requstJango() if len(jangoDic) > 0: for code in jangoDic: - if price > 0: - self.requestOrder("1", stock_code, jangoDic[code]['잔고수량'], price + 5) - else: - self.requestOrder("1", stock_code, jangoDic[code]['잔고수량'], jangoDic[code]['장부가'] + 5) - """ + self.requestOrder("1", stock_code, jangoDic[code]['잔고수량'], jangoDic[code]['장부가'] + 5) + time.sleep(0.9) logFp.close()