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

@@ -31,13 +31,14 @@ class HTS_252670 (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]['장부가'] + 5) - int(jangoDic[code]['장부가'] + 5)%5) + 5
sell_price = (int(max_price + 5) - int(max_price + 5)%5) + 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)
@@ -94,8 +95,12 @@ class HTS_252670 (HTS):
# 3시 까지만 매수를 시도한다.
if THIS_TIME.strftime('%S') in ("06", "16", "26", "36", "46", "56"):
# 데이터를 가지고 온다.
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') == "03":
# 매분 3초마다 실행한다.