siat 3.3.10__py3-none-any.whl → 3.3.11__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/markowitz2.py
CHANGED
@@ -46,7 +46,7 @@ plt.rcParams['axes.grid']=True
|
|
46
46
|
#plt.rcParams['grid.color']='steelblue'
|
47
47
|
#plt.rcParams['grid.linestyle']='dashed'
|
48
48
|
#plt.rcParams['grid.linewidth']=0.5
|
49
|
-
#plt.rcParams['axes.facecolor']='
|
49
|
+
#plt.rcParams['axes.facecolor']='papayawhip'
|
50
50
|
|
51
51
|
#处理绘图汉字乱码问题
|
52
52
|
import sys; czxt=sys.platform
|
@@ -290,7 +290,7 @@ def portfolio_cumret(portfolio,thedate,pastyears=1, \
|
|
290
290
|
def portfolio_build(portfolio,thedate='default',pastyears=1, \
|
291
291
|
indicator='Adj Close', \
|
292
292
|
adjust='qfq',source='auto',ticker_type='auto', \
|
293
|
-
printout=
|
293
|
+
printout=False,graph=False,facecolor='papayawhip'):
|
294
294
|
"""
|
295
295
|
功能:收集投资组合成份股数据,绘制收益率趋势图,并与等权和期间内交易额加权策略组合比较
|
296
296
|
注意:此处无需RF,待到优化策略时再指定
|
@@ -611,7 +611,7 @@ def portfolio_correlate(pf_info):
|
|
611
611
|
plt.xlabel(footnote1+footnote2)
|
612
612
|
plt.xticks(rotation=90); plt.yticks(rotation=0)
|
613
613
|
|
614
|
-
plt.gca().set_facecolor('
|
614
|
+
plt.gca().set_facecolor('papayawhip')
|
615
615
|
plt.show()
|
616
616
|
|
617
617
|
return
|
@@ -656,7 +656,7 @@ def portfolio_covar(pf_info):
|
|
656
656
|
plt.xticks(rotation=90)
|
657
657
|
plt.yticks(rotation=0)
|
658
658
|
|
659
|
-
plt.gca().set_facecolor('
|
659
|
+
plt.gca().set_facecolor('papayawhip')
|
660
660
|
plt.show()
|
661
661
|
|
662
662
|
return
|
@@ -795,7 +795,7 @@ if __name__=='__main__':
|
|
795
795
|
#==============================================================================
|
796
796
|
|
797
797
|
|
798
|
-
def portfolio_ranks(portfolio_returns,pname,facecolor='
|
798
|
+
def portfolio_ranks(portfolio_returns,pname,facecolor='papayawhip'):
|
799
799
|
"""
|
800
800
|
功能:区分中英文
|
801
801
|
"""
|
@@ -812,7 +812,7 @@ def portfolio_ranks(portfolio_returns,pname,facecolor='whitesmoke'):
|
|
812
812
|
|
813
813
|
#==============================================================================
|
814
814
|
|
815
|
-
def portfolio_ranks_cn(portfolio_returns,pname,facecolor='
|
815
|
+
def portfolio_ranks_cn(portfolio_returns,pname,facecolor='papayawhip'):
|
816
816
|
"""
|
817
817
|
功能:打印现有投资组合的收益率、标准差排名,收益率降序,标准差升序,中文/英文
|
818
818
|
"""
|
@@ -986,7 +986,7 @@ def portfolio_ranks_cn(portfolio_returns,pname,facecolor='whitesmoke'):
|
|
986
986
|
dispf2=dispf.set_properties(**{'background-color':facecolor,'color':'black'})
|
987
987
|
except:
|
988
988
|
print(" #Warning(portfolio_ranks_cn): color",facecolor,"is unsupported, changed to default setting")
|
989
|
-
dispf2=dispf.set_properties(**{'background-color':'
|
989
|
+
dispf2=dispf.set_properties(**{'background-color':'papayawhip','color':'black'})
|
990
990
|
|
991
991
|
from IPython.display import display
|
992
992
|
display(dispf2)
|
@@ -1115,7 +1115,7 @@ if __name__=='__main__':
|
|
1115
1115
|
|
1116
1116
|
portfolio_eset(pf_info,simulation=50000)
|
1117
1117
|
|
1118
|
-
def portfolio_eset(pf_info,simulation=1000,convex_hull=False):
|
1118
|
+
def portfolio_eset(pf_info,simulation=1000,convex_hull=False,facecolor='papayawhip'):
|
1119
1119
|
"""
|
1120
1120
|
功能:基于随机数,生成大量可能的投资组合,计算各个投资组合的年均收益率和标准差,绘制投资组合的可行集
|
1121
1121
|
默认绘制散点图凸包:convex_hull=True
|
@@ -1248,7 +1248,7 @@ def portfolio_eset(pf_info,simulation=1000,convex_hull=False):
|
|
1248
1248
|
|
1249
1249
|
plt.xlabel(footnote1+footnote2+footnote3+footnote4,fontsize=xlabel_txt_size)
|
1250
1250
|
|
1251
|
-
plt.gca().set_facecolor(
|
1251
|
+
plt.gca().set_facecolor(facecolor)
|
1252
1252
|
plt.show()
|
1253
1253
|
|
1254
1254
|
return [pf_info,RandomPortfolios]
|
@@ -1692,7 +1692,7 @@ if __name__=='__main__':
|
|
1692
1692
|
def RandomPortfolios_plot(RandomPortfolios,col_x,col_y,colorbartxt,title_ext, \
|
1693
1693
|
ylabeltxt,x_axis_name,pname,simulation,hstart,hend, \
|
1694
1694
|
hiret_point,lorisk_point,convex_hull=True, \
|
1695
|
-
facecolor="
|
1695
|
+
facecolor="papayawhip"):
|
1696
1696
|
"""
|
1697
1697
|
功能:将生成的马科维茨可行集RandomPortfolios绘制成彩色散点图
|
1698
1698
|
"""
|
@@ -1866,7 +1866,7 @@ def cvt_portfolio_name(pname,portfolio_returns):
|
|
1866
1866
|
|
1867
1867
|
#==============================================================================
|
1868
1868
|
|
1869
|
-
def portfolio_optimize_sharpe(es_info,graph=True,convex_hull=False,facecolor='
|
1869
|
+
def portfolio_optimize_sharpe(es_info,graph=True,convex_hull=False,facecolor='papayawhip'):
|
1870
1870
|
"""
|
1871
1871
|
功能:计算投资组合的最高夏普比率组合,并绘图
|
1872
1872
|
MSR: Maximium Sharpe Rate, 最高夏普指数方案
|
@@ -1943,7 +1943,7 @@ if __name__=='__main__':
|
|
1943
1943
|
|
1944
1944
|
#==============================================================================
|
1945
1945
|
|
1946
|
-
def portfolio_optimize_sortino(es_info,graph=True,convex_hull=False,facecolor="
|
1946
|
+
def portfolio_optimize_sortino(es_info,graph=True,convex_hull=False,facecolor="papayawhip"):
|
1947
1947
|
"""
|
1948
1948
|
功能:计算投资组合的最高索替诺比率组合,并绘图
|
1949
1949
|
MSO: Maximium Sortino ratio, 最高索替诺比率方案
|
@@ -1994,7 +1994,7 @@ if __name__=='__main__':
|
|
1994
1994
|
if __name__=='__main__':
|
1995
1995
|
graph=True; convex_hull=False
|
1996
1996
|
|
1997
|
-
def portfolio_optimize_alpha(es_info,graph=True,convex_hull=False,facecolor='
|
1997
|
+
def portfolio_optimize_alpha(es_info,graph=True,convex_hull=False,facecolor='papayawhip'):
|
1998
1998
|
"""
|
1999
1999
|
功能:计算投资组合的最高詹森阿尔法组合,并绘图
|
2000
2000
|
MAR: Maximium Alpha Ratio, 最高阿尔法指数方案
|
@@ -2041,7 +2041,7 @@ if __name__=='__main__':
|
|
2041
2041
|
|
2042
2042
|
#==============================================================================
|
2043
2043
|
|
2044
|
-
def portfolio_optimize_treynor(es_info,graph=True,convex_hull=False,facecolor='
|
2044
|
+
def portfolio_optimize_treynor(es_info,graph=True,convex_hull=False,facecolor='papayawhip'):
|
2045
2045
|
"""
|
2046
2046
|
功能:计算投资组合的最高特雷诺比率组合,并绘图
|
2047
2047
|
MTR: Maximium Treynor Ratio, 最高特雷诺指数方案
|
@@ -2081,7 +2081,7 @@ if __name__=='__main__':
|
|
2081
2081
|
|
2082
2082
|
def portfolio_optimize_rar(es_info,col_ratio,col_y,col_x,name_hiret,name_lorisk, \
|
2083
2083
|
colorbartxt,title_ext,ylabeltxt,x_axis_name,graph=True, \
|
2084
|
-
convex_hull=False,facecolor='
|
2084
|
+
convex_hull=False,facecolor='papayawhip'):
|
2085
2085
|
"""
|
2086
2086
|
功能:提供rar比率优化的共同处理部分
|
2087
2087
|
基于RandomPortfolios中的随机投资组合,计算相应的指数,寻找最大指数点和风险最小点,并绘图标注两个点
|
@@ -2193,7 +2193,7 @@ if __name__=='__main__':
|
|
2193
2193
|
|
2194
2194
|
def portfolio_optimize(pf_info,ratio='sharpe',simulation=10000,RF=0, \
|
2195
2195
|
graph=True,hirar_return=False,lorisk=True, \
|
2196
|
-
convex_hull=False,facecolor='
|
2196
|
+
convex_hull=False,facecolor='papayawhip'):
|
2197
2197
|
"""
|
2198
2198
|
功能:集成式投资组合优化策略
|
2199
2199
|
注意:实验发现RF较小时对于结果的影响极其微小难以观察,默认设为不使用无风险利率调整收益
|
@@ -2402,7 +2402,7 @@ def portfolio_ef_0(stocks,fromdate,todate):
|
|
2402
2402
|
plt.figtext(x_left,y_left-0.1,'观察期间:'+str(fromdate)+'至'+str(todate))
|
2403
2403
|
plt.plot(out_std,out_mean,color='r',ls=':',lw=4)
|
2404
2404
|
|
2405
|
-
plt.gca().set_facecolor('
|
2405
|
+
plt.gca().set_facecolor('papayawhip')
|
2406
2406
|
plt.show()
|
2407
2407
|
|
2408
2408
|
return
|
@@ -2486,7 +2486,7 @@ def portfolio_ef(stocks,fromdate,todate):
|
|
2486
2486
|
plt.plot(out_std_min,out_mean_min,'g*-',markersize=16,label='风险最低点')
|
2487
2487
|
|
2488
2488
|
plt.legend(loc='best')
|
2489
|
-
plt.gca().set_facecolor('
|
2489
|
+
plt.gca().set_facecolor('papayawhip')
|
2490
2490
|
plt.show()
|
2491
2491
|
|
2492
2492
|
return
|
@@ -2631,7 +2631,7 @@ def security_correlation(tickers,start,end,info_type='Close'):
|
|
2631
2631
|
plt.xlabel(footnote1+footnote2+footnote3+footnote4,fontxlabel)
|
2632
2632
|
#plt.xticks(rotation=45)
|
2633
2633
|
|
2634
|
-
plt.gca().set_facecolor('
|
2634
|
+
plt.gca().set_facecolor('papayawhip')
|
2635
2635
|
plt.show()
|
2636
2636
|
|
2637
2637
|
return df_coor
|
@@ -69,7 +69,7 @@ siat/luchy_draw.py,sha256=8Ue-NKnvSVqINPY1eXat0NJat5MR-gex_K62aOYFdmA,20486
|
|
69
69
|
siat/market_china.py,sha256=EOO-RvdnzJThTrgNHWW3TlWhx4k4rfdjbooOnQsYdQU,50299
|
70
70
|
siat/markowitz.py,sha256=DsfS6vG9TAfdJP4GgN-CCArujPi84XjD23CWbxaA2o4,97627
|
71
71
|
siat/markowitz2-20240620.py,sha256=irZAPnjaatFsKQmFRMENP-cO6bEUl2narYtkU5NKTWI,108019
|
72
|
-
siat/markowitz2.py,sha256=
|
72
|
+
siat/markowitz2.py,sha256=IJloAP3sAotlVs1tWMUXbIu-9tX4D_Dx12pIkfFDRx4,113955
|
73
73
|
siat/markowitz_ccb_test.py,sha256=xBkkoaNHdq9KSUrNuHGgKTdNYUvgi84kNYcf719eoyE,1593
|
74
74
|
siat/markowitz_ef_test.py,sha256=wjNlICkgRIqnonPeSIHo4Mu2GRtb9dr21wDt2kMNEcI,4032
|
75
75
|
siat/markowitz_old.py,sha256=Lf7O_4QWT8RsdkHiUyc_7kKY3eZjKDtFR89Fz3pwYnY,33046
|
@@ -139,7 +139,7 @@ siat/valuation_china.py,sha256=EkZQaVkoBjM0c4MCNbaX-bMnlG0e3FXeaWczZDnkptU,67784
|
|
139
139
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
140
140
|
siat/var_model_validation.py,sha256=R0caWnuZarrRg9939hxh3vJIIpIyPfvelYmzFNZtPbo,14910
|
141
141
|
siat/yf_name.py,sha256=H1EM8YYXA8nQHIqsJlso0I3HKPiJLT3QujO4gRVQXWs,13945
|
142
|
-
siat-3.3.
|
143
|
-
siat-3.3.
|
144
|
-
siat-3.3.
|
145
|
-
siat-3.3.
|
142
|
+
siat-3.3.11.dist-info/METADATA,sha256=r7Y7j2sf7516iGiB-pbSzLRC_a0VuYCLWJ2k6zHJOrE,7310
|
143
|
+
siat-3.3.11.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
144
|
+
siat-3.3.11.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
145
|
+
siat-3.3.11.dist-info/RECORD,,
|
File without changes
|