init
This commit is contained in:
@@ -29,6 +29,7 @@ class HTS_DAILY (HTS):
|
||||
self.RESOURCE_PATH = RESOURCE_PATH
|
||||
self.dailyStatus = DailyStatus(RESOURCE_PATH)
|
||||
self.buySellChecker = BuySellChecker()
|
||||
self.orderChecker = OrderChecker(self.RESOURCE_PATH)
|
||||
|
||||
self.analyzed_day = 120
|
||||
self.MAX_BUY_PRICE = 100000
|
||||
@@ -63,6 +64,8 @@ class HTS_DAILY (HTS):
|
||||
print ("START...")
|
||||
THIS_TIME = datetime.now()
|
||||
|
||||
self.orderChecker.read(today)
|
||||
|
||||
while datetime.strptime(today + " 070000", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 153100", '%Y%m%d %H%M%S'):
|
||||
|
||||
# 1515 까지만 매수를 시도한다.
|
||||
@@ -96,7 +99,7 @@ class HTS_DAILY (HTS):
|
||||
|
||||
bsLine, data = self.buySellChecker.checkTransactionWithEnvelope(data, stock_code, self.analyzed_day, isRealTime=False)
|
||||
|
||||
if len(data.index) > 10 and max(bsLine['buy'][len(bsLine['buy']) - 2:]) > 0:
|
||||
if len(data.index) > 10 and max(bsLine['buy'][len(bsLine['buy']) - 2:]) > 0 and not self.orderChecker.exist(stock_code):
|
||||
last_index = len(bsLine['buy'])-1
|
||||
if bsLine['buy'][last_index] > 0:
|
||||
bs_buy_price = bsLine['buy'][last_index]
|
||||
@@ -105,6 +108,7 @@ 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)
|
||||
|
||||
# 로그 출력
|
||||
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock_code, stock_name, bs_buy_price, buy_count)
|
||||
|
||||
Reference in New Issue
Block a user