siat 3.4.15__py3-none-any.whl → 3.4.17__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/security_price2.py +8 -1
- siat/security_prices.py +10 -5
- siat/security_trend2.py +24 -0
- siat/stock.py +10 -0
- siat/translate.py +6 -4
- siat/yf_name.py +50 -0
- {siat-3.4.15.dist-info → siat-3.4.17.dist-info}/METADATA +1 -1
- {siat-3.4.15.dist-info → siat-3.4.17.dist-info}/RECORD +10 -10
- {siat-3.4.15.dist-info → siat-3.4.17.dist-info}/WHEEL +0 -0
- {siat-3.4.15.dist-info → siat-3.4.17.dist-info}/top_level.txt +0 -0
siat/security_price2.py
CHANGED
@@ -37,8 +37,11 @@ if __name__=='__main__':
|
|
37
37
|
ticker='sz159998' #基金
|
38
38
|
|
39
39
|
ticker='801010.SW' #申万
|
40
|
+
ticker='851242.SW' #申万
|
40
41
|
|
41
42
|
ticker='AAPL'
|
43
|
+
|
44
|
+
|
42
45
|
fromdate='2024-5-1'; todate='2024-5-20'
|
43
46
|
|
44
47
|
ticker_type='auto'
|
@@ -49,7 +52,7 @@ if __name__=='__main__':
|
|
49
52
|
ticker_type='fund'
|
50
53
|
|
51
54
|
source='auto'
|
52
|
-
source='yahoo'
|
55
|
+
#source='yahoo'
|
53
56
|
|
54
57
|
adjust='qfq'
|
55
58
|
fill=True
|
@@ -84,6 +87,7 @@ def get_price_1ticker(ticker,fromdate,todate, \
|
|
84
87
|
#检查日期期间合理性
|
85
88
|
valid_period,fromdatepd,todatepd=check_period(fromdate,todate)
|
86
89
|
if not valid_period:
|
90
|
+
pass
|
87
91
|
#print(" #Warning(get_price_1ticker): invalid date period from",fromdate,"to",todate)
|
88
92
|
return df,found
|
89
93
|
|
@@ -612,6 +616,9 @@ if __name__=='__main__':
|
|
612
616
|
ticker='180202.SZ'
|
613
617
|
ticker_type='fund'
|
614
618
|
|
619
|
+
ticker='851242.SW'
|
620
|
+
ticker_type='auto'
|
621
|
+
|
615
622
|
fromdate='2021-1-1'
|
616
623
|
todate='2024-5-30'
|
617
624
|
adjust=''
|
siat/security_prices.py
CHANGED
@@ -2805,10 +2805,10 @@ def china_security_identify(ticker6):
|
|
2805
2805
|
|
2806
2806
|
#==============================================================================
|
2807
2807
|
if __name__=='__main__':
|
2808
|
-
ticker='850831'
|
2808
|
+
ticker='850831.SW'
|
2809
2809
|
|
2810
|
-
start='
|
2811
|
-
end='
|
2810
|
+
start='2024-1-1'
|
2811
|
+
end='2024-4-4'
|
2812
2812
|
info_types=['Close','Volume']
|
2813
2813
|
|
2814
2814
|
df3=fetch_price_swindex(ticker,start,end)
|
@@ -2834,12 +2834,17 @@ def fetch_price_swindex(ticker,start,end,info_types=['Close','Volume'],adjust=-2
|
|
2834
2834
|
_,start1pd,_=check_period(start1,end)
|
2835
2835
|
|
2836
2836
|
import akshare as ak
|
2837
|
+
if len(ticker)==6:
|
2838
|
+
ticker=ticker+'.SW'
|
2839
|
+
ticker6=ticker[:6]
|
2837
2840
|
try:
|
2838
|
-
prices= ak.index_hist_sw(symbol=
|
2841
|
+
prices= ak.index_hist_sw(symbol=ticker6,period="day")
|
2839
2842
|
except: pass
|
2840
2843
|
|
2841
2844
|
found=df_have_data(prices)
|
2842
|
-
if found not in ['Found','Empty']:
|
2845
|
+
if found not in ['Found','Empty']:
|
2846
|
+
pass
|
2847
|
+
return df
|
2843
2848
|
|
2844
2849
|
prices.columns=['Code','Date','Close','Open','High','Low','Volume','Amount']
|
2845
2850
|
million=1000000
|
siat/security_trend2.py
CHANGED
@@ -76,6 +76,7 @@ if __name__=='__main__':
|
|
76
76
|
indicator='Close'
|
77
77
|
start="2020-1-1"
|
78
78
|
end="2020-6-30"
|
79
|
+
ticker_type='auto'
|
79
80
|
|
80
81
|
|
81
82
|
#测试组5
|
@@ -85,6 +86,29 @@ if __name__=='__main__':
|
|
85
86
|
end="2024-5-30"
|
86
87
|
ticker_type='fund'
|
87
88
|
|
89
|
+
#测试组6
|
90
|
+
ticker="851242.SW"
|
91
|
+
indicator='Close'
|
92
|
+
start="2024-1-1"
|
93
|
+
end="2024-6-30"
|
94
|
+
ticker_type='auto'
|
95
|
+
|
96
|
+
attention_value=''; average_value=False
|
97
|
+
kline=False; kline_demo=False; mav=[5,10,20]
|
98
|
+
dividend=False; split=False
|
99
|
+
ret_type='Annual Adj Ret%'; RF=0; regression_period=365; market_index="auto"
|
100
|
+
sortby='tpw_mean'; trailing=7; trend_threshhold=0.05
|
101
|
+
band_area=''
|
102
|
+
graph=True; twinx=False; loc1='best'; loc2='best'
|
103
|
+
datatag=False; power=0
|
104
|
+
smooth=True; date_range=False; date_freq=False
|
105
|
+
preprocess='none'; scaling_option='change%'
|
106
|
+
annotate=False; annotate_value=False
|
107
|
+
mark_top=False; mark_bottom=False; mark_end=False
|
108
|
+
printout=False; source='auto'
|
109
|
+
ticker_type='auto'
|
110
|
+
facecolor='papayawhip'
|
111
|
+
|
88
112
|
df=security_trend(ticker,indicator,start,end,ticker_type=ticker_type)
|
89
113
|
|
90
114
|
|
siat/stock.py
CHANGED
@@ -613,6 +613,16 @@ if __name__ =="__main__":
|
|
613
613
|
ticker_type='auto'
|
614
614
|
facecolor='whitesmoke'
|
615
615
|
|
616
|
+
# 测试组5
|
617
|
+
ticker='851242.SW'
|
618
|
+
indicator='Close'
|
619
|
+
fromdate='2024-5-1'; todate='2024-5-20'
|
620
|
+
adjust=''
|
621
|
+
zeroline=False; average_value=False; datatag=False; power=0; graph=True
|
622
|
+
source='auto'
|
623
|
+
mark_top=True; mark_bottom=True; mark_end=True
|
624
|
+
ticker_type='auto'
|
625
|
+
facecolor='whitesmoke'
|
616
626
|
|
617
627
|
df=security_indicator(ticker,indicator,fromdate,todate,ticker_type=ticker_type)
|
618
628
|
|
siat/translate.py
CHANGED
@@ -3252,6 +3252,7 @@ if __name__=='__main__':
|
|
3252
3252
|
ticker='PDD'
|
3253
3253
|
ticker='IBM'
|
3254
3254
|
ticker='600000.SS'
|
3255
|
+
ticker='ULVR.L'
|
3255
3256
|
|
3256
3257
|
ticker_type='auto'
|
3257
3258
|
ticker_type='bond'
|
@@ -3259,6 +3260,7 @@ if __name__=='__main__':
|
|
3259
3260
|
ticker={'Market':('US','^SPX','中概教培组合'),'EDU':0.5,'TAL':0.3,'TEDU':0.2}
|
3260
3261
|
|
3261
3262
|
ticker1_name(ticker,ticker_type)
|
3263
|
+
ticker1_name(ticker)
|
3262
3264
|
|
3263
3265
|
def ticker1_name(ticker,ticker_type='auto'):
|
3264
3266
|
"""
|
@@ -3283,7 +3285,6 @@ def ticker1_name(ticker,ticker_type='auto'):
|
|
3283
3285
|
if tname != ticker: #翻译成功,注意证券代码与其名称相同的情形,例如IBM
|
3284
3286
|
return tname
|
3285
3287
|
|
3286
|
-
|
3287
3288
|
symbol=ticker1_cvt2yahoo(ticker)
|
3288
3289
|
|
3289
3290
|
#申万行业指数
|
@@ -3325,7 +3326,8 @@ def ticker1_name(ticker,ticker_type='auto'):
|
|
3325
3326
|
if tname != symbol or symbol in ['IBM']: break
|
3326
3327
|
else:
|
3327
3328
|
tname=get_stock_name_china_sina(symbol[:6])
|
3328
|
-
if tname
|
3329
|
+
if tname=='': tname=symbol
|
3330
|
+
if tname != symbol and tname != '': break
|
3329
3331
|
|
3330
3332
|
|
3331
3333
|
#查找证券名称文件:次优先交易所债券
|
@@ -3351,11 +3353,11 @@ def ticker1_name(ticker,ticker_type='auto'):
|
|
3351
3353
|
break
|
3352
3354
|
|
3353
3355
|
#如未查到,尝试stooq和雅虎名称,限英文名称
|
3354
|
-
if tname==symbol:
|
3356
|
+
if tname==symbol or tname=='':
|
3355
3357
|
#不包括中国大陆和香港证券,这些都应在前面查到?新上市的可能查不到
|
3356
3358
|
#if ('.SS' not in symbol) and ('.SH' not in symbol) and ('.SZ' not in symbol) and ('.BJ' not in symbol) and ('.HK' not in symbol):
|
3357
3359
|
tname=get_stock_name1_en(symbol)
|
3358
|
-
if tname
|
3360
|
+
if tname!=symbol:
|
3359
3361
|
return tname
|
3360
3362
|
|
3361
3363
|
#加港股标记
|
siat/yf_name.py
CHANGED
@@ -295,6 +295,52 @@ def yahoo_name1(ticker,short_name=False,add_suffix=True,maxlen=80):
|
|
295
295
|
t_name=t_name+'('+sid+')'
|
296
296
|
|
297
297
|
return t_name
|
298
|
+
|
299
|
+
#==============================================================================
|
300
|
+
if __name__ == '__main__':
|
301
|
+
stock_code='KSL.AX'
|
302
|
+
stock_code='AAPL'
|
303
|
+
stock_code='600519.SS'
|
304
|
+
stock_code='6758.T'
|
305
|
+
stock_code='6758.JP'
|
306
|
+
stock_code='ULVR.L'
|
307
|
+
stock_code='ULVR.UK'
|
308
|
+
|
309
|
+
stock_code='1155.KL'
|
310
|
+
stock_code='MSFT'
|
311
|
+
|
312
|
+
yahoo_name1_direct(stock_code)
|
313
|
+
|
314
|
+
|
315
|
+
def yahoo_name1_direct(stock_code,add_suffix=True):
|
316
|
+
"""
|
317
|
+
功能:网页直接抓取,有的带后缀的股票代码可能失败,原因未知
|
318
|
+
"""
|
319
|
+
import requests
|
320
|
+
from bs4 import BeautifulSoup
|
321
|
+
|
322
|
+
stock_code1=stock_code.upper()
|
323
|
+
|
324
|
+
#抓取证券名称
|
325
|
+
url = f"https://finance.yahoo.com/quote/{stock_code1}/"
|
326
|
+
response = requests.get(url)
|
327
|
+
if response.status_code == 200:
|
328
|
+
soup = BeautifulSoup(response.text, 'html.parser')
|
329
|
+
soup_title=soup.title
|
330
|
+
soup_text=soup_title.text
|
331
|
+
soup_text_list=soup_text.split('(')
|
332
|
+
|
333
|
+
t_name = soup_text_list[0].strip()
|
334
|
+
else:
|
335
|
+
#未找到证券代码
|
336
|
+
pass
|
337
|
+
return stock_code
|
338
|
+
|
339
|
+
#过滤名称中多余的尾部词汇
|
340
|
+
t_name=filter_stock_name(t_name)
|
341
|
+
|
342
|
+
|
343
|
+
return t_name
|
298
344
|
#==============================================================================
|
299
345
|
if __name__=='__main__':
|
300
346
|
original_name='Oponeo.pl SA'
|
@@ -437,6 +483,10 @@ if __name__=='__main__':
|
|
437
483
|
ticker='MBG.DE'
|
438
484
|
ticker='005930.KS'
|
439
485
|
ticker='LI'
|
486
|
+
ticker='ULVR.L'
|
487
|
+
ticker='KSL.AX'
|
488
|
+
|
489
|
+
ticker='IBM'
|
440
490
|
|
441
491
|
get_stock_name1_en(ticker)
|
442
492
|
|
@@ -97,15 +97,15 @@ siat/risk_free_rate_test.py,sha256=CpmhUf8aEAEZeNu4gvWP2Mz2dLoIgBX5bI41vfUBEr8,4
|
|
97
97
|
siat/sector_china.py,sha256=_-NgVSI2AMRCZw3U85ov6CgU5riii4Y9oY-rfUrfVSk,132551
|
98
98
|
siat/sector_china_test.py,sha256=1wq7ef8Bb_L8F0h0W6FvyBrIcBTEbrTV7hljtpj49U4,5843
|
99
99
|
siat/security_price.py,sha256=2oHskgiw41KMGfqtnA0i2YjNNV6cYgtlUK0j3YeuXWs,29185
|
100
|
-
siat/security_price2.py,sha256=
|
101
|
-
siat/security_prices.py,sha256=
|
100
|
+
siat/security_price2.py,sha256=Y4suVC-4koUSI_n8kY0l0y4lo_CTcoeM_kwTHiIFzyM,26291
|
101
|
+
siat/security_prices.py,sha256=lh4G7Q20HoC3Iph8hOuACFcIc33xKyWBgMqhTykh8Qo,106492
|
102
102
|
siat/security_prices_test.py,sha256=OEphoJ87NPKoNow1QA8EU_5MUYrJF-qKoWKNapVfZNI,10779
|
103
103
|
siat/security_trend.py,sha256=o0vpWdrJkmODCP94X-Bvn-w7efHhj9HpUYBHtLl55D0,17240
|
104
104
|
siat/security_trend2-20240620.py,sha256=QVnEcb7AyVbO77jVqfFsJffGXrX8pgJ9xCfoAKmWBPk,24854
|
105
|
-
siat/security_trend2.py,sha256=
|
105
|
+
siat/security_trend2.py,sha256=za9vUgWUsfG_xCjwjtCdo3kpQKWjzw8pDNAJZuDwXl0,26115
|
106
106
|
siat/setup.py,sha256=up65rQGLmTBkhtaMLowjoQXYmIsnycnm4g1SYmeQS6o,1335
|
107
107
|
siat/shenwan index history test.py,sha256=JCVAzOSEldHalhSFa3pqD8JI_8_djPMQOxpkuYU-Esg,1418
|
108
|
-
siat/stock.py,sha256=
|
108
|
+
siat/stock.py,sha256=o8Mowq8qKYnRUczYdjV4Q_HSSMfbShylLUowDyYkXQ8,152856
|
109
109
|
siat/stock_advice_linear.py,sha256=-twT7IGP-NEplkL1WPSACcNJjggRB2j4mlAQCkzOAuo,31655
|
110
110
|
siat/stock_base.py,sha256=uISvbRyOGy8p9QREA96CVydgflBkn5L3OXOGKl8oanc,1312
|
111
111
|
siat/stock_china.py,sha256=zyUyghIrkkkYWlHRRP7Hoblxzfp-jrck60pTJpwMahg,91553
|
@@ -131,15 +131,15 @@ siat/transaction_test.py,sha256=Z8g1LJCN4-mnUByXMUMoFmN0t105cbmsz2QmvSuIkbU,1858
|
|
131
131
|
siat/translate-20230125.py,sha256=NPPSXhT38s5t9fzMvl_fvi4ckSB73ThLmZetVI-xGdU,117953
|
132
132
|
siat/translate-20230206.py,sha256=-vtI125WyaJhmPotOpDAmclt_XnYVaWU9ByLWZ6FyYE,118133
|
133
133
|
siat/translate-20230215.py,sha256=TJgtPE3n8IjljmZ4Pefy8dmHoNdFF-1zpML6BhA9FKE,121657
|
134
|
-
siat/translate.py,sha256=
|
134
|
+
siat/translate.py,sha256=Isa2gjmuY6xKo3HwaPOR0CJzPqLalcu0J1Qw2cZbmFs,218567
|
135
135
|
siat/translate_20240606.py,sha256=63IyHWEU3Uz9mjwyuAX3fqY4nUMdwh0ICQAgmgPXP7Y,215121
|
136
136
|
siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
137
137
|
siat/valuation.py,sha256=NKfeZMdDJOW42oLVHob6eSVBXUqlN1OCnnzwyGAst8c,48855
|
138
138
|
siat/valuation_china.py,sha256=EkZQaVkoBjM0c4MCNbaX-bMnlG0e3FXeaWczZDnkptU,67784
|
139
139
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
140
140
|
siat/var_model_validation.py,sha256=R0caWnuZarrRg9939hxh3vJIIpIyPfvelYmzFNZtPbo,14910
|
141
|
-
siat/yf_name.py,sha256=
|
142
|
-
siat-3.4.
|
143
|
-
siat-3.4.
|
144
|
-
siat-3.4.
|
145
|
-
siat-3.4.
|
141
|
+
siat/yf_name.py,sha256=9U_XfEeMlS3TrCrO3Bww21nuFgghbnO-cqDJMhQWqew,16193
|
142
|
+
siat-3.4.17.dist-info/METADATA,sha256=M2n9lbqaF_FGunS14PxHCmi43xlZqE_vb2_xiWomdvk,7683
|
143
|
+
siat-3.4.17.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
144
|
+
siat-3.4.17.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
145
|
+
siat-3.4.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|