This commit is contained in:
dsyoon
2022-08-10 00:42:03 +09:00
parent 62e0deecfe
commit 2564871ff8
6 changed files with 116 additions and 21 deletions

View File

@@ -30,13 +30,14 @@ class HTS_122630 (HTS):
self.labelMaker = LabelMaker(RESOURCE_PATH)
return
def getDefaultSell(self, log_time, stock_code):
def getDefaultSell(self, log_time, stock_code, final_price):
jangoDic = self.requstJango()
if jangoDic and len(jangoDic.keys()) > 0:
for code in jangoDic:
if jangoDic[code]['매도가능'] > 0:
max_price = max(jangoDic[code]['장부가'], final_price)
if code == "A"+stock_code:
sell_price = (int(jangoDic[code]['장부가'] + 10) - int(jangoDic[code]['장부가'] + 10) % 10) + 5
sell_price = (int(max_price+ 10) - int(max_price + 10) % 10) + 5
if log_time.strftime('%H%M') < "1430":
orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], sell_price)
print("ORDER_SELL", stock_code, log_time.strftime('%Y%m%d %H%M%S'), jangoDic[code]['매도가능'], sell_price)
@@ -93,8 +94,12 @@ class HTS_122630 (HTS):
# 3시 까지만 매수를 시도한다.
if THIS_TIME.strftime('%S') in ("09", "19", "29", "39", "49", "59"):
# 데이터를 가지고 온다.
result = self.getRealTime(self.stock_code, today, LAST_DATA)
final_price = result["close"][len(result["close"])-1]
# 10초마다 체크하여 체결된 내역이 있으면 60원 높게 매도를 주문한다.
self.getDefaultSell(THIS_TIME, self.stock_code)
self.getDefaultSell(THIS_TIME, self.stock_code, final_price)
if THIS_TIME.strftime('%S') == "05":
# 매분 5초마다 실행한다.