AdditionalRadar-线性回归,因子筛选,多因子模型

# coding=utf-8
import numpy as np
import xlrd
import statsmodels.api as sm
import MySQLdb
import math


#*****************Load data part*****************
data = xlrd.open_workbook('StandarData.xlsx')
tb_hist_info = data.sheet_by_name('hist_info')
feat_num = 14
feat_index = np.zeros(feat_num)
for k in range(0,feat_num):
    feat_index[k] = k
hist_info_rows = tb_hist_info.nrows - 3
hist_info = np.zeros((hist_info_rows,feat_num))
for k in range(1,tb_hist_info.ncols):
    hist_info[:,k-1] = tb_hist_info.col_values(k,3)


#----------------load data from SQL---------------
db = MySQLdb.connect("10.91.24.140","thfund_cia","ciacia","cia" )
cursor = db.cursor()
sql = """SELECT
-- 大盘点位
t.index_point      ,
-- 折价率
t.dis_rate         ,
-- 发行价格
t.issue_price      ,
t.pe_ttm           ,
t.pe_lyr           ,
t.pb               ,
-- 募集金额
t.collection       ,
-- 总市值
t.val_mv           ,
-- 发行目的代码
t.OBJECT_CODE      ,
-- 中证流通PE
t.zzlt_pe          ,
-- 中证流通pb
t.zzlt_pb          ,
-- 摊薄比例
t.DILUTED_RATIO    ,
-- 净利润同比
t.yoy_net_profit   ,
-- 大股东认购比例
t.holder_subs_rate ,
-- 定增收益
t.seo_yield
         FROM seo_cd_factor t
         order by t.index ASC
;
"""
cursor.execute(sql)
factor = cursor.fetchall()
db.close()
sample_num = len(factor)
factor = np.array(factor)
#----------------load data from xlsx---------------
# tb_factor_info = data.sheet_by_name('factor')
# sample_num = tb_factor_info.nrows - 2
# factor_num = 16
# factor = np.zeros((sample_num, factor_num))
# for k in range(0,factor_num):
#     factor[:,k] = tb_factor_info.col_values(k,2)


#*****************model generate part*****************
#--------hist the rate base on the factor--------
max_bin_num = hist_info_rows
hist_yield = np.zeros((max_bin_num,feat_num))
hist_sample_num = np.zeros((max_bin_num,feat_num))
factor_index = np.zeros((samp
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值