siat 3.2.1__py3-none-any.whl → 3.2.2__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/fund_china.py +3 -3
- siat/stock_technical.py +81 -50
- {siat-3.2.1.dist-info → siat-3.2.2.dist-info}/METADATA +1 -1
- {siat-3.2.1.dist-info → siat-3.2.2.dist-info}/RECORD +6 -6
- {siat-3.2.1.dist-info → siat-3.2.2.dist-info}/WHEEL +0 -0
- {siat-3.2.1.dist-info → siat-3.2.2.dist-info}/top_level.txt +0 -0
siat/fund_china.py
CHANGED
@@ -2375,14 +2375,14 @@ def compare_metf_china(fund_list,start,end,ftype='单位净值',graph=True):
|
|
2375
2375
|
|
2376
2376
|
#绘图
|
2377
2377
|
y_label=ftype
|
2378
|
-
import datetime;
|
2378
|
+
import datetime; todaydt = datetime.date.today()
|
2379
2379
|
|
2380
2380
|
lang=check_language()
|
2381
2381
|
if lang == 'English':
|
2382
|
-
x_label="Source: eastmoney/tiantian funds, "+str(
|
2382
|
+
x_label="Source: eastmoney/tiantian funds, "+str(todaydt)
|
2383
2383
|
title_txt="Compare Multiple ETF Fund Performance"
|
2384
2384
|
else:
|
2385
|
-
x_label="数据来源: 东方财富/天天基金,"+str(
|
2385
|
+
x_label="数据来源: 东方财富/天天基金,"+str(todaydt)
|
2386
2386
|
title_txt="比较多只ETF基金的净值指标"
|
2387
2387
|
|
2388
2388
|
draw_lines(fdf,y_label,x_label,axhline_value=0,axhline_label='',title_txt=title_txt, \
|
siat/stock_technical.py
CHANGED
@@ -2438,6 +2438,7 @@ if __name__ =="__main__":
|
|
2438
2438
|
technical='EMV'; indicator='Close'
|
2439
2439
|
|
2440
2440
|
attention_values=[0,25,50,75]
|
2441
|
+
more_details=False
|
2441
2442
|
ticker_type='auto'; source='auto'
|
2442
2443
|
ahead_days=30*4
|
2443
2444
|
resample_freq='6H'; smooth=True;linewidth=1.5
|
@@ -2449,8 +2450,7 @@ if __name__ =="__main__":
|
|
2449
2450
|
price_line_style='dotted'; price_line_color='red'; price_line_width=5; price_line_marker='.'
|
2450
2451
|
|
2451
2452
|
|
2452
|
-
df=security_technical2(ticker,start,end,technical=technical,
|
2453
|
-
loc1='lower left',loc2='lower right')
|
2453
|
+
df=security_technical2(ticker,start,end,technical=technical,marker_sizes=[20,150,300])
|
2454
2454
|
|
2455
2455
|
tlist=['RSI','OBV','MACD','KDJ','VOL','PSY','ARBR','CR','EMV','Bollinger', \
|
2456
2456
|
'TRIX','DMA','BIAS','CCI','W%R','ROC','DMI']
|
@@ -2459,50 +2459,55 @@ if __name__ =="__main__":
|
|
2459
2459
|
|
2460
2460
|
def security_technical2(ticker,start='default',end='default', \
|
2461
2461
|
technical=['MACD'],indicator='Close', \
|
2462
|
-
|
2462
|
+
more_details=False, \
|
2463
2463
|
attention_values=[0,25,50,75,100], \
|
2464
2464
|
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2465
|
+
ticker_type='auto',source='auto', \
|
2466
|
+
|
2467
|
+
#指标的默认参数
|
2468
|
+
RSI_days=[6,24], \
|
2469
|
+
OBV_days=5, \
|
2470
|
+
|
2471
|
+
MA_days=[5,20], \
|
2472
|
+
MACD_fastperiod=12,MACD_slowperiod=26,MACD_signalperiod=9, \
|
2473
|
+
|
2474
|
+
KDJ_fastk_period=9,KDJ_slowk_period=5,KDJ_slowk_matype=1, \
|
2475
|
+
KDJ_slowd_period=5,KDJ_slowd_matype=1, \
|
2476
|
+
|
2477
|
+
VOL_fastperiod=5,VOL_slowperiod=10, \
|
2478
|
+
PSY_days=12, \
|
2479
|
+
ARBR_days=26, \
|
2480
|
+
CR_day=16,CR_madays=[5,20], \
|
2481
|
+
EMV_day=14,EMV_madays=9, \
|
2482
|
+
|
2483
|
+
BULL_days=20,BULL_nbdevup=2,BULL_nbdevdn=2,BULL_matype=0, \
|
2484
|
+
|
2485
|
+
DMA_fastperiod=10,DMA_slowperiod=50,DMA_madays=10, \
|
2486
|
+
|
2487
|
+
TRIX_day=12,TRIX_madays=20, \
|
2488
|
+
BIAS_days=[6,24], \
|
2489
|
+
CCI_days=14, \
|
2490
|
+
WR_days=[10,6], \
|
2491
|
+
ROC_day=12,ROC_madays=6, \
|
2492
|
+
DMI_DIdays=14,DMI_ADXdays=6, \
|
2493
|
+
|
2494
|
+
#数据提前量
|
2495
|
+
ahead_days=30*4, \
|
2496
|
+
|
2497
|
+
#绘图参数
|
2498
|
+
resample_freq='6H',smooth=True,linewidth=1.5, \
|
2499
|
+
date_range=False,date_freq=False,annotate=False, \
|
2500
|
+
|
2501
|
+
graph=['ALL'],printout=False, \
|
2502
|
+
loc1='best',loc2='best', \
|
2503
|
+
|
2504
|
+
facecolor=['whitesmoke','papayawhip'], \
|
2505
|
+
#price_line_style=(0,(1,1)), \
|
2506
|
+
price_line_style='dotted', \
|
2507
|
+
price_line_color=['red','green'], \
|
2508
|
+
price_line_width=5,price_line_marker='o', \
|
2509
|
+
marker_sizes=[30,120,250], \
|
2510
|
+
):
|
2506
2511
|
"""
|
2507
2512
|
功能:计算和绘制证券技术分析指标的简易图,仅供进一步探索使用,仅用于单个证券(股债基)
|
2508
2513
|
|
@@ -2520,7 +2525,7 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2520
2525
|
return None
|
2521
2526
|
|
2522
2527
|
#检查indicator
|
2523
|
-
if indicator not in ['Open','Close','High','Low']:
|
2528
|
+
if indicator not in ['Open','Close','High','Low','Adj Close']:
|
2524
2529
|
print(" #Warning(security_technical2): not a valid price type for",indicator)
|
2525
2530
|
return None
|
2526
2531
|
|
@@ -2555,7 +2560,21 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2555
2560
|
print(" #Warning(security_technical2): no prices found for",ticker,'as type',ticker_type)
|
2556
2561
|
return None
|
2557
2562
|
|
2563
|
+
#当日涨跌
|
2558
2564
|
price['up_down']=price['Close']-price['Open']
|
2565
|
+
price['up_down_abs']=abs(price['up_down'])
|
2566
|
+
|
2567
|
+
#分位数
|
2568
|
+
import numpy as np
|
2569
|
+
"""
|
2570
|
+
max(price['up_down_abs'])
|
2571
|
+
min(price['up_down_abs'])
|
2572
|
+
"""
|
2573
|
+
q70=np.percentile(price['up_down_abs'],70)
|
2574
|
+
q30=np.percentile(price['up_down_abs'],30)
|
2575
|
+
|
2576
|
+
small_size=marker_sizes[0]; mid_size=marker_sizes[1]; big_size=marker_sizes[2]
|
2577
|
+
price['marker_size']=price['up_down_abs'].apply(lambda x: big_size if x>=q70 else mid_size if x>=q30 else small_size)
|
2559
2578
|
|
2560
2579
|
#计算技术指标
|
2561
2580
|
df=calc_technical(price,fromdate,todate, \
|
@@ -2673,7 +2692,7 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2673
2692
|
|
2674
2693
|
#字段排序
|
2675
2694
|
tech_line_collist.sort()
|
2676
|
-
df1=df[tech_line_collist+[indicator,'Volume','up_down']]
|
2695
|
+
df1=df[tech_line_collist+[indicator,'Volume','up_down','marker_size']]
|
2677
2696
|
|
2678
2697
|
#绘图----------------------------------------------------------------------
|
2679
2698
|
import matplotlib.pyplot as plt
|
@@ -2802,12 +2821,12 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2802
2821
|
seg_list=list(set(list(df1['segment'])))
|
2803
2822
|
|
2804
2823
|
ax2 = ax.twinx()
|
2805
|
-
ylabeltxt2=
|
2824
|
+
ylabeltxt2=ectranslate(indicator)
|
2806
2825
|
ax2.set_ylabel(ylabeltxt2,fontsize=ylabel_txt_size)
|
2807
2826
|
|
2808
2827
|
#细灰线先画出轮廓
|
2809
2828
|
ax2.plot(df1.index,df1[indicator],label='', \
|
2810
|
-
linestyle=price_line_style,color='grey',lw=
|
2829
|
+
linestyle=price_line_style,color='grey',lw=2)
|
2811
2830
|
|
2812
2831
|
#不同颜色绘制涨跌价格线
|
2813
2832
|
first_time=True; second_time=False
|
@@ -2834,8 +2853,10 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2834
2853
|
ax2.plot(df1seg.index,df1seg[indicator],label=labeltxt, \
|
2835
2854
|
linestyle=':',color=seg_color,lw=price_line_width,marker=price_line_marker)
|
2836
2855
|
"""
|
2837
|
-
ax2.scatter(df1seg.index,df1seg[indicator],
|
2838
|
-
|
2856
|
+
ax2.scatter(df1seg.index,df1seg[indicator], \
|
2857
|
+
s=df1seg['marker_size'], \
|
2858
|
+
label=labeltxt, \
|
2859
|
+
linestyle=':',color=seg_color,lw=price_line_width,marker=price_line_marker)
|
2839
2860
|
|
2840
2861
|
|
2841
2862
|
"""
|
@@ -2853,6 +2874,16 @@ def security_technical2(ticker,start='default',end='default', \
|
|
2853
2874
|
|
2854
2875
|
ax3.set_ylabel("交易量(百万)",fontsize=ylabel_txt_size -4)
|
2855
2876
|
|
2877
|
+
footnote1="\n注:快线自下而上穿过慢线为金叉,自上而下穿过慢线为死叉。"
|
2878
|
+
footnote2="价格曲线上端点的大中小对应当日涨跌幅度三分位数的高中低部分。\n"
|
2879
|
+
footnote3="横轴日期上的空白处为非交易日(周末或公共节假日)。"
|
2880
|
+
|
2881
|
+
import datetime; todaydt = str(datetime.date.today())
|
2882
|
+
footnote4="数据来源:新浪/雅虎/stooq/东方财富等,"+todaydt+"统计"
|
2883
|
+
|
2884
|
+
footnote=footnote1+footnote2+footnote3+footnote4
|
2885
|
+
ax3.set_xlabel(footnote,fontsize=ylabel_txt_size -2)
|
2886
|
+
|
2856
2887
|
#fig.text(0.5, 0.04, 'x', ha='center')
|
2857
2888
|
plt.subplots_adjust(hspace=0.2)
|
2858
2889
|
|
@@ -52,7 +52,7 @@ siat/financials_test.py,sha256=HJ3CPo_Xckz2wXi3AEP6ZNWCF1Duc1pLi0Y10USiImc,23829
|
|
52
52
|
siat/fred_test.py,sha256=KF50ssSbsfpa_kT6iuomD0vG4eXztAcOasZxg1OGX5w,1201
|
53
53
|
siat/fund.py,sha256=wMDORsCBV8ZXfgwbtq-0bu3qqWY66dHnbqgllW0gWCo,24637
|
54
54
|
siat/fund_china.pickle,sha256=wJIIvEjWuZylcaQ3c5kvIdKedpFF5T53cJlG-1LVoms,2410657
|
55
|
-
siat/fund_china.py,sha256=
|
55
|
+
siat/fund_china.py,sha256=rPGnYSPkbZUqtBoJnxLZLIQ8MjD8vD3TovCMfletBP4,111839
|
56
56
|
siat/fund_china_test.py,sha256=-Bh6m0J0GPpIbYXx-H2vpzJoNFI6pE2C2jVPa8DazgE,6649
|
57
57
|
siat/fund_test.py,sha256=V4ADb8Gsp8gyeFTwcgRsJBpnUih_O-Q2V1ILc5oKjK8,1116
|
58
58
|
siat/future_china.py,sha256=F-HsIf2Op8Z22RzTjet1g8COzldgnMjFNSXsAkeGyWo,17595
|
@@ -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=
|
118
|
+
siat/stock_technical.py,sha256=I7AeesRFKAK_8MZcqtV1ppvnqsTZfQYgxU3iTAUzMiQ,122806
|
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.
|
140
|
-
siat-3.2.
|
141
|
-
siat-3.2.
|
142
|
-
siat-3.2.
|
139
|
+
siat-3.2.2.dist-info/METADATA,sha256=kYXGiGAqJnm-hrtVardCgjNQ1A7SvjHoNTEudqWWV1Q,1447
|
140
|
+
siat-3.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
141
|
+
siat-3.2.2.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
142
|
+
siat-3.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|