init
This commit is contained in:
31
hts/HTS.py
31
hts/HTS.py
@@ -647,25 +647,20 @@ class HTS:
|
||||
return result
|
||||
|
||||
# 주식 현재가 조회
|
||||
def getRealTime(self, stock_code, today, LAST_DATA=None):
|
||||
if LAST_DATA is not None:
|
||||
#result = copy.deepcopy(LAST_DATA)
|
||||
|
||||
result = {"check": set(), "ymd": [], "open": [], "close": [], "high": [], "low": [], "volume": [], "label": []}
|
||||
for i in range(len(LAST_DATA['ymd'])):
|
||||
result["ymd"].append(LAST_DATA['ymd'][i])
|
||||
result["open"].append(LAST_DATA['open'][i])
|
||||
result["close"].append(LAST_DATA['close'][i])
|
||||
result["high"].append(LAST_DATA['high'][i])
|
||||
result["low"].append(LAST_DATA['low'][i])
|
||||
result["volume"].append(LAST_DATA['volume'][i])
|
||||
result["label"].append(LAST_DATA['label'][i])
|
||||
else:
|
||||
result = {"check": set(), "ymd": [], "open": [], "close": [], "high": [], "low": [], "volume": [], "label": []}
|
||||
|
||||
#### real time에서 아직 저장된 것이 없기 때문에 result는 아무것도 채워지지 않는다.
|
||||
self.getDBData(stock_code, today, result)
|
||||
def getRealTime(self, stock_code, today, LAST_DATA=None, n=7):
|
||||
result = {"check": set(), "ymd": [], "open": [], "close": [], "high": [], "low": [], "volume": [], "label": []}
|
||||
|
||||
days = []
|
||||
for i in range(1, 100):
|
||||
last_day = (datetime.strptime(today, '%Y%m%d') - timedelta(i)).strftime('%Y%m%d')
|
||||
isValid = self.isValidYMD(stock_code=stock_code, day=last_day)
|
||||
if isValid:
|
||||
days.append(last_day)
|
||||
if len(days) >= n:
|
||||
break
|
||||
days = sorted(days)
|
||||
for day in days:
|
||||
self.getDBData(stock_code, day, result)
|
||||
|
||||
int_given_day = int(today)
|
||||
objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
|
||||
|
||||
Reference in New Issue
Block a user