init
This commit is contained in:
@@ -42,12 +42,8 @@ class HTS_252670 (HTS):
|
||||
else:
|
||||
sell_price = (int(final_price) - int(final_price) % 5) + diff
|
||||
if code == "A"+stock_code:
|
||||
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)
|
||||
else:
|
||||
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)
|
||||
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)
|
||||
return
|
||||
|
||||
def buyRealTime(self, today):
|
||||
@@ -101,7 +97,7 @@ class HTS_252670 (HTS):
|
||||
ORDER_LIST = self.requestOrderList()
|
||||
# 매수 주문을 기록한다.
|
||||
orderListToCancel = self.orderChecker.add(self.stock_code, OrderType.buy, orderNum, BUY_COUNT, bs_buy_price, ORDER_LIST)
|
||||
# 두 시간 이전 미체결을 모두 취소한다.
|
||||
# 1 시간 이전 미체결을 모두 취소한다.
|
||||
self.cancelOrderList(orderListToCancel)
|
||||
# 로그 출력
|
||||
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), BUY_COUNT, bs_buy_price, len(orderListToCancel), len(ORDER_LIST))
|
||||
@@ -116,7 +112,7 @@ class HTS_252670 (HTS):
|
||||
self.cancelOrderList(orderListToCancel)
|
||||
|
||||
# 매도한다.
|
||||
self.getSellingPrice(THIS_TIME, self.stock_code, final_price)
|
||||
self.getSellingPrice(THIS_TIME, self.stock_code, final_price, diff=0)
|
||||
|
||||
# 로그 출력
|
||||
"""
|
||||
@@ -151,7 +147,7 @@ class HTS_252670 (HTS):
|
||||
result = self.getRealTime(self.stock_code, today, LAST_DATA)
|
||||
final_price = result["close"][len(result["close"]) - 1]
|
||||
|
||||
self.getSellingPrice(THIS_TIME, self.stock_code, final_price)
|
||||
self.getSellingPrice(THIS_TIME, self.stock_code, final_price, diff=0)
|
||||
|
||||
final_sell_check = True
|
||||
|
||||
@@ -179,7 +175,7 @@ if __name__ == "__main__":
|
||||
# KODEX 인버스 * 2
|
||||
stock_code = "252670"
|
||||
stock_name = "KODEX 200선물인버스2X"
|
||||
buy_count = 1000
|
||||
buy_count = 600
|
||||
|
||||
hts = HTS_252670(RESOURCE_PATH, stock_code, buy_count)
|
||||
today_str = today.strftime('%Y%m%d')
|
||||
|
||||
Reference in New Issue
Block a user