init
This commit is contained in:
@@ -132,7 +132,7 @@ class HTS_etf (HTS):
|
|||||||
|
|
||||||
if bs_buy_price > 0:
|
if bs_buy_price > 0:
|
||||||
|
|
||||||
if not self.orderChecker.exist(today, "A" + stock['stock_code'], mins=10):
|
if not self.orderChecker.exist(today, "A" + stock['stock_code'], mins=30):
|
||||||
|
|
||||||
buy_count = int(self.MAX_BUY_PRICE/bs_buy_price)
|
buy_count = int(self.MAX_BUY_PRICE/bs_buy_price)
|
||||||
|
|
||||||
|
|||||||
@@ -137,14 +137,14 @@ class HTS_Stocks (HTS):
|
|||||||
|
|
||||||
# 미체결 기록을 가져와서 10분 이상 된 매수 주문을 취소 한다.
|
# 미체결 기록을 가져와서 10분 이상 된 매수 주문을 취소 한다.
|
||||||
ORDER_LIST = self.requestOrderList()
|
ORDER_LIST = self.requestOrderList()
|
||||||
orderListToCancel = self.orderChecker.cancel(today, "A" + stock_code, ORDER_LIST, mins=60)
|
orderListToCancel = self.orderChecker.cancel(today, "A" + stock_code, ORDER_LIST, mins=10)
|
||||||
if len(orderListToCancel) > 0:
|
if len(orderListToCancel) > 0:
|
||||||
self.cancelOrderList(orderListToCancel)
|
self.cancelOrderList(orderListToCancel)
|
||||||
|
|
||||||
# 다음 조건이면 매수한다.
|
# 다음 조건이면 매수한다.
|
||||||
if len(data) > 10 and max(bsLine['buy'][len(bsLine['buy']) - 1:]) > 1000:
|
if len(data) > 10 and max(bsLine['buy'][len(bsLine['buy']) - 1:]) > 1000:
|
||||||
|
|
||||||
if not self.orderChecker.exist(today, "A" + stock_code, mins=10):
|
if not self.orderChecker.exist(today, "A" + stock_code, hours=2):
|
||||||
|
|
||||||
last_index = len(bsLine['buy'])-1
|
last_index = len(bsLine['buy'])-1
|
||||||
if bsLine['buy'][last_index] > 0:
|
if bsLine['buy'][last_index] > 0:
|
||||||
|
|||||||
@@ -29,11 +29,14 @@ class OrderChecker:
|
|||||||
order_df['datetime'] = pd.to_datetime(order_df['datetime'])
|
order_df['datetime'] = pd.to_datetime(order_df['datetime'])
|
||||||
return order_df
|
return order_df
|
||||||
|
|
||||||
def exist(self, ymd, stock_code, mins=30):
|
def exist(self, ymd, stock_code, mins=None, hours=None):
|
||||||
order_df = self.read(ymd)
|
order_df = self.read(ymd)
|
||||||
if order_df is not None and len(order_df)>0:
|
if order_df is not None and len(order_df)>0:
|
||||||
tmp = order_df.loc[order_df["stock_code"] == stock_code]
|
tmp = order_df.loc[order_df["stock_code"] == stock_code]
|
||||||
now = datetime.now() - timedelta(minutes=mins)
|
if mins is not None:
|
||||||
|
now = datetime.now() - timedelta(minutes=mins)
|
||||||
|
else:
|
||||||
|
now = datetime.now() - timedelta(hours=hours)
|
||||||
tmp = tmp.loc[now < tmp["datetime"]]
|
tmp = tmp.loc[now < tmp["datetime"]]
|
||||||
if tmp is not None and len(tmp) > 0:
|
if tmp is not None and len(tmp) > 0:
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user