siat 3.2.4__py3-none-any.whl → 3.2.5__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/stock_technical.py CHANGED
@@ -2435,7 +2435,7 @@ if __name__ =="__main__":
2435
2435
 
2436
2436
  start='2024-3-1'; end='2024-4-12'; ahead_days=30*3
2437
2437
 
2438
- technical='EMV'; indicator='Close'
2438
+ technical='ARBR'; indicator='Close'
2439
2439
 
2440
2440
  attention_values=[0,25,50,75]
2441
2441
  more_details=False
@@ -2448,7 +2448,7 @@ if __name__ =="__main__":
2448
2448
 
2449
2449
  facecolor=['whitesmoke','papayawhip']
2450
2450
  price_line_style='dotted'; price_line_color='red'; price_line_width=5; price_line_marker='.'
2451
-
2451
+ marker_sizes=[30,120,250]
2452
2452
 
2453
2453
  df=security_technical2(ticker,start,end,technical=technical,marker_sizes=[20,150,300])
2454
2454
 
@@ -2511,7 +2511,7 @@ def security_technical2(ticker,start='default',end='default', \
2511
2511
  """
2512
2512
  功能:计算和绘制证券技术分析指标的简易图,仅供进一步探索使用,仅用于单个证券(股债基)
2513
2513
 
2514
- 支持的探索指标:
2514
+ 支持的技术分析指标:
2515
2515
  OBV、SAR、VOL、PSY、ARBR、CR、EMV、TRIX、DMA、BIAS、CCI、W%R、ROC、DMI
2516
2516
  支持的其他指标:不如单独的指令功能强
2517
2517
  MACD、RSI、KDJ、BOLL
@@ -2519,6 +2519,14 @@ def security_technical2(ticker,start='default',end='default', \
2519
2519
  关注的阈值:默认[0,25,50,75,100],attention_values=[0,25,50,75,100], 可以自定义。
2520
2520
  收盘价折线:默认红色虚线,price_line_color='red'
2521
2521
  """
2522
+ # 检查ta-lib是否安装,避免浪费后续的处理
2523
+ try:
2524
+ import talib
2525
+ except:
2526
+ print(" #Error(security_technical2): lack of necessary package - talib")
2527
+ talib_install_method()
2528
+ return None
2529
+
2522
2530
  #检查证券代码
2523
2531
  if not isinstance(ticker,str):
2524
2532
  print(" #Warning(security_technical2): not a security code for",ticker)
@@ -2699,9 +2707,14 @@ def security_technical2(ticker,start='default',end='default', \
2699
2707
 
2700
2708
  #字段排序
2701
2709
  tech_line_collist.sort()
2702
- df1=df[tech_line_collist+[indicator,'Volume','up_down','marker_size']]
2710
+ if 'marker_size' in tech_line_collist:
2711
+ df1=df[tech_line_collist+[indicator,'Volume','up_down']]
2712
+ else:
2713
+ df1=df[tech_line_collist+[indicator,'Volume','up_down','marker_size']]
2703
2714
 
2704
2715
  #绘图----------------------------------------------------------------------
2716
+ print('') #距离上条信息空一行
2717
+
2705
2718
  import matplotlib.pyplot as plt
2706
2719
  import matplotlib.dates as mdates
2707
2720
  #import matplotlib.gridspec as gridspec
@@ -2772,6 +2785,8 @@ def security_technical2(ticker,start='default',end='default', \
2772
2785
  attention_draws=[False] * len(attention_values)
2773
2786
 
2774
2787
  for l in tech_line_collist:
2788
+ if l == 'marker_size': continue
2789
+
2775
2790
  labeltxt=l.upper()
2776
2791
  if labeltxt =='DEA':
2777
2792
  labeltxt='慢线(DEA)'
@@ -2787,7 +2802,7 @@ def security_technical2(ticker,start='default',end='default', \
2787
2802
  pos=attention_values.index(al)
2788
2803
 
2789
2804
  line_al=False
2790
- if lmax >= al >= lmin:
2805
+ if (lmax >= al) and (al >= lmin):
2791
2806
  line_al=True
2792
2807
 
2793
2808
  #如果需要绘制关注线,且尚未绘制过,则绘制
@@ -2879,10 +2894,10 @@ def security_technical2(ticker,start='default',end='default', \
2879
2894
  ax3.bar(df1up.index,df1up['Volume'],color=price_line_color1)
2880
2895
  ax3.bar(df1down.index,df1down['Volume'],color=price_line_color2)
2881
2896
 
2882
- ax3.set_ylabel("交易量(百万)",fontsize=ylabel_txt_size -4)
2897
+ ax3.set_ylabel("交易量(百万股)",fontsize=ylabel_txt_size -4)
2883
2898
 
2884
2899
  footnote1="\n注:快线自下而上穿过慢线为金叉,自上而下穿过慢线为死叉。"
2885
- footnote2="价格曲线上端点的大中小对应当日涨跌幅度三分位数的高中低部分。\n"
2900
+ footnote2="价格曲线端点大中小对应当日涨跌幅度的高中低情形。\n"
2886
2901
  footnote3="横轴日期上的空白处为非交易日(周末或公共节假日)。"
2887
2902
 
2888
2903
  import datetime; todaydt = str(datetime.date.today())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siat
3
- Version: 3.2.4
3
+ Version: 3.2.5
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
@@ -115,7 +115,7 @@ siat/stock_prices_kneighbors.py,sha256=WfZvo5EyeBsm-T37zDj7Sl9dPSRq5Bx4JxIJ9IUum
115
115
  siat/stock_prices_linear.py,sha256=-OUKRr27L2aStQgJSlJOrJ4gay_G7P-m-7t7cU2Yoqk,13991
116
116
  siat/stock_profile.py,sha256=B3eIwzEmiCqiCaxIlhfdEPsQBoW1PFOe1hkiY3mVF6Y,26038
117
117
  siat/stock_technical-20240620.py,sha256=A4x18mZgYSA8SSiDz4u_O3gd5oVRgbI6JIiBfFY0tVw,116013
118
- siat/stock_technical.py,sha256=BYvPqwROBek24AgeOLQIAn0X1nc0CKM_6JGWfmOzyoc,122996
118
+ siat/stock_technical.py,sha256=vewfR1NXFCn60QUEcTPJNSB8Ndq2-TJEfOyHVDGPHKE,123502
119
119
  siat/stock_test.py,sha256=E9YJAvOw1VEGJSDI4IZuEjl0tGoisOIlN-g9UqA_IZE,19475
120
120
  siat/stooq.py,sha256=dOc_S5HLrYg48YAKTCs1eX8UTJOOkPM8qLL2KupqlLY,2470
121
121
  siat/temp.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
@@ -136,7 +136,7 @@ siat/valuation.py,sha256=NKfeZMdDJOW42oLVHob6eSVBXUqlN1OCnnzwyGAst8c,48855
136
136
  siat/valuation_china.py,sha256=EkZQaVkoBjM0c4MCNbaX-bMnlG0e3FXeaWczZDnkptU,67784
137
137
  siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
138
138
  siat/var_model_validation.py,sha256=f-oDewg7bPzyNanz_Y_jLH68NowAA3gXFehW_weKGG0,14898
139
- siat-3.2.4.dist-info/METADATA,sha256=ZYOQXEN6fDtTEw8LfrqXyElewAO9OuxEax03JzawUas,1447
140
- siat-3.2.4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
141
- siat-3.2.4.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
142
- siat-3.2.4.dist-info/RECORD,,
139
+ siat-3.2.5.dist-info/METADATA,sha256=zmB_udFs6LIEZPb7Cw7Ku0bQ4GHlA_6gOzWuwaWjmU4,1447
140
+ siat-3.2.5.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
141
+ siat-3.2.5.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
142
+ siat-3.2.5.dist-info/RECORD,,
File without changes