This commit is contained in:
dosangyoon
2022-07-11 22:13:45 +09:00
parent 3d872c7ea7
commit 224624bce3
2 changed files with 36 additions and 38 deletions

View File

@@ -149,29 +149,28 @@ class HTS_122630 (HTS):
timecheck[THIS_TIME] = True timecheck[THIS_TIME] = True
elif datetime.strptime(today + " 151800", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 152000", '%Y%m%d %H%M%S'): elif datetime.strptime(today + " 151800", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 152000", '%Y%m%d %H%M%S'):
if final_sell_check:
continue
#### if not final_sell_check:
# 손해 보지 않는 가격에 매도한다. ####
#### # 손해 보지 않는 가격에 매도한다.
####
# 주문 리스트를 가져온다. # 주문 리스트를 가져온다.
orderList = self.requestOrderList() orderList = self.requestOrderList()
# 15:18:00 가 되면 모든 미체결 취소한다. # 15:18:00 가 되면 모든 미체결 취소한다.
self.cancelOrderList(orderList) self.cancelOrderList(orderList)
# 매도 가격을 가져온다. # 매도 가격을 가져온다.
result = self.getRealTime(self.stock_code, lastday, today) result = self.getRealTime(self.stock_code, lastday, today)
final_price = result["close"][len(result["close"])-1] final_price = result["close"][len(result["close"])-1]
selling_count, selling_price = self.getFinalSellingPrice(final_price) selling_count, selling_price = self.getFinalSellingPrice(final_price)
# 분석된 가격으로 매도 요청한다. # 분석된 가격으로 매도 요청한다.
if selling_count != 0 and selling_price != 0: if selling_count != 0 and selling_price != 0:
orderNum = self.requestOrder(OrderType.sell, self.stock_code, selling_count, selling_price) orderNum = self.requestOrder(OrderType.sell, self.stock_code, selling_count, selling_price)
# 로그 출력 # 로그 출력
print("SELL", THIS_TIME, selling_count, selling_price) print("SELL", THIS_TIME, selling_count, selling_price)
final_sell_check = True final_sell_check = True
time.sleep(0.9) time.sleep(0.9)
THIS_TIME = datetime.now() THIS_TIME = datetime.now()

View File

@@ -150,29 +150,28 @@ class HTS_252670 (HTS):
timecheck[THIS_TIME] = True timecheck[THIS_TIME] = True
elif datetime.strptime(today + " 151530", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 151600", '%Y%m%d %H%M%S'): elif datetime.strptime(today + " 151530", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 151600", '%Y%m%d %H%M%S'):
if final_sell_check:
continue
#### if not final_sell_check:
# 손해 보지 않는 가격에 매도한다. ####
#### # 손해 보지 않는 가격에 매도한다.
####
# 주문 리스트를 가져온다. # 주문 리스트를 가져온다.
orderList = self.requestOrderList() orderList = self.requestOrderList()
# 15:10:00 이후라면 모든 미체결 취소한다. # 15:10:00 이후라면 모든 미체결 취소한다.
self.cancelOrderList(orderList) self.cancelOrderList(orderList)
# 매도 가격을 가져온다. # 매도 가격을 가져온다.
result = self.getRealTime(self.stock_code, lastday, today) result = self.getRealTime(self.stock_code, lastday, today)
final_price = result["close"][len(result["close"]) - 1] final_price = result["close"][len(result["close"]) - 1]
selling_count, selling_price = self.getFinalSellingPrice(final_price) selling_count, selling_price = self.getFinalSellingPrice(final_price)
# 분석되 가격으로 매도 요청한다. # 분석되 가격으로 매도 요청한다.
if selling_count != 0 and selling_price != 0: if selling_count != 0 and selling_price != 0:
orderNum = self.requestOrder(OrderType.sell, self.stock_code, selling_count, selling_price) orderNum = self.requestOrder(OrderType.sell, self.stock_code, selling_count, selling_price)
# 로그 출력 # 로그 출력
print("SELL", THIS_TIME, selling_count, selling_price) print("SELL", THIS_TIME, selling_count, selling_price)
final_sell_check = True final_sell_check = True
time.sleep(0.9) time.sleep(0.9)
THIS_TIME = datetime.now() THIS_TIME = datetime.now()