siat 3.7.6__py3-none-any.whl → 3.7.7__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/__init__.py +55 -33
- siat/markowitz2.py +12 -12
- siat/security_prices.py +8 -0
- {siat-3.7.6.dist-info → siat-3.7.7.dist-info}/METADATA +1 -1
- {siat-3.7.6.dist-info → siat-3.7.7.dist-info}/RECORD +8 -8
- {siat-3.7.6.dist-info → siat-3.7.7.dist-info}/LICENSE +0 -0
- {siat-3.7.6.dist-info → siat-3.7.7.dist-info}/WHEEL +0 -0
- {siat-3.7.6.dist-info → siat-3.7.7.dist-info}/top_level.txt +0 -0
siat/__init__.py
CHANGED
@@ -10,42 +10,64 @@
|
|
10
10
|
#屏蔽所有警告性信息
|
11
11
|
import warnings; warnings.filterwarnings('ignore')
|
12
12
|
#==============================================================================
|
13
|
-
from siat.allin import *
|
14
|
-
#==============================================================================
|
15
|
-
#同一命令行多个输出,主要用于Jupyter Notebook
|
16
|
-
from IPython.core.interactiveshell import InteractiveShell
|
17
|
-
InteractiveShell.ast_node_interactivity='all'
|
18
|
-
#==============================================================================
|
19
|
-
# 检查是否存在新版本
|
20
|
-
check_newer_version=False
|
21
|
-
|
22
13
|
try:
|
23
|
-
import
|
24
|
-
|
25
|
-
|
26
|
-
print("
|
14
|
+
from siat.allin import *
|
15
|
+
success=True
|
16
|
+
except:
|
17
|
+
print(" #Warning: failed to enable siat!")
|
18
|
+
import sys; version=sys.version
|
19
|
+
version_list=version.split('|')
|
20
|
+
python_version=version_list[0].strip()
|
21
|
+
python_version_list=python_version.split('.')
|
22
|
+
python_version2="{0}.{1}".format(python_version_list[0],python_version_list[1])
|
23
|
+
|
24
|
+
if python_version2 < '3.11':
|
25
|
+
print(" Solution: your Python version is {0}, suggest upgrade to {1} or above".format(python_version2,'3.11'))
|
26
|
+
elif python_version2 < '3.12':
|
27
|
+
print(" Solution: your Python version is {0}, suggest upgrade to {1} or above".format(python_version2,'3.12'))
|
28
|
+
else:
|
29
|
+
print(" Solution: your Python version is {}, suggest upgrade to the newest one".format(python_version2))
|
30
|
+
|
31
|
+
success=False
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
if int(current_list[i]) < int(latest_list[i]):
|
37
|
-
newest=False
|
38
|
-
|
39
|
-
if not newest:
|
40
|
-
#print("The latest version of siat is",latest_version,'\n')
|
41
|
-
print("There is a newer version of siat",latest_version,'\n')
|
42
|
-
print("*** How to upgrade siat?")
|
43
|
-
print("Upgrade from official website? Command: upgrade_siat()")
|
44
|
-
print("Upgrade from Tsinghua? Command: upgrade_siat(alternative='tsinghua')")
|
45
|
-
print("Upgrade from Alibaba? Command: upgrade_siat(alternative='alibaba')")
|
33
|
+
if success:
|
34
|
+
#==============================================================================
|
35
|
+
#同一命令行多个输出,主要用于Jupyter Notebook
|
36
|
+
from IPython.core.interactiveshell import InteractiveShell
|
37
|
+
InteractiveShell.ast_node_interactivity='all'
|
38
|
+
#==============================================================================
|
39
|
+
# 检查是否存在新版本
|
40
|
+
check_newer_version=False
|
46
41
|
|
47
|
-
|
48
|
-
|
42
|
+
try:
|
43
|
+
import pkg_resources
|
44
|
+
current_version=pkg_resources.get_distribution("siat").version
|
45
|
+
current_list=current_version.split('.')
|
46
|
+
print("Successfully enabled siat version",current_version)
|
47
|
+
|
48
|
+
if check_newer_version:
|
49
|
+
import luddite
|
50
|
+
latest_version=luddite.get_version_pypi("siat")
|
51
|
+
latest_list=latest_version.split('.')
|
52
|
+
|
53
|
+
newest=True
|
54
|
+
for i in range(3):
|
55
|
+
#print(i)
|
56
|
+
if int(current_list[i]) < int(latest_list[i]):
|
57
|
+
newest=False
|
58
|
+
|
59
|
+
if not newest:
|
60
|
+
#print("The latest version of siat is",latest_version,'\n')
|
61
|
+
print("There is a newer version of siat",latest_version,'\n')
|
62
|
+
print("*** How to upgrade siat?")
|
63
|
+
print("Upgrade from official website? Command: upgrade_siat()")
|
64
|
+
print("Upgrade from Tsinghua? Command: upgrade_siat(alternative='tsinghua')")
|
65
|
+
print("Upgrade from Alibaba? Command: upgrade_siat(alternative='alibaba')")
|
66
|
+
|
67
|
+
except:
|
68
|
+
print(" #Warning: plugin went unexpected with either {0} or {1}".format("pkg_resources","luddite"))
|
69
|
+
print(" Solution: please re-run. If problem remains, contact the author of siat for help")
|
70
|
+
#pass
|
49
71
|
|
50
72
|
|
51
73
|
#==============================================================================
|
siat/markowitz2.py
CHANGED
@@ -961,27 +961,27 @@ def portfolio_ranks_cn(portfolio_returns,pname,facecolor='papayawhip'):
|
|
961
961
|
"风险排名":text_lang("风险排名","Risk#"), \
|
962
962
|
"年化标准差%":text_lang("年化标准差%","pa Std%"), \
|
963
963
|
"标准差变化":text_lang("标准差变化","Std%+/-"), \
|
964
|
-
"收益率/标准差":text_lang("
|
964
|
+
"收益率/标准差":text_lang("收益/风险性价比","Return/Std")}, \
|
965
965
|
inplace=True)
|
966
966
|
|
967
967
|
#重新排名:相同的值赋予相同的序号
|
968
|
-
prr2["pa Return%"]=prr2["pa Return%"].apply(lambda x: round(float(x),ndecimals))
|
969
|
-
prr2["Return#"]=prr2["pa Return%"].rank(ascending=False,method='dense')
|
970
|
-
prr2["Return#"]=prr2["Return#"].apply(lambda x: int(x))
|
968
|
+
prr2[text_lang("年化收益率%","pa Return%")]=prr2[text_lang("年化收益率%","pa Return%")].apply(lambda x: round(float(x),ndecimals))
|
969
|
+
prr2[text_lang("收益排名","Return#")]=prr2[text_lang("年化收益率%","pa Return%")].rank(ascending=False,method='dense')
|
970
|
+
prr2[text_lang("收益排名","Return#")]=prr2[text_lang("收益排名","Return#")].apply(lambda x: int(x))
|
971
971
|
|
972
|
-
prr2["pa Std%"]=prr2["pa Std%"].apply(lambda x: round(float(x),ndecimals))
|
973
|
-
prr2["Risk#"]=prr2["pa Std%"].rank(ascending=False,method='dense')
|
974
|
-
prr2["Risk#"]=prr2["Risk#"].apply(lambda x: int(x))
|
972
|
+
prr2[text_lang("年化标准差%","pa Std%")]=prr2[text_lang("年化标准差%","pa Std%")].apply(lambda x: round(float(x),ndecimals))
|
973
|
+
prr2[text_lang("风险排名","Risk#")]=prr2[text_lang("年化标准差%","pa Std%")].rank(ascending=False,method='dense')
|
974
|
+
prr2[text_lang("风险排名","Risk#")]=prr2[text_lang("风险排名","Risk#")].apply(lambda x: int(x))
|
975
975
|
|
976
|
-
prr2["Return/Std"]=prr2["Return/Std"].apply(lambda x: round(float(x),ndecimals))
|
977
|
-
prr2["Ret/Std#"]=prr2["Return/Std"].rank(ascending=False,method='dense')
|
978
|
-
prr2["Ret/Std#"]=prr2["Ret/Std#"].apply(lambda x: int(x))
|
976
|
+
prr2[text_lang("收益/风险性价比","Return/Std")]=prr2[text_lang("收益/风险性价比","Return/Std")].apply(lambda x: round(float(x),ndecimals))
|
977
|
+
prr2[text_lang("性价比排名","Ret/Std#")]=prr2[text_lang("收益/风险性价比","Return/Std")].rank(ascending=False,method='dense')
|
978
|
+
prr2[text_lang("性价比排名","Ret/Std#")]=prr2[text_lang("性价比排名","Ret/Std#")].apply(lambda x: int(x))
|
979
979
|
|
980
980
|
df_display_CSS(prr2,titletxt=titletxt,footnote='',facecolor='papayawhip',decimals=ndecimals, \
|
981
981
|
first_col_align='left',second_col_align='center', \
|
982
982
|
last_col_align='center',other_col_align='center', \
|
983
|
-
titile_font_size='15px',heading_font_size='
|
984
|
-
data_font_size='
|
983
|
+
titile_font_size='15px',heading_font_size='13px', \
|
984
|
+
data_font_size='13px')
|
985
985
|
|
986
986
|
"""
|
987
987
|
print(' ') #空一行
|
siat/security_prices.py
CHANGED
@@ -2211,8 +2211,16 @@ if __name__ =="__main__":
|
|
2211
2211
|
portfolio={'Market':('US','^GSPC'),'AAPL':1}
|
2212
2212
|
portfolio={'Market':('China','^HSI'),'0823.HK':1.0}
|
2213
2213
|
portfolio={'Market':('China','000001.SS'),'000661.SZ':2,'603392.SS':3,'300601.SZ':4}
|
2214
|
+
|
2214
2215
|
fromdate='2019-7-19'
|
2215
2216
|
todate='2020-7-20'
|
2217
|
+
|
2218
|
+
market={"Market":("China","000300.SS","我的地产组合")}
|
2219
|
+
stocks1={"600048.SS":.4,"001979":.3}
|
2220
|
+
stocks2={"600515.SS":.2,"600895":.1}
|
2221
|
+
portfolio=dict(market,**stocks1,**stocks2)
|
2222
|
+
|
2223
|
+
fromdate="2024-1-1"; todate="2024-11-25"
|
2216
2224
|
adj=False
|
2217
2225
|
source='auto'
|
2218
2226
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
siat/__init__ -20240701.py,sha256=gP5uajXnJesnH5SL0ZPwq_Qhv59AG1bs4qwZv26Fo2Y,2894
|
2
|
-
siat/__init__.py,sha256=
|
2
|
+
siat/__init__.py,sha256=pIo4CV3lNPKIhitmhIh_6aAfZrmzQWGNDcEnvZ7GXoc,3216
|
3
3
|
siat/allin.py,sha256=JLuxVmxtlOTDelnfulK6rPoFTIhzTNe5_GShXCiKGZY,2904
|
4
4
|
siat/alpha_vantage_test.py,sha256=tKr-vmuFH3CZAqwmISz6jzjPHzV1JJl3sPfZdz8aTfM,747
|
5
5
|
siat/assets_liquidity.py,sha256=o_UZdLs693uNWPEQB2OzxDH0mdWimOmq4qe_vx1pue0,28987
|
@@ -70,7 +70,7 @@ siat/luchy_draw.py,sha256=8Ue-NKnvSVqINPY1eXat0NJat5MR-gex_K62aOYFdmA,20486
|
|
70
70
|
siat/market_china.py,sha256=fQjAFyu4JAqtVA8I1QYfzv0fmYhLP3zoNe5Ftk63qgM,50724
|
71
71
|
siat/markowitz.py,sha256=DsfS6vG9TAfdJP4GgN-CCArujPi84XjD23CWbxaA2o4,97627
|
72
72
|
siat/markowitz2-20240620.py,sha256=irZAPnjaatFsKQmFRMENP-cO6bEUl2narYtkU5NKTWI,108019
|
73
|
-
siat/markowitz2.py,sha256=
|
73
|
+
siat/markowitz2.py,sha256=s7-E43VskzSsPpZXQVBe3VTR1AM81EDIn_uVZn3mLpw,122525
|
74
74
|
siat/markowitz_ccb_test.py,sha256=xBkkoaNHdq9KSUrNuHGgKTdNYUvgi84kNYcf719eoyE,1593
|
75
75
|
siat/markowitz_ef_test.py,sha256=wjNlICkgRIqnonPeSIHo4Mu2GRtb9dr21wDt2kMNEcI,4032
|
76
76
|
siat/markowitz_old.py,sha256=Lf7O_4QWT8RsdkHiUyc_7kKY3eZjKDtFR89Fz3pwYnY,33046
|
@@ -99,7 +99,7 @@ siat/sector_china.py,sha256=Mxx5Zd5qvhLdwutedwoPRoXlAopTsPww4rRhOgpRmb8,150762
|
|
99
99
|
siat/sector_china_test.py,sha256=1wq7ef8Bb_L8F0h0W6FvyBrIcBTEbrTV7hljtpj49U4,5843
|
100
100
|
siat/security_price.py,sha256=2oHskgiw41KMGfqtnA0i2YjNNV6cYgtlUK0j3YeuXWs,29185
|
101
101
|
siat/security_price2.py,sha256=FkX-EeqS5Gqm2kIKnDqrqSk_nvG3BbL3Eu4eEmw1OEY,26379
|
102
|
-
siat/security_prices.py,sha256=
|
102
|
+
siat/security_prices.py,sha256=i_4ZA7sRb9gMRVOgTT-XxQ1Jrz9eHDjZznsoXPDhh0Y,108859
|
103
103
|
siat/security_prices_test.py,sha256=OEphoJ87NPKoNow1QA8EU_5MUYrJF-qKoWKNapVfZNI,10779
|
104
104
|
siat/security_trend.py,sha256=o0vpWdrJkmODCP94X-Bvn-w7efHhj9HpUYBHtLl55D0,17240
|
105
105
|
siat/security_trend2-20240620.py,sha256=QVnEcb7AyVbO77jVqfFsJffGXrX8pgJ9xCfoAKmWBPk,24854
|
@@ -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.7.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
|
145
|
+
siat-3.7.7.dist-info/METADATA,sha256=4VE1VSyUItSI2OgG2CW5PSJ4PS7C9xZRhSt8TizioV8,8009
|
146
|
+
siat-3.7.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
147
|
+
siat-3.7.7.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
148
|
+
siat-3.7.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|