This commit is contained in:
dosangyoon
2022-08-11 03:06:30 +09:00
parent e117b108fc
commit 42df0fc3fa
5 changed files with 98 additions and 51 deletions

View File

@@ -36,16 +36,16 @@ class OrderChecker:
# 1) 종목 코드를 찾는다.
stock_df = order_df.loc[order_df["stock_code"] == stock_code]
# 2) 2 시간 전 계산
before_two_hour = datetime.now() - timedelta(hours=2)
# 2) 5분 전 계산
before_two_hour = datetime.now() - timedelta(minutes=5)
# 3) 만약 2 시간 전 주문을 찾는다.
# 3) 만약 5분 전 주문을 찾는다.
stock_twohour_df = stock_df.loc[stock_df["datetime"] <= before_two_hour]
# 4) 2 시간 전 주문 중에서 매수 데이터만 찾는다.
# 4) 5분 전 주문 중에서 매수 데이터만 찾는다.
orderNum_df = stock_twohour_df.loc[stock_twohour_df["type"] == OrderType.buy.value]
# 5) 2시간 전 매수 항목을 별도로 추출한다.
# 5) 5분 전 매수 항목을 별도로 추출한다.
orderNumSet = set(list(orderNum_df["orderNum"]))
for item in orderList:
if item.orderNum in orderNumSet: