def get_briefs(self, symbols, include_hour_trading=False, include_ask_bid=False, right=QuoteRight.BR, lang=None): """ 获取股票摘要 :param symbols: 股票代号列表 :param include_hour_trading: 是否包含盘前盘后 :param include_ask_bid: 是否包含买卖盘 :param right: 复权选项 ,br: 前复权,nr: 不复权 :param lang: 语言支持: zh_CN,zh_TW,en_US :return: """ params = MultipleQuoteParams() params.symbols = symbols params.include_hour_trading = include_hour_trading params.include_ask_bid = include_ask_bid params.right = right.value params.lang = lang.value if lang else self._lang.value request = OpenApiRequest(BRIEF, biz_model=params) response_content = self.__fetch_data(request) if response_content: response = QuoteBriefResponse() response.parse_response_content(response_content) if response.is_success(): return response.briefs else: raise ApiException(response.code, response.message) return None
def get_timeline(self, symbols, include_hour_trading=False, begin_time=-1, lang=None): """ 获取当日分时数据 :param symbols: 股票代码 :param include_hour_trading: 是否包含盘前盘后分时 :param begin_time: 开始时间 :param lang: 语言支持: zh_CN,zh_TW,en_US :return: """ params = MultipleQuoteParams() params.symbols = symbols params.include_hour_trading = include_hour_trading params.begin_time = begin_time params.lang = lang.value if lang else self._lang.value request = OpenApiRequest(TIMELINE, biz_model=params) response_content = self.__fetch_data(request) if response_content: response = QuoteTimelineResponse() response.parse_response_content(response_content) if response.is_success(): return response.timelines else: raise ApiException(response.code, response.message)
def get_timeline(self, symbols, include_hour_trading=False, begin_time=-1, lang=None): """ 获取当日分时数据 :param symbols: 股票代号列表 :param include_hour_trading: 是否包含盘前盘后分时 :param begin_time: 开始时间. 若是时间戳需要精确到毫秒, 为13位整数; 或是日期时间格式的字符串, 如 "2019-01-01" 或 "2019-01-01 12:00:00" :param lang: 语言支持: zh_CN,zh_TW,en_US :return: pandas.DataFrame, DataFrame 的 column 及含义如下: symbol: 证券代码 time: 精确到毫秒的时间戳 price: 当前分钟的收盘价 avg_price: 截至到当前时间的成交量加权均价 pre_close: 昨日收盘价 volume: 这一分钟的成交量 trading_session: 字符串, "pre_market" 表示盘前交易, "regular" 表示盘中交易, "after_hours"表示盘后交易 """ params = MultipleQuoteParams() params.symbols = symbols params.include_hour_trading = include_hour_trading params.begin_time = begin_time params.lang = get_enum_value(lang) if lang else get_enum_value( self._lang) request = OpenApiRequest(TIMELINE, biz_model=params) response_content = self.__fetch_data(request) if response_content: response = QuoteTimelineResponse() response.parse_response_content(response_content) if response.is_success(): return response.timelines else: raise ApiException(response.code, response.message)