siat 3.4.14__py3-none-any.whl → 3.4.16__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/common.py +1 -1
- siat/sector_china.py +13 -5
- siat/translate.py +10 -3
- siat/yf_name.py +83 -0
- {siat-3.4.14.dist-info → siat-3.4.16.dist-info}/METADATA +1 -1
- {siat-3.4.14.dist-info → siat-3.4.16.dist-info}/RECORD +8 -8
- {siat-3.4.14.dist-info → siat-3.4.16.dist-info}/WHEEL +0 -0
- {siat-3.4.14.dist-info → siat-3.4.16.dist-info}/top_level.txt +0 -0
siat/common.py
CHANGED
@@ -3810,7 +3810,7 @@ if __name__=='__main__':
|
|
3810
3810
|
|
3811
3811
|
def upgrade_siat(module_list=['siat','akshare','pandas','pandas_datareader', \
|
3812
3812
|
'yfinance','yahooquery','urllib3','tabulate','twine', \
|
3813
|
-
'mplfinance','openpyxl','pip','bottleneck'], \
|
3813
|
+
'mplfinance','openpyxl','pip','bottleneck','ipywidgets'], \
|
3814
3814
|
pipcmd="pip install --upgrade",alternative=""):
|
3815
3815
|
"""
|
3816
3816
|
功能:一次性升级siat及其相关插件
|
siat/sector_china.py
CHANGED
@@ -814,8 +814,11 @@ def print_industry_component_sw(iname,numberPerLine=5,colalign='left'):
|
|
814
814
|
"""
|
815
815
|
打印申万行业的成分股,名称(代码)
|
816
816
|
"""
|
817
|
-
|
818
|
-
|
817
|
+
try:
|
818
|
+
icode=industry_sw_code(iname)
|
819
|
+
except:
|
820
|
+
print(" #Warning(print_industry_component_sw): sector or industry name not found for",iname)
|
821
|
+
return
|
819
822
|
|
820
823
|
clist,cdf=industry_stock_sw(icode,top=1000)
|
821
824
|
|
@@ -826,10 +829,13 @@ def print_industry_component_sw(iname,numberPerLine=5,colalign='left'):
|
|
826
829
|
cdf=cdf.mask(cdf.eq('None')).dropna()
|
827
830
|
cdf['name_code']=cdf.apply(lambda x: x['证券名称']+'('+x['icode']+')',axis=1)
|
828
831
|
|
829
|
-
|
832
|
+
#标题
|
830
833
|
import datetime as dt; stoday=dt.date.today()
|
831
|
-
|
832
|
-
|
834
|
+
ilist=list(cdf['name_code'])
|
835
|
+
|
836
|
+
titletxt="行业板块"+iname+"("+icode+")成分股:计"+str(len(ilist))+'只,按行业指数权重降序排列,'+str(stoday)
|
837
|
+
print("\n"+titletxt,end='')
|
838
|
+
#表格
|
833
839
|
printInLine_md(ilist,numberPerLine=numberPerLine,colalign=colalign)
|
834
840
|
|
835
841
|
return
|
@@ -3524,6 +3530,8 @@ def get_stock_industry_sw(ticker):
|
|
3524
3530
|
industry = t.find_all("tr")[2].find("td").text
|
3525
3531
|
|
3526
3532
|
return industry
|
3533
|
+
else:
|
3534
|
+
return ticker
|
3527
3535
|
|
3528
3536
|
#==============================================================================
|
3529
3537
|
if __name__ == '__main__':
|
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
|
"""
|
@@ -3321,7 +3323,12 @@ def ticker1_name(ticker,ticker_type='auto'):
|
|
3321
3323
|
else:
|
3322
3324
|
tname=df1[df1['SYMBOL']==symbol]['ENAME'].values[0]
|
3323
3325
|
except: pass
|
3324
|
-
if tname != symbol: break
|
3326
|
+
if tname != symbol or symbol in ['IBM']: break
|
3327
|
+
else:
|
3328
|
+
tname=get_stock_name_china_sina(symbol[:6])
|
3329
|
+
if tname=='': tname=symbol
|
3330
|
+
if tname != symbol and tname != '': break
|
3331
|
+
|
3325
3332
|
|
3326
3333
|
#查找证券名称文件:次优先交易所债券
|
3327
3334
|
if tt in ['bond']:
|
@@ -3346,11 +3353,11 @@ def ticker1_name(ticker,ticker_type='auto'):
|
|
3346
3353
|
break
|
3347
3354
|
|
3348
3355
|
#如未查到,尝试stooq和雅虎名称,限英文名称
|
3349
|
-
if tname==symbol:
|
3356
|
+
if tname==symbol or tname=='':
|
3350
3357
|
#不包括中国大陆和香港证券,这些都应在前面查到?新上市的可能查不到
|
3351
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):
|
3352
3359
|
tname=get_stock_name1_en(symbol)
|
3353
|
-
if tname
|
3360
|
+
if tname!=symbol:
|
3354
3361
|
return tname
|
3355
3362
|
|
3356
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
|
|
@@ -460,6 +510,39 @@ def get_stock_name1_en(ticker,short_name=False,add_suffix=True,maxlen=80):
|
|
460
510
|
return sname
|
461
511
|
|
462
512
|
#==============================================================================
|
513
|
+
#==============================================================================
|
514
|
+
if __name__ == '__main__':
|
515
|
+
ticker='600519.SS'
|
516
|
+
ticker='600305.SS'
|
517
|
+
ticker='200725.SZ'
|
518
|
+
ticker='000725.SZ'
|
519
|
+
|
520
|
+
get_stock_name_china_sina(ticker)
|
521
|
+
|
522
|
+
def get_stock_name_china_sina(ticker):
|
523
|
+
"""
|
524
|
+
功能:抓取股票的申万行业分类名称
|
525
|
+
"""
|
526
|
+
|
527
|
+
import requests
|
528
|
+
from bs4 import BeautifulSoup
|
529
|
+
|
530
|
+
ticker6=ticker[:6]
|
531
|
+
url=f"https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CorpOtherInfo/stockid/{ticker6}/menu_num/2.phtml"
|
532
|
+
response = requests.get(url)
|
533
|
+
|
534
|
+
if response.status_code == 200:
|
535
|
+
soup = BeautifulSoup(response.text, 'html.parser')
|
536
|
+
soup_text=soup.find(id="stockName").text
|
537
|
+
|
538
|
+
soup_text_list=soup_text.split('(')
|
539
|
+
|
540
|
+
t_name = soup_text_list[0].strip()
|
541
|
+
|
542
|
+
return t_name
|
543
|
+
else:
|
544
|
+
return ticker
|
545
|
+
|
463
546
|
#==============================================================================
|
464
547
|
#==============================================================================
|
465
548
|
#==============================================================================
|
@@ -18,7 +18,7 @@ siat/capm_beta.py,sha256=cxXdRVBQBllhbfz1LeTJAIWvyRYhW54nhtNUXv4HwS0,29063
|
|
18
18
|
siat/capm_beta2.py,sha256=lUuCPVSxebkA2yye1PXu1V2Jd2UKEwD_kIA25DCIDTs,29750
|
19
19
|
siat/capm_beta_test.py,sha256=ImR0c5mc4hIl714XmHztdl7qg8v1E2lycKyiqnFj6qs,1745
|
20
20
|
siat/cmat_commons.py,sha256=Nj9Kf0alywaztVoMVeVVL_EZk5jRERJy8R8kBw88_Tg,38116
|
21
|
-
siat/common.py,sha256=
|
21
|
+
siat/common.py,sha256=hRRYWfmxAz1gSz2DJBoY8z8li0cbDMw-EiJIvThuhZY,151708
|
22
22
|
siat/compare_cross.py,sha256=3iP9TH2h3w27F2ARZc7FjKcErYCzWRc-TPiymOyoVtw,24171
|
23
23
|
siat/compare_cross_test.py,sha256=xra5XYmQGEtfIZL2h-GssdH2hLdFIhG3eoCrkDrL3gY,3473
|
24
24
|
siat/concepts_iwencai.py,sha256=m1YEDtECRT6FqtzlKm91pt2I9d3Z_XoP59BtWdRdu8I,3061
|
@@ -94,7 +94,7 @@ siat/risk_evaluation.py,sha256=I6B3gty-t--AkDCO0tKF-291YfpnF-IkXcFjqNKCt9I,76286
|
|
94
94
|
siat/risk_evaluation_test.py,sha256=YEXM96gKzTfwN4U61AS4Rr1tV7KgUvn4rRC6f3iMw9s,3731
|
95
95
|
siat/risk_free_rate.py,sha256=ZMr4cHikPvXvywr54gGqiI3Nvb69am6tq3zj2hwzANE,12384
|
96
96
|
siat/risk_free_rate_test.py,sha256=CpmhUf8aEAEZeNu4gvWP2Mz2dLoIgBX5bI41vfUBEr8,4285
|
97
|
-
siat/sector_china.py,sha256
|
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
100
|
siat/security_price2.py,sha256=65s64L68aRZdVVK3V8UYxdPd_JHMqgJ2FBJJX5MSW-Q,26174
|
@@ -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.16.dist-info/METADATA,sha256=6jn_hf0WErGP2RdyweWl-65rvA-ypaJ2y-UumDF2fyU,7683
|
143
|
+
siat-3.4.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
144
|
+
siat-3.4.16.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
145
|
+
siat-3.4.16.dist-info/RECORD,,
|
File without changes
|
File without changes
|