with api.connect(ip, port):
data = []
for i in range(26):
data += api.get_security_bars(level,
market_code, code, (25 - i) * 800, 800)
data = api.to_df(data)
data["datetime"] = pd.to_datetime(data["datetime"])
data["code"] = code
data = data.drop(["year", "month", "day", "hour", "minute"], axis=1,
After Change
level, type_ = 3, "60min"
with api.connect(ip, port):
data = pd.concat([api.to_df(api.get_security_bars(level,
market_code, code, (25 - i) * 800, 800)) for i in range(26)], axis=0)
return data\
.assign(datetime=pd.to_datetime(data["datetime"]), code=code)\
.drop(["year", "month", "day", "hour", "minute"], axis=1, inplace=False)\