From 4482c774979ea6128942e26376cc2068c74e0432 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Fri, 27 Jan 2023 12:30:55 +0900 Subject: [PATCH] init --- HTS_daily.py | 5 ++--- hts/OrderChecker.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/HTS_daily.py b/HTS_daily.py index 0ce80a7..a729a69 100644 --- a/HTS_daily.py +++ b/HTS_daily.py @@ -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 diff --git a/hts/OrderChecker.py b/hts/OrderChecker.py index cd9fd97..6198d66 100644 --- a/hts/OrderChecker.py +++ b/hts/OrderChecker.py @@ -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}) # 파일로 기록한다.