siat 3.2.2__py3-none-any.whl → 3.2.3__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
@@ -1442,6 +1442,9 @@ def portfolio_es_alpha(pf_info,simulation=1000,RF=0):
1442
1442
  mkt1=pd.DataFrame(mkt['Mkt'])
1443
1443
 
1444
1444
  stock_return0m=pd.merge(stock_return0,mkt1,how='left',left_index=True,right_index=True)
1445
+ #必须舍弃空值,否则下面的回归将得不到系数!!!
1446
+ stock_return0m.dropna(inplace=True)
1447
+
1445
1448
  #处理期间内无风险利率
1446
1449
  """
1447
1450
  if RF:
@@ -1492,8 +1495,7 @@ def portfolio_es_alpha(pf_info,simulation=1000,RF=0):
1492
1495
  stock_return['pReta']=(1+stock_return['pRet'])**252 - 1
1493
1496
  stock_return['Mkta']=(1+stock_return['Mkt'])**252 - 1
1494
1497
  """
1495
- #回归求截距项作为阿尔法指数
1496
-
1498
+ #回归求截距项作为阿尔法指数:参与回归的变量不能有空值,否则回归系数将为空值!!!
1497
1499
  (beta,alpha,_,_,_)=stats.linregress(stock_return['Mkt'],stock_return['pRet'])
1498
1500
  """
1499
1501
  mean_return=stock_return[tickerlist].mul(random_weight,axis=1).sum(axis=1).mean(axis=0)
@@ -1938,7 +1940,9 @@ if __name__=='__main__':
1938
1940
 
1939
1941
 
1940
1942
  #==============================================================================
1941
-
1943
+ if __name__=='__main__':
1944
+ graph=True; convex_hull=False
1945
+
1942
1946
  def portfolio_optimize_alpha(es_info,graph=True,convex_hull=False):
1943
1947
  """
1944
1948
  功能:计算投资组合的最高詹森阿尔法组合,并绘图
@@ -2020,7 +2024,9 @@ def portfolio_optimize_treynor(es_info,graph=True,convex_hull=False):
2020
2024
  return name_hiret,hiret_weights,name_lorisk,lorisk_weights,portfolio_returns
2021
2025
 
2022
2026
  #==============================================================================
2023
-
2027
+ if __name__=='__main__':
2028
+ col_ratio,col_y,col_x,name_hiret,name_lorisk,colorbartxt,title_ext,ylabeltxt,x_axis_name= \
2029
+ ('Sharpe', 'alpha', 'beta', 'MAR', 'GMBA', '阿尔法指数', '阿尔法指数', '阿尔法指数', '贝塔系数')
2024
2030
 
2025
2031
  def portfolio_optimize_rar(es_info,col_ratio,col_y,col_x,name_hiret,name_lorisk, \
2026
2032
  colorbartxt,title_ext,ylabeltxt,x_axis_name,graph=True, \
@@ -2132,6 +2138,7 @@ if __name__=='__main__':
2132
2138
 
2133
2139
  RF=0
2134
2140
  graph=True;hirar_return=False;lorisk=True
2141
+ convex_hull=False
2135
2142
 
2136
2143
  def portfolio_optimize(pf_info,ratio='sharpe',simulation=10000,RF=0, \
2137
2144
  graph=True,hirar_return=False,lorisk=True,convex_hull=False):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siat
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: Securities Investment Analysis Tools (siat)
5
5
  Home-page: https://pypi.org/project/siat/
6
6
  Author: Prof. WANG Dehong, International Business School, Beijing Foreign Studies University
@@ -67,7 +67,7 @@ siat/local_debug_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
67
67
  siat/market_china.py,sha256=nabx24qm7N51OafTrwUw542pNeFJ3JaQ1wqyv-nLN5I,37883
68
68
  siat/markowitz.py,sha256=c06gCRhMABnrb30F-npJsKVv8nFfEoNNR3bzrkMCyGg,97406
69
69
  siat/markowitz2-20240620.py,sha256=irZAPnjaatFsKQmFRMENP-cO6bEUl2narYtkU5NKTWI,108019
70
- siat/markowitz2.py,sha256=0FfGv8JzBWTjq3mjCDmT5K-lqpW6RvIggFD4h4SAGzM,109539
70
+ siat/markowitz2.py,sha256=yu3I90RQUxk8k8D7kCa7b0wNfckOjKWHQZNTUq8512o,110060
71
71
  siat/markowitz_ccb_test.py,sha256=xBkkoaNHdq9KSUrNuHGgKTdNYUvgi84kNYcf719eoyE,1593
72
72
  siat/markowitz_ef_test.py,sha256=wjNlICkgRIqnonPeSIHo4Mu2GRtb9dr21wDt2kMNEcI,4032
73
73
  siat/markowitz_old.py,sha256=Lf7O_4QWT8RsdkHiUyc_7kKY3eZjKDtFR89Fz3pwYnY,33046
@@ -136,7 +136,7 @@ siat/valuation.py,sha256=NKfeZMdDJOW42oLVHob6eSVBXUqlN1OCnnzwyGAst8c,48855
136
136
  siat/valuation_china.py,sha256=EkZQaVkoBjM0c4MCNbaX-bMnlG0e3FXeaWczZDnkptU,67784
137
137
  siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
138
138
  siat/var_model_validation.py,sha256=f-oDewg7bPzyNanz_Y_jLH68NowAA3gXFehW_weKGG0,14898
139
- siat-3.2.2.dist-info/METADATA,sha256=kYXGiGAqJnm-hrtVardCgjNQ1A7SvjHoNTEudqWWV1Q,1447
140
- siat-3.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
141
- siat-3.2.2.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
142
- siat-3.2.2.dist-info/RECORD,,
139
+ siat-3.2.3.dist-info/METADATA,sha256=GB36cl3udD6IE5Vaaah6WH_nNbjjruc60CRXLHwliB8,1447
140
+ siat-3.2.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
141
+ siat-3.2.3.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
142
+ siat-3.2.3.dist-info/RECORD,,
File without changes