This commit is contained in:
dsyoon
2023-02-09 10:12:32 +09:00
parent 63e1590115
commit 6cdb43571b
3 changed files with 33 additions and 49 deletions

View File

@@ -40,7 +40,7 @@ class HTS_etf (HTS):
if jangoDic and len(jangoDic.keys()) > 0:
for code in jangoDic:
if jangoDic[code]['매도가능'] > 0:
if jangoDic[code]['평가금액'] - jangoDic[code]['장부가'] > jangoDic[code]['장부가'] * 0.02:
if 2 < jangoDic[code]['평가손익']:
self.requestOrder(OrderType.sell, code, jangoDic[code]['매도가능'], jangoDic[code]['평가금액'])
self.slackBot.post_to_slack(code, jangoDic[code]['종목명'], "SELL", jangoDic[code]['평가금액'], jangoDic[code]['매도가능'])
return

View File

@@ -59,7 +59,7 @@ class HTS_Stocks (HTS):
if jangoDic and len(jangoDic.keys()) > 0:
for code in jangoDic:
if jangoDic[code]['매도가능'] > 0:
if jangoDic[code]['평가금액'] - jangoDic[code]['장부가'] > jangoDic[code]['장부가'] * 0.02:
if 2 < jangoDic[code]['평가손익']:
self.requestOrder(OrderType.sell, code, jangoDic[code]['매도가능'], jangoDic[code]['평가금액'])
self.slackBot.post_to_slack(code, jangoDic[code]['종목명'], "SELL", jangoDic[code]['평가금액'], jangoDic[code]['매도가능'])
return
@@ -159,7 +159,7 @@ class HTS_Stocks (HTS):
if not self.orderChecker.exist(today, "A" + stock_code, hours=9):
last_index = len(bsLine['buy'])-1
if bsLine['buy'][last_index] > 0:
if 0 < bsLine['buy'][last_index] < 200000:
bs_buy_price = bsLine['buy'][last_index]
bs_buy_weight = bsLine['buy_weight'][last_index]

View File

@@ -234,7 +234,7 @@ class HTS:
ord('P'): '플러스론',
ord('I'): '자기융자',
}
while True:
objRq.BlockRequest()
# 통신 및 통신 에러 처리
rqStatus = objRq.GetDibStatus()
@@ -244,7 +244,7 @@ class HTS:
return False
cnt = objRq.GetHeaderValue(7)
if cnt > 3:
if cnt < 0:
return jangoDic
for i in range(cnt):
@@ -269,22 +269,6 @@ class HTS:
key = code
jangoDic[key] = item
if len(jangoDic) >= 3: # 최대 3 종목만,
break
if len(jangoDic) >= 3:
break
if (objRq.Continue == False):
break
check = False
for item in jangoDic:
if item:
check = True
break
if not check:
return None
return jangoDic
# 예약 주문 내역 조회 및 미체결 리스트 구하기