init
This commit is contained in:
@@ -61,6 +61,16 @@ class HTS_122630 (HTS):
|
|||||||
|
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|
||||||
|
def getFinalSellingPrice(self, final_price):
|
||||||
|
# 만약 잔고가 있으면 장부가보다 5원 높게 매도한다.
|
||||||
|
jangoDic = self.requstJango()
|
||||||
|
if jangoDic and len(jangoDic.keys()) > 0:
|
||||||
|
for code in jangoDic:
|
||||||
|
if jangoDic[code]['매도가능'] > 0:
|
||||||
|
return jangoDic[code]['매도가능'], final_price - 5
|
||||||
|
|
||||||
|
return 0, 0
|
||||||
|
|
||||||
def buyRealTime(self, lastday, today):
|
def buyRealTime(self, lastday, today):
|
||||||
orderChecker = OrderChecker(self.stock_code)
|
orderChecker = OrderChecker(self.stock_code)
|
||||||
|
|
||||||
@@ -115,7 +125,7 @@ class HTS_122630 (HTS):
|
|||||||
|
|
||||||
# 매도 가격을 가져온다.
|
# 매도 가격을 가져온다.
|
||||||
selling_count, selling_price = self.getSellingPrice(final_price)
|
selling_count, selling_price = self.getSellingPrice(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)
|
||||||
@@ -136,7 +146,7 @@ class HTS_122630 (HTS):
|
|||||||
data["rsi"][data_size - 1], data["rsis"][data_size - 1]))
|
data["rsi"][data_size - 1], data["rsis"][data_size - 1]))
|
||||||
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 + " 151800", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 152000", '%Y%m%d %H%M%S'):
|
||||||
if final_sell_check:
|
if final_sell_check:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -146,14 +156,14 @@ class HTS_122630 (HTS):
|
|||||||
|
|
||||||
# 주문 리스트를 가져온다.
|
# 주문 리스트를 가져온다.
|
||||||
orderList = self.requestOrderList()
|
orderList = self.requestOrderList()
|
||||||
# 15:10: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.getSellingPrice(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)
|
||||||
# 로그 출력
|
# 로그 출력
|
||||||
|
|||||||
@@ -61,6 +61,16 @@ class HTS_252670 (HTS):
|
|||||||
|
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|
||||||
|
def getFinalSellingPrice(self, final_price):
|
||||||
|
# 만약 잔고가 있으면 장부가보다 5원 높게 매도한다.
|
||||||
|
jangoDic = self.requstJango()
|
||||||
|
if jangoDic and len(jangoDic.keys()) > 0:
|
||||||
|
for code in jangoDic:
|
||||||
|
if jangoDic[code]['매도가능'] > 0:
|
||||||
|
return jangoDic[code]['매도가능'], final_price - 5
|
||||||
|
|
||||||
|
return 0, 0
|
||||||
|
|
||||||
def buyRealTime(self, lastday, today):
|
def buyRealTime(self, lastday, today):
|
||||||
orderChecker = OrderChecker(self.stock_code)
|
orderChecker = OrderChecker(self.stock_code)
|
||||||
|
|
||||||
@@ -153,7 +163,7 @@ class HTS_252670 (HTS):
|
|||||||
# 매도 가격을 가져온다.
|
# 매도 가격을 가져온다.
|
||||||
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.getSellingPrice(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)
|
||||||
|
|||||||
Reference in New Issue
Block a user