This commit is contained in:
dosangyoon
2022-08-09 00:32:33 +09:00
parent 2173156d41
commit 9725368faf
4 changed files with 39 additions and 389 deletions

View File

@@ -30,6 +30,17 @@ class HTS_122630 (HTS):
self.labelMaker = LabelMaker(RESOURCE_PATH)
return
def getDefaultSell(self, log_time, stock_code):
jangoDic = self.requstJango()
if jangoDic and len(jangoDic.keys()) > 0:
for code in jangoDic:
if jangoDic[code]['매도가능'] > 0:
if code == "A"+stock_code:
orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], jangoDic[code]['장부가']+60)
print("SELL", log_time, jangoDic[code]['매도가능'], jangoDic[code]['장부가']+60)
return
def getSellingPrice(self, final_price):
# 만약 잔고가 있으면 장부가보다 5원 높게 매도한다.
jangoDic = self.requstJango()
@@ -67,9 +78,6 @@ class HTS_122630 (HTS):
def buyRealTime(self, today):
timecheckList = pd.read_csv("hts/timecheck.csv").values.tolist()
timecheck = {today + " " + str(second).zfill(6):False for second, check in timecheckList}
print ("START...")
THIS_TIME = datetime.now()
final_sell_check = False
@@ -80,7 +88,12 @@ class HTS_122630 (HTS):
if datetime.strptime(today + " 090000", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 151500", '%Y%m%d %H%M%S'):
# 3시 까지만 매수를 시도한다.
if THIS_TIME.strftime('%Y%m%d %H%M%S') in timecheck and not timecheck[THIS_TIME.strftime('%Y%m%d %H%M%S')]:
if THIS_TIME.strftime('%S') in ("09", "19", "29", "39", "49", "59"):
# 10초마다 체크하여 체결된 내역이 있으면 60원 높게 매도를 주문한다.
self.getDefaultSell(THIS_TIME.strftime('%Y%m%d %H%M%S'), self.stock_code)
if THIS_TIME.strftime('%S') == "05":
# 매분 3초마다 실행한다.
# 데이터를 가지고 온다.
result = self.getRealTime(self.stock_code, today, LAST_DATA)
@@ -144,8 +157,6 @@ class HTS_122630 (HTS):
data["fast_k"][data_size - 2], data["slow_k"][data_size - 2], data["slow_d"][data_size - 1],
data["rsi"][data_size - 1], data["rsis"][data_size - 1]))
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'):
# 3시 15분 30초부터 3시 16분 사이는 잔량을 매도한다.