siat 3.8.36__py3-none-any.whl → 3.8.41__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/common.py +1 -1
- siat/financials.py +85 -27
- siat/financials2.py +9 -8
- siat/grafix.py +21 -10
- siat/sector_china.py +10 -5
- siat/stock.py +3 -3
- {siat-3.8.36.dist-info → siat-3.8.41.dist-info}/METADATA +1 -1
- {siat-3.8.36.dist-info → siat-3.8.41.dist-info}/RECORD +11 -11
- {siat-3.8.36.dist-info → siat-3.8.41.dist-info}/LICENSE +0 -0
- {siat-3.8.36.dist-info → siat-3.8.41.dist-info}/WHEEL +0 -0
- {siat-3.8.36.dist-info → siat-3.8.41.dist-info}/top_level.txt +0 -0
siat/common.py
CHANGED
@@ -4697,7 +4697,7 @@ def df_save(df,file="df"):
|
|
4697
4697
|
df.to_pickle(file_name)
|
4698
4698
|
|
4699
4699
|
import os; path=os.getcwd()
|
4700
|
-
print("
|
4700
|
+
print(" Saved to",path+"\\"+file_name)
|
4701
4701
|
except:
|
4702
4702
|
print(" #Error(df_save): failed to save data to file",file_name)
|
4703
4703
|
|
siat/financials.py
CHANGED
@@ -181,7 +181,7 @@ def compare_history(tickers,items, \
|
|
181
181
|
collabel=ectranslate(item1)
|
182
182
|
ylabeltxt=''
|
183
183
|
#titletxt=ticker_name(ticker1)+texttranslate(": 基于年(季)报的业绩历史")
|
184
|
-
titletxt=ticker_name(ticker1)+":
|
184
|
+
titletxt=ticker_name(ticker1)+": 财报业绩历史"
|
185
185
|
#footnote=texttranslate("数据来源: 雅虎财经,")+' '+str(today)
|
186
186
|
footnote="数据来源: 雅虎财经,"+' '+str(today)
|
187
187
|
|
@@ -205,7 +205,7 @@ def compare_history(tickers,items, \
|
|
205
205
|
label2=ectranslate(item2)
|
206
206
|
ylabeltxt=''
|
207
207
|
#titletxt=ticker_name(ticker1)+texttranslate(": 基于年(季)报的业绩历史对比")
|
208
|
-
titletxt=ticker_name(ticker1)+":
|
208
|
+
titletxt=ticker_name(ticker1)+": 财报业绩历史对比"
|
209
209
|
#footnote=texttranslate("数据来源: 雅虎财经,")+' '+str(today)
|
210
210
|
footnote="数据来源: 雅虎财经,"+' '+str(today)
|
211
211
|
|
@@ -243,7 +243,7 @@ def compare_history(tickers,items, \
|
|
243
243
|
label2=ectranslate(item2)
|
244
244
|
ylabeltxt=''
|
245
245
|
#titletxt=ticker_name(ticker1)+" vs "+ticker_name(ticker2)+texttranslate(": 基于年(季)报的业绩历史对比")
|
246
|
-
titletxt=ticker_name(ticker1)+" vs "+ticker_name(ticker2)+":
|
246
|
+
titletxt=ticker_name(ticker1)+" vs "+ticker_name(ticker2)+": 财报业绩历史对比"
|
247
247
|
#footnote=texttranslate("数据来源: 雅虎财经,")+' '+str(today)
|
248
248
|
footnote="数据来源: 雅虎财经,"+' '+str(today)
|
249
249
|
|
@@ -276,9 +276,10 @@ if __name__ == '__main__':
|
|
276
276
|
|
277
277
|
itemk='IGR'
|
278
278
|
|
279
|
-
def compare_snapshot(
|
279
|
+
def compare_snapshot(ticker,indicator, \
|
280
|
+
facecolor='lightblue',
|
280
281
|
datatag=True,tag_offset=0.01, \
|
281
|
-
graph=True,axisamp=1.2,px=
|
282
|
+
graph=True,axisamp=1.2,px=True, \
|
282
283
|
printout=True,numberPerLine=10):
|
283
284
|
"""
|
284
285
|
功能:比较多个股票的快照数据,绘制水平柱状图
|
@@ -287,10 +288,13 @@ def compare_snapshot(tickers,itemk, \
|
|
287
288
|
tag_offset=0.01:标记的数值距离图形的距离,若不理想可以手动调节,可为最大值1%-5%
|
288
289
|
graph:是否将结果绘图,默认True
|
289
290
|
axisamp:绘图时横轴放大系数,默认1.2。若标记数值超出右边界则增加数值,也可能需要负数数值
|
290
|
-
px:是否使用plotly-express工具绘图,默认
|
291
|
+
px:是否使用plotly-express工具绘图,默认True。
|
292
|
+
其优点是无需调整axisamp,缺点是无法保存绘图结果在Jupyter Notebook中。
|
291
293
|
printout:是否显示哪些股票找到或未找到相关数据,默认True
|
292
294
|
numberPerLine:在显示相关数据时,每行显示的股票代码或名称个数,默认10
|
293
295
|
"""
|
296
|
+
tickers=ticker; itemk=indicator
|
297
|
+
|
294
298
|
#检查股票代码列表
|
295
299
|
if not isinstance(tickers,list):
|
296
300
|
print(" #Error(compare_snapshot): need more stock codes in",tickers)
|
@@ -341,8 +345,8 @@ def compare_snapshot(tickers,itemk, \
|
|
341
345
|
}
|
342
346
|
itemlist=list(itemdict.keys())
|
343
347
|
if itemk not in itemlist:
|
344
|
-
print(" #Error(compare_snapshot): unsupported
|
345
|
-
print(" Supported rates
|
348
|
+
print(" #Error(compare_snapshot): unsupported indicator",itemk)
|
349
|
+
print(" Supported rates:\n",itemlist)
|
346
350
|
return None
|
347
351
|
|
348
352
|
item=itemdict[itemk]
|
@@ -389,10 +393,48 @@ def compare_snapshot(tickers,itemk, \
|
|
389
393
|
df=df.append(row,ignore_index=True)
|
390
394
|
except:
|
391
395
|
df=df._append(row,ignore_index=True)
|
392
|
-
|
396
|
+
|
397
|
+
# 尝试恢复失败的股票信息
|
398
|
+
if len(notfoundlist) > 0:
|
399
|
+
print("Recovering info of",itemk,"for",notfoundlist,"...")
|
400
|
+
total0=len(notfoundlist)
|
401
|
+
tickers2=notfoundlist.copy(); notfoundlist=[]
|
402
|
+
for t in tickers2:
|
403
|
+
|
404
|
+
current=tickers2.index(t)
|
405
|
+
total=total0 - len(notfoundlist)
|
406
|
+
print_progress_percent(current,total,steps=10,leading_blanks=2)
|
407
|
+
|
408
|
+
try:
|
409
|
+
info=stock_info(t)
|
410
|
+
except:
|
411
|
+
notfoundlist=notfoundlist+[t]
|
412
|
+
continue
|
413
|
+
if (info is None) or (len(info)==0):
|
414
|
+
notfoundlist=notfoundlist+[t]
|
415
|
+
continue
|
416
|
+
try:
|
417
|
+
value=info[info.index == item]['Value'][0]
|
418
|
+
except:
|
419
|
+
try:
|
420
|
+
itemp=proxydict[item]
|
421
|
+
value=info[info.index == itemp]['Value'][0]
|
422
|
+
notfoundlist=notfoundlist+[t]
|
423
|
+
except:
|
424
|
+
notfoundlist=notfoundlist+[t]
|
425
|
+
continue
|
426
|
+
|
427
|
+
name=ticker_name(t)
|
428
|
+
row=pd.Series({'ticker':t,'item':item,'value':value,'name':name})
|
429
|
+
try:
|
430
|
+
df=df.append(row,ignore_index=True)
|
431
|
+
except:
|
432
|
+
df=df._append(row,ignore_index=True)
|
433
|
+
|
434
|
+
# 未找到任何股票信息
|
393
435
|
if len(df) == 0:
|
394
436
|
print("\n #Warning(compare_snapshot): no stock info not found for specified stocks")
|
395
|
-
print(" Possible reasons:
|
437
|
+
print(" Possible reasons: unaccessible to data source - Yahoo Finance")
|
396
438
|
return None
|
397
439
|
|
398
440
|
#处理小数点
|
@@ -406,7 +448,7 @@ def compare_snapshot(tickers,itemk, \
|
|
406
448
|
|
407
449
|
#绘图
|
408
450
|
if graph:
|
409
|
-
print("Calculating and drawing graph, please wait ...")
|
451
|
+
print(" Calculating and drawing graph, please wait ...")
|
410
452
|
colname='value'
|
411
453
|
|
412
454
|
lang=check_language()
|
@@ -435,7 +477,7 @@ def compare_snapshot(tickers,itemk, \
|
|
435
477
|
#在Spyder中可能无法显示
|
436
478
|
titletxt="企业业绩快照:"+ectranslate(itemk)
|
437
479
|
footnote=notestxt+','+footnote1+str(today)
|
438
|
-
plot_barh2(df,colname,titletxt,footnote)
|
480
|
+
plot_barh2(df,colname,titletxt,footnote,facecolor=facecolor)
|
439
481
|
|
440
482
|
if (len(notfoundlist) > 0):
|
441
483
|
foundlist=[]
|
@@ -453,9 +495,10 @@ def compare_snapshot(tickers,itemk, \
|
|
453
495
|
printInLine(foundlist,numberPerLine=numberPerLine,leadingBlanks=2)
|
454
496
|
"""
|
455
497
|
if (len(notfoundlist) > 0):
|
456
|
-
print("Warning
|
498
|
+
print(" [Warning]",itemk,"info not found for the stocks below:")
|
457
499
|
notfoundlist_names=ticker_name(notfoundlist)
|
458
500
|
printInLine(notfoundlist_names,numberPerLine=numberPerLine,leadingBlanks=2)
|
501
|
+
print(" [Solution] re-run the command with more stable internet connection")
|
459
502
|
|
460
503
|
return df
|
461
504
|
|
@@ -589,7 +632,7 @@ if __name__ == '__main__':
|
|
589
632
|
tickers=["0883.HK","0857.HK","0386.HK",'XOM','2222.SR','OXY','BP','RDSA.AS']
|
590
633
|
graph=True
|
591
634
|
|
592
|
-
def compare_tax(tickers,graph=True,axisamp=1.3,px=
|
635
|
+
def compare_tax(tickers,graph=True,axisamp=1.3,px=True):
|
593
636
|
"""
|
594
637
|
功能:比较公司最新的实际所得税率
|
595
638
|
"""
|
@@ -690,7 +733,7 @@ def calc_igr_sgr(ticker):
|
|
690
733
|
|
691
734
|
return igr,sgr
|
692
735
|
|
693
|
-
def compare_igr_sgr(tickers,graph=True,axisamp=1.0,px=
|
736
|
+
def compare_igr_sgr(tickers,graph=True,axisamp=1.0,px=True):
|
694
737
|
"""
|
695
738
|
功能:比较公司TTM的IGR和SGR
|
696
739
|
"""
|
@@ -1068,7 +1111,7 @@ def get_financial_rates(ticker):
|
|
1068
1111
|
财务比率:短期还债能力,长期还债能力,营运能力,盈利能力,发展能力
|
1069
1112
|
返回:报表+比率
|
1070
1113
|
"""
|
1071
|
-
print("\n Analyzing financial rates of",ticker,"
|
1114
|
+
print("\n Analyzing financial rates of",ticker,"......")
|
1072
1115
|
|
1073
1116
|
# 变换港股代码5位-->4位
|
1074
1117
|
result,prefix,suffix=split_prefix_suffix(ticker)
|
@@ -1859,7 +1902,9 @@ if __name__=='__main__':
|
|
1859
1902
|
scale2 = 10
|
1860
1903
|
hatchlist=['.', 'o', '\\']
|
1861
1904
|
|
1862
|
-
def compare_dupont(tickerlist,fsdate='latest',
|
1905
|
+
def compare_dupont(tickerlist,fsdate='latest', \
|
1906
|
+
sort='PM',facecolor='whitesmoke',font_size='16px', \
|
1907
|
+
scale1 = 10,scale2 = 10,hatchlist=['.', 'o', '\\']):
|
1863
1908
|
"""
|
1864
1909
|
功能:获得tickerlist中每只股票的杜邦分析项目,绘制柱状叠加比较图
|
1865
1910
|
tickerlist:股票代码列表,建议在10只以内
|
@@ -1936,6 +1981,17 @@ def compare_dupont(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10,hatchlist=
|
|
1936
1981
|
for i in range(num):
|
1937
1982
|
code=df.loc[i,'公司']
|
1938
1983
|
df.loc[i,'公司']=ticker_name(code)
|
1984
|
+
|
1985
|
+
# 排序
|
1986
|
+
if sort=='PM':
|
1987
|
+
df.sort_values(name1,ascending=False,inplace=True)
|
1988
|
+
elif sort=='TAT':
|
1989
|
+
df.sort_values(name2,ascending=False,inplace=True)
|
1990
|
+
elif sort=='EM':
|
1991
|
+
df.sort_values(name3,ascending=False,inplace=True)
|
1992
|
+
else:
|
1993
|
+
df.sort_values(name1,ascending=False,inplace=True)
|
1994
|
+
|
1939
1995
|
|
1940
1996
|
#f,ax1 = plt.subplots(1,figsize=(10,5))
|
1941
1997
|
f,ax1 = plt.subplots(1,figsize=(12.8,6.4))
|
@@ -2011,10 +2067,7 @@ def compare_dupont(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10,hatchlist=
|
|
2011
2067
|
pd.set_option('display.max_colwidth', 1000)
|
2012
2068
|
pd.set_option('display.unicode.ambiguous_as_wide', True)
|
2013
2069
|
pd.set_option('display.unicode.east_asian_width', True)
|
2014
|
-
|
2015
|
-
print("===== "+"杜邦分析分项数据表"+" =====")
|
2016
|
-
else:
|
2017
|
-
print("===== "+texttranslate("杜邦分析分项数据表")+" =====")
|
2070
|
+
|
2018
2071
|
df[name1]=df[name1]/scale1
|
2019
2072
|
df[name2]=df[name2]/scale2
|
2020
2073
|
|
@@ -2032,12 +2085,17 @@ def compare_dupont(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10,hatchlist=
|
|
2032
2085
|
df[ectranslate('财报类型')]=df['财报类型'].apply(lambda x:'Quarterly' if x=='季报' else 'Annual')
|
2033
2086
|
dfe=df[dfecols]
|
2034
2087
|
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2088
|
+
titletxt=text_lang("杜邦分析分项数据表","Du Pont Identity Fact Sheet")
|
2089
|
+
footnote=text_lang("数据来源: 雅虎财经","Data source: Yahoo Finance")+', '+str(today)
|
2090
|
+
#确定表格字体大小
|
2091
|
+
titile_font_size=font_size
|
2092
|
+
heading_font_size=data_font_size=str(int(font_size.replace('px',''))-1)+'px'
|
2093
|
+
|
2094
|
+
df_display_CSS(df=df,titletxt=titletxt,footnote=footnote, \
|
2095
|
+
facecolor=facecolor,decimals=4, \
|
2096
|
+
titile_font_size=titile_font_size,heading_font_size=heading_font_size, \
|
2097
|
+
data_font_size=data_font_size)
|
2098
|
+
|
2041
2099
|
|
2042
2100
|
#合并所有历史记录
|
2043
2101
|
alldf=pd.concat(dpidflist)
|
siat/financials2.py
CHANGED
@@ -265,7 +265,8 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
265
265
|
# 分析资产负债表
|
266
266
|
fsdf=get_balance_sheet(symbol=tickers)
|
267
267
|
if fsdf is None:
|
268
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",tickers,"\b, which needs connection to Yahoo")
|
268
|
+
#print(" #Warning(fs_analysis): financial info unaccessible for",tickers,"\b, which needs connection to Yahoo")
|
269
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",tickers)
|
269
270
|
return None
|
270
271
|
|
271
272
|
fsdf['reportDate']=fsdf['asOfDate'].apply(lambda x: x.strftime('%y-%m-%d'))
|
@@ -368,7 +369,7 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
368
369
|
# 分析利润表
|
369
370
|
fsdf=get_income_statements(symbol=tickers)
|
370
371
|
if fsdf is None:
|
371
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",tickers
|
372
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",tickers)
|
372
373
|
return None
|
373
374
|
|
374
375
|
fsdf['reportDate']=fsdf['asOfDate'].apply(lambda x: x.strftime('%y-%m-%d'))
|
@@ -448,7 +449,7 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
448
449
|
# 分析现金流量表
|
449
450
|
fsdf=get_cashflow_statements(symbol=tickers)
|
450
451
|
if fsdf is None:
|
451
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",tickers
|
452
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",tickers)
|
452
453
|
return None
|
453
454
|
|
454
455
|
fsdf['reportDate']=fsdf['asOfDate'].apply(lambda x: x.strftime('%y-%m-%d'))
|
@@ -546,7 +547,7 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
546
547
|
with HiddenPrints():
|
547
548
|
fsdf=get_financial_rates(tickers)
|
548
549
|
if fsdf is None:
|
549
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",tickers
|
550
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",tickers)
|
550
551
|
return None
|
551
552
|
|
552
553
|
fsdf['reportDate']=fsdf['asOfDate'].apply(lambda x: x.strftime('%y-%m-%d'))
|
@@ -636,7 +637,7 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
636
637
|
with HiddenPrints():
|
637
638
|
dftmp=get_financial_rates(t)
|
638
639
|
if dftmp is None:
|
639
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",t
|
640
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",t)
|
640
641
|
return None
|
641
642
|
|
642
643
|
if business_period=='recent':
|
@@ -759,7 +760,7 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
759
760
|
with HiddenPrints():
|
760
761
|
fsdf=get_financial_rates(tickers)
|
761
762
|
if fsdf is None:
|
762
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",tickers
|
763
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",tickers)
|
763
764
|
return None
|
764
765
|
|
765
766
|
fsdf['reportDate']=fsdf['asOfDate'].apply(lambda x: x.strftime('%y-%m-%d'))
|
@@ -846,7 +847,7 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
846
847
|
with HiddenPrints():
|
847
848
|
dftmp=get_financial_rates(t)
|
848
849
|
if dftmp is None:
|
849
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",t
|
850
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",t)
|
850
851
|
return None
|
851
852
|
|
852
853
|
if dftmp is None:
|
@@ -953,7 +954,7 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
953
954
|
with HiddenPrints():
|
954
955
|
dftmp=get_financial_rates(t)
|
955
956
|
if dftmp is None:
|
956
|
-
print(" #Warning(fs_analysis): financial info unaccessible for",t
|
957
|
+
print(" #Warning(fs_analysis): financial info unaccessible for",t)
|
957
958
|
return None
|
958
959
|
|
959
960
|
if business_period=='recent':
|
siat/grafix.py
CHANGED
@@ -476,6 +476,17 @@ def plot_line2(df1,ticker1,colname1,label1, \
|
|
476
476
|
loc1=loc1,loc2=loc2, \
|
477
477
|
color1=color1,color2=color2,facecolor=facecolor, \
|
478
478
|
maxticks=maxticks)
|
479
|
+
elif twinx == False: # twinx == False # 正常绘图
|
480
|
+
plot_line2_coaxial(df1,ticker1,colname1,label1, \
|
481
|
+
df2,ticker2,colname2,label2, \
|
482
|
+
ylabeltxt,titletxt,footnote,power,datatag1,datatag2,zeroline, \
|
483
|
+
yline=yline,attention_value_area=attention_value_area, \
|
484
|
+
xline=xline,attention_point_area=attention_point_area, \
|
485
|
+
resample_freq=resample_freq, \
|
486
|
+
loc1=loc1,loc2=loc2, \
|
487
|
+
color1=color1,color2=color2,facecolor=facecolor, \
|
488
|
+
maxticks=maxticks)
|
489
|
+
|
479
490
|
elif 'LR' in twinx.upper(): # 左右双图
|
480
491
|
plot_line2_LR(df1,ticker1,colname1,label1, \
|
481
492
|
df2,ticker2,colname2,label2, \
|
@@ -2895,7 +2906,7 @@ if __name__=='__main__':
|
|
2895
2906
|
titletxt="This is a title"
|
2896
2907
|
footnote="This is a footnote"
|
2897
2908
|
|
2898
|
-
def plot_barh2(df,colname,titletxt,footnote,facecolor='
|
2909
|
+
def plot_barh2(df,colname,titletxt,footnote,facecolor='lightblue'):
|
2899
2910
|
"""
|
2900
2911
|
功能:绘制水平单值柱状图,并在外侧标注数据标签。
|
2901
2912
|
输入:数据集df;列名colname;标题titletxt;脚注footnote;
|
@@ -2913,7 +2924,8 @@ def plot_barh2(df,colname,titletxt,footnote,facecolor='whitesmoke'):
|
|
2913
2924
|
xlabel=colname+'颜色棒'
|
2914
2925
|
df[xlabel]=df[colname]
|
2915
2926
|
|
2916
|
-
import plotly_express as px
|
2927
|
+
#import plotly_express as px
|
2928
|
+
import plotly.express as px
|
2917
2929
|
|
2918
2930
|
fig=px.bar(data_frame = df,
|
2919
2931
|
y='ycolname', #纵轴绘制的字段
|
@@ -2924,7 +2936,10 @@ def plot_barh2(df,colname,titletxt,footnote,facecolor='whitesmoke'):
|
|
2924
2936
|
labels={'ycolname':'',colname:footnote,xlabel:''} #将字段改名作为纵轴、横轴或颜色棒的标注
|
2925
2937
|
)
|
2926
2938
|
|
2927
|
-
fig.
|
2939
|
+
fig.update_coloraxes(showscale=False) # 隐藏颜色条
|
2940
|
+
|
2941
|
+
fig.update_traces(textposition='outside',#直方图顶端的数值标在外侧
|
2942
|
+
)
|
2928
2943
|
|
2929
2944
|
fig.update_layout(
|
2930
2945
|
title={
|
@@ -2933,14 +2948,10 @@ def plot_barh2(df,colname,titletxt,footnote,facecolor='whitesmoke'):
|
|
2933
2948
|
'x':0.5,
|
2934
2949
|
'xanchor': 'center', # 相对位置
|
2935
2950
|
'yanchor': 'top'},
|
2951
|
+
plot_bgcolor=facecolor, #设置画布背景颜色
|
2952
|
+
coloraxis_showscale=False, #彻底移除颜色条,需要升级plotly!
|
2936
2953
|
)
|
2937
|
-
|
2938
|
-
try:
|
2939
|
-
fig.gca().set_facecolor(facecolor)
|
2940
|
-
except:
|
2941
|
-
print(" #Warning(plot_barh2): color",facecolor,"is unsupported, changed to default setting")
|
2942
|
-
fig.gca().set_facecolor("whitesmoke")
|
2943
|
-
|
2954
|
+
|
2944
2955
|
fig.show()
|
2945
2956
|
|
2946
2957
|
return
|
siat/sector_china.py
CHANGED
@@ -394,7 +394,8 @@ def sector_rank_china(comp="涨跌幅",indicator="新浪行业",num=10):
|
|
394
394
|
titletxt="中国股票市场:板块"+comp+"排行榜(按照"+indtag+"分类)"
|
395
395
|
import datetime; stoday = datetime.date.today()
|
396
396
|
footnote1="注:代表个股是指板块中涨幅最高或跌幅最低的股票\n"
|
397
|
-
footnote2="板块总数"+str(len(df))+",数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
397
|
+
#footnote2="板块总数"+str(len(df))+",数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
398
|
+
footnote2="板块总数"+str(len(df))+",数据来源:新浪财经,"+str(stoday)
|
398
399
|
footnote=footnote1+footnote2
|
399
400
|
|
400
401
|
df_display_CSS(df4,titletxt=titletxt,footnote=footnote,facecolor='papayawhip',decimals=2, \
|
@@ -556,10 +557,12 @@ def sector_detail_china(sector="new_dlhy",comp="涨跌幅",num=10):
|
|
556
557
|
import datetime; stoday = datetime.date.today()
|
557
558
|
if "流通市值" in df3_collist:
|
558
559
|
footnote1="市值单位:亿元,板块成份股:"+str(len(df))+'\n'
|
559
|
-
footnote2="数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
560
|
+
#footnote2="数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
561
|
+
footnote2="数据来源:新浪财经,"+str(stoday)
|
560
562
|
else:
|
561
563
|
footnote1="板块成份股:"+str(len(df))+','
|
562
|
-
footnote2="数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
564
|
+
#footnote2="数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
565
|
+
footnote2="数据来源:新浪财经,"+str(stoday)
|
563
566
|
footnote=footnote1+footnote2
|
564
567
|
|
565
568
|
df_display_CSS(df4,titletxt=titletxt,footnote=footnote,facecolor='papayawhip',decimals=2, \
|
@@ -568,7 +571,8 @@ def sector_detail_china(sector="new_dlhy",comp="涨跌幅",num=10):
|
|
568
571
|
titile_font_size='16px',heading_font_size='15px', \
|
569
572
|
data_font_size='15px')
|
570
573
|
|
571
|
-
return df2
|
574
|
+
#return df2
|
575
|
+
return df4
|
572
576
|
|
573
577
|
#==============================================================================
|
574
578
|
if __name__=='__main__':
|
@@ -717,7 +721,8 @@ def sector_position_china(ticker,sector="new_dlhy"):
|
|
717
721
|
titletxt="\n上市公司地位分析:"+sname+","+sector_name+"行业/板块("+indicator+"分类)"
|
718
722
|
import datetime; stoday = datetime.date.today()
|
719
723
|
footnote1=""
|
720
|
-
footnote2="成分股总数:"+str(len(df))+",数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
724
|
+
#footnote2="成分股总数:"+str(len(df))+",数据来源:新浪财经,"+str(stoday)+"(截至昨日)"
|
725
|
+
footnote2="成分股总数:"+str(len(df))+",数据来源:新浪财经,"+str(stoday)
|
721
726
|
footnote=footnote1+footnote2
|
722
727
|
|
723
728
|
#print("") #空一行
|
siat/stock.py
CHANGED
@@ -2009,7 +2009,7 @@ def compare_msecurity(tickers,measure,start,end, \
|
|
2009
2009
|
if isinstance(measure,list):
|
2010
2010
|
measure=measure[0]
|
2011
2011
|
|
2012
|
-
print(" Searching
|
2012
|
+
print(" Searching securities for",measure,"...")
|
2013
2013
|
#屏蔽函数内print信息输出的类
|
2014
2014
|
import os, sys
|
2015
2015
|
class HiddenPrints:
|
@@ -2991,8 +2991,8 @@ def stock_info(symbol):
|
|
2991
2991
|
#如果出现类似于{'AAPL': 'Invalid Cookie'}错误,则需要升级yahooquery
|
2992
2992
|
adict=stock.asset_profile
|
2993
2993
|
except:
|
2994
|
-
print(" #Error(stock_info): failed to get
|
2995
|
-
print("
|
2994
|
+
print(" #Error(stock_info): failed to get info of",symbol)
|
2995
|
+
print(" Reasons: Wrong stock code, or poor internet connection, or need to upgrade yahooquery")
|
2996
2996
|
return None
|
2997
2997
|
|
2998
2998
|
if adict[symbol] == 'Invalid Cookie':
|
@@ -19,7 +19,7 @@ siat/capm_beta.py,sha256=cxXdRVBQBllhbfz1LeTJAIWvyRYhW54nhtNUXv4HwS0,29063
|
|
19
19
|
siat/capm_beta2.py,sha256=wGF_HmK_AiGWjpSAx79XHIxDghtI_ueYozvh06-2JEQ,33707
|
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=XDt269wDd8L_sd4FWqFw2N5bPA6v051c2YnIxIJ_2V0,181169
|
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
|
@@ -42,9 +42,9 @@ siat/fin_stmt2_yahoo.py,sha256=LGmspk0nKyz4X87MtcovZXUfMQkAvrWINuxR4HQ8PI8,41178
|
|
42
42
|
siat/financial_base.py,sha256=A1rV7XQOVFpCXCV-T6Ge0QeF897hINiu0olN1XWeaFk,41287
|
43
43
|
siat/financial_statements.py,sha256=xx0SMpFqAMKm6cj8uYeG2RpJE6G-RoJ3NWa33UyaVMk,25414
|
44
44
|
siat/financial_statements_test.py,sha256=FLhx8JD-tVVWSBGux6AMz1jioXX4U4bp9DmgFHYXb_w,716
|
45
|
-
siat/financials.py,sha256=
|
45
|
+
siat/financials.py,sha256=3lUDWCWNkI9TGPMHWHqVzOWlcdB8KvNn103VT_dj9k4,82884
|
46
46
|
siat/financials2 - 副本.py,sha256=dKlNjIfKeoSy055fQ6E6TUj9HEoO5Ney9grD84J5kfk,14389
|
47
|
-
siat/financials2.py,sha256=
|
47
|
+
siat/financials2.py,sha256=YF-A-5iSTzLXTFI0sDGju4_6T87wWC9IlFd4fSXbJXw,50805
|
48
48
|
siat/financials_china.py,sha256=Hu85JOKnCmcTHgblIvHhsV-6c-Y15HFGNR_ZaaJt8nM,191974
|
49
49
|
siat/financials_china2.py,sha256=VvkzkjZeH84zwypR7ReldgJeZ7jnNw0qkzebvWMPm10,94956
|
50
50
|
siat/financials_china2_test.py,sha256=Erz5k4LyOplBBvYls2MypuqHpVNJ3daiLdyeJezNPu0,2722
|
@@ -64,7 +64,7 @@ siat/future_china.py,sha256=F-HsIf2Op8Z22RzTjet1g8COzldgnMjFNSXsAkeGyWo,17595
|
|
64
64
|
siat/future_china_test.py,sha256=BrSzmDVaOHki6rntOtosmRn-6dkfOBuLulJNqh7MOpc,1163
|
65
65
|
siat/global_index_test.py,sha256=hnFp3wqqzzL-kAP8mgxDZ54Bd5Ijf6ENi5YJlGBgcXw,2402
|
66
66
|
siat/google_authenticator.py,sha256=ZUbZR8OW0IAKDbcYtlqGqIpZdERpFor9NccFELxg9yI,1637
|
67
|
-
siat/grafix.py,sha256=
|
67
|
+
siat/grafix.py,sha256=X9eWpD6ndQSAkOEcbfC9b8KrY-rlYEhz63kE8JALs8E,139802
|
68
68
|
siat/grafix_test.py,sha256=kXvcpLgQNO7wd30g_bWljLj5UH7bIVI0_dUtXbfiKR0,3150
|
69
69
|
siat/holding_risk.py,sha256=uWRtMMJqKr-puQn26g6Fq5N3mFB70c0B99zLQug8hAo,30774
|
70
70
|
siat/holding_risk_test.py,sha256=FRlw_9wFG98BYcg_cSj95HX5WZ1TvkGaOUdXD7-V86s,474
|
@@ -98,7 +98,7 @@ siat/risk_evaluation.py,sha256=HK6U2G85-AxjSoeARbmTuiCNwTVdPdB9Znfgvslo0Os,76455
|
|
98
98
|
siat/risk_evaluation_test.py,sha256=YEXM96gKzTfwN4U61AS4Rr1tV7KgUvn4rRC6f3iMw9s,3731
|
99
99
|
siat/risk_free_rate.py,sha256=IBuRqA2kppdZsW4D4fapW7vnM5HMEXOn95A5r9Pkwlo,12384
|
100
100
|
siat/risk_free_rate_test.py,sha256=CpmhUf8aEAEZeNu4gvWP2Mz2dLoIgBX5bI41vfUBEr8,4285
|
101
|
-
siat/sector_china.py,sha256=
|
101
|
+
siat/sector_china.py,sha256=9zjdORWx5ia_gUezidhOKWmCnVDwWcnnjjugHudelaQ,157411
|
102
102
|
siat/sector_china_test.py,sha256=1wq7ef8Bb_L8F0h0W6FvyBrIcBTEbrTV7hljtpj49U4,5843
|
103
103
|
siat/security_price.py,sha256=2oHskgiw41KMGfqtnA0i2YjNNV6cYgtlUK0j3YeuXWs,29185
|
104
104
|
siat/security_price2.py,sha256=dYwvz9H-uWp-Gyc1g_MId9k8cITS6ZHmjW-Fc2ypp-0,26587
|
@@ -109,7 +109,7 @@ siat/security_trend2-20240620.py,sha256=QVnEcb7AyVbO77jVqfFsJffGXrX8pgJ9xCfoAKmW
|
|
109
109
|
siat/security_trend2.py,sha256=8-Z-PWaX8fjnyAyfxEp3qXdVllgDpRISOASKEn7Zeoc,30706
|
110
110
|
siat/setup.py,sha256=up65rQGLmTBkhtaMLowjoQXYmIsnycnm4g1SYmeQS6o,1335
|
111
111
|
siat/shenwan index history test.py,sha256=JCVAzOSEldHalhSFa3pqD8JI_8_djPMQOxpkuYU-Esg,1418
|
112
|
-
siat/stock.py,sha256=
|
112
|
+
siat/stock.py,sha256=SBFJ3Fw9bLi9fqoKsXgOmM6LVRL2Vh3G3hVrq0R20wo,159507
|
113
113
|
siat/stock_advice_linear.py,sha256=-twT7IGP-NEplkL1WPSACcNJjggRB2j4mlAQCkzOAuo,31655
|
114
114
|
siat/stock_base.py,sha256=uISvbRyOGy8p9QREA96CVydgflBkn5L3OXOGKl8oanc,1312
|
115
115
|
siat/stock_china.py,sha256=85Ggb21E2mrCYMdSSTTrkoyyLGXMK2V-BtlweHomSRg,93460
|
@@ -144,8 +144,8 @@ siat/valuation_china.py,sha256=eSKIDckyjG8QkENlW_OKkqbQHno8pzDcomBO9iGNJVM,83079
|
|
144
144
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
145
145
|
siat/var_model_validation.py,sha256=R0caWnuZarrRg9939hxh3vJIIpIyPfvelYmzFNZtPbo,14910
|
146
146
|
siat/yf_name.py,sha256=laNKMTZ9hdenGX3IZ7G0a2RLBKEWtUQJFY9CWuk_fp8,24058
|
147
|
-
siat-3.8.
|
148
|
-
siat-3.8.
|
149
|
-
siat-3.8.
|
150
|
-
siat-3.8.
|
151
|
-
siat-3.8.
|
147
|
+
siat-3.8.41.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
|
148
|
+
siat-3.8.41.dist-info/METADATA,sha256=ONZ6STCncVm8mzYcuak9rytMOAoRPKAdM6fNSzas0og,8321
|
149
|
+
siat-3.8.41.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
150
|
+
siat-3.8.41.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
151
|
+
siat-3.8.41.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|