mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-07 21:11:50 +08:00
fix bugs
This commit is contained in:
@@ -80,12 +80,12 @@ class Report:
|
||||
fields = ["$close/Ref($close,1)-1"]
|
||||
try:
|
||||
_temp_result = D.features(_codes, fields, start_time, end_time, freq=freq, disk_cache=1)
|
||||
except ValueError:
|
||||
except (ValueError, KeyError):
|
||||
_, norm_freq = parse_freq(freq)
|
||||
if norm_freq in ["month", "week", "day"]:
|
||||
try:
|
||||
_temp_result = D.features(_codes, fields, start_time, end_time, freq="day", disk_cache=1)
|
||||
except ValueError:
|
||||
except (ValueError, KeyError):
|
||||
_temp_result = D.features(_codes, fields, start_time, end_time, freq="1min", disk_cache=1)
|
||||
elif norm_freq == "minute":
|
||||
_temp_result = D.features(_codes, fields, start_time, end_time, freq="1min", disk_cache=1)
|
||||
|
||||
@@ -177,8 +177,6 @@ class TopkDropoutStrategy(ModelStrategy):
|
||||
|
||||
# Get the stock list we really want to buy
|
||||
buy = today[: len(sell) + self.topk - len(last)]
|
||||
# print("INTRANEL BAR", len(sell), len(sell) + self.topk - len(last), len(last))
|
||||
# print("flag", len(sell), len(buy), self.topk, len(last))
|
||||
for code in current_stock_list:
|
||||
if not self.trade_exchange.is_stock_tradable(
|
||||
stock_id=code, start_time=trade_start_time, end_time=trade_end_time
|
||||
|
||||
@@ -182,7 +182,7 @@ def get_resam_calendar(
|
||||
try:
|
||||
_calendar = Cal.calendar(start_time=start_time, end_time=end_time, freq=freq, future=future)
|
||||
freq, freq_sam = freq, None
|
||||
except ValueError:
|
||||
except (ValueError, KeyError):
|
||||
freq_sam = freq
|
||||
if norm_freq in ["month", "week", "day"]:
|
||||
try:
|
||||
@@ -190,16 +190,16 @@ def get_resam_calendar(
|
||||
start_time=start_time, end_time=end_time, freq="day", freq_sam=freq, future=future
|
||||
)
|
||||
freq = "day"
|
||||
except ValueError:
|
||||
except (ValueError, KeyError):
|
||||
_calendar = Cal.calendar(
|
||||
start_time=start_time, end_time=end_time, freq="1min", freq_sam=freq, future=future
|
||||
)
|
||||
freq = "min"
|
||||
freq = "1min"
|
||||
elif norm_freq == "minute":
|
||||
_calendar = Cal.calendar(
|
||||
start_time=start_time, end_time=end_time, freq="1min", freq_sam=freq, future=future
|
||||
)
|
||||
freq = "min"
|
||||
freq = "1min"
|
||||
else:
|
||||
raise ValueError(f"freq {freq} is not supported")
|
||||
return _calendar, freq, freq_sam
|
||||
|
||||
Reference in New Issue
Block a user