This commit is contained in:
dsyoon
2023-01-27 12:30:55 +09:00
parent ae978a6f24
commit 4482c77497
2 changed files with 4 additions and 5 deletions

View File

@@ -132,12 +132,11 @@ class HTS_DAILY (HTS):
# 매수를 주문한다.
orderNum = self.requestOrder(OrderType.buy, stock_code, buy_count, bs_buy_price)
self.orderChecker.add(today, stock_code, 1, orderNum, buy_count, bs_buy_price)
self.orderChecker.add(today, stock_code, 1, buy_count, bs_buy_price, orderNum)
# 로그 출력
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock_code, stock_name, bs_buy_price, buy_count)
"""
# 다음 조건이면 매도한다.
if len(data.index) > 10 and max(bsLine['sell'][len(bsLine['sell']) - 1:]) > 0:
last_index = len(bsLine['sell']) - 1
@@ -148,7 +147,7 @@ class HTS_DAILY (HTS):
# 로그 출력
print("SELL", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock_code, stock_name, bs_sell_price)
"""
THIS_TIME = datetime.now()
return

View File

@@ -39,7 +39,7 @@ class OrderChecker:
return False
return True
def add(self, ymd, stock_code, type, orderNum, count, price):
def add(self, ymd, stock_code, type, count, price, orderNum=None):
if self.exist(ymd, stock_code):
return False
@@ -47,7 +47,7 @@ class OrderChecker:
# 새로운 주문을 추가한다.
order_df = order_df.append({"stock_code": int(stock_code), "type": int(type), "orderNum": int(orderNum), "count": int(count), "price": int(price), "datetime": datetime.now()}, ignore_index=True)
order_df = order_df.append({"stock_code": int(stock_code), "type": int(type), "orderNum": int(0), "count": int(count), "price": int(price), "datetime": datetime.now()}, ignore_index=True)
order_df = order_df.astype({"stock_code": int, "type": int, "orderNum": int, "count": int, "price": int})
# 파일로 기록한다.