This commit is contained in:
dsyoon
2021-09-28 12:28:26 +09:00
parent 5f0f02cfa7
commit ca1fc5943f

View File

@@ -715,7 +715,10 @@ class HTS:
for code in jangoDic:
if jangoDic[code]['매도가능'] > 0:
# 가장 마지막 현재가를 가져온다.
last_price = result['close'][len(result['close'])-1]
if len(result['close']) > 0:
last_price = result['close'][len(result['close'])-1]
else:
last_price = 0
# 현재가가 장부가보다 크다면 현재가 + 5원 매도한다.
if last_price > int(jangoDic[code]['장부가']):
# 현재가가 장부가보다 크다면,
@@ -727,7 +730,7 @@ class HTS:
# 장부가 가격의 마지막 자리를 0으로 만든다. (2092 -> 2090, 2098 -> 2090)
sell_price = int(jangoDic[code]['장부가'] / 10) * 10
# 만약 오후 1시 이전이라면 한 호가 (5원) 더 올려서 매도한다.
if datetime.now() < datetime.strptime(given_day + " 130000", '%Y%m%d %H%M%S'):
if datetime.now() < datetime.strptime(given_day + " 101000", '%Y%m%d %H%M%S'):
sell_price += 5
if last_number in [0, 1, 2]: