siat 3.1.20__py3-none-any.whl → 3.1.22__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/grafix.py +3 -3
- siat/risk_adjusted_return2.py +9 -3
- siat/security_prices.py +7 -1
- siat/security_trend2.py +4 -2
- siat/stock.py +9 -5
- siat/stock_technical.py +5 -5
- siat/translate.py +2 -1
- {siat-3.1.20.dist-info → siat-3.1.22.dist-info}/METADATA +1 -1
- {siat-3.1.20.dist-info → siat-3.1.22.dist-info}/RECORD +11 -11
- {siat-3.1.20.dist-info → siat-3.1.22.dist-info}/WHEEL +0 -0
- {siat-3.1.20.dist-info → siat-3.1.22.dist-info}/top_level.txt +0 -0
siat/grafix.py
CHANGED
@@ -1204,7 +1204,7 @@ def draw_lines(df0,y_label,x_label,axhline_value,axhline_label,title_txt, \
|
|
1204
1204
|
lines = plt.gca().lines
|
1205
1205
|
last_line_color = lines[-1].get_color()
|
1206
1206
|
|
1207
|
-
if annotate:
|
1207
|
+
if annotate and (c not in ["平均值","中位数"]):
|
1208
1208
|
mark_end=False
|
1209
1209
|
df_end=dfg.tail(1)
|
1210
1210
|
# df_end[c]必须为数值类型,否则可能出错
|
@@ -1234,7 +1234,7 @@ def draw_lines(df0,y_label,x_label,axhline_value,axhline_label,title_txt, \
|
|
1234
1234
|
ha='center',va='bottom',fontsize=7)
|
1235
1235
|
|
1236
1236
|
#标记最高点/最低点
|
1237
|
-
if mark_top or mark_bottom:
|
1237
|
+
if (mark_top or mark_bottom) and (c not in ["平均值","中位数"]):
|
1238
1238
|
df_mark=dfg[[c]].copy() #避免影响原df
|
1239
1239
|
df_mark.dropna(inplace=True)
|
1240
1240
|
df_mark.sort_values(by=c,ascending=False,inplace=True)
|
@@ -1262,7 +1262,7 @@ def draw_lines(df0,y_label,x_label,axhline_value,axhline_label,title_txt, \
|
|
1262
1262
|
plt.scatter(x,y, color='seagreen',marker='8',s=70)
|
1263
1263
|
|
1264
1264
|
#标记曲线末端数值
|
1265
|
-
if mark_end:
|
1265
|
+
if mark_end and (c not in ["平均值","中位数"]):
|
1266
1266
|
df_end=dfg.tail(1)
|
1267
1267
|
y_end = df_end[c].min() # 末端的y坐标
|
1268
1268
|
x_end = df_end[c].idxmin() # 末端值的x坐标
|
siat/risk_adjusted_return2.py
CHANGED
@@ -87,6 +87,10 @@ def get_rolling_sharpe_sortino(ticker,start,end,rar_name="sharpe", \
|
|
87
87
|
pricedf,found=get_price_1ticker_mixed(ticker=ticker,fromdate=start1, \
|
88
88
|
todate=end,source=source,ticker_type=ticker_type)
|
89
89
|
|
90
|
+
if found !='Found':
|
91
|
+
print(" #Error(get_rolling_sharpe_sortino): no records found for",ticker)
|
92
|
+
return None
|
93
|
+
|
90
94
|
#计算收益率和收益率标准差
|
91
95
|
rardf1=calc_daily_return(pricedf)
|
92
96
|
rardf2=calc_rolling_return(rardf1,period=ret_period)
|
@@ -668,7 +672,7 @@ if __name__=='__main__':
|
|
668
672
|
annotate=False
|
669
673
|
mktidx='auto'; source='auto'
|
670
674
|
|
671
|
-
rars=compare_mticker_1rar(ticker=["600519.SS","000858.SZ"],start="2024-1-1",end="2024-
|
675
|
+
rars=compare_mticker_1rar(ticker=["600519.SS","000858.SZ"],start="2024-1-1",end="2024-6-16",rar='sharpe',printout=True)
|
672
676
|
|
673
677
|
def compare_mticker_1rar(ticker,start,end,rar='sharpe', \
|
674
678
|
ret_type="Annual Ret%",RF=0,regression_period=365, \
|
@@ -720,7 +724,9 @@ def compare_mticker_1rar(ticker,start,end,rar='sharpe', \
|
|
720
724
|
mktidx=mktidx,source=source,ticker_type=tt)
|
721
725
|
|
722
726
|
if df_tmp is None:
|
723
|
-
break
|
727
|
+
#break
|
728
|
+
print(" #Warning(compare_mticker_1rar): data not available for",ticker_name(t,tt),"between",start,"and",end)
|
729
|
+
continue
|
724
730
|
else:
|
725
731
|
dft=df_tmp[[rar]]
|
726
732
|
dft.rename(columns={rar:ticker_name(t,tt)},inplace=True)
|
@@ -731,7 +737,7 @@ def compare_mticker_1rar(ticker,start,end,rar='sharpe', \
|
|
731
737
|
df=pd.merge(df,dft,how='outer',left_index=True,right_index=True)
|
732
738
|
|
733
739
|
if len(df)==0:
|
734
|
-
print(" #Error(compare_mticker_1rar):
|
740
|
+
print(" #Error(compare_mticker_1rar): data not available for",ticker,"between",start,"and",end)
|
735
741
|
return None
|
736
742
|
|
737
743
|
#仅用于绘图和制表
|
siat/security_prices.py
CHANGED
@@ -1737,7 +1737,13 @@ if __name__ =="__main__":
|
|
1737
1737
|
fromdate='2018-1-1'
|
1738
1738
|
todate='2020-3-16'
|
1739
1739
|
pricedf=get_price(ticker, fromdate, todate)
|
1740
|
-
drdf=calc_daily_return(pricedf)
|
1740
|
+
drdf=calc_daily_return(pricedf)
|
1741
|
+
|
1742
|
+
eu7=['GSK','ASML','NVS','NVO','AZN','SAP','SNY']
|
1743
|
+
for ticker in eu7:
|
1744
|
+
print("Processing",ticker,"...")
|
1745
|
+
pricedf,found=get_price_1ticker_mixed(ticker,fromdate='2022-1-1',todate='2024-6-16',source='yahoo')
|
1746
|
+
dret=calc_daily_return(pricedf)
|
1741
1747
|
|
1742
1748
|
|
1743
1749
|
#==============================================================================
|
siat/security_trend2.py
CHANGED
@@ -91,7 +91,7 @@ if __name__=='__main__':
|
|
91
91
|
def security_trend(ticker,indicator='Close', \
|
92
92
|
start='default',end='default', \
|
93
93
|
|
94
|
-
|
94
|
+
attention_value='',average_value=False, \
|
95
95
|
|
96
96
|
kline=False,kline_demo=False,mav=[5,10,20], \
|
97
97
|
|
@@ -139,7 +139,7 @@ def security_trend(ticker,indicator='Close', \
|
|
139
139
|
省略时默认为最近的1个月。
|
140
140
|
end参数:指定分析的结束日期。日期格式:YYYY-mm-dd。省略时默认为今日。
|
141
141
|
|
142
|
-
|
142
|
+
attention_value参数:绘图时绘制一条水平线,用以强调一个阈值。默认不绘制。
|
143
143
|
average_value参数:开关打开时,绘图时绘制一条均值线,仅适用于绘制单条曲线。默认关闭。
|
144
144
|
|
145
145
|
kline参数:开关打开时,绘制一条K线图,仅适用于单只股票。默认关闭。
|
@@ -177,6 +177,8 @@ def security_trend(ticker,indicator='Close', \
|
|
177
177
|
source参数:指定证券基础数据来源,默认由系统决定。当系统找到的数据不理想时,可手动指定。
|
178
178
|
若指定雅虎财经数据源,需要拥有访问该网站的权限。
|
179
179
|
"""
|
180
|
+
critical_value=attention_value
|
181
|
+
|
180
182
|
portfolio_flag=False #标志:ticker中是否含有投资组合
|
181
183
|
ticker=tickers_cvt2yahoo(ticker) #支持多种形式证券代码格式
|
182
184
|
|
siat/stock.py
CHANGED
@@ -2169,12 +2169,14 @@ if __name__ =="__main__":
|
|
2169
2169
|
fromdate="2021-1-1"
|
2170
2170
|
todate="2022-9-26"
|
2171
2171
|
|
2172
|
-
def stock_dividend(ticker,
|
2172
|
+
def stock_dividend(ticker,start,end,facecolor='whitesmoke',fontcolor='black'):
|
2173
2173
|
"""
|
2174
2174
|
功能:显示股票的分红历史
|
2175
2175
|
输入:单一股票代码
|
2176
2176
|
输出:分红历史
|
2177
|
-
"""
|
2177
|
+
"""
|
2178
|
+
fromdate,todate=start,end
|
2179
|
+
|
2178
2180
|
print(" Searching for the dividend info of stock",ticker,"... ...")
|
2179
2181
|
result,startdt,enddt=check_period(fromdate,todate)
|
2180
2182
|
if not result:
|
@@ -2258,7 +2260,7 @@ def stock_dividend(ticker,fromdate,todate,facecolor='whitesmoke',fontcolor='blac
|
|
2258
2260
|
sourcetxt="数据来源: 雅虎,"
|
2259
2261
|
|
2260
2262
|
#修改列命为中文
|
2261
|
-
divprt.columns = ['序号','日期','星期','
|
2263
|
+
divprt.columns = ['序号','日期','星期','每股派息']
|
2262
2264
|
"""
|
2263
2265
|
print(divprt.to_string(index=False))
|
2264
2266
|
"""
|
@@ -2294,12 +2296,14 @@ if __name__ =="__main__":
|
|
2294
2296
|
todate='2020-6-30'
|
2295
2297
|
|
2296
2298
|
#==============================================================================
|
2297
|
-
def stock_split(ticker,
|
2299
|
+
def stock_split(ticker,start,end,facecolor='whitesmoke',fontcolor='black'):
|
2298
2300
|
"""
|
2299
2301
|
功能:显示股票的分拆历史
|
2300
2302
|
输入:单一股票代码
|
2301
2303
|
输出:分拆历史
|
2302
2304
|
"""
|
2305
|
+
fromdate,todate=start,end
|
2306
|
+
|
2303
2307
|
print(" Searching for the split info of stock",ticker,"... ...")
|
2304
2308
|
result,startdt,enddt=check_period(fromdate,todate)
|
2305
2309
|
if not result:
|
@@ -2408,7 +2412,7 @@ def stock_split(ticker,fromdate,todate,facecolor='whitesmoke',fontcolor='black')
|
|
2408
2412
|
sourcetxt="数据来源: 雅虎,"
|
2409
2413
|
|
2410
2414
|
#修改列命为中文
|
2411
|
-
divprt.columns = ['序号','日期','星期','
|
2415
|
+
divprt.columns = ['序号','日期','星期','分拆比例']
|
2412
2416
|
"""
|
2413
2417
|
print(divprt.to_string(index=False))
|
2414
2418
|
"""
|
siat/stock_technical.py
CHANGED
@@ -2451,9 +2451,8 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2451
2451
|
loc1='best',loc2='best', \
|
2452
2452
|
ticker_type='auto', \
|
2453
2453
|
|
2454
|
-
|
2455
|
-
|
2456
|
-
attention_values=[0,30,50,80]):
|
2454
|
+
attention_values=[0,30,50,80], \
|
2455
|
+
facecolor='papayawhip',price_line_color='red'):
|
2457
2456
|
"""
|
2458
2457
|
|
2459
2458
|
功能:计算和绘制证券技术分析指标的简易图,仅供进一步探索使用,仅用于单个证券(股债基)
|
@@ -2463,7 +2462,8 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2463
2462
|
支持的其他指标:不如单独的指令功能强
|
2464
2463
|
MACD、RSI、KDJ、BOLL
|
2465
2464
|
|
2466
|
-
关注的阈值:默认[0,30,50,80]
|
2465
|
+
关注的阈值:默认[0,30,50,80],attention_values=[0,30,50,80], 可以自定义,但0线一般建议保留。
|
2466
|
+
收盘价折线:默认红色虚线,price_line_color='red'
|
2467
2467
|
"""
|
2468
2468
|
#检查证券代码
|
2469
2469
|
if not isinstance(ticker,str):
|
@@ -2682,7 +2682,7 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2682
2682
|
ax2 = ax.twinx()
|
2683
2683
|
ylabeltxt2='收盘价'
|
2684
2684
|
ax2.set_ylabel(ylabeltxt2,fontsize=ylabel_txt_size)
|
2685
|
-
ax2.plot(df1.index,df1[indicator],label=ylabeltxt2,linestyle='dotted',color=
|
2685
|
+
ax2.plot(df1.index,df1[indicator],label=ylabeltxt2,linestyle='dotted',color=price_line_color)
|
2686
2686
|
ax2.legend(loc=loc2,fontsize=legend_txt_size)
|
2687
2687
|
|
2688
2688
|
titletxt=ticker_name(ticker)+': '+tech_list[technical1]+technical1
|
siat/translate.py
CHANGED
@@ -972,7 +972,8 @@ def codetranslate0(code):
|
|
972
972
|
['PHG.US','飞利浦美股'],['0LNG.UK','荷兰飞利浦'],
|
973
973
|
|
974
974
|
# 德国知名上市公司
|
975
|
-
['SAP.DE','德国思爱普'],['
|
975
|
+
['SAP.DE','德国思爱普'],['SAP','思爱普'],
|
976
|
+
['SIE.DE','西门子集团'],
|
976
977
|
['P911.DE','保时捷'],['0JHU.UK','保时捷'],
|
977
978
|
['DTE.DE','德国电信'],['ALV.DE','德国安联集团'],
|
978
979
|
['MBG.DE','奔驰汽车'],['0NXX.UK','奔驰汽车'],
|
@@ -59,7 +59,7 @@ siat/future_china.py,sha256=F-HsIf2Op8Z22RzTjet1g8COzldgnMjFNSXsAkeGyWo,17595
|
|
59
59
|
siat/future_china_test.py,sha256=BrSzmDVaOHki6rntOtosmRn-6dkfOBuLulJNqh7MOpc,1163
|
60
60
|
siat/global_index_test.py,sha256=hnFp3wqqzzL-kAP8mgxDZ54Bd5Ijf6ENi5YJlGBgcXw,2402
|
61
61
|
siat/google_authenticator.py,sha256=ZUbZR8OW0IAKDbcYtlqGqIpZdERpFor9NccFELxg9yI,1637
|
62
|
-
siat/grafix.py,sha256=
|
62
|
+
siat/grafix.py,sha256=r-tQUxxBW-O53oPUFFHO7-lnDPO0TlK78d6nsEtxSDI,85008
|
63
63
|
siat/grafix_test.py,sha256=kXvcpLgQNO7wd30g_bWljLj5UH7bIVI0_dUtXbfiKR0,3150
|
64
64
|
siat/holding_risk.py,sha256=X3vL_2rU0zpjiiRtStWxWOXZrAJ323huSsZK3jGgABc,30633
|
65
65
|
siat/holding_risk_test.py,sha256=FRlw_9wFG98BYcg_cSj95HX5WZ1TvkGaOUdXD7-V86s,474
|
@@ -85,7 +85,7 @@ siat/option_sina_api_test.py,sha256=dn-k_wrQnAaNKHoROvWJEc7lqlU0bwiV2Aa4usWAFGM,
|
|
85
85
|
siat/proxy_test.py,sha256=erQJrmGs2X46z8Gb1h-7GYQ0rTUcaR8dxHExWoBz2eM,2610
|
86
86
|
siat/quandl_test.py,sha256=EcPoXnLuqzPl5dKyVEZi3j3PJZFpsnU_iNPhLWC9p-A,1552
|
87
87
|
siat/risk_adjusted_return.py,sha256=L5FoeOFzvItT03gNBTCaIo32hUvncOJkbchtHOveSBM,54929
|
88
|
-
siat/risk_adjusted_return2.py,sha256=
|
88
|
+
siat/risk_adjusted_return2.py,sha256=PmwOvB0gJ9-v0fhTfl5lZ8eYfRwX07VsADYnSJ5iJb4,64866
|
89
89
|
siat/risk_adjusted_return_test.py,sha256=m_VHL5AtT74cJv5i7taTeTfnkX48y0AFJk5phawyYWg,3416
|
90
90
|
siat/risk_evaluation.py,sha256=I6B3gty-t--AkDCO0tKF-291YfpnF-IkXcFjqNKCt9I,76286
|
91
91
|
siat/risk_evaluation_test.py,sha256=YEXM96gKzTfwN4U61AS4Rr1tV7KgUvn4rRC6f3iMw9s,3731
|
@@ -95,13 +95,13 @@ siat/sector_china.py,sha256=keON6hxiZh_ZmnjBfz1T-cyfXkcm3pyeSiKaJYi-1JQ,118072
|
|
95
95
|
siat/sector_china_test.py,sha256=1wq7ef8Bb_L8F0h0W6FvyBrIcBTEbrTV7hljtpj49U4,5843
|
96
96
|
siat/security_price.py,sha256=2oHskgiw41KMGfqtnA0i2YjNNV6cYgtlUK0j3YeuXWs,29185
|
97
97
|
siat/security_price2.py,sha256=CbipBUH7O_tDFDkCM5u8gBCh7cbWjCMnFOy4ATvZWaI,25620
|
98
|
-
siat/security_prices.py,sha256=
|
98
|
+
siat/security_prices.py,sha256=a5U5qM5iX3Fl2GM8X1ceM5TGE5z32Q3ovMewKgE-6pg,103410
|
99
99
|
siat/security_prices_test.py,sha256=OEphoJ87NPKoNow1QA8EU_5MUYrJF-qKoWKNapVfZNI,10779
|
100
100
|
siat/security_trend.py,sha256=o0vpWdrJkmODCP94X-Bvn-w7efHhj9HpUYBHtLl55D0,17240
|
101
|
-
siat/security_trend2.py,sha256=
|
101
|
+
siat/security_trend2.py,sha256=QVnEcb7AyVbO77jVqfFsJffGXrX8pgJ9xCfoAKmWBPk,24854
|
102
102
|
siat/setup.py,sha256=up65rQGLmTBkhtaMLowjoQXYmIsnycnm4g1SYmeQS6o,1335
|
103
103
|
siat/shenwan index history test.py,sha256=JCVAzOSEldHalhSFa3pqD8JI_8_djPMQOxpkuYU-Esg,1418
|
104
|
-
siat/stock.py,sha256=
|
104
|
+
siat/stock.py,sha256=dE-AitC0nba2Vf0iU_J2CgN9nB5MA2J2I8EH1zrM97U,140357
|
105
105
|
siat/stock_advice_linear.py,sha256=-twT7IGP-NEplkL1WPSACcNJjggRB2j4mlAQCkzOAuo,31655
|
106
106
|
siat/stock_base.py,sha256=uISvbRyOGy8p9QREA96CVydgflBkn5L3OXOGKl8oanc,1312
|
107
107
|
siat/stock_china.py,sha256=zyUyghIrkkkYWlHRRP7Hoblxzfp-jrck60pTJpwMahg,91553
|
@@ -112,7 +112,7 @@ siat/stock_list_china_test.py,sha256=gv14UwMMvkZqtb6G7DCTSuehIwVHuVwu7w60p6gyHoo
|
|
112
112
|
siat/stock_prices_kneighbors.py,sha256=WfZvo5EyeBsm-T37zDj7Sl9dPSRq5Bx4JxIJ9IUum6s,36738
|
113
113
|
siat/stock_prices_linear.py,sha256=-OUKRr27L2aStQgJSlJOrJ4gay_G7P-m-7t7cU2Yoqk,13991
|
114
114
|
siat/stock_profile.py,sha256=B3eIwzEmiCqiCaxIlhfdEPsQBoW1PFOe1hkiY3mVF6Y,26038
|
115
|
-
siat/stock_technical.py,sha256=
|
115
|
+
siat/stock_technical.py,sha256=uBHps4RpWYbLjHV4buNU-B29aG1YKYJ2WzS8QzLZl7k,113918
|
116
116
|
siat/stock_test.py,sha256=E9YJAvOw1VEGJSDI4IZuEjl0tGoisOIlN-g9UqA_IZE,19475
|
117
117
|
siat/stooq.py,sha256=dOc_S5HLrYg48YAKTCs1eX8UTJOOkPM8qLL2KupqlLY,2470
|
118
118
|
siat/temp.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
@@ -126,14 +126,14 @@ siat/transaction_test.py,sha256=Z8g1LJCN4-mnUByXMUMoFmN0t105cbmsz2QmvSuIkbU,1858
|
|
126
126
|
siat/translate-20230125.py,sha256=NPPSXhT38s5t9fzMvl_fvi4ckSB73ThLmZetVI-xGdU,117953
|
127
127
|
siat/translate-20230206.py,sha256=-vtI125WyaJhmPotOpDAmclt_XnYVaWU9ByLWZ6FyYE,118133
|
128
128
|
siat/translate-20230215.py,sha256=TJgtPE3n8IjljmZ4Pefy8dmHoNdFF-1zpML6BhA9FKE,121657
|
129
|
-
siat/translate.py,sha256=
|
129
|
+
siat/translate.py,sha256=mldxeFwkxFrh_7EV1O_nRju8W0wIPnKAtN_mbN621w8,215280
|
130
130
|
siat/translate_20240606.py,sha256=63IyHWEU3Uz9mjwyuAX3fqY4nUMdwh0ICQAgmgPXP7Y,215121
|
131
131
|
siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
132
132
|
siat/valuation.py,sha256=NKfeZMdDJOW42oLVHob6eSVBXUqlN1OCnnzwyGAst8c,48855
|
133
133
|
siat/valuation_china.py,sha256=Tde2LzPDQy3Z7xOQQDw4ckQMPdROp_z0-GjFE6Z5_lI,67639
|
134
134
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
135
135
|
siat/var_model_validation.py,sha256=f-oDewg7bPzyNanz_Y_jLH68NowAA3gXFehW_weKGG0,14898
|
136
|
-
siat-3.1.
|
137
|
-
siat-3.1.
|
138
|
-
siat-3.1.
|
139
|
-
siat-3.1.
|
136
|
+
siat-3.1.22.dist-info/METADATA,sha256=-tITPyfoAysRKI9PCIi9qlAVxctl-EZ3sqD42rB22Jo,1448
|
137
|
+
siat-3.1.22.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
138
|
+
siat-3.1.22.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
139
|
+
siat-3.1.22.dist-info/RECORD,,
|
File without changes
|
File without changes
|