siat 1.7.41__py3-none-any.whl → 1.7.43__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/economy.py CHANGED
@@ -47,7 +47,8 @@ def get_econ_factors(start,end,scope='China',factor='GDP'):
47
47
  import pandas as pd
48
48
  ds_gni1=pd.DataFrame(ds_gni['VALUE'])
49
49
 
50
- ds_gdp=get_econ_factors0(start,end,scope,'GDP')
50
+ #ds_gdp=get_econ_factors0(start,end,scope,'GDP')
51
+ ds_gdp=get_econ_factors0(start,end,scope,'Current GDP')
51
52
  if ds_gdp is None: return None
52
53
 
53
54
  ds_gdp1=pd.DataFrame(ds_gdp['VALUE'])
@@ -742,7 +743,6 @@ def fred_factor_codes():
742
743
  ['China','GNP Ratio','Annual','Ratio of GNP to GDP','GNPGDPCNA156NUPN','Percent, Not Seasonally Adjusted'],
743
744
  ['USA','GNP Ratio','Annual','Ratio of GNP to GDP','GNPGDPUSA156NUPN','Percent, Not Seasonally Adjusted'],
744
745
  ['Japan','GNP Ratio','Annual','Ratio of GNP to GDP','GNPGDPJPA156NUPN','Percent, Not Seasonally Adjusted'],
745
-
746
746
 
747
747
  # GDP Per Capita:人均GDP,年度指标,美元现价,未经季节性调整。未扣除通胀因素,受到汇率变化影响
748
748
  ['China','GDP Per Capita','Annual','Gross Domestic Product Per Capita','PCAGDPCNA646NWDB','Current USD, Not Seasonally Adjusted'],
