siat 3.7.26__py3-none-any.whl → 3.7.28__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 +35 -2
- siat/common.py +5 -0
- siat/economy.py +115 -11
- siat/markowitz.py +16 -7
- siat/markowitz2.py +27 -11
- siat/translate.py +18 -18
- {siat-3.7.26.dist-info → siat-3.7.28.dist-info}/METADATA +1 -1
- {siat-3.7.26.dist-info → siat-3.7.28.dist-info}/RECORD +11 -11
- {siat-3.7.26.dist-info → siat-3.7.28.dist-info}/LICENSE +0 -0
- {siat-3.7.26.dist-info → siat-3.7.28.dist-info}/WHEEL +0 -0
- {siat-3.7.26.dist-info → siat-3.7.28.dist-info}/top_level.txt +0 -0
siat/__init__.py
CHANGED
@@ -14,7 +14,40 @@ 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
|
+
with open('fix_package.pkl','wb') as file:
|
28
|
+
pickle.dump(current_version,file)
|
29
|
+
|
30
|
+
except:
|
31
|
+
restart=True
|
32
|
+
with open('fix_package.pkl','wb') as file:
|
33
|
+
pickle.dump(current_version,file)
|
34
|
+
|
35
|
+
#屏蔽函数内print信息输出的类
|
36
|
+
import os, sys
|
37
|
+
class HiddenPrints:
|
38
|
+
def __enter__(self):
|
39
|
+
self._original_stdout = sys.stdout
|
40
|
+
sys.stdout = open(os.devnull, 'w')
|
41
|
+
|
42
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
43
|
+
sys.stdout.close()
|
44
|
+
sys.stdout = self._original_stdout
|
45
|
+
|
46
|
+
if not restart:
|
47
|
+
print("Successfully enabled siat v{}".format(current_version))
|
48
|
+
else:
|
49
|
+
with HiddenPrints():
|
50
|
+
fix_package()
|
51
|
+
print("Please RESTART Python kernel and run this command again after installed or upgraded siat")
|
19
52
|
|
20
53
|
#==============================================================================
|
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/economy.py
CHANGED
@@ -197,7 +197,8 @@ if __name__=='__main__':
|
|
197
197
|
|
198
198
|
|
199
199
|
|
200
|
-
def
|
200
|
+
def economy_trend0(ticker='China',start='L10Y',end='today',indicator='GDP', \
|
201
|
+
datatag=False,power=0, \
|
201
202
|
zeroline=False,yline=999,facecolor='papayawhip'):
|
202
203
|
"""
|
203
204
|
===========================================================================
|
@@ -215,11 +216,15 @@ def economy_trend(start,end,scope='China',factor='GDP',datatag=False,power=0, \
|
|
215
216
|
|
216
217
|
若需比较两个经济体的同一个指标,或同意经济体的两个指标,可用compare_economy
|
217
218
|
"""
|
219
|
+
|
220
|
+
start,end=start_end_preprocess(start,end)
|
218
221
|
#检查日期期间的合理性
|
219
222
|
valid,_,_=check_period(start,end)
|
220
223
|
if not valid:
|
221
224
|
print(' Error(trend_economy): period not valid:',start,end)
|
222
225
|
return
|
226
|
+
|
227
|
+
scope=ticker; factor=indicator
|
223
228
|
|
224
229
|
#获取指标
|
225
230
|
ds=get_econ_factors(start,end,scope,factor)
|
@@ -286,7 +291,8 @@ if __name__=='__main__':
|
|
286
291
|
power=0; twinx=False; loc1='upper left'; loc2='lower right'
|
287
292
|
|
288
293
|
|
289
|
-
def compare_economy(
|
294
|
+
def compare_economy(ticker,indicator='GDP',start='L10Y',end='today', \
|
295
|
+
power=0,twinx=False, \
|
290
296
|
yline=999, \
|
291
297
|
loc1='upper left',loc2='lower right',facecolor='papayawhip'):
|
292
298
|
"""
|
@@ -308,8 +314,9 @@ def compare_economy(tickers,measures,start,end,power=0,twinx=False, \
|
|
308
314
|
loc2:图例2的位置,默认右下角'lower right'
|
309
315
|
facecolor:背景颜色,默认'papayawhip'
|
310
316
|
"""
|
311
|
-
|
312
|
-
todate=end
|
317
|
+
start,end=start_end_preprocess(start,end)
|
318
|
+
fromdate=start; todate=end
|
319
|
+
tickers=ticker; measures=indicator
|
313
320
|
|
314
321
|
DEBUG=False
|
315
322
|
if DEBUG:
|
@@ -526,6 +533,57 @@ if __name__ =="__main__":
|
|
526
533
|
df=compare_economy('Japan',['Real GDP','Real GDP Per Capita'],fromdate,todate,twinx=True)
|
527
534
|
df=compare_economy('Israel',['Real GDP','Real GDP Per Capita'],fromdate,todate,twinx=True)
|
528
535
|
|
536
|
+
#==============================================================================
|
537
|
+
|
538
|
+
def economy_trend(ticker='China',indicator='GDP',start='L10Y',end='today', \
|
539
|
+
power=0,twinx=False, \
|
540
|
+
attention_value=999,datatag=False,zeroline=False, \
|
541
|
+
loc1='upper left',loc2='lower right',facecolor='papayawhip'):
|
542
|
+
"""
|
543
|
+
===========================================================================
|
544
|
+
功能:宏观经济指标趋势分析,支持单个国家单指标、单个国家双指标、两个国家单指标。
|
545
|
+
主要参数:
|
546
|
+
ticker:经济体名称,默认'China'。如果是列表且内含两个经济体名称,则比较两个国家的
|
547
|
+
同一个指标
|
548
|
+
indicator:宏观经济指标,默认'GDP'。如果ticker为一个经济体,而indicator为列表且
|
549
|
+
有两个指标,则比较一个国家的两个指标。如果两个判断互相矛盾,以第一个为准
|
550
|
+
start:开始日期,格式YYYY-MM-DD,支持简易格式,默认'L10Y;;end:结束日期
|
551
|
+
power:趋势线的多项式阶数,默认0不绘制
|
552
|
+
twinx:是否使用双轴绘图法,默认False,仅在两个国家或两个指标时有效
|
553
|
+
yline:绘制纵轴水平线的数值,默认999不绘制。相当于attention_value,但仅一个数值
|
554
|
+
datatag:是否绘制折线各点数值,默认False
|
555
|
+
zeroline:是否绘制水平零线,默认False
|
556
|
+
loc1:图例1的位置,默认左上角'upper left',仅用于双国家或双指标情形
|
557
|
+
loc2:图例2的位置,默认右下角'lower right',仅用于双国家或双指标情形
|
558
|
+
facecolor:背景颜色,默认'papayawhip'
|
559
|
+
|
560
|
+
套壳函数:,economy_trend0
|
561
|
+
"""
|
562
|
+
# 判断经济体个数:优先
|
563
|
+
ticker_num=1
|
564
|
+
if isinstance(ticker,list) and len(ticker)>=2:
|
565
|
+
ticker_num=2
|
566
|
+
|
567
|
+
# 判断指标个数:次优先
|
568
|
+
indicator_num=1
|
569
|
+
if isinstance(indicator,list) and len(indicator)>=2:
|
570
|
+
indicator_num=2
|
571
|
+
|
572
|
+
if ticker_num==2 or indicator_num==2:
|
573
|
+
df=compare_economy(ticker=ticker,indicator=indicator, \
|
574
|
+
start=start,end=end, \
|
575
|
+
power=power,twinx=twinx, \
|
576
|
+
yline=attention_value, \
|
577
|
+
loc1=loc1,loc2=loc2,facecolor=facecolor)
|
578
|
+
else:
|
579
|
+
df=economy_trend0(ticker=ticker,start=start,end=end, \
|
580
|
+
indicator=indicator, \
|
581
|
+
datatag=datatag,power=power, \
|
582
|
+
zeroline=zeroline,yline=attention_value, \
|
583
|
+
facecolor=facecolor)
|
584
|
+
|
585
|
+
return df
|
586
|
+
|
529
587
|
#==============================================================================
|
530
588
|
if __name__ =="__main__":
|
531
589
|
measure='M2 MoM'
|
@@ -558,11 +616,15 @@ def econ_fin_depth(fromdate,todate,scope,power=0,graph=True):
|
|
558
616
|
#检查日期期间的合理性
|
559
617
|
valid,_,_=check_period(fromdate,todate)
|
560
618
|
if not valid:
|
561
|
-
print(' Error(econ_fin_depth): period not valid:',fromdate,todate)
|
619
|
+
print(' #Error(econ_fin_depth): period not valid:',fromdate,todate)
|
562
620
|
return None
|
563
621
|
|
564
622
|
#获取GDP,按季度,本币
|
565
|
-
gdp_qtr=get_econ_factors(fromdate,todate,scope,'
|
623
|
+
gdp_qtr=get_econ_factors(fromdate,todate,scope,'GDP')
|
624
|
+
if gdp_qtr is None:
|
625
|
+
print(f" #Error(econ_fin_depth): no GDP info found for {scope}")
|
626
|
+
return None
|
627
|
+
|
566
628
|
gdp_qtr['date']=gdp_qtr.index.date
|
567
629
|
datecvt=lambda x: str(x)[0:4]
|
568
630
|
gdp_qtr['date_str']=gdp_qtr['date'].apply(datecvt)
|
@@ -573,6 +635,10 @@ def econ_fin_depth(fromdate,todate,scope,power=0,graph=True):
|
|
573
635
|
|
574
636
|
#获取M2,按月,本币
|
575
637
|
m2_mth=get_econ_factors(fromdate,todate,scope,'M2')
|
638
|
+
if m2_mth is None:
|
639
|
+
print(f" #Error(econ_fin_depth): no M2 info found for {scope}")
|
640
|
+
return None
|
641
|
+
|
576
642
|
m2_mth['date']=m2_mth.index.date
|
577
643
|
datecvt=lambda x: str(x)[0:4]
|
578
644
|
m2_mth['date_str']=m2_mth['date'].apply(datecvt)
|
@@ -593,7 +659,7 @@ def econ_fin_depth(fromdate,todate,scope,power=0,graph=True):
|
|
593
659
|
colname='m2/gdp'
|
594
660
|
collabel="经济的金融深度"
|
595
661
|
ylabeltxt="M2/GDP比例"
|
596
|
-
titletxt=ectranslate(scope)
|
662
|
+
titletxt='经济金融深度走势:'+ectranslate(scope)
|
597
663
|
footnote="数据来源: OECD|IMF|WB|FRED"
|
598
664
|
plot_line(df,colname,collabel,ylabeltxt,titletxt,footnote,power=power)
|
599
665
|
|
@@ -617,24 +683,33 @@ def compare_efd(fromdate,todate,scopelist,power=0):
|
|
617
683
|
#检查日期期间的合理性
|
618
684
|
valid,_,_=check_period(fromdate,todate)
|
619
685
|
if not valid:
|
620
|
-
print(' Error(econ_fin_depth): period not valid:',fromdate,todate)
|
686
|
+
print(' #Error(econ_fin_depth): period not valid:',fromdate,todate)
|
621
687
|
return None,None
|
622
688
|
|
623
689
|
#检查国家列表
|
624
690
|
if isinstance(scopelist,list):
|
625
691
|
if len(scopelist) < 2:
|
626
|
-
print(" Error(compare_efd): need a list with 2 countries",scopelist)
|
692
|
+
print(" #Error(compare_efd): need a list with 2 countries",scopelist)
|
627
693
|
return None,None
|
628
694
|
scope1 = scopelist[0]; scope2 = scopelist[1]
|
629
695
|
else:
|
630
|
-
print(" Error(compare_efd): need a list with 2 countries",scopelist)
|
696
|
+
print(" #Error(compare_efd): need a list with 2 countries",scopelist)
|
631
697
|
return None,None
|
632
698
|
|
633
699
|
#计算scope1/2的efd。美国的M2指标单位是Billions Dollars
|
634
700
|
df1=econ_fin_depth(fromdate,todate,scope1,graph=False)
|
701
|
+
if df1 is None:
|
702
|
+
print(f" #Error(compare_efd): no M2/GDP info found for {scope1}")
|
703
|
+
return None,None
|
704
|
+
|
635
705
|
if scope1=='USA':
|
636
706
|
df1['m2/gdp']=df1['m2/gdp']*1000000000.0
|
707
|
+
|
637
708
|
df2=econ_fin_depth(fromdate,todate,scope2,graph=False)
|
709
|
+
if df2 is None:
|
710
|
+
print(f" #Error(compare_efd): no M2/GDP info found for {scope2}")
|
711
|
+
return None,None
|
712
|
+
|
638
713
|
if scope2=='USA':
|
639
714
|
df2['m2/gdp']=df2['m2/gdp']*1000000000.0
|
640
715
|
|
@@ -643,7 +718,7 @@ def compare_efd(fromdate,todate,scopelist,power=0):
|
|
643
718
|
colname1='m2/gdp'; colname2='m2/gdp'
|
644
719
|
label1="M2/GDP"; label2="M2/GDP"
|
645
720
|
ylabeltxt="M2/GDP比例"
|
646
|
-
titletxt='
|
721
|
+
titletxt='经济金融深度对比:'+ectranslate(scope1)+' vs '+ectranslate(scope2)
|
647
722
|
|
648
723
|
import datetime
|
649
724
|
today=datetime.date.today()
|
@@ -652,6 +727,7 @@ def compare_efd(fromdate,todate,scopelist,power=0):
|
|
652
727
|
df2,ectranslate(ticker2),colname2,label2, \
|
653
728
|
ylabeltxt,titletxt,footnote, \
|
654
729
|
power=power)
|
730
|
+
|
655
731
|
return df1,df2
|
656
732
|
|
657
733
|
if __name__=='__main__':
|
@@ -663,6 +739,34 @@ if __name__=='__main__':
|
|
663
739
|
cn,kr=compare_efd(fromdate,todate,['China','Korea'])
|
664
740
|
|
665
741
|
#==============================================================================
|
742
|
+
|
743
|
+
def efd_trend(ticker='China',start='L30Y',end='today',power=0):
|
744
|
+
"""
|
745
|
+
===========================================================================
|
746
|
+
功能:基于M2/GDP比例分析经济的金融化深度,支持单个经济体和双经济体对比
|
747
|
+
参数:
|
748
|
+
ticker:经济体名称,默认'China',可为双经济体列表
|
749
|
+
start:开始日期,格式YYYY-MM-DD,支持简易格式,默认'L30Y'
|
750
|
+
end:截止日期,默认'today'
|
751
|
+
power:趋势线的多项式阶数,默认0不绘制
|
752
|
+
"""
|
753
|
+
# 处理日期
|
754
|
+
fromdate,todate=start_end_preprocess(start,end)
|
755
|
+
|
756
|
+
ticker_num=1
|
757
|
+
if isinstance(ticker,list) and len(ticker) >= 2:
|
758
|
+
ticker_num=2
|
759
|
+
|
760
|
+
if ticker_num==1:
|
761
|
+
df=econ_fin_depth(fromdate=fromdate,todate=todate,scope=ticker,power=power)
|
762
|
+
else:
|
763
|
+
df=compare_efd(fromdate=fromdate,todate=todate,scopelist=ticker,power=power)
|
764
|
+
|
765
|
+
return df
|
766
|
+
|
767
|
+
|
768
|
+
#==============================================================================
|
769
|
+
|
666
770
|
def economy_security(scope,fromdate,todate,econ_factor,sec_ticker,loc1='upper left',loc2='lower right'):
|
667
771
|
"""
|
668
772
|
功能:比较宏观经济与证券市场之间的关联关系
|
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
|
|
siat/markowitz2.py
CHANGED
@@ -2659,11 +2659,23 @@ if __name__=='__main__':
|
|
2659
2659
|
def cm2inch(x,y):
|
2660
2660
|
return x/2.54,y/2.54
|
2661
2661
|
|
2662
|
-
def security_correlation(tickers,start,end,info_type='Close',
|
2662
|
+
def security_correlation(tickers,start='L5Y',end='today',info_type='Close', \
|
2663
|
+
facecolor='white'):
|
2663
2664
|
"""
|
2665
|
+
===========================================================================
|
2664
2666
|
功能:股票/指数收盘价之间的相关性
|
2665
|
-
|
2667
|
+
参数:
|
2668
|
+
tickers:指标列表,至少两个
|
2669
|
+
start:起始日期,格式YYYY-MM-DD,支持简易格式
|
2670
|
+
end:截止日期
|
2671
|
+
info_type:指标的数值类型,默认'Close', 还可为Open/High/Low/Volume
|
2672
|
+
facecolor:背景颜色,默认'papayawhip'
|
2673
|
+
|
2674
|
+
返回:相关系数df
|
2666
2675
|
"""
|
2676
|
+
|
2677
|
+
start,end=start_end_preprocess(start,end)
|
2678
|
+
|
2667
2679
|
info_types=['Close','Open','High','Low','Volume']
|
2668
2680
|
info_types_cn=['收盘价','开盘价','最高价','最低价','成交量']
|
2669
2681
|
if not(info_type in info_types):
|
@@ -2684,7 +2696,7 @@ def security_correlation(tickers,start,end,info_type='Close',facecolor='papayawh
|
|
2684
2696
|
sys.stdout.close()
|
2685
2697
|
sys.stdout = self._original_stdout
|
2686
2698
|
|
2687
|
-
print(" Searching for security prices, please wait
|
2699
|
+
print(" Searching for security prices, please wait ...\n")
|
2688
2700
|
with HiddenPrints():
|
2689
2701
|
prices=get_prices_simple(tickers,start,end)
|
2690
2702
|
df=prices[info_type]
|
@@ -2706,7 +2718,9 @@ def security_correlation(tickers,start,end,info_type='Close',facecolor='papayawh
|
|
2706
2718
|
|
2707
2719
|
|
2708
2720
|
#fig = plt.figure(figsize=(cm2inch(16,12)))
|
2709
|
-
fig = plt.figure(figsize=(cm2inch(12,8)))
|
2721
|
+
#fig = plt.figure(figsize=(cm2inch(12,8)))
|
2722
|
+
#fig = plt.figure(figsize=(12.8,7.2))
|
2723
|
+
fig = plt.figure(figsize=(12,6))
|
2710
2724
|
ax1 = plt.gca()
|
2711
2725
|
|
2712
2726
|
#构造mask,去除重复数据显示
|
@@ -2720,7 +2734,7 @@ def security_correlation(tickers,start,end,info_type='Close',facecolor='papayawh
|
|
2720
2734
|
, mask=mask#构造mask,去除重复数据显示
|
2721
2735
|
, vmax=1,vmin=-1
|
2722
2736
|
, cbar=False
|
2723
|
-
, fmt='.2f',ax = ax1,annot_kws={"size":
|
2737
|
+
, fmt='.2f',ax = ax1,annot_kws={"size": 16})
|
2724
2738
|
|
2725
2739
|
ax1.tick_params(axis = 'both', length=0)
|
2726
2740
|
|
@@ -2746,7 +2760,7 @@ def security_correlation(tickers,start,end,info_type='Close',facecolor='papayawh
|
|
2746
2760
|
widthy = -0.15
|
2747
2761
|
|
2748
2762
|
# 星号的大小
|
2749
|
-
font_dict={'size':
|
2763
|
+
font_dict={'size':10}
|
2750
2764
|
|
2751
2765
|
for m in ax1.get_xticks():
|
2752
2766
|
for n in ax1.get_yticks():
|
@@ -2769,8 +2783,9 @@ def security_correlation(tickers,start,end,info_type='Close',facecolor='papayawh
|
|
2769
2783
|
elif pv< 0.001:
|
2770
2784
|
ax1.text(n+widthx,m+widthy,'***',ha = 'center',color = 'k',fontdict=font_dict)
|
2771
2785
|
|
2772
|
-
plt.title(text_lang("
|
2773
|
-
plt.
|
2786
|
+
#plt.title(text_lang("时间序列相关性分析:","Time Series Correlation Analysis: ")+text_lang(info_type_cn,info_type),fontsize=16)
|
2787
|
+
plt.title(text_lang("时间序列相关性分析","Time Series Correlation Analysis"),fontsize=16)
|
2788
|
+
plt.tick_params(labelsize=10)
|
2774
2789
|
|
2775
2790
|
footnote1=text_lang("\n显著性数值:***非常显著(<0.001),**很显著(<0.01),*显著(<0.05),其余为不显著", \
|
2776
2791
|
"\nSig level: *** Extremely sig(p<0.001), ** Very sig(<0.01), * Sig(<0.05), others unsig")
|
@@ -2781,14 +2796,15 @@ def security_correlation(tickers,start,end,info_type='Close',facecolor='papayawh
|
|
2781
2796
|
import datetime as dt; stoday=dt.date.today()
|
2782
2797
|
footnote4=text_lang(";数据来源:Sina/EM/Stooq/Yahoo,",". Data source: Sina/EM/Stooq/Yahoo, ")+str(stoday)
|
2783
2798
|
|
2784
|
-
fontxlabel={'size':
|
2799
|
+
fontxlabel={'size':8}
|
2785
2800
|
plt.xlabel(footnote1+footnote2+footnote3+footnote4,fontxlabel)
|
2786
2801
|
#plt.xticks(rotation=45)
|
2787
2802
|
|
2788
2803
|
plt.gca().set_facecolor(facecolor)
|
2789
2804
|
|
2790
|
-
plt.xticks(fontsize=
|
2791
|
-
plt.
|
2805
|
+
#plt.xticks(fontsize=10, rotation=90)
|
2806
|
+
plt.xticks(fontsize=10, rotation=30)
|
2807
|
+
plt.yticks(fontsize=10, rotation=0)
|
2792
2808
|
|
2793
2809
|
plt.show()
|
2794
2810
|
|
siat/translate.py
CHANGED
@@ -1557,24 +1557,24 @@ def codetranslate0(code):
|
|
1557
1557
|
['PMSRIT.M','意大利PMI(服务业)'],
|
1558
1558
|
|
1559
1559
|
|
1560
|
-
['TRBNCN.M','
|
1561
|
-
['TRBNPH.M','
|
1562
|
-
['TRBNMY.M','
|
1563
|
-
['TRBNAU.M','
|
1564
|
-
['TRBNIN.M','
|
1565
|
-
['TRBNZA.M','
|
1566
|
-
['TRBNUS.M','
|
1567
|
-
['TRBNUK.M','
|
1568
|
-
['TRBNFR.M','
|
1569
|
-
['TRBNNL.M','
|
1570
|
-
['TRBNPT.M','
|
1571
|
-
['TRBNGR.M','
|
1572
|
-
['TRBNDE.M','
|
1573
|
-
['TRBNCH.M','
|
1574
|
-
['TRBNSE.M','
|
1575
|
-
['TRBNRO.M','
|
1576
|
-
['TRBNCZ.M','
|
1577
|
-
['TRBNEU.M','
|
1560
|
+
['TRBNCN.M','中国贸易余额(百万美元)'],['TRBNJP.M','日本贸易余额(百万美元)'],
|
1561
|
+
['TRBNPH.M','菲律宾贸易余额(百万美元)'],['TRBNSG.M','新加坡贸易余额(百万美元)'],
|
1562
|
+
['TRBNMY.M','马来西亚贸易余额(百万美元)'],
|
1563
|
+
['TRBNAU.M','澳大利亚贸易余额(百万美元)'],['TRBNNZ.M','新西兰贸易余额(百万美元)'],
|
1564
|
+
['TRBNIN.M','印度贸易余额(百万美元)'],['TRBNTR.M','土耳其贸易余额(百万美元)'],
|
1565
|
+
['TRBNZA.M','南非贸易余额(百万美元)'],
|
1566
|
+
['TRBNUS.M','美国贸易余额(百万美元)'],['TRBNMX.M','墨西哥贸易余额(百万美元)'],
|
1567
|
+
['TRBNUK.M','英国贸易余额(百万美元)'],['TRBNIE.M','爱尔兰贸易余额(百万美元)'],
|
1568
|
+
['TRBNFR.M','法国贸易余额(百万美元)'],['TRBNBE.M','比利时贸易余额(百万美元)'],
|
1569
|
+
['TRBNNL.M','荷兰贸易余额(百万美元)'],
|
1570
|
+
['TRBNPT.M','葡萄牙贸易余额(百万美元)'],['TRBNIT.M','意大利贸易余额(百万美元)'],
|
1571
|
+
['TRBNGR.M','希腊贸易余额(百万美元)'],
|
1572
|
+
['TRBNDE.M','德国贸易余额(百万美元)'],['TRBNAT.M','奥地利贸易余额(百万美元)'],
|
1573
|
+
['TRBNCH.M','瑞士贸易余额(百万美元)'],
|
1574
|
+
['TRBNSE.M','瑞典贸易余额(百万美元)'],['TRBNNO.M','挪威贸易余额(百万美元)'],
|
1575
|
+
['TRBNRO.M','罗马尼亚贸易余额(百万美元)'],['TRBNHU.M','匈牙利贸易余额(百万美元)'],
|
1576
|
+
['TRBNCZ.M','捷克贸易余额(百万美元)'],['TRBNSK.M','斯洛伐克贸易余额(百万美元)'],
|
1577
|
+
['TRBNEU.M','欧元区贸易余额(百万美元)'],['TRBNLT.M','立陶宛贸易余额(百万美元)'],
|
1578
1578
|
|
1579
1579
|
|
1580
1580
|
#有问题:同比or环比or金额?都对不上;EXPRUS与EXPYUS的差别是什么?
|
@@ -1,5 +1,5 @@
|
|
1
1
|
siat/__init__ -20240701.py,sha256=gP5uajXnJesnH5SL0ZPwq_Qhv59AG1bs4qwZv26Fo2Y,2894
|
2
|
-
siat/__init__.py,sha256=
|
2
|
+
siat/__init__.py,sha256=tX_xClvPr3TZ8t7WlUMFJnceRCQSseGnq1szeRjck8Q,1813
|
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
|
@@ -29,7 +29,7 @@ siat/cryptocurrency.py,sha256=ImkP0Z3QsKNrHrA07mZM46RvGAWb36AD14cNaiv_pCg,27829
|
|
29
29
|
siat/cryptocurrency_test.py,sha256=3AikTNJ7j-HwLGLIYEfyXZ3bLVuLeru9mwiwHQi2SdA,2669
|
30
30
|
siat/derivative.py,sha256=qV8n09799eqLc26ojR6vN5n_X-xd7rGwdYjgq-wBih8,41483
|
31
31
|
siat/economy-20230125.py,sha256=vxZZlPnLkh7SpGMVEPLwxjt0yYLSVmdZrO-s2NYLyoM,73848
|
32
|
-
siat/economy.py,sha256=
|
32
|
+
siat/economy.py,sha256=BFVQDxOTbuizyumpCgpZIauH6sqnwUXebpqRMmQCzys,84198
|
33
33
|
siat/economy_test.py,sha256=6vjNlPz7W125pJb7simCddobSEp3jmLIMvVkLRZ7zW8,13339
|
34
34
|
siat/esg.py,sha256=GMhaonIKtvOK83rhpQUH5aJt2OL3HQBSVfD__Yw-0oo,19040
|
35
35
|
siat/esg_test.py,sha256=Z9m6GUt8O7oHZSEG9aDYpGdvvrv2AiRJdHTiU6jqmZ0,2944
|
@@ -70,9 +70,9 @@ 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
|
-
siat/markowitz2.py,sha256=
|
75
|
+
siat/markowitz2.py,sha256=svek5sWRbrFUA1DNEI0RQktMlUPeSoEKAsSLOFJNRlg,123177
|
76
76
|
siat/markowitz_ccb_test.py,sha256=xBkkoaNHdq9KSUrNuHGgKTdNYUvgi84kNYcf719eoyE,1593
|
77
77
|
siat/markowitz_ef_test.py,sha256=wjNlICkgRIqnonPeSIHo4Mu2GRtb9dr21wDt2kMNEcI,4032
|
78
78
|
siat/markowitz_old.py,sha256=Lf7O_4QWT8RsdkHiUyc_7kKY3eZjKDtFR89Fz3pwYnY,33046
|
@@ -134,7 +134,7 @@ siat/transaction_test.py,sha256=Z8g1LJCN4-mnUByXMUMoFmN0t105cbmsz2QmvSuIkbU,1858
|
|
134
134
|
siat/translate-20230125.py,sha256=NPPSXhT38s5t9fzMvl_fvi4ckSB73ThLmZetVI-xGdU,117953
|
135
135
|
siat/translate-20230206.py,sha256=-vtI125WyaJhmPotOpDAmclt_XnYVaWU9ByLWZ6FyYE,118133
|
136
136
|
siat/translate-20230215.py,sha256=TJgtPE3n8IjljmZ4Pefy8dmHoNdFF-1zpML6BhA9FKE,121657
|
137
|
-
siat/translate.py,sha256=
|
137
|
+
siat/translate.py,sha256=lIT0MO9QwhGaHipDK0p7_evOJN3e5wwKlCqv8Vebvto,251987
|
138
138
|
siat/translate_20240606.py,sha256=63IyHWEU3Uz9mjwyuAX3fqY4nUMdwh0ICQAgmgPXP7Y,215121
|
139
139
|
siat/translate_241003_keep.py,sha256=un7Fqe1v35MXsja5exZgjmLzrZtt66NARZIGlyFuGGU,218747
|
140
140
|
siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
@@ -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.28.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
|
147
|
+
siat-3.7.28.dist-info/METADATA,sha256=4kVtKwGVnpVtaWBWbl0PuPiWcclWxuzhtt3ndREUq7o,8321
|
148
|
+
siat-3.7.28.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
149
|
+
siat-3.7.28.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
150
|
+
siat-3.7.28.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|