- 指定日期当天最新成分股 def components_ac
- 获得成分股的WIND一级行业分布 def industry_distrubution
- 判断板块分布功能 def market_distribution
- ST, *ST 成分股剔除 def st_remove
- 去除不满上市不满n天的成分股 def remove_nomore_n_days
- 去除指定成分股 def remove_from_list
- 添加指定股票 def add_elements
- 获取上证50当天最新自由流通股本 def sh50_components_freeshare
处理过的quote数据进行handle_inday_data.py 处理3s采样,加入权重
回测框架,详见项目五
- 判断日期是否为交易日 def check_trade_da
- 成分股捏合指数单日收益率计算 def sh50_components_single_date_ror (inday解决 overnight,day因为自由流通股本问题尚未解决)
- 成分股对应行业的收益率 def components_single_date_industry_ror
- 指数单日收益率计算 def index_single_date_ror
- 如果wind数据库更新维护成功可以执行如下代码来更新自由流通股本 def components_capital_information (文件中已经注释处理)
- 同上如果wind表格更新成功可以采用如下方法 def change (文件中已经注释处理)
- 行业中文名称和CODE映射code--name def code_to_name
- 单宽基指数、定制指数wind以及行业分布画图 def single_index_industry_plt
- 双指数wind一级行业对比,可定制指数,也可以为宽基指数,取决于df的输入 def double_index_industry_plt
- 成分股市场分布 def market_plt
- 找到最近交易日期 def find_nearest_trading_day
- 找到区间内的交易日 def calculate_trade_days
- 赋予市场权重 def assign_market_weight
- 保存quote def save_to_csvf
- 上证50靠档 def process_rate (如果自由流通股表格实时更新可以启用)
- 计算成分股权重 def components_weight (分级靠档后计算调整股本,同上)
- 预处理quote文件 def pre_quote_information
- 自由流通市值加权 def weight_prc
- 整合成分股quote数据 def final_to_plt
- 画图 def quote_plt
- 比较指数和捏合指数三秒行情收益率差异 def indat_ror_comparison
- components_information_acquisition.components_ac
- components_information_acquisition.industry_distrubution ->indusry_market_plt.single_index_industry_plt
- components_information_acquisition.components_ac -> rate_or_return.components_single_date_industry_ror
- rate_or_return.index_single_date_ror
股票复权价格是一种对股票价格进行调整的方法,旨在消除除权除息对股价带来的影响,使得投资者可以更客观地分析股票的价格走势。在股票市场中,公司会定期进行除权除息操作,例如派发现金股利、进行股票拆细或合并等。这些操作会对股票的价格产生影响,导致价格出现突变。
为了便于投资者对股票价格进行比较和分析,需要对股票价格进行复权处理,即将股票历史价格调整为考虑除权除息因素后的价格,以保持连续性和可比性。常见的复权价格类型包括:
前复权价格(前向复权价格):以股票除权日为基准,将除权日之前的价格按照除权因子进行调整,使得除权日之前的价格与除权日当天的价格相一致。前复权价格反映了投资者在除权前的实际买入成本和收益情况。
后复权价格(后向复权价格):以股票除权日为基准,将除权日之后的价格按照除权因子进行调整,使得除权日之后的价格与除权日当天的价格相一致。后复权价格反映了投资者在除权后的实际买入成本和收益情况。
日内涨跌:今收-今开
隔天涨跌:今开-昨收
当天涨跌:今收-昨收
- components_information_acquisition.components_ac
- components_information_acquisition.components_ac
- indusry_market_plt.double_index_industry_plt
- components_information_acquisition.components_ac 1.1 components_information_acquisition.industry_distrubution 1.2 st_remove 1.3 remove_nomore_n_days 1.4 remove_from_list 1.5 add_elements
- components_information_acquisition.industry_distrubution
- industry_market_plt.double_index_industry_plt
- quote.information.save_to_csvf 4.1 pre_quote_information 4.2 capital_today_df = sh50_components_freeshare 4.3 weight_prc 4.4 final_to_plt 4.5 quote_plt
收益类 1. Alpha 收益 a. 单日平均收益率 b. 年化累积收益率 2. 绝对收益 a. 单日平均 b. 年化累积 风险类 1. 夏普比例 2. 索提诺比率 3. 最大回撤 4. 最大回撤持续时间
- handle_inday_data.py
- backtest.py
class类,connect_class, components_class 修复industry_market_plt.py, components_information_acquisition.py, nearest_trading_day.py内所有发现错误 更新reference->time_stamp 标准化时间HHMMSS,时间标签HH:MM:SS 更新v2_code: components class, utilities class, index class 采用ray并行计算,加速运行时间 单个项目进行单独.py文件,可直接执行 test.py 单独取出指数quote数据