siat/grafix.py CHANGED
@@ -119,6 +119,8 @@ def plot_line(df0,colname,collabel,ylabeltxt,titletxt,footnote,datatag=False, \
119
119
  hline=0
120
120
  elif isinstance(zeroline,float):
121
121
  hline=zeroline
122
+ elif isinstance(zeroline,int):
123
+ hline=zeroline
122
124
  else:
123
125
  hline=0
124
126
  plt.axhline(y=hline,ls=":",c="black",linewidth=2)
@@ -316,11 +318,11 @@ def plot_line2_coaxial(df01,ticker1,colname1,label1, \
316
318
 
317
319
  #是否绘制水平0线
318
320
  if zeroline and ((min(df1[colname1]) < 0) or (min(df2[colname2]) < 0)):
319
- plt.axhline(y=0,ls=":",c="black",linewidth=1)
321
+ plt.axhline(y=0,ls=":",c="black",linewidth=2)
320
322
 
321
323
  #是否绘制水平线
322
324
  if yline != 999:
323
- plt.axhline(y=yline,ls=":",c="black",linewidth=1)
325
+ plt.axhline(y=yline,ls=":",c="black",linewidth=2)
324
326
 
325
327
  #是否绘制垂直线
326
328
  if xline != 999:
siat/security_prices.py CHANGED
@@ -1078,8 +1078,16 @@ def get_price_portfolio(tickerlist,sharelist,fromdate,todate,adj=False):
1078
1078
  if __name__=='__main__':
1079
1079
  tickerlist=['INTC','MSFT']
1080
1080
  sharelist=[0.6,0.4]
1081
- fromdate='2020-11-1'
1082
- todate='2021-1-31'
1081
+
1082
+ tickerlist=['JD']
1083
+ sharelist=[1000]
1084
+
1085
+ tickerlist=['601988.SS']
1086
+ sharelist=[1000]
1087
+
1088
+ fromdate='2023-1-1'
1089
+ todate='2023-3-8'
1090
+ adj=False
1083
1091
 
1084
1092
  def get_prices_portfolio(tickerlist,sharelist,fromdate,todate,adj=False):
1085
1093
  """
@@ -1095,7 +1103,7 @@ def get_prices_portfolio(tickerlist,sharelist,fromdate,todate,adj=False):
1095
1103
 
1096
1104
  #检查股票列表个数与份额列表个数是否一致
1097
1105
  if len(tickerlist) != len(sharelist):
1098
- print(" Error(get_prices_portfolio): numbers of stocks and shares mismatch.")
1106
+ print(" #Error(get_prices_portfolio): numbers of stocks and shares mismatch.")
1099
1107
  return None
1100
1108
 
1101
1109
  #抓取股票价格
@@ -1149,7 +1157,16 @@ def get_prices_portfolio(tickerlist,sharelist,fromdate,todate,adj=False):
1149
1157
  ocprice=pd.merge(oprice,cprice,how='inner',left_index=True,right_index=True)
1150
1158
  prices=pd.merge(ocprice,acprice,how='inner',left_index=True,right_index=True)
1151
1159
  else:
1152
- prices=p*sharelist[0]
1160
+ #prices=p*sharelist[0]
1161
+ prices=p
1162
+ pcols=list(prices)
1163
+ import pandas as pd
1164
+ for pc in pcols:
1165
+ #判断某列的数据类型
1166
+ if pd.api.types.is_float_dtype(prices[pc]):
1167
+ prices[pc]=prices[pc]*sharelist[0]
1168
+ else:
1169
+ continue
1153
1170
 
1154
1171
  #提取日期和星期几
1155
1172
  prices['Date']=prices.index.strftime("%Y-%m-%d")
siat/translate.py CHANGED
@@ -238,7 +238,10 @@ def ectranslate_c(eword):
238
238
  ['Peer Group','业务分类'],['Count','数目'],
239
239
 
240
240
  ['China','中国'],['Japan','日本'],['USA','美国'],['India','印度'],
241
- ['Russia','俄罗斯'],['Korea','韩国'],
241
+ ['Russia','俄罗斯'],['Korea','韩国'],['Australia','澳大利亚'],
242
+ ['Germany','德国'],['UK','英国'],['GBR','英国'],['France','法国'],
243
+ ['Vietnam','越南'],['Indonesia','印度尼西亚'],['Malaysia','马来西亚'],
244
+ ['Singapore','新加坡'],
242
245
 
243
246
  ['Gross Domestic Product','国内生产总值'],['GDP','国内生产总值'],
244
247
  ['Constant GDP','GDP(美元不变价格)'],['Current GDP','GDP(美元现价)'],
@@ -249,8 +252,8 @@ def ectranslate_c(eword):
249
252
  ['Gross Domestic Product Per Capita','人均GDP(美元现价)'],
250
253
  ['Constant Price GDP Per Capita','人均GDP(美元不变价格)'],
251
254
  ['GNP','国民生产总值'],['GNP Ratio','GNP(GNI)与GDP的比例'],
252
- ['GNI/GDP Ratio','GNP(GNI)与GDP的比例'],
253
- ['Ratio of GNP to GDP','GNP(GNI)与GDP之间的比例关系'],
255
+ ['GNI/GDP Ratio','GNP(GNI)与GDP之比'],
256
+ ['Ratio of GNP to GDP','GNP(GNI)与GDP之比'],
254
257
 
255
258
  ['CPI','消费者价格指数'],['YoY CPI','CPI%(同比)'],
256
259
  ['MoM CPI','CPI%(环比)'],['Constant CPI','CPI%(相对基准值)'],
@@ -262,7 +262,10 @@ def backtest_VaR(tickerlist,sharelist,today,future_days=1, \
262
262
 
263
263
  #打印结果
264
264
  print("\n======= VaR模型:回溯测试 =======")
265
- print("投资组合 :",tickerlist)
265
+ #print("投资组合 :",codetranslate(tickerlist))
266
+ print("投资组合 :",end='')
267
+ print_list(codetranslate(tickerlist))
268
+
266
269
  print("成分股票配置 :",sharelist)
267
270
  print("持有日期 :",today)
268
271
  print("当前头寸 :",format(round(position,2),','))
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siat
3
- Version: 1.7.41
3
+ Version: 1.7.43
4
4
  Summary: Securities Investment Analysis Tools (siat)
5
5
  Home-page: https://pypi.org/project/siat/
6
6
  Author: Prof. WANG Dehong, Business School, BFSU (北京外国语大学 国际商学院 王德宏 教授)
7
7
  Author-email: wdehong2000@163.com
8
8
  License: Copyright (C) WANG Dehong, 2023. For educational purpose only!
9
- Platform: UNKNOWN
10
9
  Requires-Dist: pandas-datareader
11
10
  Requires-Dist: yfinance
12
11
  Requires-Dist: plotly-express
@@ -37,4 +36,3 @@ Requires-Dist: prettytable
37
36
  The author is not responsible for the results of applying this plug-in in real
38
37
  investment activities.
39
38
 
40
-
@@ -22,7 +22,7 @@ siat/cryptocurrency.py,sha256=SKh_S85cqd2tRgKBKls1Fpd6HdFd9JfmUTCa2e3mpsE,27351
22
22
  siat/cryptocurrency_test.py,sha256=3AikTNJ7j-HwLGLIYEfyXZ3bLVuLeru9mwiwHQi2SdA,2669
23
23
  siat/derivative.py,sha256=qV8n09799eqLc26ojR6vN5n_X-xd7rGwdYjgq-wBih8,41483
24
24
  siat/economy-20230125.py,sha256=vxZZlPnLkh7SpGMVEPLwxjt0yYLSVmdZrO-s2NYLyoM,73848
25
- siat/economy.py,sha256=ZRVv1wMwy_E6JaC6VzYcBt_89QcHfLMFoALpLfxVX_8,73174
25
+ siat/economy.py,sha256=RMwHi3RU4wVdCAxAQVM0iDLMSYA0IzPhPaISNEPDBlk,73238
26
26
  siat/economy_test.py,sha256=6vjNlPz7W125pJb7simCddobSEp3jmLIMvVkLRZ7zW8,13339
27
27
  siat/esg.py,sha256=Kzui78HKwnLvtxWcjjnSjME6IZKK9cR3zSZYqTtAO0k,18941
28
28
  siat/esg_test.py,sha256=Z9m6GUt8O7oHZSEG9aDYpGdvvrv2AiRJdHTiU6jqmZ0,2944
@@ -47,7 +47,7 @@ siat/fund_test.py,sha256=V4ADb8Gsp8gyeFTwcgRsJBpnUih_O-Q2V1ILc5oKjK8,1116
47
47
  siat/future_china.py,sha256=s9LgTuy4nFIXgqtZKc71HaZIyFnSmyvxEloGHxlmLZ4,16442
48
48
  siat/future_china_test.py,sha256=BrSzmDVaOHki6rntOtosmRn-6dkfOBuLulJNqh7MOpc,1163
49
49
  siat/global_index_test.py,sha256=hnFp3wqqzzL-kAP8mgxDZ54Bd5Ijf6ENi5YJlGBgcXw,2402
50
- siat/grafix.py,sha256=vR3vfzp8XVJZgc-aBnwDvGnz-lN72jp3E00gf67DodY,63422
50
+ siat/grafix.py,sha256=dRPQM6ZjGWrQqa2u4h0GZpQptK-1bUZR5HTaeSslZM4,63490
51
51
  siat/grafix_test.py,sha256=kXvcpLgQNO7wd30g_bWljLj5UH7bIVI0_dUtXbfiKR0,3150
52
52
  siat/holding_risk.py,sha256=108tiI7DDl8uUZkyUiq6Y-McKeim1mxYsgqgk7CcXw8,30544
53
53
  siat/holding_risk_test.py,sha256=FRlw_9wFG98BYcg_cSj95HX5WZ1TvkGaOUdXD7-V86s,474
@@ -76,7 +76,7 @@ siat/risk_free_rate_test.py,sha256=CpmhUf8aEAEZeNu4gvWP2Mz2dLoIgBX5bI41vfUBEr8,4
76
76
  siat/sector_china.py,sha256=mTMspgBgd07pesdMhGm-SpTr-rcKts-kaEsIM3kXsjk,58803
77
77
  siat/sector_china_test.py,sha256=tvFQYptmj7jq6H5kNaRJtcP5Wgb-eWvaoSl33Y47ZsM,4210
78
78
  siat/security_price.py,sha256=ibrdUJyt_n0c8oKRbVStE1_ptmWkzy4YIHjpc_fGiPQ,29148
79
- siat/security_prices.py,sha256=sjN5detfjfCOo5yZs3yXPImIhTThG0kVJitc1mviUu4,69300
79
+ siat/security_prices.py,sha256=oe_QLqmQtrWOP2oP-hQc9-TaGoMpiMfvLG38lkZTqfI,69727
80
80
  siat/security_prices_test.py,sha256=OEphoJ87NPKoNow1QA8EU_5MUYrJF-qKoWKNapVfZNI,10779
81
81
  siat/setup.py,sha256=up65rQGLmTBkhtaMLowjoQXYmIsnycnm4g1SYmeQS6o,1335
82
82
  siat/shenwan index history test.py,sha256=JCVAzOSEldHalhSFa3pqD8JI_8_djPMQOxpkuYU-Esg,1418
@@ -99,12 +99,12 @@ siat/transaction_test.py,sha256=Z8g1LJCN4-mnUByXMUMoFmN0t105cbmsz2QmvSuIkbU,1858
99
99
  siat/translate-20230125.py,sha256=NPPSXhT38s5t9fzMvl_fvi4ckSB73ThLmZetVI-xGdU,117953
100
100
  siat/translate-20230206.py,sha256=-vtI125WyaJhmPotOpDAmclt_XnYVaWU9ByLWZ6FyYE,118133
101
101
  siat/translate-20230215.py,sha256=TJgtPE3n8IjljmZ4Pefy8dmHoNdFF-1zpML6BhA9FKE,121657
102
- siat/translate.py,sha256=KKrzZ6e_uGFlO4xgQJnpc-YcI4y43csHSSH7D6Wxmm4,124097
102
+ siat/translate.py,sha256=WWDwWaA47Bi1B41qLU7x-CkHhRuqybsAjRj0eWx1rkY,124319
103
103
  siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
104
104
  siat/valuation_china.py,sha256=U9FQgFcbJcS-S0cwy8iJ9Z0Rf8sxCN5Pxhm1DItUUgQ,51206
105
105
  siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
106
- siat/var_model_validation.py,sha256=eY64qRL7EDo9YsMoF800N_GZElFf_qynlCfjZpfa5xQ,14749
107
- siat-1.7.41.dist-info/METADATA,sha256=o_U6ZaLgHpA5vK0eJ9UZWYCPz3tiZhcTa11-Vdfp6PQ,1400
108
- siat-1.7.41.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
109
- siat-1.7.41.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
110
- siat-1.7.41.dist-info/RECORD,,
106
+ siat/var_model_validation.py,sha256=zB_Skk_tmzIR15l6oAW3am4HBGVIG-eZ8gJhCdXZ8Qw,14859
107
+ siat-1.7.43.dist-info/METADATA,sha256=FzWG4cHoAlcWiwawjrYBs5exrgUSaqh1r33UwDmSc2Q,1381
108
+ siat-1.7.43.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
109
+ siat-1.7.43.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
110
+ siat-1.7.43.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.37.0)
2
+ Generator: bdist_wheel (0.37.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5