siat 3.7.26__py3-none-any.whl → 3.7.27__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 +20 -2
- siat/common.py +5 -0
- siat/markowitz.py +16 -7
- {siat-3.7.26.dist-info → siat-3.7.27.dist-info}/METADATA +1 -1
- {siat-3.7.26.dist-info → siat-3.7.27.dist-info}/RECORD +8 -8
- {siat-3.7.26.dist-info → siat-3.7.27.dist-info}/LICENSE +0 -0
- {siat-3.7.26.dist-info → siat-3.7.27.dist-info}/WHEEL +0 -0
- {siat-3.7.26.dist-info → siat-3.7.27.dist-info}/top_level.txt +0 -0
siat/__init__.py
CHANGED
@@ -14,7 +14,25 @@ from siat.allin import *
|
|
14
14
|
|
15
15
|
import pkg_resources
|
16
16
|
current_version=pkg_resources.get_distribution("siat").version
|
17
|
-
current_list=current_version.split('.')
|
18
|
-
|
17
|
+
#current_list=current_version.split('.')
|
18
|
+
|
19
|
+
#==============================================================================
|
20
|
+
# 处理stooq.py修复问题
|
21
|
+
restart=False
|
22
|
+
try:
|
23
|
+
with open('fix_package.pkl','rb') as file:
|
24
|
+
siat_ver=pickle.load(file)
|
25
|
+
if siat_ver != current_version:
|
26
|
+
restart=True
|
27
|
+
except:
|
28
|
+
restart=True
|
29
|
+
with open('fix_package.pkl','wb') as file:
|
30
|
+
pickle.dump(current_version,file)
|
31
|
+
|
32
|
+
if not restart:
|
33
|
+
print("Successfully enabled siat v{}".format(current_version))
|
34
|
+
else:
|
35
|
+
fix_package()
|
36
|
+
#print("Please RESTART Python kernel since siat is newly installed or upgraded")
|
19
37
|
|
20
38
|
#==============================================================================
|
siat/common.py
CHANGED
@@ -60,6 +60,8 @@ def text_lang(txtcn,txten):
|
|
60
60
|
else: txt=txten
|
61
61
|
|
62
62
|
return txt
|
63
|
+
|
64
|
+
|
63
65
|
#==============================================================================
|
64
66
|
"""
|
65
67
|
def today():
|
@@ -2928,6 +2930,9 @@ def fix_package(file='stooq.py',package='pandas_datareader'):
|
|
2928
2930
|
|
2929
2931
|
return
|
2930
2932
|
|
2933
|
+
|
2934
|
+
|
2935
|
+
|
2931
2936
|
#==============================================================================
|
2932
2937
|
if __name__=='__main__':
|
2933
2938
|
file='stock_info.pickle'
|
siat/markowitz.py
CHANGED
@@ -2150,11 +2150,19 @@ if __name__=='__main__':
|
|
2150
2150
|
def cm2inch(x,y):
|
2151
2151
|
return x/2.54,y/2.54
|
2152
2152
|
|
2153
|
-
def security_correlation(tickers,start,end,info_type='Close'):
|
2153
|
+
def security_correlation(tickers,start='L5Y',end='today',info_type='Close'):
|
2154
2154
|
"""
|
2155
|
+
===========================================================================
|
2155
2156
|
功能:股票/指数收盘价之间的相关性
|
2156
|
-
|
2157
|
+
参数:
|
2158
|
+
tickers:指标列表,至少两个
|
2159
|
+
start:起始日期,格式YYYY-MM-DD,支持简易格式
|
2160
|
+
end:截止日期
|
2161
|
+
info_type:指标的数值类型,默认'Close', 还可为Open/High/Low/Volume
|
2157
2162
|
"""
|
2163
|
+
|
2164
|
+
start,end=start_end_preprocess(start,end)
|
2165
|
+
|
2158
2166
|
info_types=['Close','Open','High','Low','Volume']
|
2159
2167
|
info_types_cn=['收盘价','开盘价','最高价','最低价','成交量']
|
2160
2168
|
if not(info_type in info_types):
|
@@ -2197,7 +2205,8 @@ def security_correlation(tickers,start,end,info_type='Close'):
|
|
2197
2205
|
|
2198
2206
|
|
2199
2207
|
#fig = plt.figure(figsize=(cm2inch(16,12)))
|
2200
|
-
fig = plt.figure(figsize=(cm2inch(12,
|
2208
|
+
#fig = plt.figure(figsize=(cm2inch(12,6)))
|
2209
|
+
fig = plt.figure(figsize=(12.8,7.2))
|
2201
2210
|
ax1 = plt.gca()
|
2202
2211
|
|
2203
2212
|
#构造mask,去除重复数据显示
|
@@ -2210,7 +2219,7 @@ def security_correlation(tickers,start,end,info_type='Close'):
|
|
2210
2219
|
im1 = sns.heatmap(df_coor,annot=True,cmap="YlGnBu"
|
2211
2220
|
, mask=mask#构造mask,去除重复数据显示
|
2212
2221
|
,vmax=1,vmin=-1
|
2213
|
-
, fmt='.2f',ax = ax1,annot_kws={"size":
|
2222
|
+
, fmt='.2f',ax = ax1,annot_kws={"size": 5})
|
2214
2223
|
|
2215
2224
|
ax1.tick_params(axis = 'both', length=0)
|
2216
2225
|
|
@@ -2259,8 +2268,8 @@ def security_correlation(tickers,start,end,info_type='Close'):
|
|
2259
2268
|
elif pv< 0.001:
|
2260
2269
|
ax1.text(n+widthx,m+widthy,'***',ha = 'center',color = 'k',fontdict=font_dict)
|
2261
2270
|
|
2262
|
-
plt.title("
|
2263
|
-
plt.tick_params(labelsize=
|
2271
|
+
plt.title("序列相关性分析:"+info_type_cn)
|
2272
|
+
plt.tick_params(labelsize=5)
|
2264
2273
|
|
2265
2274
|
footnote1="\n显著性数值:***非常显著(<0.001),**很显著(<0.01),*显著(<0.05),其余为不显著"
|
2266
2275
|
footnote2="\n系数绝对值:>=0.8极强相关,0.6-0.8强相关,0.4-0.6相关,0.2-0.4弱相关,否则为极弱(不)相关"
|
@@ -2269,7 +2278,7 @@ def security_correlation(tickers,start,end,info_type='Close'):
|
|
2269
2278
|
import datetime as dt; stoday=dt.date.today()
|
2270
2279
|
footnote4=";数据来源:Sina/EM/Stooq/Yahoo,"+str(stoday)
|
2271
2280
|
|
2272
|
-
fontxlabel={'size':
|
2281
|
+
fontxlabel={'size':5}
|
2273
2282
|
plt.xlabel(footnote1+footnote2+footnote3+footnote4,fontxlabel)
|
2274
2283
|
#plt.xticks(rotation=45)
|
2275
2284
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
siat/__init__ -20240701.py,sha256=gP5uajXnJesnH5SL0ZPwq_Qhv59AG1bs4qwZv26Fo2Y,2894
|
2
|
-
siat/__init__.py,sha256=
|
2
|
+
siat/__init__.py,sha256=dJlkoRbcOHt295ND-oiRIPHcV37ZY0dap3wUNRgkm5g,1325
|
3
3
|
siat/__init__.py.backup_20250214.py,sha256=pIo4CV3lNPKIhitmhIh_6aAfZrmzQWGNDcEnvZ7GXoc,3216
|
4
4
|
siat/allin.py,sha256=x1QC29PUBUYiA6IAbQKbRvtxIEUOBx8dy5k7zh1ABT4,2970
|
5
5
|
siat/alpha_vantage_test.py,sha256=tKr-vmuFH3CZAqwmISz6jzjPHzV1JJl3sPfZdz8aTfM,747
|
@@ -19,7 +19,7 @@ siat/capm_beta.py,sha256=cxXdRVBQBllhbfz1LeTJAIWvyRYhW54nhtNUXv4HwS0,29063
|
|
19
19
|
siat/capm_beta2.py,sha256=-ZYYp1HK7SkfTR3vBKZ0QVC4Q_tbST2O4MGbX_V77J0,32031
|
20
20
|
siat/capm_beta_test.py,sha256=ImR0c5mc4hIl714XmHztdl7qg8v1E2lycKyiqnFj6qs,1745
|
21
21
|
siat/cmat_commons.py,sha256=Nj9Kf0alywaztVoMVeVVL_EZk5jRERJy8R8kBw88_Tg,38116
|
22
|
-
siat/common.py,sha256=
|
22
|
+
siat/common.py,sha256=IkeZU6i-F0cv7pnrMtZjYUegk1B2jaD_ULmLD_SJZv0,179357
|
23
23
|
siat/compare_cross.py,sha256=3iP9TH2h3w27F2ARZc7FjKcErYCzWRc-TPiymOyoVtw,24171
|
24
24
|
siat/compare_cross_test.py,sha256=xra5XYmQGEtfIZL2h-GssdH2hLdFIhG3eoCrkDrL3gY,3473
|
25
25
|
siat/concepts_iwencai.py,sha256=m1YEDtECRT6FqtzlKm91pt2I9d3Z_XoP59BtWdRdu8I,3061
|
@@ -70,7 +70,7 @@ siat/holding_risk_test.py,sha256=FRlw_9wFG98BYcg_cSj95HX5WZ1TvkGaOUdXD7-V86s,474
|
|
70
70
|
siat/local_debug_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
71
71
|
siat/luchy_draw.py,sha256=8Ue-NKnvSVqINPY1eXat0NJat5MR-gex_K62aOYFdmA,20486
|
72
72
|
siat/market_china.py,sha256=fQjAFyu4JAqtVA8I1QYfzv0fmYhLP3zoNe5Ftk63qgM,50724
|
73
|
-
siat/markowitz.py,sha256=
|
73
|
+
siat/markowitz.py,sha256=dpfBK7myua83wQVqebP8Z1Qv0A5U_7nmocnQDFR5dJY,97988
|
74
74
|
siat/markowitz2-20240620.py,sha256=irZAPnjaatFsKQmFRMENP-cO6bEUl2narYtkU5NKTWI,108019
|
75
75
|
siat/markowitz2.py,sha256=s7-E43VskzSsPpZXQVBe3VTR1AM81EDIn_uVZn3mLpw,122525
|
76
76
|
siat/markowitz_ccb_test.py,sha256=xBkkoaNHdq9KSUrNuHGgKTdNYUvgi84kNYcf719eoyE,1593
|
@@ -143,8 +143,8 @@ siat/valuation_china.py,sha256=CVp1IwIsF3Om0J29RGkyxZLt4n9Ug-ua_RKhLwL9fUQ,69624
|
|
143
143
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
144
144
|
siat/var_model_validation.py,sha256=R0caWnuZarrRg9939hxh3vJIIpIyPfvelYmzFNZtPbo,14910
|
145
145
|
siat/yf_name.py,sha256=laNKMTZ9hdenGX3IZ7G0a2RLBKEWtUQJFY9CWuk_fp8,24058
|
146
|
-
siat-3.7.
|
147
|
-
siat-3.7.
|
148
|
-
siat-3.7.
|
149
|
-
siat-3.7.
|
150
|
-
siat-3.7.
|
146
|
+
siat-3.7.27.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
|
147
|
+
siat-3.7.27.dist-info/METADATA,sha256=BDILw2YFXymfHmWlCydzSOFqu2QwznLKRsKqW-eLK58,8321
|
148
|
+
siat-3.7.27.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
149
|
+
siat-3.7.27.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
150
|
+
siat-3.7.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|