This commit is contained in:
dosangyoon
2021-10-03 21:57:59 +09:00
parent d30cfed3f7
commit 563158e9ca

View File

@@ -873,8 +873,9 @@ class HTS:
"low": [],
"vol": []}
toExist = False
print ("START...")
while datetime.strptime(given_day + " 083000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(given_day + " 151100", '%Y%m%d %H%M%S'):
while datetime.strptime(given_day + " 083000", '%Y%m%d %H%M%S') < datetime.now() < datetime.strptime(given_day + " 152000", '%Y%m%d %H%M%S'):
second = datetime.now().strftime('%Y%m%d %H%M%S')
if second in timecheck and not timecheck[second]:
@@ -935,6 +936,11 @@ class HTS:
for code in jangoDic:
TOTAL_BUY_AMT = jangoDic[code]['매입금액']
if jangoDic[code]['매도가능'] > 0:
if datetime.now() > datetime.strptime(given_day + " 151000", '%Y%m%d %H%M%S'):
self.requestOrder("1", stock_code, jangoDic[code]['매도가능'], result["close"])
toExist = True
break
# 장부가 가격의 마지막 자리를 0으로 만든다. (2090 -> 2090, 2092 -> 2090, 2098 -> 2090)
sell_price = int(jangoDic[code]['장부가'] / 10) * 10
# 장부가의 마지막 자리수를 가져온다.
@@ -949,6 +955,9 @@ class HTS:
# 장부가의 마지막 자리수가 7,8,9 라면 (2097, 2098, 2099 -> 2105 에 매도)
self.requestOrder("1", stock_code, jangoDic[code]['매도가능'], sell_price + 15)
if toExist:
break
time.sleep(0.9)
logFp.close()