siat 3.7.2__py3-none-any.whl → 3.7.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- siat/common.py +17 -6
- siat/event_study.py +138 -71
- {siat-3.7.2.dist-info → siat-3.7.4.dist-info}/METADATA +1 -1
- {siat-3.7.2.dist-info → siat-3.7.4.dist-info}/RECORD +7 -7
- {siat-3.7.2.dist-info → siat-3.7.4.dist-info}/LICENSE +0 -0
- {siat-3.7.2.dist-info → siat-3.7.4.dist-info}/WHEEL +0 -0
- {siat-3.7.2.dist-info → siat-3.7.4.dist-info}/top_level.txt +0 -0
siat/common.py
CHANGED
@@ -3836,6 +3836,8 @@ def upgrade_siat(module_list=['siat','akshare','pandas','pandas_datareader', \
|
|
3836
3836
|
或python -m pip install --upgrade pip
|
3837
3837
|
如果上述方法不适用,您可能需要重新安装Python,并确保在安装过程中选中了“Add Python to PATH”
|
3838
3838
|
"""
|
3839
|
+
DEBUG=False
|
3840
|
+
|
3839
3841
|
print("Upgrading siat and related modules, please wait ... ...")
|
3840
3842
|
|
3841
3843
|
#获取系统目录
|
@@ -3865,7 +3867,8 @@ def upgrade_siat(module_list=['siat','akshare','pandas','pandas_datareader', \
|
|
3865
3867
|
if sp_list[-1] == 'anaconda3': break
|
3866
3868
|
|
3867
3869
|
#生成pip命令字符串前半段,仅缺插件名
|
3868
|
-
cmdstr=sp+sep_flag+'Scripts'+sep_flag+pipcmd+' '
|
3870
|
+
#cmdstr=sp+sep_flag+'Scripts'+sep_flag+pipcmd+' '
|
3871
|
+
cmdstr=sp+sep_flag+pipcmd+' '
|
3869
3872
|
|
3870
3873
|
#检查是否使用镜像源
|
3871
3874
|
if alternative == "":
|
@@ -3898,17 +3901,25 @@ def upgrade_siat(module_list=['siat','akshare','pandas','pandas_datareader', \
|
|
3898
3901
|
for m in tqdm(module_list):
|
3899
3902
|
#print("Upgrading",m,"... ...",end='')
|
3900
3903
|
#print_progress_percent2(m,module_list,steps=5,leading_blanks=2)
|
3904
|
+
if DEBUG:
|
3905
|
+
print(" DEBUG: m={}".format(m))
|
3901
3906
|
|
3902
3907
|
if alternative == "":
|
3903
3908
|
cmdstr1=cmdstr+m
|
3904
3909
|
else:
|
3905
3910
|
cmdstr1=cmdstr+m+' '+alter_source
|
3906
|
-
|
3911
|
+
if DEBUG:
|
3912
|
+
print(" DEBUG: cmdstr1={}".format(cmdstr1))
|
3907
3913
|
|
3908
3914
|
#proc=subprocess.run(cmdstr1.split(' '),stdout=subprocess.PIPE)
|
3909
|
-
|
3910
|
-
|
3911
|
-
|
3915
|
+
try:
|
3916
|
+
proc=subprocess.run(cmdstr1.split(' '))
|
3917
|
+
rcode=proc.returncode
|
3918
|
+
if rcode !=0: fail_list=fail_list+[m]
|
3919
|
+
except:
|
3920
|
+
print(" #Error(upgrade_siat): executable file python not found in {}".format(sp))
|
3921
|
+
print(" Solution: find out the exact path where the executable file python locates")
|
3922
|
+
return
|
3912
3923
|
|
3913
3924
|
if len(fail_list) == 0:
|
3914
3925
|
print("All specified modules are successfully upgraded!")
|
@@ -3918,7 +3929,7 @@ def upgrade_siat(module_list=['siat','akshare','pandas','pandas_datareader', \
|
|
3918
3929
|
|
3919
3930
|
if 'pip' in fail_list:
|
3920
3931
|
print("Upgrading for pip, in Anaconda Prompt (Windows) or Terminal (Mac):")
|
3921
|
-
print(" python -m pip install --upgrade pip")
|
3932
|
+
print(" python -m pip install --upgrade --user pip")
|
3922
3933
|
|
3923
3934
|
return
|
3924
3935
|
|
siat/event_study.py
CHANGED
@@ -54,6 +54,16 @@ if __name__=='__main__':
|
|
54
54
|
market_index='000300.SS'
|
55
55
|
RF="market model"
|
56
56
|
|
57
|
+
#测试组3
|
58
|
+
ticker=['600519.SS','399997.SZ']
|
59
|
+
|
60
|
+
event_date='2024-4-2' #贵州茅台2023年报披露日
|
61
|
+
start='auto'; end='auto'
|
62
|
+
event_window=[0,1]
|
63
|
+
method='CAPM'
|
64
|
+
market_index='000001.SS'
|
65
|
+
RF="1YCNY.B"
|
66
|
+
|
57
67
|
#共同部分
|
58
68
|
post_event_days=7
|
59
69
|
method='CAPM'
|
@@ -63,7 +73,8 @@ if __name__=='__main__':
|
|
63
73
|
ret_type="Daily Adj Ret%"
|
64
74
|
ticker_type='stock' #贵州茅台为股票
|
65
75
|
facecolor="whitesmoke"
|
66
|
-
show_AR=
|
76
|
+
show_AR=True
|
77
|
+
show_RF=True
|
67
78
|
loc='best'
|
68
79
|
|
69
80
|
es=event_study("600519.SS",event_date="2024-4-2", \
|
@@ -90,8 +101,8 @@ if __name__=='__main__':
|
|
90
101
|
|
91
102
|
|
92
103
|
def event_study(ticker,event_date, \
|
93
|
-
start='
|
94
|
-
event_window=[
|
104
|
+
start='auto',end='auto', \
|
105
|
+
event_window=[1,3], \
|
95
106
|
post_event_days=0, \
|
96
107
|
method='CAPM', \
|
97
108
|
early_response_days=-2, \
|
@@ -100,7 +111,8 @@ def event_study(ticker,event_date, \
|
|
100
111
|
RF="market index", \
|
101
112
|
ret_type="Daily Adj Ret%", \
|
102
113
|
ticker_type='auto', \
|
103
|
-
facecolor="whitesmoke",show_AR='auto',
|
114
|
+
facecolor="whitesmoke",show_AR='auto',show_RF=False, \
|
115
|
+
loc='best'):
|
104
116
|
"""
|
105
117
|
|
106
118
|
功能:展示事件研究法的累计异常收益率CAR。
|
@@ -114,7 +126,7 @@ def event_study(ticker,event_date, \
|
|
114
126
|
注意:事件窗口不一定包括事件日(适用于事件日在非交易日的情形,例如周末或假日)
|
115
127
|
如果事件日为非交易日,事件窗口需要后移至事件日后的第一个交易日。
|
116
128
|
如果怀疑市场提前对事件发生反应,可以考虑前移事件窗口的开始日期。
|
117
|
-
post_event_days
|
129
|
+
post_event_days:用于分析事件窗口后的漂移效应,取事件窗口后多少天。默认不分析,取0天。
|
118
130
|
method:估计事件窗口以及事件后窗口收益率预期值的方法,默认为CAPM(主要用于ticker为股票等)
|
119
131
|
如果ticker为股票等,也可以直接使用指数的收益率为其预期收益率,此时method为Market或Index。
|
120
132
|
如果ticker为指数,无法再借助指数,method只能使用Random Walk,即使用前一个收益率为预期收益率。
|
@@ -126,11 +138,13 @@ def event_study(ticker,event_date, \
|
|
126
138
|
默认在事件窗口开始日期+提前反应天数前的365个自然日(约250个交易日)。
|
127
139
|
market_index:当method为CAPM时,用于计算市场收益率。默认中国市场采用000300.SS。
|
128
140
|
注意:需要根据不同市场采取不同的市场指数,例如香港市场为恒生指数,美国市场为标普500指数等。
|
129
|
-
RF
|
141
|
+
RF:年化无风险收益率,默认使用市场模型"market index",无需指定;可直接指定具体数值;
|
130
142
|
也可指定特定指标,例如一年期中国国债收益率"1YCNY.B"或一年期美债收益率"1YUSY.B"等。
|
143
|
+
show_RF:在使用市场模型或指定指标时是否显示计算出的RF均值,默认为False。
|
131
144
|
ticker_type:显式指明ticker的证券类型,当siat误判其类型(中国内地股票/债券/基金)时使用,默认'auto'。
|
132
145
|
facecolor:显式指定绘图背景颜色,默认"whitesmoke"。
|
133
|
-
show_AR:是否绘图时绘制异常收益率AR,默认'auto'(单个ticker
|
146
|
+
show_AR:是否绘图时绘制异常收益率AR,默认'auto'(单个ticker时绘制,多个时不绘制)。
|
147
|
+
也可指定True/False强行绘制/不绘制。
|
134
148
|
"""
|
135
149
|
|
136
150
|
DEBUG=False
|
@@ -177,7 +191,6 @@ def event_study(ticker,event_date, \
|
|
177
191
|
adjust_end=-2
|
178
192
|
event_window_end=date_adjust(event_window_end,adjust=adjust_end)
|
179
193
|
event_window_new[1]=event_window[1]+adjust_start+adjust_end
|
180
|
-
|
181
194
|
|
182
195
|
if DEBUG:
|
183
196
|
print(" DEBUG: event window is between {0} to {1}".format(event_window_start,event_window_end))
|
@@ -231,6 +244,14 @@ def event_study(ticker,event_date, \
|
|
231
244
|
if DEBUG:
|
232
245
|
print(" DEBUG: regression period starts from {0} to {1}".format(est_window_start,est_window_end))
|
233
246
|
|
247
|
+
#处理绘图时显示的日期范围
|
248
|
+
if start=='auto':
|
249
|
+
start=date_adjust(early_response_date,adjust=-7)
|
250
|
+
if end=='auto':
|
251
|
+
if len(ticker) == 1 or show_AR:
|
252
|
+
end=date_adjust(post_event_end,adjust=7)
|
253
|
+
else:
|
254
|
+
end=date_adjust(post_event_end,adjust=2)
|
234
255
|
|
235
256
|
#=====判断ticker是否为指数,调整预期收益率计算方法============================
|
236
257
|
if isinstance(ticker,str):
|
@@ -257,29 +278,28 @@ def event_study(ticker,event_date, \
|
|
257
278
|
#基于CAPM获取数据
|
258
279
|
if 'capm' in method.lower():
|
259
280
|
method_type="capm"
|
281
|
+
df_ret=compare_msecurity(tickers=ticker+[market_index],measure=ret_type, \
|
282
|
+
start=est_window_start,end=end, \
|
283
|
+
ticker_type=ticker_type, \
|
284
|
+
graph=False)
|
285
|
+
|
260
286
|
if isinstance(RF,int) or isinstance(RF,float):
|
261
287
|
#RF为具体数值
|
262
288
|
RF_type="value"
|
263
|
-
df_ret=compare_msecurity(tickers=ticker+[market_index],measure=ret_type, \
|
264
|
-
start=est_window_start,end=end, \
|
265
|
-
ticker_type=ticker_type, \
|
266
|
-
graph=False)
|
267
289
|
|
268
290
|
elif "market" in (str(RF)).lower() or "index" in (str(RF)).lower():
|
269
291
|
#RF通过市场模型计算,无需指定
|
270
292
|
RF_type="model"
|
271
|
-
df_ret=compare_msecurity(tickers=ticker+[market_index],measure=ret_type, \
|
272
|
-
start=est_window_start,end=end, \
|
273
|
-
ticker_type=ticker_type, \
|
274
|
-
graph=False)
|
275
293
|
else:
|
276
|
-
#指定RF代码,例如1YCNY.B
|
294
|
+
#指定RF代码,例如1YCNY.B,注意1:得到的是年化收益率%,注意2:中国的只有近一年的数据
|
277
295
|
RF_type="code"
|
278
|
-
|
296
|
+
|
297
|
+
if RF_type=="code":
|
298
|
+
df_rf=compare_msecurity(tickers=RF,measure='Close', \
|
279
299
|
start=est_window_start,end=end, \
|
280
|
-
ticker_type=ticker_type, \
|
281
300
|
graph=False)
|
282
|
-
|
301
|
+
RF=df_rf[list(df_rf)[0]].mean() / 100.0
|
302
|
+
|
283
303
|
#基于市场指数获取数据
|
284
304
|
elif 'market' in method.lower() or 'index' in method.lower():
|
285
305
|
method_type="market"
|
@@ -329,78 +349,82 @@ def event_study(ticker,event_date, \
|
|
329
349
|
df_reg=df_reg.replace([np.nan, None], np.nan).dropna()
|
330
350
|
|
331
351
|
import statsmodels.api as sm
|
332
|
-
if RF_type
|
333
|
-
if not ("%" in ret_type): #注意:RF
|
334
|
-
X=df_reg[ticker_name(market_index)] - RF #无截距项回归,指定RF具体数值
|
352
|
+
if RF_type in ["value","code"]:
|
353
|
+
if not ("%" in ret_type): #注意:RF是年化收益率(需要转化为日收益率),这里不是百分比
|
354
|
+
X=df_reg[ticker_name(market_index)] - RF/365.0 #无截距项回归,指定RF具体数值
|
335
355
|
else:
|
336
|
-
X=df_reg[ticker_name(market_index)] - RF*100.0
|
356
|
+
X=df_reg[ticker_name(market_index)] - RF/365.0 * 100.0 #这里需要转化为日收益率百分比%
|
337
357
|
|
338
|
-
|
358
|
+
else: #RF_type=="model"
|
339
359
|
X=df_reg[ticker_name(market_index)]
|
340
360
|
X=sm.add_constant(X) #有截距项回归,基于市场模型
|
341
|
-
else: #RF_type=="code"
|
342
|
-
if not ("%" in ret_type): #注意:1YCNY.B数值是百分比%
|
343
|
-
X=df_reg[ticker_name(market_index)] - df_reg[ticker_name(RF)]/100.0
|
344
|
-
else:
|
345
|
-
X=df_reg[ticker_name(market_index)] - df_reg[ticker_name(RF)]
|
346
361
|
|
347
362
|
if DEBUG:
|
348
|
-
print(" DEBUG: method_type={0}, RF_type={1}".format(method_type,RF_type))
|
363
|
+
print(" DEBUG: method_type={0}, RF_type={1}, RF={2}".format(method_type,RF_type,RF))
|
349
364
|
|
350
365
|
#CAPM回归
|
351
|
-
beta_dict={}; intercept_dict={}; pvalue_dict={}
|
366
|
+
beta_dict={}; intercept_dict={}; pvalue_dict={}; rf_dict={}
|
352
367
|
for t in ticker_name(ticker,ticker_type):
|
353
368
|
try:
|
354
|
-
if RF_type
|
355
|
-
if not ("%" in ret_type): #注意:RF
|
356
|
-
y=df_reg[t] - RF
|
369
|
+
if RF_type in ["value","code"]:
|
370
|
+
if not ("%" in ret_type): #注意:RF是年化收益率(需要转化为日收益率),不是百分比
|
371
|
+
y=df_reg[t] - RF/365.0
|
357
372
|
else:
|
358
|
-
y=df_reg[t] - RF*100.0
|
373
|
+
y=df_reg[t] - RF/365.0 * 100.0
|
359
374
|
|
360
|
-
|
375
|
+
else: #RF_type=="model"
|
361
376
|
y=df_reg[t]
|
362
|
-
|
363
|
-
else: #RF_type=="code"
|
364
|
-
if not ("%" in ret_type): #注意:1YCNY.B数值是百分比%
|
365
|
-
y=df_reg[t] - df_reg[ticker_name(RF)]/100.0
|
366
|
-
else:
|
367
|
-
y=df_reg[t] - df_reg[ticker_name(RF)]
|
368
377
|
except: continue
|
369
378
|
|
370
379
|
model = sm.OLS(y,X) #定义回归模型y=X
|
371
380
|
results = model.fit() #进行OLS回归
|
372
381
|
|
382
|
+
if DEBUG2:
|
383
|
+
print(" DEBUG: RF_type={0}, results.params={1},results.pvalues={2}".format(RF_type,results.params,results.pvalues))
|
384
|
+
|
373
385
|
#提取回归系数,详细信息见results.summary()
|
374
|
-
|
375
|
-
|
386
|
+
if RF_type=="model":
|
387
|
+
intercept=results.params[0]
|
388
|
+
beta=results.params[1]; pvalue=results.pvalues[1]
|
389
|
+
try:
|
390
|
+
#此处回归得到的rf应该为日收益率,转为年化收益率。
|
391
|
+
#注意:不同证券回归出的结果可能差异较大,原因可能是混入了回归残差!
|
392
|
+
if not ("%" in ret_type):
|
393
|
+
rf=intercept / (1-beta) * 365.0
|
394
|
+
else:
|
395
|
+
rf=intercept / (1-beta) / 100.0 * 365.0
|
396
|
+
except: rf=0
|
397
|
+
|
398
|
+
else: #RF_type in ["value","code"]
|
399
|
+
intercept=0
|
400
|
+
beta=results.params[0]; pvalue=results.pvalues[0]
|
401
|
+
rf=RF
|
376
402
|
|
377
|
-
beta_dict[t] = beta; intercept_dict[t] = intercept; pvalue_dict[t] = pvalue;
|
378
|
-
if
|
379
|
-
print(" DEBUG: {0}, intercept={1}, beta={2}, pvalue={3}".format(t,round(intercept,4),round(beta,4),round(pvalue,4)))
|
403
|
+
beta_dict[t] = beta; intercept_dict[t] = intercept; pvalue_dict[t] = pvalue; rf_dict[t]=rf
|
404
|
+
if DEBUG2:
|
405
|
+
print(" DEBUG: t={0}, intercept={1}, beta={2}, pvalue={3}, annualized rf={4}".format(t,round(intercept,4),round(beta,4),round(pvalue,4),round(rf,4)))
|
380
406
|
|
381
407
|
#计算收益率预期和AR
|
382
408
|
for t in ticker_name(ticker,ticker_type):
|
383
409
|
try:
|
384
|
-
if RF_type
|
410
|
+
if RF_type in ["value","code"]:
|
411
|
+
#CAPM模型:E(R) = RF + (Rm-RF)*beta
|
385
412
|
RF_text=str(round(RF*100.0,4))[:6]+'%'
|
386
|
-
if not ("%" in ret_type): #注意:RF
|
387
|
-
df_ret[t+"_predicted"]=(df_ret[ticker_name(market_index)] - RF)*beta_dict[t] + RF
|
413
|
+
if not ("%" in ret_type): #注意:RF是年化收益率,此处不是百分比
|
414
|
+
df_ret[t+"_predicted"]=(df_ret[ticker_name(market_index)] - RF/365.0)*beta_dict[t] + RF/365.0
|
388
415
|
else:
|
389
|
-
df_ret[t+"_predicted"]=(df_ret[ticker_name(market_index)] - RF*100.0)*beta_dict[t] + RF*100.0
|
416
|
+
df_ret[t+"_predicted"]=(df_ret[ticker_name(market_index)] - RF*100.0/365.0)*beta_dict[t] + RF*100.0/365.0
|
390
417
|
|
391
|
-
|
418
|
+
else: #RF_type=="model"
|
419
|
+
#市场模型:E(R) = intercept + Rm*beta
|
392
420
|
RF_text="基于市场模型回归"
|
393
421
|
df_ret[t+"_predicted"]=df_ret[ticker_name(market_index)]*beta_dict[t] + intercept_dict[t]
|
394
|
-
|
395
|
-
else: #RF_type=="code"
|
396
|
-
RF_text=ticker_name(RF)
|
397
|
-
df_ret[t+"_predicted"]=(df_ret[ticker_name(market_index)] - df_ret[ticker_name(RF)])*beta_dict[t] + df_ret[ticker_name(RF)]
|
398
422
|
|
399
423
|
df_ret[t+"_AR"]=df_ret[t] - df_ret[t+"_predicted"]
|
400
424
|
except: continue
|
401
425
|
|
402
426
|
if DEBUG2:
|
403
|
-
print(" DEBUG: RF_type={0}, RF_text={1}".format(RF_type,RF_text))
|
427
|
+
print(" DEBUG: RF_type={0}, RF_text={1}, rf_dict={2}".format(RF_type,RF_text, rf_dict))
|
404
428
|
|
405
429
|
#=====计算CAR==============================================================
|
406
430
|
for t in ticker_name(ticker,ticker_type):
|
@@ -475,9 +499,19 @@ def event_study(ticker,event_date, \
|
|
475
499
|
|
476
500
|
#显著性检验:异于零的t检验,事件窗口
|
477
501
|
df_event_window=df0[(df0.index >=event_window_start) & (df0.index <=event_window_end)]
|
478
|
-
footnote5="事件窗口CAR
|
502
|
+
footnote5="事件窗口CAR(终值,p值):"
|
479
503
|
for c in list(df_event_window):
|
480
504
|
if 'CAR' in c.upper():
|
505
|
+
c_name=c[:-4]
|
506
|
+
|
507
|
+
event_window_endpd=pd.to_datetime(event_window_end)
|
508
|
+
#car_value=df_event_window[df_event_window.index == event_window_endpd][c].values[0]
|
509
|
+
car_value=df_event_window[c][-1]
|
510
|
+
if car_value > 0:
|
511
|
+
car_value_str=str(round(car_value,4))[:6]
|
512
|
+
else:
|
513
|
+
car_value_str=str(round(car_value,4))[:7]
|
514
|
+
|
481
515
|
if len(df_event_window[c])==1:
|
482
516
|
if abs(df_event_window[c].values[0]) > 0.01:
|
483
517
|
p_value=0.0
|
@@ -485,17 +519,36 @@ def event_study(ticker,event_date, \
|
|
485
519
|
p_value=1.0
|
486
520
|
else:
|
487
521
|
p_value=ttest(df_event_window[c],0)
|
488
|
-
|
489
|
-
|
522
|
+
if p_value > 0:
|
523
|
+
p_value_str=str(round(p_value,4))[:6]
|
524
|
+
else:
|
525
|
+
p_value_str=str(round(p_value,4))[:7]
|
526
|
+
#footnote5=footnote5+c_name+p_value_str+","
|
527
|
+
footnote5=footnote5+"{0}({1}, {2}), ".format(c_name,car_value_str,p_value_str)
|
528
|
+
footnote5=footnote5.strip(", ")
|
490
529
|
|
491
530
|
#显著性检验:异于零的t检验,事件后窗口
|
492
|
-
|
531
|
+
df_post_event_window=df0[(df0.index >event_window_end) & (df0.index <=post_event_end)]
|
532
|
+
if len(df_post_event_window) == 0:
|
533
|
+
footnote6=''
|
534
|
+
|
535
|
+
elif len(df_post_event_window) == 0:
|
493
536
|
footnote6=''
|
494
537
|
else:
|
495
|
-
|
496
|
-
footnote6="事件后窗口CAR的p值:"
|
538
|
+
footnote6="事件后窗口CAR(终值,p值):"
|
497
539
|
for c in list(df_post_event_window):
|
498
540
|
if 'CAR' in c.upper():
|
541
|
+
c_name=c[:-4]
|
542
|
+
post_event_endpd=pd.to_datetime(post_event_end)
|
543
|
+
if DEBUG2:
|
544
|
+
print(" DEBUG: c={0},post_event_end={1},df_post_event_window={2}".format(c,post_event_end,df_post_event_window))
|
545
|
+
#car_value=df_post_event_window[df_post_event_window.index == post_event_endpd][c].values[0]
|
546
|
+
car_value=df_post_event_window[c][-1]
|
547
|
+
if car_value > 0:
|
548
|
+
car_value_str=str(round(car_value,4))[:6]
|
549
|
+
else:
|
550
|
+
car_value_str=str(round(car_value,4))[:7]
|
551
|
+
|
499
552
|
if len(df_post_event_window[c])==1:
|
500
553
|
if abs(df_post_event_window[c].values[0]) > 0.01:
|
501
554
|
p_value=0.0
|
@@ -503,8 +556,14 @@ def event_study(ticker,event_date, \
|
|
503
556
|
p_value=1.0
|
504
557
|
else:
|
505
558
|
p_value=ttest(df_post_event_window[c],0)
|
506
|
-
|
507
|
-
|
559
|
+
if p_value > 0:
|
560
|
+
p_value_str=str(round(p_value,4))[:6]
|
561
|
+
else:
|
562
|
+
p_value_str=str(round(p_value,4))[:7]
|
563
|
+
|
564
|
+
#footnote6=footnote6+c[:-4]+str(p_value)[:6]+","
|
565
|
+
footnote6=footnote6+"{0}({1}, {2}), ".format(c_name,car_value_str,p_value_str)
|
566
|
+
footnote6=footnote6.strip(", ")
|
508
567
|
|
509
568
|
footnote7="数据来源:Sina/EM/Yahoo/Stooq/SWHY,"+stoday
|
510
569
|
|
@@ -615,18 +674,26 @@ def event_study(ticker,event_date, \
|
|
615
674
|
#title_txt=title_txt+",窗口收益率"
|
616
675
|
|
617
676
|
if "CAPM" in method.upper():
|
618
|
-
footnotex="CAPM回归期间:{0}至{1},无风险收益率
|
677
|
+
footnotex="CAPM回归期间:{0}至{1},无风险收益率{2}".format(est_window_start,est_window_end,RF_text)
|
619
678
|
footnotey="CAPM贝塔系数:"
|
620
679
|
for k in beta_dict:
|
621
680
|
footnotey=footnotey+k+str(round(beta_dict[k],4))[:6]+","
|
622
681
|
footnotey=footnotey.strip(",")
|
623
|
-
|
624
|
-
|
682
|
+
|
683
|
+
if show_RF:
|
684
|
+
footnotez="无风险收益率均值:"
|
685
|
+
for r in rf_dict:
|
686
|
+
footnotez=footnotez+r+str(round(rf_dict[r]*100.0,4))[:6]+"%, "
|
687
|
+
|
688
|
+
footnotez=footnotez.strip(", ")
|
689
|
+
footnote=footnote2+footnote3+footnote4+'\n'+footnotex+'\n'+footnotey+'\n'+footnotez+'\n'+footnote5+'\n'+footnote6
|
690
|
+
else:
|
691
|
+
footnote=footnote2+footnote3+footnote4+'\n'+footnotex+'\n'+footnotey+'\n'+footnote5+'\n'+footnote6
|
625
692
|
else:
|
626
693
|
footnote=footnote2+footnote3+footnote4+'\n'+footnote5+'\n'+footnote6
|
627
694
|
|
628
|
-
|
629
|
-
df_display_CSS(df1,titletxt=title_txt,footnote=footnote,facecolor=
|
695
|
+
#显示结果表格
|
696
|
+
df_display_CSS(df1,titletxt=title_txt,footnote=footnote,facecolor=facecolor,decimals=4, \
|
630
697
|
first_col_align='left',second_col_align='left', \
|
631
698
|
last_col_align='center',other_col_align='center')
|
632
699
|
|
@@ -18,7 +18,7 @@ siat/capm_beta.py,sha256=cxXdRVBQBllhbfz1LeTJAIWvyRYhW54nhtNUXv4HwS0,29063
|
|
18
18
|
siat/capm_beta2.py,sha256=-ZYYp1HK7SkfTR3vBKZ0QVC4Q_tbST2O4MGbX_V77J0,32031
|
19
19
|
siat/capm_beta_test.py,sha256=ImR0c5mc4hIl714XmHztdl7qg8v1E2lycKyiqnFj6qs,1745
|
20
20
|
siat/cmat_commons.py,sha256=Nj9Kf0alywaztVoMVeVVL_EZk5jRERJy8R8kBw88_Tg,38116
|
21
|
-
siat/common.py,sha256=
|
21
|
+
siat/common.py,sha256=2Y51NN6n4FhkNXDRFnV9xPE2Z7XcjqcqaWtZLRaDmgQ,163283
|
22
22
|
siat/compare_cross.py,sha256=3iP9TH2h3w27F2ARZc7FjKcErYCzWRc-TPiymOyoVtw,24171
|
23
23
|
siat/compare_cross_test.py,sha256=xra5XYmQGEtfIZL2h-GssdH2hLdFIhG3eoCrkDrL3gY,3473
|
24
24
|
siat/concepts_iwencai.py,sha256=m1YEDtECRT6FqtzlKm91pt2I9d3Z_XoP59BtWdRdu8I,3061
|
@@ -32,7 +32,7 @@ siat/economy.py,sha256=ijMAVA5ydghbQDgNDDdz8fz9NPd2eq90RzpJSRGWz5c,78638
|
|
32
32
|
siat/economy_test.py,sha256=6vjNlPz7W125pJb7simCddobSEp3jmLIMvVkLRZ7zW8,13339
|
33
33
|
siat/esg.py,sha256=GMhaonIKtvOK83rhpQUH5aJt2OL3HQBSVfD__Yw-0oo,19040
|
34
34
|
siat/esg_test.py,sha256=Z9m6GUt8O7oHZSEG9aDYpGdvvrv2AiRJdHTiU6jqmZ0,2944
|
35
|
-
siat/event_study.py,sha256=
|
35
|
+
siat/event_study.py,sha256=Q_AdnJzxxL6udCjn5LP6rdhOngsDRWPu5udFkK1CJZw,32223
|
36
36
|
siat/exchange_bond_china.pickle,sha256=zDqdPrFacQ0nqjP_SuF6Yy87EgijIRsFvFroW7FAYYY,1265092
|
37
37
|
siat/fama_french.py,sha256=aUTC-67t_CEPbLk4u79woW_zfZ7OCP6Fo4z5EdWCSkQ,48051
|
38
38
|
siat/fama_french_test.py,sha256=M4O23lBKsJxhWHRluwCb3l7HSEn3OFTjzGMpehcevRg,4678
|
@@ -141,8 +141,8 @@ siat/valuation_china.py,sha256=CVp1IwIsF3Om0J29RGkyxZLt4n9Ug-ua_RKhLwL9fUQ,69624
|
|
141
141
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
142
142
|
siat/var_model_validation.py,sha256=R0caWnuZarrRg9939hxh3vJIIpIyPfvelYmzFNZtPbo,14910
|
143
143
|
siat/yf_name.py,sha256=r0Q67cSMMlfebEkI9h9pdGlJCooEq7hw_3M5IUs4cSI,20081
|
144
|
-
siat-3.7.
|
145
|
-
siat-3.7.
|
146
|
-
siat-3.7.
|
147
|
-
siat-3.7.
|
148
|
-
siat-3.7.
|
144
|
+
siat-3.7.4.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
|
145
|
+
siat-3.7.4.dist-info/METADATA,sha256=Z5_tRV4Qco5cFw7n0OY1MUd17AVse6nzSrziWnY9PMI,8009
|
146
|
+
siat-3.7.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
147
|
+
siat-3.7.4.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
148
|
+
siat-3.7.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|