siat 3.2.3__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/__init__.py CHANGED
@@ -20,12 +20,24 @@ InteractiveShell.ast_node_interactivity='all'
20
20
  try:
21
21
  import pkg_resources
22
22
  current_version=pkg_resources.get_distribution("siat").version
23
+ current_list=current_version.split('.')
23
24
  print("Successfully imported siat version",current_version)
24
25
 
25
26
  import luddite
26
27
  latest_version=luddite.get_version_pypi("siat")
28
+ latest_list=latest_version.split('.')
27
29
 
28
- if latest_version != current_version:
30
+ newest=True
31
+ if current_list[0] < latest_list[0]:
32
+ newest=False
33
+ elif current_list[1] < latest_list[1]:
34
+ newest=False
35
+ elif current_list[2] < latest_list[2]:
36
+ newest=False
37
+ else:
38
+ pass
39
+
40
+ if not newest:
29
41
  print("The latest version of siat is",latest_version,'\n')
30
42
  print("*** If you expect to upgrade siat in Anaconda Prompt, use the instruction below:")
31
43
  print(" pip install siat --upgrade")
@@ -35,7 +47,7 @@ try:
35
47
  print(" pip uninstall siat")
36
48
  print(" pip install siat",'\n')
37
49
 
38
- print("*** If you have a slow internet connection, use an option after the instruction above:")
50
+ print("*** If you have a slow internet connection, use an option trailing the instruction above:")
39
51
  print(" -i https://mirrors.aliyun.com/pypi/simple/",'\n')
40
52
 
41
53
  print("If you have done any of the above, restart the Python (eg. restarting the kernel)")
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
 
@@ -2505,20 +2505,28 @@ def security_technical2(ticker,start='default',end='default', \
2505
2505
  #price_line_style=(0,(1,1)), \
2506
2506
  price_line_style='dotted', \
2507
2507
  price_line_color=['red','green'], \
2508
- price_line_width=5,price_line_marker='o', \
2508
+ price_line_width=1,price_line_marker='o', \
2509
2509
  marker_sizes=[30,120,250], \
2510
2510
  ):
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
2518
2518
 
2519
- 关注的阈值:默认[0,30,50,80],attention_values=[0,30,50,80], 可以自定义,但0线一般建议保留。
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)
@@ -2615,6 +2623,13 @@ def security_technical2(ticker,start='default',end='default', \
2615
2623
 
2616
2624
  indicator=indicator, \
2617
2625
  more_details=more_details)
2626
+ #未安装talib
2627
+ if df is None:
2628
+ return None
2629
+
2630
+ if len(df) == 0:
2631
+ print(" #Warning(security_technical2): zero records calculated for",technical,"using indicator",indicator)
2632
+ return None
2618
2633
 
2619
2634
  #技术指标的绘图线
2620
2635
  tech_line_default={'RSI':['rsi'],
@@ -2692,9 +2707,14 @@ def security_technical2(ticker,start='default',end='default', \
2692
2707
 
2693
2708
  #字段排序
2694
2709
  tech_line_collist.sort()
2695
- 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']]
2696
2714
 
2697
2715
  #绘图----------------------------------------------------------------------
2716
+ print('') #距离上条信息空一行
2717
+
2698
2718
  import matplotlib.pyplot as plt
2699
2719
  import matplotlib.dates as mdates
2700
2720
  #import matplotlib.gridspec as gridspec
@@ -2765,6 +2785,8 @@ def security_technical2(ticker,start='default',end='default', \
2765
2785
  attention_draws=[False] * len(attention_values)
2766
2786
 
2767
2787
  for l in tech_line_collist:
2788
+ if l == 'marker_size': continue
2789
+
2768
2790
  labeltxt=l.upper()
2769
2791
  if labeltxt =='DEA':
2770
2792
  labeltxt='慢线(DEA)'
@@ -2780,7 +2802,7 @@ def security_technical2(ticker,start='default',end='default', \
2780
2802
  pos=attention_values.index(al)
2781
2803
 
2782
2804
  line_al=False
2783
- if lmax >= al >= lmin:
2805
+ if (lmax >= al) and (al >= lmin):
2784
2806
  line_al=True
2785
2807
 
2786
2808
  #如果需要绘制关注线,且尚未绘制过,则绘制
@@ -2872,10 +2894,10 @@ def security_technical2(ticker,start='default',end='default', \
2872
2894
  ax3.bar(df1up.index,df1up['Volume'],color=price_line_color1)
2873
2895
  ax3.bar(df1down.index,df1down['Volume'],color=price_line_color2)
2874
2896
 
2875
- ax3.set_ylabel("交易量(百万)",fontsize=ylabel_txt_size -4)
2897
+ ax3.set_ylabel("交易量(百万股)",fontsize=ylabel_txt_size -4)
2876
2898
 
2877
2899
  footnote1="\n注:快线自下而上穿过慢线为金叉,自上而下穿过慢线为死叉。"
2878
- footnote2="价格曲线上端点的大中小对应当日涨跌幅度三分位数的高中低部分。\n"
2900
+ footnote2="价格曲线端点大中小对应当日涨跌幅度的高中低情形。\n"
2879
2901
  footnote3="横轴日期上的空白处为非交易日(周末或公共节假日)。"
2880
2902
 
2881
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.3
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
@@ -1,4 +1,4 @@
1
- siat/__init__.py,sha256=2c0GKq4KaxA0vfdvMeyCPiNR6wODmH6CGj8n5UDOywY,2182
1
+ siat/__init__.py,sha256=0N9ER3IIQkOVCLiX2nvfOmYfaYpt4OMd-r0Hbh2DSJc,2496
2
2
  siat/allin.py,sha256=f1VWxZLvPLR57ilk9GOziZMWjyAYOYLXbvQI4z38r50,2708
3
3
  siat/alpha_vantage_test.py,sha256=tKr-vmuFH3CZAqwmISz6jzjPHzV1JJl3sPfZdz8aTfM,747
4
4
  siat/assets_liquidity.py,sha256=deAJ60YcqMUgrXY7jy7BfzLutoy4uOEtfXqqMSujCRo,28889
@@ -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=I7AeesRFKAK_8MZcqtV1ppvnqsTZfQYgxU3iTAUzMiQ,122806
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.3.dist-info/METADATA,sha256=GB36cl3udD6IE5Vaaah6WH_nNbjjruc60CRXLHwliB8,1447
140
- siat-3.2.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
141
- siat-3.2.3.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
142
- siat-3.2.3.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