init
This commit is contained in:
@@ -60,15 +60,14 @@ 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('%S') in ("09", "19", "29", "39", "49", "59"):
|
||||
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, final_price)
|
||||
"""
|
||||
# 10초마다 체크하여 체결된 내역이 있으면 50원 높게 매도를 주문한다.
|
||||
self.getSellingPrice(THIS_TIME, self.stock_code, final_price)
|
||||
|
||||
if THIS_TIME.strftime('%S') == "05":
|
||||
# 매분 5초마다 실행한다.
|
||||
@@ -79,6 +78,17 @@ class HTS_122630 (HTS):
|
||||
# 규칙 기반의 분석을 통해서 볼린저밴드 상/하단을 계산한다.
|
||||
data = self.buySellChecker.analyze(result)
|
||||
|
||||
# 만약 미체결 내역이 있는데, 지표가 꺽여 내려온다면, 매수 주문을 취소 시킨다.
|
||||
last_index = len(data['close']) - 1
|
||||
if data['slow_k'][last_index - 1] >= 80 and data['slow_k'][last_index - 1] > data['slow_k'][
|
||||
last_index]:
|
||||
# 미체결 기록을 가져온다.
|
||||
ORDER_LIST = self.requestOrderList()
|
||||
orderListToCancel = self.orderChecker.remove(self.stock_code, OrderType.sell, ORDER_LIST)
|
||||
self.cancelOrderList(orderListToCancel)
|
||||
print("CANCEL", THIS_TIME.strftime('%Y%m%d %H%M%S'), len(orderListToCancel), len(ORDER_LIST))
|
||||
|
||||
|
||||
# 사야 할 시점/가격과 팔아야 할 시점/가격을 체크한다.
|
||||
bsLine, data = self.buySellChecker.checkTransaction(data, self.stock_code, isRealTime=True)
|
||||
bs_buy_price = bsLine['buy'][0]
|
||||
|
||||
@@ -81,6 +81,16 @@ class HTS_252670 (HTS):
|
||||
# 규칙 기반의 분석을 통해서 볼린저밴드 상/하단을 계산한다.
|
||||
data = self.buySellChecker.analyze(result)
|
||||
|
||||
# 만약 미체결 내역이 있는데, 지표가 꺽여 내려온다면, 매수 주문을 취소 시킨다.
|
||||
last_index = len(data['close']) - 1
|
||||
if data['slow_k'][last_index-1]>=80 and data['slow_k'][last_index-1] > data['slow_k'][last_index]:
|
||||
# 미체결 기록을 가져온다.
|
||||
ORDER_LIST = self.requestOrderList()
|
||||
orderListToCancel = self.orderChecker.remove(self.stock_code, OrderType.sell, ORDER_LIST)
|
||||
self.cancelOrderList(orderListToCancel)
|
||||
print("CANCEL", THIS_TIME.strftime('%Y%m%d %H%M%S'), len(orderListToCancel), len(ORDER_LIST))
|
||||
|
||||
|
||||
# 사야 할 시점/가격과 팔아야 할 시점/가격을 체크한다.
|
||||
bsLine, data = self.buySellChecker.checkTransaction(data, self.stock_code, isRealTime=True)
|
||||
bs_buy_price = bsLine['buy'][0]
|
||||
|
||||
@@ -338,7 +338,7 @@ class HTS:
|
||||
return orderList
|
||||
|
||||
# 미체결 취소하기
|
||||
def cancelOrderList(self, orderList):
|
||||
def cancelOrderList(self, orderList=None):
|
||||
|
||||
if len(orderList) < 1:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user