siat 3.4.8__py3-none-any.whl → 3.4.9__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/market_china.py CHANGED
@@ -268,10 +268,6 @@ def market_profile_china(market='SSE'):
268
268
 
269
269
 
270
270
 
271
-
272
-
273
-
274
-
275
271
  def market_profile_china_tmp(market='SSE'):
276
272
  """
277
273
  功能:沪深市场概况,废弃!
@@ -921,7 +917,7 @@ if __name__=='__main__':
921
917
  def market_detail_china2(category='price',
922
918
  facecolor='papayawhip',
923
919
  decimals=2,
924
- font_size='22px'):
920
+ font_size='20px'):
925
921
  """
926
922
  功能:给出中国当前最新的三大股票交易所的更多细节,合成
927
923
  输出:构造表格型数据框df,利用CSS格式输出
siat/option_pricing.py CHANGED
@@ -1330,11 +1330,13 @@ if __name__ =="__main__":
1330
1330
  lastndays=7
1331
1331
 
1332
1332
  #def predict_stock_trend_by_option(ticker,lastndays=7,power=4):
1333
- def predict_stock_trend_by_option(ticker,lastndays=7):
1333
+ def market_prospect_via_option(ticker,lastdays=7):
1334
1334
  """
1335
1335
  功能:根据股票期权行权价及交易量预测股价
1336
- 注意:本函数已废弃!
1336
+ 注意:本函数与price_prospect_via_option内容基本一致,图示方式略有不同
1337
1337
  """
1338
+ lastndays=lastdays
1339
+
1338
1340
  DEBUG=False
1339
1341
  try:
1340
1342
  datelist=option_maturity(ticker,printout=False)
@@ -1497,15 +1499,15 @@ def predict_stock_trend_by_option(ticker,lastndays=7):
1497
1499
  titletxt="Predicting Price Trend via Option Configuration: "+tname
1498
1500
  footnote1="Note:\n"
1499
1501
  footnote2="1. Recent price: "+lastprice+", "+lastdate+'\n'
1500
- footnote3="2. +(-) predicts higher(lower) price than recent, ++(--) for more likely, +/- for undetermined trend\n"
1501
- footnote4="3. Option trade period: recent "+str(lastndays)+" days. No stock splits in the period. Dates with only 1 option removed\n"
1502
+ footnote3="2. +(-) predicts higher(lower) price than recent, ++(--) more likely, +/- undetermined\n"
1503
+ footnote4="3. Period: recent "+str(lastndays)+" days. No stock splits in the period. Removed dates with 1 option only\n"
1502
1504
  footnote9=footnote1+footnote2+footnote3+footnote4+footnote
1503
1505
 
1504
1506
  df_display_CSS(df3,titletxt=titletxt,footnote=footnote9,facecolor='papayawhip',decimals=2, \
1505
1507
  first_col_align='left',second_col_align='right', \
1506
1508
  last_col_align='right',other_col_align='right', \
1507
- titile_font_size='16px',heading_font_size='15px', \
1508
- data_font_size='15px')
1509
+ titile_font_size='15px',heading_font_size='13px', \
1510
+ data_font_size='13px')
1509
1511
 
1510
1512
  return df2
1511
1513
 
@@ -1864,8 +1866,8 @@ def price_prospect_via_option(ticker,lastdays=7,cutoff=[1.1,5.0,10.0]):
1864
1866
  df_display_CSS(df3,titletxt=titletxt,footnote=footnote9,facecolor='papayawhip',decimals=2, \
1865
1867
  first_col_align='left',second_col_align='right', \
1866
1868
  last_col_align='right',other_col_align='right', \
1867
- titile_font_size='16px',heading_font_size='15px', \
1868
- data_font_size='15px')
1869
+ titile_font_size='15px',heading_font_size='13px', \
1870
+ data_font_size='13px')
1869
1871
 
1870
1872
  return df2
1871
1873
 
siat/sector_china.py CHANGED
@@ -3065,7 +3065,7 @@ if __name__=='__main__':
3065
3065
 
3066
3066
  find_industry_sw(ticker)
3067
3067
 
