This commit is contained in:
dsyoon
2021-10-06 18:44:56 +09:00
parent 09f5baba20
commit 2872569fa0

View File

@@ -931,7 +931,7 @@ class HTS:
avg60_2 = 0
final_price = 0
print ("START...")
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'):
while datetime.strptime(given_day + " 083000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(given_day + " 151600", '%Y%m%d %H%M%S'):
second = datetime.now().strftime('%Y%m%d %H%M%S')
if second in timecheck and not timecheck[second]:
@@ -969,7 +969,7 @@ class HTS:
# 매수 주문
# 현재까지 매입금액이 7백만원 이하일 때만 매수를 한다.
if TOTAL_BUY_AMT < 7000000:
if TOTAL_BUY_AMT < 9000000:
self.requestOrder("2", stock_code, BUY_COUNT , bs_buy_price)
## 매도 주문 (아래 잔고를 체크해서 매도를 호출하는 것으로 시도한다.)
@@ -990,7 +990,9 @@ class HTS:
# 60일 선이 꺾여서 하락 중일 경우만 바로 매도를 한다.
if ((avg60_1 != 0 and avg60_2 != 0) and avg60_2 > avg60_1):
if (((avg60_1 != 0 and avg60_2 != 0) and avg60_2 > avg60_1) or
datetime.now() >= datetime.strptime(given_day + " 151500", '%Y%m%d %H%M%S') or
datetime.now() < datetime.strptime(given_day + " 090200", '%Y%m%d %H%M%S')):
# 만약 잔고가 있으면 장부가보다 5원 높게 매도한다.
jangoDic = self.requstJango()
if jangoDic and len(jangoDic.keys()) > 0:
@@ -1014,7 +1016,7 @@ class HTS:
# 장부가의 마지막 자리수가 7,8,9 라면 (2097, 2098, 2099 -> 2105 에 매도)
self.requestOrder("1", stock_code, jangoDic[code]['매도가능'], sell_price + 15)
time.sleep(0.9)
time.sleep(30)
logFp.close()
return