Metadata-Version: 2.1
Name: jqfactor-analyzer
Version: 1.0.1
Summary: JoinQuant single factor analyzer
Home-page: https://www.joinquant.com
Author: JoinQuant
Author-email: xlx@joinquant.com
Maintainer: 
Maintainer-email: 
License: Apache License v2
Description: # jqfactor_analyzer
        
        **聚宽单因子分析工具**
        
        ---
        
        聚宽单因子分析工具是提供给用户进行因子分析的工具，提供了包括计算因子IC值，因子收益，因子换手率等各种详细指标，用户可以按照自己的需求查看因子详情。
        
        
        
        ## **安装**
        
        ```bash
        pip install jqfactor_analyzer
        ```
        
        ## **升级**
        
        ```bash
        pip install -U jqfactor_analyzer
        ```
        
        ## **使用示例**
        
        * ### 示例：5日平均换手率因子分析
        
        ```python
        #载入函数库
        import pandas as pd
        import jqfactor_analyzer as ja
        
        # 获取 jqdatasdk 授权
        # 输入用户名、密码，申请地址：http://t.cn/EINDOxE
        # 聚宽官网及金融终端，使用方法参见：http://t.cn/EINcS4j
        import jqdatasdk
        jqdatasdk.auth('username', 'password')
        
        # 获取5日平均换手率因子2018-01-01到2018-12-31之间的数据（示例用从库中直接调取）
        # 因子数据获取方法在下方
        from jqfactor_analyzer.sample import VOL5
        factor_data = VOL5
        
        # 对因子进行分析
        factor_analyzer = ja.analyze_factor(
            factor_data,  # factor_data 为因子值的 pandas.DataFrame
            quantiles=10,
            periods=(1, 10),
            industry='jq_l1',
            weight_method='avg',
            max_loss=0.1
        )
        # 获取整理后的因子的IC值
        factor_analyzer.ic
        
        # 生成统计图表
        factor_analyzer.create_full_tear_sheet(
            demeaned=False, group_adjust=False, by_group=False,
            turnover_periods=None, avgretplot=(5, 15), std_bar=False
        )
        ```
        
        ## **获取因子数据方法**
        
        1. 连接jqdatasdk获取数据包，数据接口需调用聚宽 [`jqdatasdk`](https://github.com/JoinQuant/jqdatasdk/blob/master/README.md) 接口获取金融数据([试用注册地址](https://www.joinquant.com/default/index/sdk))
        
           ```python
           # 获取因子数据：以销售毛利率因子为例，该数据可以直接用于因子分析
           # 具体使用方法可以参照jqdatasdk的API文档
           import jqdatasdk
           jqdatasdk.auth('username', 'password')
        
           factor_data=jqdatasdk.get_factor_values(
               securities=get_index_stocks('000300.XSHG'),
               factors='gross_income_ratio',
               start_date='2018-01-01',
               end_date='2018-12-31')['gross_income_ratio']
           ```
        
        2. 自己算好因子值需要转换成 pandas.DataFrame格式的数据
        
           * index为日期，格式为pandas日期通用的DatetimeIndex
        
           * columns为股票代码，格式要求符合聚宽的代码定义规则（如：平安银行的股票代码为000001.XSHE）
             * 如果是深交所上市的股票，在股票代码后面需要加入.XSHE
             * 如果是上交所上市的股票，在股票代码后面需要加入.XSHG
        
Platform: all
Classifier: Programming Language :: Python
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
