siat 3.8.2__py3-none-any.whl → 3.8.20__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.
@@ -811,6 +811,7 @@ def compare_1ticker_mrar(ticker,start,end,rar=['sharpe','sortino','treynor','alp
811
811
  ret_type="Annual Adj Ret%",RF=0,regression_period=365, \
812
812
  attention_value='',attention_value_area='', \
813
813
  attention_point='',attention_point_area='', \
814
+ band_area='', \
814
815
  graph=True,loc1='best', \
815
816
  axhline_value=0,axhline_label='',facecolor='whitesmoke', \
816
817
  printout=False,sortby='tpw_mean',trailing=7,trend_threshhold=0.01, \
@@ -843,7 +844,7 @@ def compare_1ticker_mrar(ticker,start,end,rar=['sharpe','sortino','treynor','alp
843
844
  regression_period=regression_period[0]
844
845
 
845
846
  tname=ticker_name(ticker,ticker_type)
846
- print(" Starting to retrieve and calculate different rar for",tname,"\b, please wait ......\n")
847
+ print(" Working on different rars for",tname,"\b, please wait ......\n")
847
848
 
848
849
  #预处理ticker_type
849
850
  ticker_type=ticker_type_preprocess_mticker_mixed(ticker,ticker_type)
@@ -876,7 +877,14 @@ def compare_1ticker_mrar(ticker,start,end,rar=['sharpe','sortino','treynor','alp
876
877
  if df1[c].max() > axhline_value and df1[c].min() < axhline_value:
877
878
  axhline_label='零线'
878
879
 
879
- df1.rename(columns={c:ectranslate(c)},inplace=True)
880
+ cname=ectranslate(c)
881
+ df1.rename(columns={c:cname},inplace=True)
882
+
883
+ # 将band_area中的ticker替换为tname
884
+ if band_area != '':
885
+ for index, item in enumerate(band_area):
886
+ if item == c:
887
+ band_area[index] = cname
880
888
 
881
889
  footnote1=text_lang("评估值基于","Note: RaR based on ")+ectranslate(ret_type)
882
890
  if RF !=0:
@@ -914,6 +922,7 @@ def compare_1ticker_mrar(ticker,start,end,rar=['sharpe','sortino','treynor','alp
914
922
  attention_value=attention_value,attention_value_area=attention_value_area, \
915
923
  attention_point=attention_point,attention_point_area=attention_point_area, \
916
924
  annotate=annotate,annotate_value=annotate, \
925
+ band_area=band_area, \
917
926
  mark_top=mark_top,mark_bottom=mark_bottom,mark_end=mark_end, \
918
927
  facecolor=facecolor,loc=loc1)
919
928
 
@@ -974,6 +983,7 @@ def compare_mticker_1rar(ticker,start,end,rar='sharpe', \
974
983
  ret_type="Annual Adj Ret%",RF=0,regression_period=365, \
975
984
  attention_value='',attention_value_area='', \
976
985
  attention_point='',attention_point_area='', \
986
+ band_area='', \
977
987
  graph=True,loc1='best', \
978
988
  axhline_value=0,axhline_label='', \
979
989
  printout=False,sortby='tpw_mean',trailing=7,trend_threshhold=0.01, \
@@ -1006,7 +1016,7 @@ def compare_mticker_1rar(ticker,start,end,rar='sharpe', \
1006
1016
  RF=RF[0]
1007
1017
  if isinstance(regression_period,list):
1008
1018
  regression_period=regression_period[0]
1009
- print(" Starting to retrieve and calculate",rar,"\b, please wait ......\n")
1019
+ print(" Working on",rar,"ratio, please wait ......\n")
1010
1020
 
1011
1021
  #预处理ticker_type
1012
1022
  ticker_type_list=ticker_type_preprocess_mticker_mixed(ticker,ticker_type)
@@ -1027,7 +1037,14 @@ def compare_mticker_1rar(ticker,start,end,rar='sharpe', \
1027
1037
  continue
1028
1038
  else:
1029
1039
  dft=df_tmp[[rar]]
1030
- dft.rename(columns={rar:ticker_name(t,tt)},inplace=True)
1040
+ tname=ticker_name(t,tt)
1041
+ dft.rename(columns={rar:tname},inplace=True)
1042
+
1043
+ # 将band_area中的ticker替换为tname
1044
+ if band_area != '':
1045
+ for index, item in enumerate(band_area):
1046
+ if item == t:
1047
+ band_area[index] = tname
1031
1048
 
1032
1049
  if len(df)==0: #第一个
1033
1050
  df=dft
@@ -1097,6 +1114,7 @@ def compare_mticker_1rar(ticker,start,end,rar='sharpe', \
1097
1114
  title_txt=title_txt,data_label=False, \
1098
1115
  attention_value=attention_value,attention_value_area=attention_value_area, \
1099
1116
  attention_point=attention_point,attention_point_area=attention_point_area, \
1117
+ band_area=band_area, \
1100
1118
  annotate=annotate,annotate_value=annotate, \
1101
1119
  mark_top=mark_top,mark_bottom=mark_bottom,mark_end=mark_end, \
1102
1120
  facecolor=facecolor,loc=loc1)
@@ -1154,6 +1172,7 @@ def compare_mticker_mrar(ticker,start,end,rar=['sharpe','alpha','sortino','treyn
1154
1172
  ret_type="Annual Adj Ret%",RF=0,regression_period=365, \
1155
1173
  attention_value='',attention_value_area='', \
1156
1174
  attention_point='',attention_point_area='', \
1175
+ band_area='', \
1157
1176
  graph=True,loc1='best', \
1158
1177
  axhline_value=0,axhline_label='', \
1159
1178
  printout=True,sortby='tpw_mean',trailing=7,trend_threshhold=0.01, \
@@ -1184,6 +1203,7 @@ def compare_mticker_mrar(ticker,start,end,rar=['sharpe','alpha','sortino','treyn
1184
1203
  ret_type=ret_type,RF=RF,regression_period=regression_period, \
1185
1204
  attention_value=attention_value,attention_value_area=attention_value_area, \
1186
1205
  attention_point=attention_point,attention_point_area=attention_point_area, \
1206
+ band_area=band_area, \
1187
1207
  graph=graph,facecolor=facecolor, \
1188
1208
  axhline_value=axhline_value,axhline_label=axhline_label, \
1189
1209
  printout=printout,sortby=sortby, \
@@ -1361,6 +1381,7 @@ def compare_1ticker_1rar_mret(ticker,start,end,rar='sharpe', \
1361
1381
  RF=0,regression_period=365, \
1362
1382
  attention_value='',attention_value_area='', \
1363
1383
  attention_point='',attention_point_area='', \
1384
+ band_area='', \
1364
1385
  graph=True,loc1='best', \
1365
1386
  axhline_value=0,axhline_label='',facecolor='whitesmoke', \
1366
1387
  printout=False,sortby='tpw_mean',trailing=7,trend_threshhold=0.01, \
@@ -1392,7 +1413,7 @@ def compare_1ticker_1rar_mret(ticker,start,end,rar='sharpe', \
1392
1413
  RF=RF[0]
1393
1414
  if isinstance(regression_period,list):
1394
1415
  regression_period=regression_period[0]
1395
- print(" Working on",rar,"for",ticker_name(ticker,ticker_type),"in different returns, please wait ......\n")
1416
+ print(" Working on",rar,"ratio for",ticker_name(ticker,ticker_type),"in different return types ......\n")
1396
1417
 
1397
1418
  df=pd.DataFrame()
1398
1419
  for t in ret_type:
@@ -1406,8 +1427,15 @@ def compare_1ticker_1rar_mret(ticker,start,end,rar='sharpe', \
1406
1427
  break
1407
1428
  else:
1408
1429
  dft=df_tmp[[rar]]
1430
+ tname=text_lang("基于","Based on ")+ectranslate(t)
1409
1431
  dft.rename(columns={rar:text_lang("基于","Based on ")+ectranslate(t)},inplace=True)
1410
1432
 
1433
+ # 将band_area中的ticker替换为tname
1434
+ if band_area != '':
1435
+ for index, item in enumerate(band_area):
1436
+ if item == t:
1437
+ band_area[index] = tname
1438
+
1411
1439
  if len(df)==0: #第一个
1412
1440
  df=dft
1413
1441
  else:
@@ -1457,6 +1485,7 @@ def compare_1ticker_1rar_mret(ticker,start,end,rar='sharpe', \
1457
1485
  attention_value=attention_value,attention_value_area=attention_value_area, \
1458
1486
  attention_point=attention_point,attention_point_area=attention_point_area, \
1459
1487
  annotate=annotate,annotate_value=annotate, \
1488
+ band_area=band_area, \
1460
1489
  mark_top=mark_top,mark_bottom=mark_bottom,mark_end=mark_end, \
1461
1490
  facecolor=facecolor,loc=loc1)
1462
1491
 
@@ -1514,6 +1543,7 @@ def compare_1ticker_1rar_1ret_mRF(ticker,start,end,rar='sharpe', \
1514
1543
  ret_type="Annual Adj Ret%",RF=[0,0.02,0.05],regression_period=365, \
1515
1544
  attention_value='',attention_value_area='', \
1516
1545
  attention_point='',attention_point_area='', \
1546
+ band_area='', \
1517
1547
  graph=True,loc1='best', \
1518
1548
  axhline_value=0,axhline_label='',facecolor='whitesmoke', \
1519
1549
  printout=False,sortby='tpw_mean',trailing=7,trend_threshhold=0.01, \
@@ -1546,7 +1576,7 @@ def compare_1ticker_1rar_1ret_mRF(ticker,start,end,rar='sharpe', \
1546
1576
  RF=[RF]
1547
1577
  if isinstance(regression_period,list):
1548
1578
  regression_period=regression_period[0]
1549
- print(" Starting to retrieve and calculate",rar,"for",ticker_name(ticker,ticker_type),"on different RF, please wait ......\n")
1579
+ print(" Working on",rar,"ratio for",ticker_name(ticker,ticker_type),"in different RF levels ......\n")
1550
1580
 
1551
1581
  df=pd.DataFrame()
1552
1582
  for t in RF:
@@ -1560,7 +1590,14 @@ def compare_1ticker_1rar_1ret_mRF(ticker,start,end,rar='sharpe', \
1560
1590
  break
1561
1591
  else:
1562
1592
  dft=df_tmp[[rar]]
1563
- dft.rename(columns={rar:text_lang("基于无风险利率","Based on RF=")+str(round(t*100,4))+'%'},inplace=True)
1593
+ tname=text_lang("RF=","RF=")+str(round(t*100,4))+'%'
1594
+ dft.rename(columns={rar:tname},inplace=True)
1595
+
1596
+ # 将band_area中的ticker替换为tname
1597
+ if band_area != '':
1598
+ for index, item in enumerate(band_area):
1599
+ if item == t:
1600
+ band_area[index] = tname
1564
1601
 
1565
1602
  if len(df)==0: #第一个
1566
1603
  df=dft
@@ -1605,6 +1642,7 @@ def compare_1ticker_1rar_1ret_mRF(ticker,start,end,rar='sharpe', \
1605
1642
  attention_value=attention_value,attention_value_area=attention_value_area, \
1606
1643
  attention_point=attention_point,attention_point_area=attention_point_area, \
1607
1644
  annotate=annotate,annotate_value=annotate, \
1645
+ band_area=band_area, \
1608
1646
  mark_top=mark_top,mark_bottom=mark_bottom,mark_end=mark_end, \
1609
1647
  facecolor=facecolor,loc=loc1)
1610
1648
 
@@ -1679,6 +1717,7 @@ def compare_rar_security(ticker,start,end,rar='sharpe', \
1679
1717
  regression_period=365, \
1680
1718
  attention_value='',attention_value_area='', \
1681
1719
  attention_point='',attention_point_area='', \
1720
+ band_area='', \
1682
1721
  graph=True,loc1='best', \
1683
1722
  axhline_value=0,axhline_label='',facecolor='whitesmoke', \
1684
1723
  printout=False,sortby='tpw_mean',trailing=7,trend_threshhold=0.05, \
@@ -1712,6 +1751,7 @@ def compare_rar_security(ticker,start,end,rar='sharpe', \
1712
1751
  ret_type=ret_type,RF=RF,regression_period=regression_period, \
1713
1752
  attention_value=attention_value,attention_value_area=attention_value_area, \
1714
1753
  attention_point=attention_point,attention_point_area=attention_point_area, \
1754
+ band_area=band_area, \
1715
1755
  graph=graph,loc1=loc1, \
1716
1756
  axhline_value=axhline_value,axhline_label=axhline_label, \
1717
1757
  printout=printout, \
@@ -1722,12 +1762,13 @@ def compare_rar_security(ticker,start,end,rar='sharpe', \
1722
1762
  ticker_type=ticker_type,facecolor=facecolor)
1723
1763
  return df
1724
1764
 
1725
- if rar_num >1: #多个RAR
1765
+ if rar_num >1: #多个RAR,此项的主要意图并非绘图,而是进行多指标综合推荐
1726
1766
  printout=True #否则无法运行descriptive_statistics2函数
1727
1767
  df=compare_mticker_mrar(ticker=ticker,start=start,end=end,rar=rar, \
1728
1768
  ret_type=ret_type,RF=RF,regression_period=regression_period, \
1729
1769
  attention_value=attention_value,attention_value_area=attention_value_area, \
1730
1770
  attention_point=attention_point,attention_point_area=attention_point_area, \
1771
+ band_area=band_area, \
1731
1772
  graph=graph,loc1=loc1, \
1732
1773
  axhline_value=axhline_value,axhline_label=axhline_label, \
1733
1774
  printout=printout, \
@@ -1753,6 +1794,7 @@ def compare_rar_security(ticker,start,end,rar='sharpe', \
1753
1794
  ret_type=ret_type,RF=RF,regression_period=regression_period, \
1754
1795
  attention_value=attention_value,attention_value_area=attention_value_area, \
1755
1796
  attention_point=attention_point,attention_point_area=attention_point_area, \
1797
+ band_area=band_area, \
1756
1798
  graph=graph,loc1=loc1, \
1757
1799
  axhline_value=axhline_value,axhline_label=axhline_label, \
1758
1800
  printout=printout,facecolor=facecolor, \
@@ -1776,6 +1818,7 @@ def compare_rar_security(ticker,start,end,rar='sharpe', \
1776
1818
  ret_type=ret_type,RF=RF,regression_period=regression_period, \
1777
1819
  attention_value=attention_value,attention_value_area=attention_value_area, \
1778
1820
  attention_point=attention_point,attention_point_area=attention_point_area, \
1821
+ band_area=band_area, \
1779
1822
  graph=graph,loc1=loc1, \
1780
1823
  axhline_value=axhline_value,axhline_label=axhline_label, \
1781
1824
  printout=printout, \
@@ -1797,6 +1840,7 @@ def compare_rar_security(ticker,start,end,rar='sharpe', \
1797
1840
  ret_type=ret_type,RF=RF,regression_period=regression_period, \
1798
1841
  attention_value=attention_value,attention_value_area=attention_value_area, \
1799
1842
  attention_point=attention_point,attention_point_area=attention_point_area, \
1843
+ band_area=band_area, \
1800
1844
  graph=graph,loc1=loc1, \
1801
1845
  axhline_value=axhline_value,axhline_label=axhline_label, \
1802
1846
  printout=printout,facecolor=facecolor, \
siat/risk_evaluation.py CHANGED
@@ -40,7 +40,8 @@ if czxt in ['linux']: #website Jupyter
40
40
  plt.rcParams['axes.unicode_minus'] = False
41
41
  #==============================================================================
42
42
  #统一设定绘制的图片大小:数值为英寸,1英寸=100像素
43
- plt.rcParams['figure.figsize']=(12.8,7.2)
43
+ #plt.rcParams['figure.figsize']=(12.8,7.2)
44
+ plt.rcParams['figure.figsize']=(12.8,6.4)
44
45
  plt.rcParams['figure.dpi']=300
45
46
  plt.rcParams['font.size'] = 13
46
47
  plt.rcParams['xtick.labelsize']=11 #横轴字体大小
@@ -742,7 +743,8 @@ def plot_rets_histogram(ticker,start,end,num_bins=20):
742
743
  sigma=rets.std()
743
744
 
744
745
  #绘制股票收益率直方图
745
- plt.figure(figsize=(8,4))
746
+ #plt.figure(figsize=(8,4))
747
+ plt.figure(figsize=(12.8,6.4))
746
748
  n,bins,patches=plt.hist(rets,num_bins,facecolor='blue',alpha=0.5,label=ticker_name(ticker))
747
749
 
748
750
  #生成与直方图柱子对应的正态分布概率密度
@@ -789,7 +791,7 @@ def plot_rets_curve(ticker,start,end):
789
791
  import numpy as np
790
792
  x=mu+sigma*np.random.randn(1000000)
791
793
 
792
- #plt.figure(figsize=(8,4))
794
+ #plt.figure(figsize=(12.8,6.4))
793
795
  import seaborn as sns
794
796
  #绘制曲线:股票收益率
795
797
  sns.kdeplot(data=rets,shade=True,color='blue',legend=True,label=ticker_name(ticker),lw=2)
@@ -1435,7 +1437,7 @@ def series_VaR_tlcp(tickerlist,today,alpha=0.99,pastyears=1,model="montecarlo"):
1435
1437
  #tlcpdf.reset_index(drop=True)
1436
1438
  tlcpdf.set_index('Ticker',drop=True,inplace=True)
1437
1439
  """
1438
- #ax=plt.figure(figsize=(8,4))
1440
+ #ax=plt.figure(figsize=(12.8,6.4))
1439
1441
  tlcpdf.plot.barh(x='Ticker',y='TLCP',color='r',grid=True)
1440
1442
  plt.ylabel('股票')
1441
1443
  titlel1="VaR全损临界点(TLCP)"
@@ -1516,7 +1518,8 @@ def plot_VaR_days_changes(ticker,shares,today,dayslist,alpha=0.99, \
1516
1518
 
1517
1519
  #绘图
1518
1520
  if printout == True:
1519
- plt.figure(figsize=(8,4))
1521
+ #plt.figure(figsize=(8,4))
1522
+ plt.figure(figsize=(12.8,6.4))
1520
1523
  #绘制曲线:ratio
1521
1524
  plt.plot(vardf['ratio%'],color='red',lw=2,label=ticker_name(ticker),marker=markertype)
1522
1525
  #设置标题、图例、坐标轴标签
@@ -1564,7 +1567,8 @@ def compare_VaR_days_changes(tickerlist,shares,today,dayslist,alpha=0.99, \
1564
1567
  return
1565
1568
 
1566
1569
  #依次绘图tickerlist中的各个股票
1567
- plt.figure(figsize=(8,4))
1570
+ #plt.figure(figsize=(8,4))
1571
+ plt.figure(figsize=(12.8,6.4))
1568
1572
 
1569
1573
  markerlist=['.','o','s','*','+','x','1','2']
1570
1574
  for t in tickerlist:
siat/sector_china.py CHANGED
@@ -2729,7 +2729,8 @@ def industry_correlation_sw(df,tickers,start,end, \
2729
2729
  import seaborn as sns
2730
2730
  sns.set(font='SimHei') # 解决Seaborn中文显示问题
2731
2731
 
2732
- fig = plt.figure(figsize=(cm2inch(12,8)))
2732
+ #fig = plt.figure(figsize=(cm2inch(12,8)))
2733
+ fig = plt.figure(figsize=(12.8,6.4))
2733
2734
  ax1 = plt.gca()
2734
2735
 
2735
2736
  #构造mask,去除重复数据显示
siat/security_trend2.py CHANGED
@@ -198,7 +198,7 @@ def security_trend(ticker,indicator='Close',adjust='', \
198
198
  注意:本参数需要特殊访问获取数据。
199
199
 
200
200
  ret_type、RF、regression_period和market_index:仅用于计算RAR指标和CAPM贝塔系数。
201
- ret_type:指定计算RAR的收益率类型,支持滚动和扩展收益率,但不建议混合使用。
201
+ ret_type:指定计算RAR的收益率类型,支持滚动和扩展收益率,不同种类的计算结果之间不可比。
202
202
  RF:指定年化无风险利率,非百分比数值。
203
203
  regression_period:指定CAPM回归时的日期期间跨度,为日历日(自然日),默认一年。
204
204
  market_index:用于计算CAPM回归贝塔系数时的市场收益率。
@@ -523,6 +523,7 @@ def security_trend(ticker,indicator='Close',adjust='', \
523
523
  axhline_value=axhline_value,axhline_label=axhline_label, \
524
524
  preprocess=preprocess,linewidth=linewidth, \
525
525
  scaling_option=scaling_option, \
526
+ band_area=band_area, \
526
527
  graph=graph,loc=loc1, \
527
528
  annotate=annotate,annotate_value=annotate_value, \
528
529
  smooth=smooth, \
@@ -539,11 +540,13 @@ def security_trend(ticker,indicator='Close',adjust='', \
539
540
  print("Scenario 6: indicator_group2 RAR")
540
541
  print("attention_value=",attention_value)
541
542
  print("attention_point=",attention_point)
542
-
543
+
544
+ # ret_type要使用复权价
543
545
  df=compare_rar_security(ticker=tickers,start=fromdate,end=todate,rar=measures, \
544
546
  ret_type=ret_type,RF=RF,regression_period=regression_period, \
545
547
  attention_value=attention_value,attention_value_area=attention_value_area, \
546
548
  attention_point=attention_point,attention_point_area=attention_point_area, \
549
+ band_area=band_area, \
547
550
  graph=graph,axhline_value=0,axhline_label='', \
548
551
  loc1=loc1, \
549
552
  printout=printout, \
@@ -556,11 +559,17 @@ def security_trend(ticker,indicator='Close',adjust='', \
556
559
 
557
560
  # 情形7:单个或多个证券,CAPM贝塔系数=========================================
558
561
  if indicator_group4:
562
+ #if 'adj' in ret_type.lower() and adjust == '':
563
+ if adjust == '':
564
+ # 使用前复权价
565
+ adjust='qfq'
566
+
559
567
  df=compare_beta_security(ticker=tickers,start=fromdate,end=todate, \
560
568
  adjust=adjust, \
561
569
  RF=RF,regression_period=regression_period, \
562
570
  attention_value=attention_value,attention_value_area=attention_value_area, \
563
571
  attention_point=attention_point,attention_point_area=attention_point_area, \
572
+ band_area=band_area, \
564
573
  graph=graph,facecolor=facecolor,loc=loc1, \
565
574
  annotate=annotate,annotate_value=annotate_value, \
566
575
  mark_top=mark_top,mark_bottom=mark_bottom,mark_end=mark_end, \
@@ -578,6 +587,7 @@ def security_trend(ticker,indicator='Close',adjust='', \
578
587
  graph=graph,facecolor=facecolor, \
579
588
  attention_value=attention_value,attention_value_area=attention_value_area, \
580
589
  attention_point=attention_point,attention_point_area=attention_point_area, \
590
+ band_area=band_area, \
581
591
  annotate=annotate,annotate_value=annotate_value, \
582
592
  mark_top=mark_top,mark_bottom=mark_bottom,mark_end=mark_end)
583
593
  return df
siat/stock.py CHANGED
@@ -24,7 +24,8 @@ from siat.security_price2 import *
24
24
 
25
25
  #==============================================================================
26
26
  import matplotlib.pyplot as plt
27
- plt.rcParams['figure.figsize']=(12.8,7.2)
27
+ #plt.rcParams['figure.figsize']=(12.8,7.2)
28
+ plt.rcParams['figure.figsize']=(12.8,6.4)
28
29
  plt.rcParams['figure.dpi']=300
29
30
  plt.rcParams['font.size'] = 13
30
31
  plt.rcParams['xtick.labelsize']=11 #横轴字体大小
@@ -71,7 +72,8 @@ def reset_plt():
71
72
 
72
73
  #尝试恢复绘图尺寸
73
74
  #统一设定绘制的图片大小:数值为英寸,1英寸=100像素
74
- plt.rcParams['figure.figsize']=(12.8,7.2)
75
+ #plt.rcParams['figure.figsize']=(12.8,7.2)
76
+ plt.rcParams['figure.figsize']=(12.8,6.4)
75
77
  plt.rcParams['figure.dpi']=300
76
78
  plt.rcParams['font.size'] = 13
77
79
  plt.rcParams['xtick.labelsize']=11 #横轴字体大小
@@ -1963,6 +1965,7 @@ def compare_msecurity(tickers,measure,start,end, \
1963
1965
  preprocess='none',linewidth=1.5, \
1964
1966
  scaling_option='start', \
1965
1967
  plus_sign=False, \
1968
+ band_area='', \
1966
1969
  graph=True,loc='best',facecolor='whitesmoke', \
1967
1970
  annotate=False,annotate_value=False, \
1968
1971
  smooth=True, \
@@ -2046,7 +2049,16 @@ def compare_msecurity(tickers,measure,start,end, \
2046
2049
  continue
2047
2050
 
2048
2051
  df_tmp1=pd.DataFrame(df_tmp[measure])
2049
- df_tmp1.rename(columns={measure:ticker_name(t,tt)},inplace=True)
2052
+
2053
+ tname=ticker_name(t,tt)
2054
+ df_tmp1.rename(columns={measure:tname},inplace=True)
2055
+
2056
+ # 将band_area中的ticker替换为tname
2057
+ if band_area != '':
2058
+ for index, item in enumerate(band_area):
2059
+ if item == t:
2060
+ band_area[index] = tname
2061
+
2050
2062
  if len(dfs)==0:
2051
2063
  dfs=df_tmp1
2052
2064
  else:
@@ -2139,6 +2151,7 @@ def compare_msecurity(tickers,measure,start,end, \
2139
2151
  data_label=False,resample_freq='H',smooth=smooth,linewidth=linewidth,loc=loc, \
2140
2152
  attention_value=attention_value,attention_value_area=attention_value_area, \
2141
2153
  attention_point=attention_point,attention_point_area=attention_point_area, \
2154
+ band_area=band_area, \
2142
2155
  annotate=annotate,annotate_value=annotate_value,plus_sign=plus_sign, \
2143
2156
  mark_top=mark_top,mark_bottom=mark_bottom,mark_end=mark_end,facecolor=facecolor)
2144
2157
 
@@ -2573,7 +2586,7 @@ def candlestick_demo(stkcd,fromdate,todate, \
2573
2586
 
2574
2587
  print('')
2575
2588
  #specify the size of the graph
2576
- #fig,ax=plt.subplots(figsize=(10,6))
2589
+ #fig,ax=plt.subplots(figsize=(12.8,6.4))
2577
2590
  fig,ax=plt.subplots()
2578
2591
 
2579
2592
  #绘制各个价格的折线图
siat/stock_profile.py CHANGED
@@ -515,7 +515,8 @@ def plot_sustainability(sustainability,option="ESG"):
515
515
  else: width=round(2.9/l,2)
516
516
  #print("Firms:",s.index,", Width:",width)
517
517
 
518
- fig,ax=plt.subplots(figsize=(10,6))
518
+ #fig,ax=plt.subplots(figsize=(10,6))
519
+ fig,ax=plt.subplots(figsize=(12.8,6.4))
519
520
 
520
521
  #绘制分数和分位数图
521
522
  if option=="ESG":
siat/stock_technical.py CHANGED
@@ -25,7 +25,8 @@ from siat.stock import *
25
25
  from siat.valuation import *
26
26
  #==============================================================================
27
27
  import matplotlib.pyplot as plt
28
- plt.rcParams['figure.figsize']=(12.8,7.2)
28
+ #plt.rcParams['figure.figsize']=(12.8,7.2)
29
+ plt.rcParams['figure.figsize']=(12.8,6.4)
29
30
  plt.rcParams['figure.dpi']=300
30
31
  plt.rcParams['font.size'] = 13
31
32
  plt.rcParams['xtick.labelsize']=11 #横轴字体大小
siat/translate.py CHANGED
@@ -817,7 +817,7 @@ def codetranslate0(code):
817
817
  ['EBAY','易贝'],['eBay','易贝'],['META','元宇宙(脸书)'],['ZM','ZOOM'],
818
818
  ['GOOG','谷歌'],['GOOGL','谷歌'],['TWTR','X(推特)'],
819
819
  ['VIPS','唯品会'],['Vipshop','唯品会'],
820
- ['PDD','拼多多'],['Pinduoduo','拼多多'],
820
+ ['PDD','拼多多美股'],['Pinduoduo','拼多多'],
821
821
  ['BABA','阿里巴巴美股'],['Alibaba','阿里巴巴美股'],
822
822
  ['JD','京东美股'],['MPNGY','美团美股'],
823
823
  ['SINA','新浪网'],['BIDU','百度'],['NTES','网易'],
siat/valuation.py CHANGED
@@ -944,6 +944,7 @@ def security_valuation(tickers,indicators,start,end, \
944
944
  graph=True,facecolor='whitesmoke', \
945
945
  attention_value='',attention_value_area='', \
946
946
  attention_point='',attention_point_area='', \
947
+ band_area='', \
947
948
  annotate=False,annotate_value=False, \
948
949
  mark_top=False,mark_bottom=False,mark_end=False):
949
950
  """
@@ -974,6 +975,28 @@ def security_valuation(tickers,indicators,start,end, \
974
975
  name_num=len(names1)
975
976
  indicator_num=len(indicators1)
976
977
 
978
+
979
+ # 将band_area中的ticker替换为tname
980
+ if band_area != '':
981
+ if name_num > 1:
982
+ # 假定band_area里面的是ticker
983
+ for index, item in enumerate(band_area):
984
+ tname=ticker_name(item)
985
+ if tname in names1:
986
+ band_area[index] = tname
987
+ else:
988
+ band_area.remove(item)
989
+
990
+ if name_num == 1 and indicator_num > 1:
991
+ # 假定band_area里面的是indicator
992
+ for index, item in enumerate(band_area):
993
+ if item not in indicators1:
994
+ band_area.remove(item)
995
+
996
+ if len(band_area) != 2:
997
+ band_area=''
998
+ print(" #Warning(security_valuation): band_area does not match ticker or indicator")
999
+
977
1000
  import datetime
978
1001
  # 绘制一条线+均值/中位数虚线
979
1002
  if name_num * indicator_num == 1:
@@ -1120,6 +1143,7 @@ def security_valuation(tickers,indicators,start,end, \
1120
1143
  title_txt=titletxt,data_label=False, \
1121
1144
  resample_freq='D',loc=loc1, \
1122
1145
  annotate=annotate,annotate_value=annotate_value, \
1146
+ band_area=band_area, \
1123
1147
  plus_sign=plus_sign, \
1124
1148
  facecolor=facecolor, \
1125
1149
  attention_value=attention_value,attention_value_area=attention_value_area, \
@@ -1167,6 +1191,7 @@ def security_valuation(tickers,indicators,start,end, \
1167
1191
  title_txt=titletxt,data_label=False, \
1168
1192
  resample_freq='D',loc=loc1,plus_sign=plus_sign, \
1169
1193
  annotate=annotate,annotate_value=annotate_value, \
1194
+ band_area=band_area, \
1170
1195
  facecolor=facecolor, \
1171
1196
  attention_value=attention_value,attention_value_area=attention_value_area, \
1172
1197
  attention_point=attention_point,attention_point_area=attention_point_area, \
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: siat
3
- Version: 3.8.2
3
+ Version: 3.8.20
4
4
  Summary: Securities Investment Analysis Tools (siat)
5
5
  Home-page: https://pypi.org/project/siat/
6
6
  Author: Prof. WANG Dehong, International Business School, Beijing Foreign Studies University
@@ -40,14 +40,6 @@ Requires-Dist: translators
40
40
  Requires-Dist: nbconvert
41
41
  Requires-Dist: ipywidgets
42
42
  Requires-Dist: playwright
43
- Dynamic: author
44
- Dynamic: author-email
45
- Dynamic: description
46
- Dynamic: description-content-type
47
- Dynamic: home-page
48
- Dynamic: license
49
- Dynamic: requires-dist
50
- Dynamic: summary
51
43
 
52
44
 
53
45
  # What is siat?