跳转至

成分股与市场行情

IndexStockMapping

字段映射 指数成分股数据

IndexStock

IndexStock(
    index_name: Optional[
        Literal["沪深300", "上证50", "中证500", "科创50"]
    ] = None,
    size: Optional[int] = 50,
    verbose: Optional[bool] = False,
    logger: Optional[Callable] = None,
    **kwargs: Any
)

查询 指数成分股数据

Notes
from wisecon.stock.index import *

data = IndexStock(index_name="沪深300", size=5).load()
data.to_frame(chinese_column=True)

Parameters:

Name Type Description Default
index_name Optional[Literal['沪深300', '上证50', '中证500', '科创50']]

指数名称["沪深300", "上证50", "中证500", "科创50"]

None
size Optional[int]

返回条数

50
verbose Optional[bool]

是否打印日志

False
logger Optional[Callable]

自定义日志

None
**kwargs Any

其他参数

{}
Source code in wisecon\stock\index\index.py
def __init__(
        self,
        index_name: Optional[Literal["沪深300", "上证50", "中证500", "科创50"]] = None,
        size: Optional[int] = 50,
        verbose: Optional[bool] = False,
        logger: Optional[Callable] = None,
        **kwargs: Any
):
    """
    Notes:
        ```python
        from wisecon.stock.index import *

        data = IndexStock(index_name="沪深300", size=5).load()
        data.to_frame(chinese_column=True)
        ```

    Args:
        index_name: 指数名称`["沪深300", "上证50", "中证500", "科创50"]`
        size: 返回条数
        verbose: 是否打印日志
        logger: 自定义日志
        **kwargs: 其他参数
    """
    self.index_name = index_name
    self.size = size
    self.mapping = IndexStockMapping()
    self.verbose = verbose
    self.logger = logger
    self.kwargs = kwargs
    self.request_set(response_type="json", description="指数成分股数据")
    self.conditions = []

CurrentMarketMapping

字段映射 ETF/LOF/Stock当前市场行情

CurrentMarket

CurrentMarket(
    market: TypeMarket = "ETF",
    sort_by: Optional[str] = "f3",
    page_size: Optional[int] = 20,
    page_number: Optional[int] = 1,
    verbose: Optional[bool] = False,
    logger: Optional[Callable] = None,
    **kwargs: Any
)

查询 ETF/LOF/Stock当前市场行情

Notes
from wisecon.stock.market import *

# 查询ETF市场当前行情
data = CurrentMarket(market="ETF",).load()
data.to_frame(chinese_column=True)

# 查询LOF市场当前行情
data = CurrentMarket(market="LOF",).load()
data.to_frame(chinese_column=True)

# 查询封闭基金当前行情
data = CurrentMarket(market="封闭基金",).load()
data.to_frame(chinese_column=True)

# 查询沪深京A股当前行情
data = CurrentMarket(market="沪深京A股",).load()
data.to_frame(chinese_column=True)

Parameters:

Name Type Description Default
market TypeMarket

市场类型: [ "沪深京A股", "上证A股", "注册制上证A股", "核准制上证A股", "深证A股", "注册制深证A股", "核准制深证A股", "创业板", "注册制创业板", "核准制创业板", "北证A股", "新股", "科创板", "沪股通", "深股通", "B股", "上证AB股比价", "深证AB股比价", "风险警示板", "风险警示板(SH)", "风险警示板(SZ)", "风险警示板(科创)", "风险警示板(创业)", "两网及退市", "ETF", "LOF", "封闭基金", ]

'ETF'
sort_by Optional[str]

排序字段

'f3'
page_size Optional[int]

每页数据量

20
page_number Optional[int]

页码

1
verbose Optional[bool]

是否打印日志

False
logger Optional[Callable]

自定义日志打印函数

None
**kwargs Any

其他参数

{}
Source code in wisecon\stock\market\market.py
def __init__(
        self,
        market: TypeMarket = "ETF",
        sort_by: Optional[str] = "f3",
        page_size: Optional[int] = 20,
        page_number: Optional[int] = 1,
        verbose: Optional[bool] = False,
        logger: Optional[Callable] = None,
        **kwargs: Any
):
    """
    Notes:
        ```python
        from wisecon.stock.market import *

        # 查询ETF市场当前行情
        data = CurrentMarket(market="ETF",).load()
        data.to_frame(chinese_column=True)

        # 查询LOF市场当前行情
        data = CurrentMarket(market="LOF",).load()
        data.to_frame(chinese_column=True)

        # 查询封闭基金当前行情
        data = CurrentMarket(market="封闭基金",).load()
        data.to_frame(chinese_column=True)

        # 查询沪深京A股当前行情
        data = CurrentMarket(market="沪深京A股",).load()
        data.to_frame(chinese_column=True)
        ```

    Args:
        market: 市场类型: ```
            [
                "沪深京A股",
                "上证A股", "注册制上证A股", "核准制上证A股",
                "深证A股", "注册制深证A股", "核准制深证A股",
                "创业板", "注册制创业板", "核准制创业板",
                "北证A股", "新股", "科创板", "沪股通", "深股通", "B股",
                "上证AB股比价", "深证AB股比价",
                "风险警示板", "风险警示板(SH)", "风险警示板(SZ)", "风险警示板(科创)", "风险警示板(创业)", "两网及退市",
                "ETF", "LOF", "封闭基金",
            ]```
        sort_by: 排序字段
        page_size: 每页数据量
        page_number: 页码
        verbose: 是否打印日志
        logger: 自定义日志打印函数
        **kwargs: 其他参数
    """
    self.market = market
    self.sort_by = sort_by
    self.page_size = page_size
    self.page_number = page_number
    self.mapping = CurrentMarketMapping()
    self.verbose = verbose
    self.logger = logger
    self.kwargs = kwargs
    self.request_set(description="`ETF/LOF/Stock`当前市场行情")