This commit is contained in:
dsyoon
2021-10-27 09:41:38 +09:00
parent ed581cd90c
commit e812e99bce
2 changed files with 52 additions and 54 deletions

View File

@@ -386,7 +386,7 @@ class HTS_122630:
return
# 주식 현재가 조회
def writeStockData(self, stock_codes, given_day):
def writeStockData(self, stock_code, given_day):
objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
bConnect = objCpCybos.IsConnect
if (bConnect == 0):
@@ -396,7 +396,6 @@ class HTS_122630:
# 차트 객체 구하기
objStockChart = win32com.client.Dispatch("CpSysDib.StockChart")
for stock_code in stock_codes:
outfp = open("./data/"+stock_code+"_"+given_day+".csv", mode="w", encoding="utf-8")
objStockChart.SetInputValue(0, 'A' + stock_code) # 종목 코드
objStockChart.SetInputValue(1, ord('1')) # 1: 기간으로 조회, 2: 개수로 조회
@@ -656,7 +655,7 @@ if __name__ == "__main__":
hts = HTS_122630(stock_code)
given_day = datetime.today().strftime('%Y%m%d')
#hts.writeStockData(stock_codes, "20211025")
hts.buyRealTime(given_day)
hts.writeStockData(stock_code, "20211026")
#hts.buyRealTime(given_day)
print ("done...")

View File

@@ -386,7 +386,7 @@ class HTS_252670:
return
# 주식 현재가 조회
def writeStockData(self, stock_codes, given_day):
def writeStockData(self, stock_code, given_day):
objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
bConnect = objCpCybos.IsConnect
if (bConnect == 0):
@@ -396,7 +396,6 @@ class HTS_252670:
# 차트 객체 구하기
objStockChart = win32com.client.Dispatch("CpSysDib.StockChart")
for stock_code in stock_codes:
outfp = open("./data/"+stock_code+"_"+given_day+".csv", mode="w", encoding="utf-8")
objStockChart.SetInputValue(0, 'A' + stock_code) # 종목 코드
objStockChart.SetInputValue(1, ord('1')) # 1: 기간으로 조회, 2: 개수로 조회
@@ -550,7 +549,7 @@ class HTS_252670:
def buyRealTime(self, GIVEN_DAY):
orderChecker = OrderChecker(self.stock_code)
BASE_COUNT = 100
BASE_COUNT = 200
timecheckList = pd.read_csv("timecheck.csv").values.tolist()
timecheck = {GIVEN_DAY + " " + str(second).zfill(6):False for second, check in timecheckList}
@@ -658,7 +657,7 @@ if __name__ == "__main__":
hts = HTS_252670(stock_code)
given_day = datetime.today().strftime('%Y%m%d')
#hts.writeStockData(stock_codes, "20211025")
#hts.writeStockData(stock_code, "20211026")
hts.buyRealTime(given_day)
print ("done...")