改进 sys_performance,在query日期不在stock的有效日期范围内时,抛出异常

This commit is contained in:
fasiondog 2024-04-28 02:33:14 +08:00
parent cca00a548c
commit 4aae90134c

View File

@ -754,6 +754,7 @@ def sys_performance(sys, ref_stk=None):
if ref_stk is None:
ref_stk = get_stock('sh000300')
ref_k = ref_stk.get_kdata(sys.query)
hku_check(len(ref_k) > 0, "The length of ref_k is zero! Maybe The query date is out of the ref-stock range!\n ref_k: {}", ref_k)
query = Query(ref_k[0].datetime.start_of_day(), ref_k[-1].datetime.start_of_day() + TimeDelta(1), Query.DAY)
ref_k = ref_stk.get_kdata(query)