def get_hour_index(date, freq=FREQUENCY.FREQ_1_HOUR, market=MARKET_TYPE.STOCK_CN): """获取不同市场股票小时线的index """ # 参数校验 if market not in MARKET_TYPE.TUPLE_MARKET_TYPE or freq not in FREQUENCY.TUPLE_FREQ_HOUR \ or not DateUtil.is_valid_date(date): return None if market == MARKET_TYPE.STOCK_CN: return __get_market_cn_index(date, freq) elif market == MARKET_TYPE.STOCK_HK: return __get_market_hk_index(date, freq) else: return None
def get_min_index(date, freq=FREQUENCY.FREQ_1_MIN, market=MARKET_TYPE.STOCK_CN): """获取不同市场股票分钟线的index """ # 参数校验 if market not in MARKET_TYPE.TUPLE_MARKET_TYPE or freq not in FREQUENCY.TUPLE_FREQ_MIN \ or not DateUtil.is_valid_date(date): return None # if QA_util_if_trade(day) is True: if market == MARKET_TYPE.STOCK_CN: return __get_market_cn_index(date, freq) elif market == MARKET_TYPE.STOCK_HK: return __get_market_hk_index(date, freq) else: return None