From 8f87a0268b40af7b51e9fbe5d77df317368f0f52 Mon Sep 17 00:00:00 2001 From: zengbin93 Date: Tue, 2 Apr 2024 12:40:32 +0800 Subject: [PATCH] 0.9.47 fix minites split --- czsc/utils/bar_generator.py | 36 +++++++++--------------------- czsc/utils/minites_split.feather | Bin 174522 -> 175682 bytes examples/develop/minites_split.py | 14 ++++++++++++ test/test_bar_generator.py | 7 +++--- 4 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 examples/develop/minites_split.py diff --git a/czsc/utils/bar_generator.py b/czsc/utils/bar_generator.py index 92c554de1..a47f6cf13 100644 --- a/czsc/utils/bar_generator.py +++ b/czsc/utils/bar_generator.py @@ -81,39 +81,25 @@ def check_freq_and_market(time_seq: List[AnyStr], freq: Optional[AnyStr] = None) - freq K线周期 - market 交易市场 """ - if not freq or freq in ['日线', '周线', '月线', '季线', '年线']: + if freq in ['日线', '周线', '月线', '季线', '年线']: return freq, "默认" - # if freq == '1分钟': - # time_seq.extend(['14:57', '14:58', '14:59', '15:00']) + if freq == '1分钟': + time_seq.extend(['14:57', '14:58', '14:59', '15:00']) time_seq = sorted(list(set(time_seq))) assert len(time_seq) >= 2, "time_seq长度必须大于等于2" - a_sdt = freq_market_times[f"{freq}_A股"][0] - f_sdt = freq_market_times[f"{freq}_期货"][0] + for key, tts in freq_market_times.items(): + if freq and not key.startswith(freq): + continue - # 判断是不是有 dt 落在 10:15 - 10:30 之间 - # match = [x for x in time_seq if "10:15" < x < "10:30"] + sub_tts = [x for x in tts if x >= min(time_seq) and x <= max(time_seq)] + if set(time_seq) == set(sub_tts): + freq_x, market = key.split("_") + return freq_x, market - if time_seq[0] >= a_sdt and time_seq[-1] <= "15:00": - market = "A股" - elif time_seq[0] >= f_sdt and time_seq[-1] in ["15:00", "23:00", "23:30", "02:30"]: - market = "期货" - else: - market = "默认" - - return freq, market - - # for key, tts in freq_market_times.items(): - # if freq and not key.startswith(freq): - # continue - - # if set(time_seq) == set(tts[:len(time_seq)]): - # freq_x, market = key.split("_") - # return freq_x, market - - # return None, "默认" + return None, "默认" def freq_end_date(dt, freq: Union[Freq, AnyStr]): diff --git a/czsc/utils/minites_split.feather b/czsc/utils/minites_split.feather index c2c1a0b108362364cf1704f7d122c07d05256198..7999c167ba76c6d617898dabb93db8f561c25c49 100644 GIT binary patch delta 5054 zcmcgwYitx%6h3EmXS?0*I#b=9mLiC)(k@cEk1jM-6d$yOBCYZi31Bry3=+}AU=*in zzy?vlCe{b2iN>xEBKDC*EozV-4WNP=)P$&skD$g!G%6y=c+S0ZVW)^uV>`)r?>*;! z=gvLno^xm0SKklqIuzRUik6x3@@ox2JvAvcDcKt+JgRAR4|Qtc@pzy!9l;N>=>3pXIz6k$n@O$3V%7pRM3|djGS9lGj@8HBhoL*xoAVSG)YGMP9y=6~AMx zoPV{z-OxHOzlmk`Um0YxlCU-)4XR%98Yo%uJKmG?-9E`r9Q5*)toWOLm-EYA{*hxS z-Y>1GWd%RVVBt7T$g5m~!3rr0B{fP`{HjJdKhdQvoZ;mwS@CzQ)a3a$yBiO#@){^v z8LZeW=l7`{P;U?p1oIUCN_O+_zb_zP{GaXJD*D$RG`Z#JFTcEW*|fWxdP~ivWtlDK z0z5@{hL9z^NZ3y3BkUjy5Z)y0CJYkx5%%{!GU2}9#ZRTE5(qC6dI&oRuM>6?_7L_H z4iXL##G?l84(4>$rRy{YJ6ES;XaCx|<;lZ+-7b^5q1(+(8^EH9d3(+Sc$e@2;bX!l zgwF|w3EvTZBK$@;M!<;x0YVYMB*X~fQ3H1)OM3_Bzh&8NX5wfFbaEtSCjJiJ#LQ%? zZYEQZ4{SXy8aJWu|==zlCP%#SE=aW7V3qDR8HiDt~%frY@QItO#BT!3+y-rkr0P zcAnRw*as!@Rd8ic&&%QO!!SJ=+`5L$}K+$-Nq5)&0(4cD}pq3YH z5Y@c_z6it0Fe_Ah3BODhGt3S{VH`GBvDwBdW^JtEX)f~Yi6S4tAU&ANCb6c_ZZb2A z41?S^C|K}=NQ5tAMKVq`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