"""
    QuantDB API

    Financial data API service using core business logic

    The version of the OpenAPI document: 
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictBool, StrictStr
from typing import Any, Optional
from typing_extensions import Annotated
from jinyanniu_databases_quantdb_client.models.index_data_response import IndexDataResponse
from jinyanniu_databases_quantdb_client.models.index_list_response import IndexListResponse
from jinyanniu_databases_quantdb_client.models.realtime_index_data_response import RealtimeIndexDataResponse

from jinyanniu_databases_quantdb_client.api_client import ApiClient, RequestSerialized
from jinyanniu_databases_quantdb_client.api_response import ApiResponse
from jinyanniu_databases_quantdb_client.rest import RESTResponseType


class IndexApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    async def get_index_categories(
        self,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> object:
        """Get Index Categories

        获取指数分类列表  返回所有可用的指数分类及其说明，方便用户了解可查询的指数范围。 每个分类包含 code（分类代码）和 name（分类名称）。

        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_categories_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_categories_with_http_info(
        self,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[object]:
        """Get Index Categories

        获取指数分类列表  返回所有可用的指数分类及其说明，方便用户了解可查询的指数范围。 每个分类包含 code（分类代码）和 name（分类名称）。

        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_categories_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_categories_without_preload_content(
        self,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Index Categories

        获取指数分类列表  返回所有可用的指数分类及其说明，方便用户了解可查询的指数范围。 每个分类包含 code（分类代码）和 name（分类名称）。

        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_categories_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_categories_serialize(
        self,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/categories',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_index_categories_0(
        self,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> object:
        """Get Index Categories

        获取指数分类列表  返回所有可用的指数分类及其说明，方便用户了解可查询的指数范围。 每个分类包含 code（分类代码）和 name（分类名称）。

        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_categories_0_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_categories_0_with_http_info(
        self,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[object]:
        """Get Index Categories

        获取指数分类列表  返回所有可用的指数分类及其说明，方便用户了解可查询的指数范围。 每个分类包含 code（分类代码）和 name（分类名称）。

        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_categories_0_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_categories_0_without_preload_content(
        self,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Index Categories

        获取指数分类列表  返回所有可用的指数分类及其说明，方便用户了解可查询的指数范围。 每个分类包含 code（分类代码）和 name（分类名称）。

        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_categories_0_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_categories_0_serialize(
        self,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/categories',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_index_historical_by_id(
        self,
        symbol: StrictStr,
        start_date: Annotated[Optional[StrictStr], Field(description="开始日期，格式 YYYYMMDD，例如：20240101")] = None,
        end_date: Annotated[Optional[StrictStr], Field(description="结束日期，格式 YYYYMMDD，例如：20240630")] = None,
        period: Annotated[Optional[StrictStr], Field(description="数据频率：daily（日线）、weekly（周线）、monthly（月线）")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> IndexDataResponse:
        """Get Historical Index Data

        获取指定指数的历史行情数据  支持中国 A 股主要指数的历史日线/周线/月线查询。 常见指数代码： - 000001：上证指数 - 399001：深证成指 - 399006：创业板指 - 000688：科创 50 - 000300：沪深 300 - 000016：上证 50 - 000905：中证 500  返回数据包含日期、开盘价、收盘价、最高价、最低价、成交量、成交额等字段。

        :param symbol: (required)
        :type symbol: str
        :param start_date: 开始日期，格式 YYYYMMDD，例如：20240101
        :type start_date: str
        :param end_date: 结束日期，格式 YYYYMMDD，例如：20240630
        :type end_date: str
        :param period: 数据频率：daily（日线）、weekly（周线）、monthly（月线）
        :type period: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_historical_by_id_serialize(
            symbol=symbol,
            start_date=start_date,
            end_date=end_date,
            period=period,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_historical_by_id_with_http_info(
        self,
        symbol: StrictStr,
        start_date: Annotated[Optional[StrictStr], Field(description="开始日期，格式 YYYYMMDD，例如：20240101")] = None,
        end_date: Annotated[Optional[StrictStr], Field(description="结束日期，格式 YYYYMMDD，例如：20240630")] = None,
        period: Annotated[Optional[StrictStr], Field(description="数据频率：daily（日线）、weekly（周线）、monthly（月线）")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[IndexDataResponse]:
        """Get Historical Index Data

        获取指定指数的历史行情数据  支持中国 A 股主要指数的历史日线/周线/月线查询。 常见指数代码： - 000001：上证指数 - 399001：深证成指 - 399006：创业板指 - 000688：科创 50 - 000300：沪深 300 - 000016：上证 50 - 000905：中证 500  返回数据包含日期、开盘价、收盘价、最高价、最低价、成交量、成交额等字段。

        :param symbol: (required)
        :type symbol: str
        :param start_date: 开始日期，格式 YYYYMMDD，例如：20240101
        :type start_date: str
        :param end_date: 结束日期，格式 YYYYMMDD，例如：20240630
        :type end_date: str
        :param period: 数据频率：daily（日线）、weekly（周线）、monthly（月线）
        :type period: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_historical_by_id_serialize(
            symbol=symbol,
            start_date=start_date,
            end_date=end_date,
            period=period,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_historical_by_id_without_preload_content(
        self,
        symbol: StrictStr,
        start_date: Annotated[Optional[StrictStr], Field(description="开始日期，格式 YYYYMMDD，例如：20240101")] = None,
        end_date: Annotated[Optional[StrictStr], Field(description="结束日期，格式 YYYYMMDD，例如：20240630")] = None,
        period: Annotated[Optional[StrictStr], Field(description="数据频率：daily（日线）、weekly（周线）、monthly（月线）")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Historical Index Data

        获取指定指数的历史行情数据  支持中国 A 股主要指数的历史日线/周线/月线查询。 常见指数代码： - 000001：上证指数 - 399001：深证成指 - 399006：创业板指 - 000688：科创 50 - 000300：沪深 300 - 000016：上证 50 - 000905：中证 500  返回数据包含日期、开盘价、收盘价、最高价、最低价、成交量、成交额等字段。

        :param symbol: (required)
        :type symbol: str
        :param start_date: 开始日期，格式 YYYYMMDD，例如：20240101
        :type start_date: str
        :param end_date: 结束日期，格式 YYYYMMDD，例如：20240630
        :type end_date: str
        :param period: 数据频率：daily（日线）、weekly（周线）、monthly（月线）
        :type period: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_historical_by_id_serialize(
            symbol=symbol,
            start_date=start_date,
            end_date=end_date,
            period=period,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_historical_by_id_serialize(
        self,
        symbol,
        start_date,
        end_date,
        period,
        force_refresh,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if symbol is not None:
            _path_params['symbol'] = symbol
        # process the query parameters
        if start_date is not None:
            
            _query_params.append(('start_date', start_date))
            
        if end_date is not None:
            
            _query_params.append(('end_date', end_date))
            
        if period is not None:
            
            _query_params.append(('period', period))
            
        if force_refresh is not None:
            
            _query_params.append(('force_refresh', force_refresh))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/historical/{symbol}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_index_historical_by_id_0(
        self,
        symbol: StrictStr,
        start_date: Annotated[Optional[StrictStr], Field(description="开始日期，格式 YYYYMMDD，例如：20240101")] = None,
        end_date: Annotated[Optional[StrictStr], Field(description="结束日期，格式 YYYYMMDD，例如：20240630")] = None,
        period: Annotated[Optional[StrictStr], Field(description="数据频率：daily（日线）、weekly（周线）、monthly（月线）")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> IndexDataResponse:
        """Get Historical Index Data

        获取指定指数的历史行情数据  支持中国 A 股主要指数的历史日线/周线/月线查询。 常见指数代码： - 000001：上证指数 - 399001：深证成指 - 399006：创业板指 - 000688：科创 50 - 000300：沪深 300 - 000016：上证 50 - 000905：中证 500  返回数据包含日期、开盘价、收盘价、最高价、最低价、成交量、成交额等字段。

        :param symbol: (required)
        :type symbol: str
        :param start_date: 开始日期，格式 YYYYMMDD，例如：20240101
        :type start_date: str
        :param end_date: 结束日期，格式 YYYYMMDD，例如：20240630
        :type end_date: str
        :param period: 数据频率：daily（日线）、weekly（周线）、monthly（月线）
        :type period: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_historical_by_id_0_serialize(
            symbol=symbol,
            start_date=start_date,
            end_date=end_date,
            period=period,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_historical_by_id_0_with_http_info(
        self,
        symbol: StrictStr,
        start_date: Annotated[Optional[StrictStr], Field(description="开始日期，格式 YYYYMMDD，例如：20240101")] = None,
        end_date: Annotated[Optional[StrictStr], Field(description="结束日期，格式 YYYYMMDD，例如：20240630")] = None,
        period: Annotated[Optional[StrictStr], Field(description="数据频率：daily（日线）、weekly（周线）、monthly（月线）")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[IndexDataResponse]:
        """Get Historical Index Data

        获取指定指数的历史行情数据  支持中国 A 股主要指数的历史日线/周线/月线查询。 常见指数代码： - 000001：上证指数 - 399001：深证成指 - 399006：创业板指 - 000688：科创 50 - 000300：沪深 300 - 000016：上证 50 - 000905：中证 500  返回数据包含日期、开盘价、收盘价、最高价、最低价、成交量、成交额等字段。

        :param symbol: (required)
        :type symbol: str
        :param start_date: 开始日期，格式 YYYYMMDD，例如：20240101
        :type start_date: str
        :param end_date: 结束日期，格式 YYYYMMDD，例如：20240630
        :type end_date: str
        :param period: 数据频率：daily（日线）、weekly（周线）、monthly（月线）
        :type period: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_historical_by_id_0_serialize(
            symbol=symbol,
            start_date=start_date,
            end_date=end_date,
            period=period,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_historical_by_id_0_without_preload_content(
        self,
        symbol: StrictStr,
        start_date: Annotated[Optional[StrictStr], Field(description="开始日期，格式 YYYYMMDD，例如：20240101")] = None,
        end_date: Annotated[Optional[StrictStr], Field(description="结束日期，格式 YYYYMMDD，例如：20240630")] = None,
        period: Annotated[Optional[StrictStr], Field(description="数据频率：daily（日线）、weekly（周线）、monthly（月线）")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Historical Index Data

        获取指定指数的历史行情数据  支持中国 A 股主要指数的历史日线/周线/月线查询。 常见指数代码： - 000001：上证指数 - 399001：深证成指 - 399006：创业板指 - 000688：科创 50 - 000300：沪深 300 - 000016：上证 50 - 000905：中证 500  返回数据包含日期、开盘价、收盘价、最高价、最低价、成交量、成交额等字段。

        :param symbol: (required)
        :type symbol: str
        :param start_date: 开始日期，格式 YYYYMMDD，例如：20240101
        :type start_date: str
        :param end_date: 结束日期，格式 YYYYMMDD，例如：20240630
        :type end_date: str
        :param period: 数据频率：daily（日线）、weekly（周线）、monthly（月线）
        :type period: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_historical_by_id_0_serialize(
            symbol=symbol,
            start_date=start_date,
            end_date=end_date,
            period=period,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_historical_by_id_0_serialize(
        self,
        symbol,
        start_date,
        end_date,
        period,
        force_refresh,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if symbol is not None:
            _path_params['symbol'] = symbol
        # process the query parameters
        if start_date is not None:
            
            _query_params.append(('start_date', start_date))
            
        if end_date is not None:
            
            _query_params.append(('end_date', end_date))
            
        if period is not None:
            
            _query_params.append(('period', period))
            
        if force_refresh is not None:
            
            _query_params.append(('force_refresh', force_refresh))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/historical/{symbol}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_index_list(
        self,
        category: Annotated[Optional[StrictStr], Field(description="指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> IndexListResponse:
        """Get Index List

        获取可选指数列表，支持按分类筛选  返回指数的代码、名称、分类和简要描述。 支持的分类： - 沪深重要指数：上证指数、深证成指、沪深 300 等 - 上证系列指数：上证 50、上证 180 等 - 深证系列指数：深证 100、中小板指等 - 中证系列指数：中证 500、中证 1000 等 - 香港指数：恒生指数、恒生国企指数等

        :param category: 指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数
        :type category: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_list_serialize(
            category=category,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexListResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_list_with_http_info(
        self,
        category: Annotated[Optional[StrictStr], Field(description="指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[IndexListResponse]:
        """Get Index List

        获取可选指数列表，支持按分类筛选  返回指数的代码、名称、分类和简要描述。 支持的分类： - 沪深重要指数：上证指数、深证成指、沪深 300 等 - 上证系列指数：上证 50、上证 180 等 - 深证系列指数：深证 100、中小板指等 - 中证系列指数：中证 500、中证 1000 等 - 香港指数：恒生指数、恒生国企指数等

        :param category: 指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数
        :type category: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_list_serialize(
            category=category,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexListResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_list_without_preload_content(
        self,
        category: Annotated[Optional[StrictStr], Field(description="指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Index List

        获取可选指数列表，支持按分类筛选  返回指数的代码、名称、分类和简要描述。 支持的分类： - 沪深重要指数：上证指数、深证成指、沪深 300 等 - 上证系列指数：上证 50、上证 180 等 - 深证系列指数：深证 100、中小板指等 - 中证系列指数：中证 500、中证 1000 等 - 香港指数：恒生指数、恒生国企指数等

        :param category: 指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数
        :type category: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_list_serialize(
            category=category,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexListResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_list_serialize(
        self,
        category,
        force_refresh,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if category is not None:
            
            _query_params.append(('category', category))
            
        if force_refresh is not None:
            
            _query_params.append(('force_refresh', force_refresh))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/list',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_index_list_0(
        self,
        category: Annotated[Optional[StrictStr], Field(description="指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> IndexListResponse:
        """Get Index List

        获取可选指数列表，支持按分类筛选  返回指数的代码、名称、分类和简要描述。 支持的分类： - 沪深重要指数：上证指数、深证成指、沪深 300 等 - 上证系列指数：上证 50、上证 180 等 - 深证系列指数：深证 100、中小板指等 - 中证系列指数：中证 500、中证 1000 等 - 香港指数：恒生指数、恒生国企指数等

        :param category: 指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数
        :type category: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_list_0_serialize(
            category=category,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexListResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_list_0_with_http_info(
        self,
        category: Annotated[Optional[StrictStr], Field(description="指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[IndexListResponse]:
        """Get Index List

        获取可选指数列表，支持按分类筛选  返回指数的代码、名称、分类和简要描述。 支持的分类： - 沪深重要指数：上证指数、深证成指、沪深 300 等 - 上证系列指数：上证 50、上证 180 等 - 深证系列指数：深证 100、中小板指等 - 中证系列指数：中证 500、中证 1000 等 - 香港指数：恒生指数、恒生国企指数等

        :param category: 指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数
        :type category: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_list_0_serialize(
            category=category,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexListResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_list_0_without_preload_content(
        self,
        category: Annotated[Optional[StrictStr], Field(description="指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数")] = None,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Index List

        获取可选指数列表，支持按分类筛选  返回指数的代码、名称、分类和简要描述。 支持的分类： - 沪深重要指数：上证指数、深证成指、沪深 300 等 - 上证系列指数：上证 50、上证 180 等 - 深证系列指数：深证 100、中小板指等 - 中证系列指数：中证 500、中证 1000 等 - 香港指数：恒生指数、恒生国企指数等

        :param category: 指数分类筛选，例如：沪深重要指数、上证系列指数、深证系列指数、中证系列指数、香港指数
        :type category: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_list_0_serialize(
            category=category,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IndexListResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_list_0_serialize(
        self,
        category,
        force_refresh,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if category is not None:
            
            _query_params.append(('category', category))
            
        if force_refresh is not None:
            
            _query_params.append(('force_refresh', force_refresh))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/list',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_index_realtime_by_id(
        self,
        symbol: StrictStr,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RealtimeIndexDataResponse:
        """Get Realtime Index Data

        获取指定指数的实时行情数据  支持主要指数的实时价格、涨跌幅、成交量等数据查询。 数据缓存策略同股票实时行情：交易时段短缓存（3 秒），非交易时段长缓存（300 秒）。 常见指数：000001（上证指数）、399001（深证成指）、399006（创业板指）等。

        :param symbol: (required)
        :type symbol: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_realtime_by_id_serialize(
            symbol=symbol,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "RealtimeIndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_realtime_by_id_with_http_info(
        self,
        symbol: StrictStr,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[RealtimeIndexDataResponse]:
        """Get Realtime Index Data

        获取指定指数的实时行情数据  支持主要指数的实时价格、涨跌幅、成交量等数据查询。 数据缓存策略同股票实时行情：交易时段短缓存（3 秒），非交易时段长缓存（300 秒）。 常见指数：000001（上证指数）、399001（深证成指）、399006（创业板指）等。

        :param symbol: (required)
        :type symbol: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_realtime_by_id_serialize(
            symbol=symbol,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "RealtimeIndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_realtime_by_id_without_preload_content(
        self,
        symbol: StrictStr,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Realtime Index Data

        获取指定指数的实时行情数据  支持主要指数的实时价格、涨跌幅、成交量等数据查询。 数据缓存策略同股票实时行情：交易时段短缓存（3 秒），非交易时段长缓存（300 秒）。 常见指数：000001（上证指数）、399001（深证成指）、399006（创业板指）等。

        :param symbol: (required)
        :type symbol: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_realtime_by_id_serialize(
            symbol=symbol,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "RealtimeIndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_realtime_by_id_serialize(
        self,
        symbol,
        force_refresh,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if symbol is not None:
            _path_params['symbol'] = symbol
        # process the query parameters
        if force_refresh is not None:
            
            _query_params.append(('force_refresh', force_refresh))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/realtime/{symbol}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_index_realtime_by_id_0(
        self,
        symbol: StrictStr,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RealtimeIndexDataResponse:
        """Get Realtime Index Data

        获取指定指数的实时行情数据  支持主要指数的实时价格、涨跌幅、成交量等数据查询。 数据缓存策略同股票实时行情：交易时段短缓存（3 秒），非交易时段长缓存（300 秒）。 常见指数：000001（上证指数）、399001（深证成指）、399006（创业板指）等。

        :param symbol: (required)
        :type symbol: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_realtime_by_id_0_serialize(
            symbol=symbol,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "RealtimeIndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_index_realtime_by_id_0_with_http_info(
        self,
        symbol: StrictStr,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[RealtimeIndexDataResponse]:
        """Get Realtime Index Data

        获取指定指数的实时行情数据  支持主要指数的实时价格、涨跌幅、成交量等数据查询。 数据缓存策略同股票实时行情：交易时段短缓存（3 秒），非交易时段长缓存（300 秒）。 常见指数：000001（上证指数）、399001（深证成指）、399006（创业板指）等。

        :param symbol: (required)
        :type symbol: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_realtime_by_id_0_serialize(
            symbol=symbol,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "RealtimeIndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_index_realtime_by_id_0_without_preload_content(
        self,
        symbol: StrictStr,
        force_refresh: Annotated[Optional[StrictBool], Field(description="是否强制刷新：true 则绕过缓存重新从数据源拉取")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Realtime Index Data

        获取指定指数的实时行情数据  支持主要指数的实时价格、涨跌幅、成交量等数据查询。 数据缓存策略同股票实时行情：交易时段短缓存（3 秒），非交易时段长缓存（300 秒）。 常见指数：000001（上证指数）、399001（深证成指）、399006（创业板指）等。

        :param symbol: (required)
        :type symbol: str
        :param force_refresh: 是否强制刷新：true 则绕过缓存重新从数据源拉取
        :type force_refresh: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_index_realtime_by_id_0_serialize(
            symbol=symbol,
            force_refresh=force_refresh,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "RealtimeIndexDataResponse",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_index_realtime_by_id_0_serialize(
        self,
        symbol,
        force_refresh,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if symbol is not None:
            _path_params['symbol'] = symbol
        # process the query parameters
        if force_refresh is not None:
            
            _query_params.append(('force_refresh', force_refresh))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/index/realtime/{symbol}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