3068
- def find_industry_sw(ticker,level='1',ticker_order=True,max_sleep=8):
3068
+ def find_industry_sw(ticker,level='1',ticker_order=True,max_sleep=10):
3069
3069
  """
3070
3070
  功能:寻找一只或一组股票所属的申万行业,支持股票代码和股票名称。
3071
3071
  level='1':默认只查找申万1级行业,以便节省时间
@@ -3188,8 +3188,115 @@ def find_industry_sw(ticker,level='1',ticker_order=True,max_sleep=8):
3188
3188
  return result
3189
3189
 
3190
3190
  #==============================================================================
3191
+ #东方财富板块分类:查找股票所属行业与主要同行
3191
3192
  #==============================================================================
3192
- #==============================================================================
3193
+ if __name__=='__main__':
3194
+ ticker='600519.SS'
3195
+ indicator="市盈率"
3196
+ rank=40
3197
+
3198
+ font_size="16px"; facecolor="papayawhip"
3199
+
3200
+ peers=stock_peer_em(ticker,indicator="市盈率",rank=10)
3201
+
3202
+ def stock_peer_em(ticker,indicator="市盈率",rank=10, \
3203
+ font_size="16px",facecolor="papayawhip"):
3204
+ """
3205
+ 功能:基于东方财富行业分类,查找股票所属的行业板块以及主要同行
3206
+ 特点:行业板块分类较粗糙,略胜于无
3207
+ """
3208
+ if indicator in ["股价","股票价格","价格","收盘价","价位"]:
3209
+ indicator="最新价"
3210
+ if indicator in ["流动性","热门","活跃"]:
3211
+ indicator="换手率"
3212
+
3213
+ if rank==0:
3214
+ rank=5
3215
+
3216
+ import akshare as ak
3217
+
3218
+ #股票基本信息
3219
+ try:
3220
+ info=ak.stock_individual_info_em(symbol=ticker[:6])
3221
+ except:
3222
+ print(" #Warning(stock_peer_em): stock info not found for",ticker,"\n")
3223
+ df_em=ak.stock_board_industry_name_em()
3224
+ #df_em.sort_values(by="板块名称",ascending=True,inplace=True)
3225
+ #industry_names_em=sorted(list(df_em["板块名称"]),reverse=True)
3226
+ industry_names_em=list(df_em["板块名称"])
3227
+ print(" List of sectors/industries in East Money:",len(df_em))
3228
+ printlist(industry_names_em,numperline=7,beforehand=' ')
3229
+
3230
+ return None
3231
+
3232
+ #东方财富板块名称
3233
+ hangye=info[info['item']=='行业']['value'].values[0]
3234
+
3235
+ #东方财富板块成分股
3236
+ cfg=ak.stock_board_industry_cons_em(symbol=hangye)
3237
+
3238
+ cfg_col_list=list(cfg)
3239
+ indicator_col=''
3240
+ for i in cfg_col_list:
3241
+ if indicator in i:
3242
+ indicator_col=i
3243
+ if indicator_col=='':
3244
+ print(" #Warning(stock_peer_em): unsupported indicator",indicator)
3245
+
3246
+ remove_list=["序号","代码","名称"]
3247
+ cfg_col_list_tmp = [x for x in cfg_col_list if x not in remove_list]
3248
+ print(" Supported indicators:",)
3249
+ print_list(cfg_col_list_tmp,leading_blanks=2)
3250
+ return None
3251
+
3252
+ collist=['序号','名称','代码','市盈率-动态','市净率','最新价','涨跌幅','换手率']
3253
+ if not indicator_col in collist:
3254
+ collist=collist+[indicator_col]
3255
+
3256
+ #重新排序
3257
+ cfg.sort_values(by=indicator_col,ascending=False,inplace=True)
3258
+ cfg.reset_index(drop=True,inplace=True)
3259
+ cfg['序号']=cfg.index+1
3260
+
3261
+ #行业均值与中位数
3262
+ indicator_mean=cfg[indicator_col].mean()
3263
+ indicator_median=cfg[indicator_col].median()
3264
+ indicator_total=cfg["代码"].count()
3265
+
3266
+ indicator_value=cfg[cfg['代码']==ticker[:6]][indicator_col].values[0]
3267
+ indicator_seq=cfg[cfg['代码']==ticker[:6]]["序号"].values[0]
3268
+ from scipy.stats import percentileofscore
3269
+ indicator_pct=percentileofscore(cfg[indicator_col],indicator_value)
3270
+
3271
+ #筛选
3272
+ if rank > 0:
3273
+ rank_flag="前"
3274
+ df_disp=cfg[collist].head(rank)
3275
+ else:
3276
+ rank_flag="后"
3277
+ df_disp=cfg[collist].tail(abs(rank))
3278
+
3279
+ #制表
3280
+ tname=ticker_name(ticker)
3281
+ titletxt="行业板块及其上市公司排名:"+hangye+","+indicator_col+"("+rank_flag+str(abs(rank))+"名)"
3282
+
3283
+ footnote1="全行业的"+indicator_col+"状况:均值"+str(round(indicator_mean,2))+",中位数"+str(round(indicator_median,2))+"\n"
3284
+ footnote2=tname+"的"+indicator_col+":"+str(round(indicator_value,2))+",行业排名"+str(indicator_seq)+"/"+str(indicator_total)+",分位数"+str(round(indicator_pct,2))+"%\n"
3285
+ import datetime; stoday = datetime.date.today()
3286
+ footnote3="*** 信息来源:东方财富,"+str(stoday)
3287
+ footnote=footnote1+footnote2+footnote3
3288
+
3289
+ #确定表格字体大小
3290
+ titile_font_size=font_size
3291
+ heading_font_size=data_font_size=str(int(font_size.replace('px',''))-1)+'px'
3292
+
3293
+ df_display_CSS(df_disp,titletxt=titletxt,footnote=footnote,facecolor=facecolor, \
3294
+ first_col_align='center',second_col_align='left', \
3295
+ titile_font_size=titile_font_size,heading_font_size=heading_font_size, \
3296
+ data_font_size=data_font_size)
3297
+
3298
+ return cfg
3299
+
3193
3300
 
3194
3301
 
3195
3302
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siat
3
- Version: 3.4.8
3
+ Version: 3.4.9
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
@@ -66,7 +66,7 @@ siat/holding_risk.py,sha256=G3wpaewAKF9CwEqRpr4khyuDu9SU2EGyQUHdk7cmHOA,30693
66
66
  siat/holding_risk_test.py,sha256=FRlw_9wFG98BYcg_cSj95HX5WZ1TvkGaOUdXD7-V86s,474
67
67
  siat/local_debug_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
68
68
  siat/luchy_draw.py,sha256=8Ue-NKnvSVqINPY1eXat0NJat5MR-gex_K62aOYFdmA,20486
69
- siat/market_china.py,sha256=W39wwOG9qr0-NQuOXH8gIKEyA6OiThiju8KHOV-G73o,50732
69
+ siat/market_china.py,sha256=fQjAFyu4JAqtVA8I1QYfzv0fmYhLP3zoNe5Ftk63qgM,50724
70
70
  siat/markowitz.py,sha256=DsfS6vG9TAfdJP4GgN-CCArujPi84XjD23CWbxaA2o4,97627
71
71
  siat/markowitz2-20240620.py,sha256=irZAPnjaatFsKQmFRMENP-cO6bEUl2narYtkU5NKTWI,108019
72
72
  siat/markowitz2.py,sha256=LK2pDEtE5PUmBtCHmCcRs8FlPqZKmhFXiuLIL4JeQa8,121991
@@ -82,7 +82,7 @@ siat/ml_cases_example.py,sha256=xRGb3YTQEDTOnaWNzZN_myU5umQnA2RdMNiPrxTmn9c,1673
82
82
  siat/ml_cases_example1.py,sha256=xRGb3YTQEDTOnaWNzZN_myU5umQnA2RdMNiPrxTmn9c,1673
83
83
  siat/option_china.py,sha256=0eIWy5-0L8fECVwakVoA8EUO-_5u5jGW66dVLRi1_PY,120954
84
84
  siat/option_china_test.py,sha256=UQ-YUHUjoGBQyanLcM-yzqeEIUQP_gCQIeT0W6rnUnA,16355
85
- siat/option_pricing.py,sha256=8uGzCNcSmLu_99w8qx99oqxvUHUNOZq5LObPffrdtxk,73177
85
+ siat/option_pricing.py,sha256=VEqe7VbPkdWX8lS7fJaL1GF9cQx2HRe3UBI2XZJouBQ,73237
86
86
  siat/option_pricing_test.py,sha256=eeorV5Ja5vjlRXnP6fWJHetGU5Vb8SnLopkC6RV3GfA,2203
87
87
  siat/option_sina_api_test.py,sha256=dn-k_wrQnAaNKHoROvWJEc7lqlU0bwiV2Aa4usWAFGM,5908
88
88
  siat/proxy_test.py,sha256=erQJrmGs2X46z8Gb1h-7GYQ0rTUcaR8dxHExWoBz2eM,2610
@@ -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=nP6kfYsnaQWZj8dK-zklwSDW8FDS-obZWp_zL0ec2Ig,118603
97
+ siat/sector_china.py,sha256=y07Yh8t_LKc7MPOeOw6sTNgzmJR6vgYyLVUY9XB3rCU,122864
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
@@ -139,7 +139,7 @@ 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
141
  siat/yf_name.py,sha256=H1EM8YYXA8nQHIqsJlso0I3HKPiJLT3QujO4gRVQXWs,13945
142
- siat-3.4.8.dist-info/METADATA,sha256=za1tq7AU9BmJbNQUSZICpzAQvfJZc4_ThYOCqwcGN2s,7682
143
- siat-3.4.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
144
- siat-3.4.8.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
145
- siat-3.4.8.dist-info/RECORD,,
142
+ siat-3.4.9.dist-info/METADATA,sha256=JWFmtzgZF0_L_HvISH6Cy_rbSOykNGFnSx0vUHqpEMA,7682
143
+ siat-3.4.9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
144
+ siat-3.4.9.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
145
+ siat-3.4.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.38.4)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5