siat 3.8.26__py3-none-any.whl → 3.8.27__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 CHANGED
@@ -1583,7 +1583,7 @@ def print_progress_percent(current,total,steps=5,leading_blanks=2):
1583
1583
 
1584
1584
  if pct=="100%":
1585
1585
  #print("100% completing")
1586
- print("100%, completing ...")
1586
+ print("100%, finalizing ...")
1587
1587
  else:
1588
1588
  print(pct,end=' ')
1589
1589
 
@@ -1632,7 +1632,7 @@ def print_progress_percent2(current,total_list,steps=5,leading_blanks=4):
1632
1632
  pct=pct_list[pos]
1633
1633
 
1634
1634
  if pct=="100%":
1635
- print("100%, completing ...")
1635
+ print("100%, finalizing ...")
1636
1636
  else:
1637
1637
  print(pct,end=' ')
1638
1638
 
@@ -4470,7 +4470,7 @@ if __name__ == '__main__':
4470
4470
  def sleep_random(max_sleep=30):
4471
4471
  """
4472
4472
 
4473
- 功能:随机挂起秒数,以防被数据源封堵IP地址,适用于连续抓取同种信息时。
4473
+ 功能:随机睡眠秒数,以防被数据源封堵IP地址,适用于连续抓取同种信息时。
4474
4474
  参数:
4475
4475
  max_sleep:最大挂起秒数,默认30秒。随机挂起1-30秒。
4476
4476
  """
siat/economy2.py CHANGED
@@ -22,6 +22,65 @@ import pandas as pd
22
22
  from pandas_datareader import wb
23
23
  import requests
24
24
 
25
+ #==============================================================================
26
+ if __name__=='__main__':
27
+ key_words='NY.GDP.MKTP'
28
+ key_words='per_allsp_gini_rur'
29
+
30
+ search_id_only=True
31
+ return_id_list=True
32
+ top=20; country='CN'; max_sleep=30; start='L3Y'
33
+
34
+ def test_economic_indicator(key_words='NY.GDP.MKTP',top=20, \
35
+ country='CN',max_sleep=30,start='L3Y'):
36
+ """
37
+ ===========================================================================
38
+ 功能:测试某一类宏观经济指标的可用性
39
+ 参数:
40
+ key_words:宏观经济指标类别,默认GDP系列指标'NY.GDP.MKTP'
41
+ country:测试使用的经济体,默认中国'CN'
42
+ max_sleep:测试指标指标之间的最大间隔秒数,默认30。若间隔时间过短可能被数据源屏蔽
43
+ """
44
+ print(f"*** Indicator magic={key_words}, top={top}, country={country}, start={start}:")
45
+ id_list=indicator_wb(key_words,top=top,search_id_only=True,return_id_list=True)
46
+ id_list_usable=id_list.copy() #需要使用copy,不然两者始终同步
47
+
48
+ #屏蔽函数内print信息输出的类
49
+ import os, sys
50
+ class HiddenPrints:
51
+ def __enter__(self):
52
+ self._original_stdout = sys.stdout
53
+ sys.stdout = open(os.devnull, 'w')
54
+
55
+ def __exit__(self, exc_type, exc_val, exc_tb):
56
+ sys.stdout.close()
57
+ sys.stdout = self._original_stdout
58
+
59
+ print(f'\nTesting the above indicators in {country}, please wait ... ...') #空一行
60
+ for id in id_list:
61
+ #print(f"Testing {id} ... ...")
62
+ print_progress_percent2(id,id_list,steps=10,leading_blanks=4)
63
+
64
+ with HiddenPrints():
65
+ df=economy_trend2(country,indicator=id,start=start,graph=False)
66
+
67
+ if df is None:
68
+ #print(f"*** {id} deprecated or not provided for {country}")
69
+ id_list_usable.remove(id)
70
+ elif len(df)==0:
71
+ #printf(f"### {id} has no data for {country}")
72
+ id_list_usable.remove(id)
73
+
74
+ sleep_random(max_sleep)
75
+
76
+ print(f"\n*** Economic indicators available for {country}:")
77
+ for id in id_list_usable:
78
+ pos=id_list.index(id)+1
79
+ print(f"{pos} {id}")
80
+
81
+ return
82
+
83
+
25
84
  #==============================================================================
26
85
  if __name__=='__main__':
27
86
  key_words='GDP per capita'
@@ -29,8 +88,10 @@ if __name__=='__main__':
29
88
 
30
89
  indicator_wb(key_words='GDP',top=10,note=False)
31
90
 
32
- def find_economic_indicator(key_words='GDP',top=10, \
33
- note=False,translate=False,source='wb'):
91
+ def find_economic_indicator(key_words='GDP',top=20, \
92
+ note=False,translate=False,source='wb', \
93
+ search_id_only=False, \
94
+ return_id_list=False):
34
95
  """
35
96
  ===========================================================================
36
97
  功能:查找宏观经济指标代码
@@ -40,41 +101,73 @@ def find_economic_indicator(key_words='GDP',top=10, \
40
101
  note:是否显示指标的描述,默认否False
41
102
  translate:是否调用AI大模型进行翻译,若翻译可能影响反应速度,默认否False
42
103
  source:信息来源,默认'wb'
104
+ search_id_only:是否仅仅查找指标代码,默认False;
105
+ 否则只查找指标代码,用于快速查找类似指标。
106
+ return_id_list:是否返回指标代码列表,默认False;
107
+ 否则可用于快速检查返回的指标是否有数据、新数据或者已经deprecated
43
108
 
44
109
  注意:有时网络可能拒绝访问,可以换个时段再次进行访问
45
110
  """
46
111
  if source=='wb':
47
- df=indicator_wb(key_words=key_words,top=top,note=note,translate=translate)
112
+ df=indicator_wb(key_words=key_words,top=top,note=note,translate=translate, \
113
+ search_id_only=search_id_only,return_id_list=return_id_list)
48
114
  else:
49
115
  print(" Sorry, the source option currently only supports wb (World Bank)")
50
116
 
51
117
  return
52
118
 
53
- def indicator_wb(key_words='GDP',top=20,note=False,translate=False):
119
+ #==============================================================================
120
+
121
+ if __name__=='__main__':
122
+ key_words='GDP'
123
+ key_words='NY.GDP.MKTP'
124
+
125
+ top=20; note=False; translate=False
126
+ search_id_only=True
127
+ return_id_list=True
128
+
129
+
130
+
131
+ def indicator_wb(key_words='GDP',top=20,note=False,translate=False, \
132
+ search_id_only=False, \
133
+ return_id_list=False):
54
134
  """
55
135
  ============================================================================
56
136
  功能:在WB/IMF/FRED数据库中查找宏观经济指标的代码
57
137
  参数:
58
138
  key_words:可包括多个关键词,使用空格隔开,不区分大小写
59
- top:输出相似度最高的,默认5
139
+ top:输出相似度最高的,默认20
60
140
  note:是否显示每个指标的注释,默认False
141
+ translate: 是否翻译,默认False
142
+ search_id_only:是否仅仅查找指标代码,默认False;
143
+ 否则只查找指标代码,用于快速查找类似指标。
144
+ return_id_list:是否返回指标代码列表,默认False;
145
+ 否则可用于快速检查返回的指标是否有数据、新数据或者已经deprecated
61
146
 
62
147
  输出:基于文本相似度,输出可能的指标代码及其简介
63
148
 
64
149
  返回值:可能的指标代码及其简介
65
150
  """
66
-
151
+ import re
152
+
67
153
  # 拆分关键词字符串为列表
68
- words_list=key_words.split(' ')
154
+ #words_list=key_words.split(' ')
155
+ if not search_id_only:
156
+ words_list=re.split(r'[\s,.,]+', key_words)
157
+ else:
158
+ words_list=[key_words]
69
159
 
70
160
  # 循环查找每个关键词,并合成
71
161
  df=None
72
162
  for word in words_list:
73
163
  try:
74
- df_tmp=wb.search(word)
164
+ if not search_id_only:
165
+ df_tmp=wb.search(word)
166
+ else:
167
+ df_tmp=wb.search('')
75
168
  except:
76
- print(" Sorry, data source rejected connection, try again later")
77
- return None
169
+ #print(" Sorry, data source rejected connection, try again later")
170
+ break
78
171
 
79
172
  # 合并
80
173
  if df is None:
@@ -82,16 +175,33 @@ def indicator_wb(key_words='GDP',top=20,note=False,translate=False):
82
175
  else:
83
176
  df=pd.concat([df,df_tmp])
84
177
 
178
+ # 未找到
179
+ if df is None:
180
+ print(" Sorry, data source rejected connection, try again later")
181
+ return
182
+ if len(df) == 0:
183
+ print(f" Pity, nothing found for {key_words}")
184
+ return
185
+
85
186
  # 去重
86
187
  df.drop_duplicates(subset=['id'],keep='first',inplace=True)
87
188
 
88
189
  # 去掉名称中的逗号、左右括号、美元符号和百分号,以免降低模糊匹配度
89
- import re
90
190
  #df['name2']=df['name'].apply(lambda x: re.sub('[(),$%]', '', x))
91
- df['name2']=df['name'].apply(lambda x: re.sub('[(),]', '', x))
191
+ if not search_id_only:
192
+ df['name2']=df['name'].apply(lambda x: re.sub('[(),]', '', x))
193
+ #df['name2']=df.apply(lambda x: re.sub('[(),]', '', x['name']) + ' ' + x['id'],axis=1)
92
194
 
93
- # 匹配相似度
94
- df2=fuzzy_search_wb(df,key_words=key_words,column='name2',top=top)
195
+ # 匹配相似度
196
+ df2=fuzzy_search_wb(df,key_words=key_words,column='name2',top=top)
197
+ else:
198
+ df['id_tag']=df['id'].apply(lambda x: 1 if key_words.lower() in x.lower() else 0)
199
+ df2=df[df['id_tag']==1].head(top)
200
+
201
+ #note=True
202
+
203
+ df2.reset_index(drop=True,inplace=True)
204
+ df2['seq']=df2.index + 1
95
205
 
96
206
  # 遍历输出
97
207
  if len(df2)==0:
@@ -101,7 +211,7 @@ def indicator_wb(key_words='GDP',top=20,note=False,translate=False):
101
211
  #print('') #空一行
102
212
  for row in df2.itertuples():
103
213
 
104
- print(f"{row.id}",end=': ')
214
+ print(f"{row.seq} {row.id}",end=': ')
105
215
  if not translate:
106
216
  print(f"{row.name}",end='')
107
217
  else:
@@ -117,7 +227,10 @@ def indicator_wb(key_words='GDP',top=20,note=False,translate=False):
117
227
  print(f"{lang_auto2(row.sourceNote)}")
118
228
  print('') #空一行
119
229
 
120
- return df2
230
+ if return_id_list:
231
+ return list(df2['id'])
232
+ else:
233
+ return
121
234
 
122
235
  #==============================================================================
123
236
  if __name__=='__main__':
@@ -306,7 +419,7 @@ def economy_indicator_wb(ticker='CN',indicator='NY.GDP.MKTP.KN', \
306
419
  try:
307
420
  pricedf=wb.download(indicator=indicator,country=ticker,start=start,end=end)
308
421
  except:
309
- print(f" #Error(economy_indicator_wb): {indicator} deprecated or {ticker} not found")
422
+ print(f" #Error(economy_indicator_wb): {indicator} not available for {ticker}")
310
423
  return None
311
424
 
312
425
  # 是否返回None
@@ -1041,32 +1154,40 @@ def economic_translate(indicator):
1041
1154
  import pandas as pd
1042
1155
  trans_dict=pd.DataFrame([
1043
1156
 
1044
- # NE.CON.PRVT:家庭及NPISH最终消费=======================================
1045
- ['NE.CON.PRVT.CD','家庭及NPISH最终消费(美元时价)',
1157
+ # NE.CON.PRVT:最终消费支出-家庭及NPISH===================================
1158
+ ['NE.CON.PRVT.CD','家庭及NPISH最终消费(美元现价)',
1046
1159
  'Household & NPISHs Final Consumption (current US$)',
1047
1160
  'Households and NPISHs Final consumption expenditure (current US$)'],
1048
1161
 
1162
+ ['NE.CON.PRVT.CN','家庭及NPISH最终消费(本币现价)',
1163
+ 'Household & NPISHs Final Consumption (current LCU)',
1164
+ 'Households and NPISHs Final consumption expenditure (current LCU)'],
1165
+
1166
+ ['NE.CON.PRVT.CN.AD','家庭及NPISH最终消费(统计口径调整后,本币现价)',
1167
+ 'Household & NPISHs Final Consumption (linked series, current LCU)',
1168
+ 'Households and NPISHs Final consumption expenditure: linked series (current LCU)'],
1169
+
1049
1170
  ['NE.CON.PRVT.KD','家庭及NPISH最终消费(2015美元不变价格)',
1050
1171
  'Household & NPISHs Final Consumption (constant 2015 US$)',
1051
1172
  'Households and NPISHs Final consumption expenditure (constant 2015 US$)'],
1052
-
1053
- ['NE.CON.PRVT.CN','家庭及NPISH最终消费(本币时价)',
1054
- 'Household & NPISHs Final Consumption (current LCU)',
1055
- 'Households and NPISHs Final consumption expenditure (current LCU)'],
1173
+
1174
+ ['NE.CON.PRVT.KD.ZG','家庭及NPISH最终消费(年增速%)',
1175
+ 'Household & NPISHs Final Consumption (annual % growth)',
1176
+ 'Households and NPISHs Final consumption expenditure (annual % growth)'],
1056
1177
 
1057
1178
  ['NE.CON.PRVT.KN','家庭及NPISH最终消费(本币不变价格)',
1058
1179
  'Household & NPISHs Final Consumption (constant LCU)',
1059
1180
  'Households and NPISHs Final consumption expenditure (constant LCU)'],
1060
1181
 
1061
- ['NE.CON.PRVT.ZS','家庭及NPISH最终消费(占GDP%)',
1062
- 'Household & NPISHs Final Consumption (GDP%)',
1063
- 'Households and NPISHs Final consumption expenditure (% of GDP)'],
1182
+ ['NE.CON.PRVT.PC.KD','人均家庭及NPISH最终消费(2015美元不变价格)',
1183
+ 'Household & NPISHs Final Consumption per capita (constant 2015 US$)',
1184
+ 'Households and NPISHs Final consumption expenditure per capita (constant 2015 US$)'],
1064
1185
 
1065
- ['NE.CON.PRVT.KD.ZG','家庭及NPISH最终消费(年增速%)',
1066
- 'Household & NPISHs Final Consumption (annual % growth)',
1067
- 'Households and NPISHs Final consumption expenditure (annual % growth)'],
1186
+ ['NE.CON.PRVT.PC.KD.ZG','人均家庭及NPISH最终消费(年增速%)',
1187
+ 'Household & NPISHs Final Consumption per capita growth (annual %)',
1188
+ 'Households and NPISHs Final consumption expenditure per capita growth (annual %)'],
1068
1189
 
1069
- ['NE.CON.PRVT.PP.CD','家庭及NPISH最终消费(购买力平价,国际美元时价)',
1190
+ ['NE.CON.PRVT.PP.CD','家庭及NPISH最终消费(购买力平价,国际美元现价)',
1070
1191
  'Household & NPISHs Final Consumption (PPP, current intl $)',
1071
1192
  'Households and NPISHs Final consumption expenditure, PPP (current international $)'],
1072
1193
 
@@ -1074,21 +1195,342 @@ def economic_translate(indicator):
1074
1195
  'Household & NPISHs Final Consumption (PPP, constant 2021 intl $)',
1075
1196
  'Households and NPISHs Final consumption expenditure, PPP (constant 2021 international $)'],
1076
1197
 
1077
- ['NE.CON.PRVT.PC.KD.ZG','人均家庭及NPISH最终消费(年增速%)',
1078
- 'Household & NPISHs Final Consumption per capita growth (annual %)',
1079
- 'Households and NPISHs Final consumption expenditure per capita growth (annual %)'],
1080
-
1081
- ['NE.CON.PRVT.PC.KD','人均家庭及NPISH最终消费(2015美元不变价格)',
1082
- 'Household & NPISHs Final Consumption per capita (constant 2015 US$)',
1083
- 'Households and NPISHs Final consumption expenditure per capita (constant 2015 US$)'],
1084
-
1085
- ['NE.CON.PRVT.CN.AD','家庭及NPISH最终消费(统计口径调整后,本币时价)',
1086
- 'Household & NPISHs Final Consumption (linked series, current LCU)',
1087
- 'Households and NPISHs Final consumption expenditure: linked series (current LCU)'],
1198
+ ['NE.CON.PRVT.ZS','家庭及NPISH最终消费支出(占GDP%)',
1199
+ 'Household & NPISHs Final Consumption (GDP%)',
1200
+ 'Households and NPISHs Final consumption expenditure (% of GDP)'],
1088
1201
 
1089
1202
  # 币种指标:CD=current US$, KD=constant 2015 US$, CN=current LCU
1090
1203
  # KN=constant LCU, ZS=% of GDP, PC=per capita, PP=PPP
1091
1204
 
1205
+ # NE.CON.GOVT:最终消费支出-政府=========================================
1206
+ ['NE.CON.GOVT.CD','政府最终消费支出(美元现价)',
1207
+ 'Government final consumption expenditure (current US$)',
1208
+ 'General government final consumption expenditure (current US$)'],
1209
+
1210
+ ['NE.CON.GOVT.CN','政府最终消费支出(本币现价)',
1211
+ 'Government final consumption expenditure (current LCU)',
1212
+ 'General government final consumption expenditure (current LCU)'],
1213
+
1214
+ ['NE.CON.GOVT.ZS','政府最终消费支出(占GDP%)',
1215
+ 'Government final consumption expenditure (% of GDP)',
1216
+ 'General government final consumption expenditure (% of GDP)'],
1217
+
1218
+ # NE.CON.TOTL:最终消费支出总计==========================================
1219
+ ['NE.CON.TOTL.CD','最终消费支出总计(美元现价)',
1220
+ 'Final consumption expenditure (current US$)',
1221
+ 'Final consumption expenditure (current US$)'],
1222
+
1223
+ ['NE.CON.TOTL.CN','最终消费支出总计(本币现价)',
1224
+ 'Final consumption expenditure (current LCU)',
1225
+ 'Final consumption expenditure (current LCU)'],
1226
+
1227
+ ['NE.CON.TOTL.KD','最终消费支出总计(2015美元不变价格)',
1228
+ 'Final consumption expenditure (constant 2015 US$)',
1229
+ 'Final consumption expenditure (constant 2015 US$)'],
1230
+
1231
+ ['NE.CON.TOTL.KD.ZG','最终消费支出总计年增速%(2015美元不变价格)',
1232
+ 'Final consumption expenditure (annual % growth)',
1233
+ 'Final consumption expenditure (annual % growth)'],
1234
+
1235
+ ['NE.CON.TOTL.KN','最终消费支出总计(本币不变价格)',
1236
+ 'Final consumption expenditure (constant LCU)',
1237
+ 'Final consumption expenditure (constant LCU)'],
1238
+
1239
+ ['NE.CON.TOTL.ZS','最终消费支出总计(占GDP%)',
1240
+ 'Final consumption expenditure (% of GDP)',
1241
+ 'Final consumption expenditure (% of GDP)'],
1242
+
1243
+ #######################################################################
1244
+ # NE.CON.TOTL.CD:最终消费支出,包括家庭、非营利机构为家庭服务的支出(NPISHs)以及政府消费支出。
1245
+ # 它反映了经济中所有部门的消费总支出。
1246
+ # 涵盖家庭、政府以及非营利机构为家庭服务的支出,是一个全面的消费指标。
1247
+ # 用于分析一个国家或地区的整体消费水平和消费结构,了解消费在经济中的地位和作用。
1248
+ # NE.CON.TETC.CD:最终消费支出(总额),通常与 NE.CON.TOTL.CD 类似。
1249
+ #
1250
+ # NE.CON.PRVT.CD:家庭和非营利机构为家庭服务的最终消费支出,主要反映私人部门的消费情况。
1251
+ # 仅包括家庭和非营利机构为家庭服务的消费支出,不包含政府消费支出。
1252
+ # 用于研究私人消费在经济增长中的贡献,分析家庭消费行为和消费趋势。
1253
+ # NE.CON.PETC.CD:私人最终消费支出,通常与 NE.CON.PRVT.CD 类似。
1254
+ #
1255
+ # NE.CON.GOVT.CD:政府最终消费支出,反映政府在提供公共服务和进行行政管理等方面的消费支出。
1256
+ # 仅包括政府的消费支出,不包含家庭和非营利机构的支出。
1257
+ # 用于分析政府消费支出在经济中的作用,了解政府在公共服务和行政管理方面的投入。
1258
+ #
1259
+ # NE.CON.TOTL.CD = NE.CON.PRVT.CD + NE.CON.GOVT.CD
1260
+ #======================================================================
1261
+
1262
+ # NY.GDP.MKTP:国内生产总值GDP总量=======================================
1263
+ ['NY.GDP.MKTP.CD','GDP(美元现价)',
1264
+ 'GDP (current US$)',
1265
+ 'GDP (current US$)'],
1266
+
1267
+ ['NY.GDP.MKTP.CN','GDP(本币现价)',
1268
+ 'GDP (current LCU)',
1269
+ 'GDP (current LCU)'],
1270
+
1271
+ ['NY.GDP.MKTP.CN.AD','GDP(统计口径调整后,本币现价)',
1272
+ 'GDP: linked series (current LCU)',
1273
+ 'GDP: linked series (current LCU)'],
1274
+
1275
+ ['NY.GDP.MKTP.KD','GDP(2015美元不变价格)',
1276
+ 'GDP (constant 2015 US$)',
1277
+ 'GDP (constant 2015 US$)'],
1278
+
1279
+ ['NY.GDP.MKTP.KD.ZG','GDP年增速%(2015美元不变价格)',
1280
+ 'GDP growth (annual %, constant 2015 US$)',
1281
+ 'GDP growth (annual %, constant 2015 US$)'],
1282
+
1283
+ ['NY.GDP.MKTP.KN','GDP(本币不变价格)',
1284
+ 'GDP (constant LCU)',
1285
+ 'GDP (constant LCU)'],
1286
+
1287
+ ['NY.GDP.MKTP.PP.CD','GDP(购买力平价,国际美元现价)',
1288
+ 'GDP, PPP (current international $)',
1289
+ 'GDP, PPP (current international $)'],
1290
+
1291
+ ['NY.GDP.MKTP.PP.KD','GDP(购买力平价,2021国际美元不变价格)',
1292
+ 'GDP, PPP (constant 2021 international $)',
1293
+ 'GDP, PPP (constant 2021 international $)'],
1294
+
1295
+ # NY.GDP.PCAP:国内生产总值GDP人均=======================================
1296
+ ['NY.GDP.PCAP.CD','人均GDP(美元现价)',
1297
+ 'GDP per capita (current US$)',
1298
+ 'GDP per capita (current US$)'],
1299
+
1300
+ ['NY.GDP.PCAP.CN','人均GDP(本币现价)',
1301
+ 'GDP per capita (current LCU)',
1302
+ 'GDP per capita (current LCU)'],
1303
+
1304
+ ['NY.GDP.PCAP.KD','人均GDP(2015美元不变价格)',
1305
+ 'GDP per capita (constant 2015 US$)',
1306
+ 'GDP per capita (constant 2015 US$)'],
1307
+
1308
+ ['NY.GDP.PCAP.KD.ZG','人均GDP年增速%(2015美元不变价格)',
1309
+ 'GDP per capita growth (annual %, constant 2015 US$)',
1310
+ 'GDP per capita growth (annual %, constant 2015 US$)'],
1311
+
1312
+ ['NY.GDP.PCAP.KN','人均GDP(本币不变价格)',
1313
+ 'GDP per capita (constant LCU)',
1314
+ 'GDP per capita (constant LCU)'],
1315
+
1316
+ ['NY.GDP.PCAP.PP.CD','人均GDP(购买力平价,国际美元现价)',
1317
+ 'GDP per capita, PPP (current international $)',
1318
+ 'GDP per capita, PPP (current international $)'],
1319
+
1320
+ ['NY.GDP.PCAP.PP.KD','人均GDP(购买力平价,2021国际美元不变价格)',
1321
+ 'GDP per capita, PPP (constant 2021 international $)',
1322
+ 'GDP per capita, PPP (constant 2021 international $)'],
1323
+
1324
+ #######################################################################
1325
+ #“International $”(国际美元)是一种标准化的货币单位,用于消除汇率差异,
1326
+ #使不同国家的经济指标(如 GDP)在购买力平价(PPP)基础上更具可比性。
1327
+ #它帮助我们更真实地了解各国居民的生活水平。
1328
+ #
1329
+ #在 GDP per capita, PPP(按购买力平价计算的人均 GDP)中,
1330
+ #使用“国际美元”可以更真实地反映一个国家居民的实际生活水平。
1331
+ #
1332
+ #例如,如果一个国家的 GDP per capita, PPP 是 20,000 国际美元,
1333
+ #这意味着该国居民的平均购买力相当于美国居民用 20,000 美元的购买力。
1334
+ #在这种情况下,1 国际美元的购买力等于在美国用 1 美元的购买力。
1335
+ #
1336
+ #再比如,如果一个同样的汉堡在美国售价为 5 美元,在印度售价为 200 卢比,
1337
+ #那么根据 PPP 理论,1 美元应该等于 40 卢比(200 卢比 / 5 美元)。
1338
+ #
1339
+ #为了计算国际美元,需要对各国商品和服务的价格进行比较,并根据其在经济中的重要性分配权重。
1340
+ #例如,食品、住房、交通等商品和服务的权重可能更高。
1341
+ #######################################################################
1342
+
1343
+ # GFDD.DM:证券市场-股票、权益与债券=====================================
1344
+ ['GFDD.DM.01','股票市场总市值占GDP%',
1345
+ 'Stock market capitalization to GDP (%)',
1346
+ 'Stock market capitalization to GDP (%)'],
1347
+
1348
+ ['GFDD.DM.02','股票市场当年交易额占GDP%',
1349
+ 'Stock market total value traded to GDP (%)',
1350
+ 'Stock market total value traded to GDP (%)'],
1351
+ # 经济意义:
1352
+ # 市场流动性:该指标越高,表明股票市场的流动性越强,交易越活跃。高流动性通常意味着市场参与者更容易买卖股票,市场效率较高。
1353
+ # 经济开放程度:较高的交易总值占GDP比重通常反映出一个国家或地区的经济开放程度较高,资本市场较为发达。
1354
+ # 金融体系发达程度:该指标还可以反映一个国家或地区的金融体系是否发达,以及股票市场在金融体系中的地位。
1355
+ # 市场波动性:在某些情况下,过高的交易总值占GDP比重可能反映出市场波动性较大,投资者情绪较为活跃。
1356
+ #
1357
+ # 实际应用:
1358
+ # 比较不同国家的股票市场活跃程度:通过比较不同国家的指标,可以了解各国股票市场的相对活跃程度。
1359
+
1360
+ ['GFDD.DM.03','未清偿的国内非政府债务证券占GDP%',
1361
+ 'Outstanding domestic private debt securities to GDP (%)',
1362
+ 'Outstanding domestic private debt securities to GDP (%)'],
1363
+ # 债务证券是政府、公司和金融机构发行的债券和票据等债务工具
1364
+ # 未清偿的国内私人债务证券占GDP的百分比。
1365
+ # 该指标反映了国内私人部门(包括公司和金融机构)发行的债务证券在经济中的比重。
1366
+ # 经济意义:
1367
+ # 金融市场发达程度:该指标越高,表明一个国家或地区的金融市场越发达,私人部门通过债务证券融资的能力越强。
1368
+ # 经济风险:较高的私人债务证券占GDP比重可能反映出较高的经济风险,特别是在债务水平超过经济承受能力的情况下。
1369
+ # 债务可持续性:该指标可以帮助评估私人部门债务的可持续性,了解债务水平是否与经济增长相匹配。
1370
+
1371
+ ['GFDD.DM.04','未清偿的国内政府债务证券占GDP%',
1372
+ 'Outstanding domestic public debt securities to GDP (%)',
1373
+ 'Outstanding domestic public debt securities to GDP (%)'],
1374
+ # 经济意义
1375
+ # 公共债务水平:该指标反映了政府的债务负担,特别是通过国内市场融资的债务水平。
1376
+ # 债务可持续性:较高的公共债务证券占GDP比重可能反映出较高的债务风险,尤其是在债务水平超过经济承受能力的情况下。
1377
+ # 财政政策的稳健性:该指标可以用来评估一个国家的财政政策是否稳健,以及政府是否有能力偿还其债务。
1378
+ # 经济风险:公共债务水平的高低可以反映一个国家的经济风险,尤其是在国际金融市场波动或经济衰退时。
1379
+
1380
+ ['GFDD.DM.05','未清偿的国际非政府债务证券占GDP%',
1381
+ 'Outstanding international private debt securities to GDP (%)',
1382
+ 'Outstanding international private debt securities to GDP (%)'],
1383
+ # 经济意义:
1384
+ # 国际融资能力:该指标反映了私人部门在国际市场上融资的能力,较高的比重通常表明一个国家的私人部门能够更有效地利用国际资本。
1385
+ # 经济开放程度:较高的国际私人债务证券占GDP比重通常表明一个国家的经济开放程度较高,与国际资本市场的联系较为紧密。
1386
+ # 经济风险:较高的国际私人债务证券占GDP比重可能反映出较高的经济风险,尤其是在国际金融市场波动或经济衰退时。
1387
+ # 债务可持续性:该指标可以帮助评估私人部门国际债务的可持续性,了解债务水平是否与经济增长相匹配。
1388
+ # 资本流动:该指标可以反映国际资本流动的趋势,帮助分析资本流入和流出的动态。
1389
+ #
1390
+ # 实际应用:
1391
+ # 比较不同国家的国际融资能力:通过比较不同国家的“Outstanding international private debt securities to GDP (%)”,可以了解各国私人部门在国际市场上融资的相对能力。
1392
+
1393
+ ['GFDD.DM.06','未清偿的国际政府债务证券占GDP%',
1394
+ 'Outstanding international public debt securities to GDP (%)',
1395
+ 'Outstanding international public debt securities to GDP (%)'],
1396
+
1397
+ ['GFDD.DM.07','国际债务发行总额占GDP%',
1398
+ 'International debt issues to GDP (%)',
1399
+ 'International debt issues to GDP (%)'],
1400
+
1401
+ ['GFDD.DM.08','发行权益工具吸引外资形成的经济责任总额占GDP%',
1402
+ 'Gross portfolio equity liabilities to GDP (%)',
1403
+ 'Gross portfolio equity liabilities to GDP (%)'],
1404
+
1405
+ ['GFDD.DM.09','通过权益工具持有的国际资产总额占GDP%',
1406
+ 'Gross portfolio equity assets to GDP (%)',
1407
+ 'Gross portfolio equity assets to GDP (%)'],
1408
+
1409
+ ['GFDD.DM.10','发行债务工具吸引外资形成的经济责任总额占GDP%',
1410
+ 'Gross portfolio debt liabilities to GDP (%)',
1411
+ 'Gross portfolio debt liabilities to GDP (%)'],
1412
+
1413
+ ['GFDD.DM.11','通过债务工具持有的国际资产总额占GDP%',
1414
+ 'Gross portfolio debt assets to GDP (%)',
1415
+ 'Gross portfolio debt assets to GDP (%)'],
1416
+ # 注意:总额Gross与净额Net的区别
1417
+ ['GFDD.DM.12','银团贷款发行量占GDP%',
1418
+ 'Syndicated loan issuance volume to GDP (%)',
1419
+ 'Syndicated loan issuance volume to GDP (%)'],
1420
+
1421
+ ['GFDD.DM.13','公司债券发行量占GDP%',
1422
+ 'Corporate bond issuance volume to GDP (%)',
1423
+ 'Corporate bond issuance volume to GDP (%)'],
1424
+
1425
+ ['GFDD.DM.14','银团贷款的平均到期年限',
1426
+ 'Syndicated loan average maturity (years)',
1427
+ 'Syndicated loan average maturity (years)'],
1428
+
1429
+ ['GFDD.DM.15','公司债券的平均到期年限',
1430
+ 'Corporate bond average maturity (years)',
1431
+ 'Corporate bond average maturity (years)'],
1432
+
1433
+ ['GFDD.DM.16','金融科技和大型科技公司提供的信贷流量占GDP%',
1434
+ 'Credit flows by fintech and bigtech companies to GDP (%)',
1435
+ 'Credit flows by fintech and bigtech companies to GDP (%)'],
1436
+ # 经济意义:
1437
+ # 金融创新:该指标反映了金融科技和大型科技公司在信贷市场中的活跃程度,较高的比重通常表明金融创新较为活跃。
1438
+ # 金融包容性:较高的信贷流量占GDP比重可能表明金融科技和大型科技公司正在帮助提高金融包容性,为更多人提供信贷服务。
1439
+ # 经济活力:该指标可以反映一个国家或地区的经济活力,特别是在金融技术和科技创新方面的活力。
1440
+ # 监管挑战:较高的信贷流量可能带来监管挑战,因为金融科技和大型科技公司可能不受传统银行监管的约束。
1441
+ # 市场竞争力:该指标可以帮助评估金融科技和大型科技公司与传统银行之间的竞争力。
1442
+ #
1443
+ # 实际应用:
1444
+ # 比较不同国家的金融创新程度:通过比较不同国家的“Credit flows by fintech and bigtech companies to GDP (%)”,可以了解各国在金融创新方面的相对程度。
1445
+ # 评估金融包容性:该指标可以用来评估一个国家的金融包容性,特别是金融科技和大型科技公司在提供信贷服务方面的作用。
1446
+
1447
+ # FM.LBL.BMNY:广义货币M2===============================================
1448
+ ['FM.LBL.BMNY.CN','广义货币(本币现价)',
1449
+ 'Broad money (current LCU)',
1450
+ 'Broad money (current LCU)'],
1451
+
1452
+ ['FM.LBL.BMNY.GD.ZS','广义货币(占GDP%)',
1453
+ 'Broad money (% of GDP)',
1454
+ 'Broad money (% of GDP)'],
1455
+
1456
+ ['FM.LBL.BMNY.IR.ZS','广义货币供应量与总储备的比率',
1457
+ 'Broad money to total reserves ratio',
1458
+ 'Broad money to total reserves ratio'],
1459
+ # total reserves:总储备,FI.RES.TOTL.CD,指外汇储备和其他国际储备资产。
1460
+ # 即央行持有的外汇储备、黄金储备、国际货币基金组织(IMF)特别提款权(SDR)等可动用的国际储备资产总和。
1461
+ # 用于衡量一个国家 货币供应量 相对于其 外汇储备和其他国际储备资产 的充足程度的指标,反映该国应对资本外流或货币危机的能力。
1462
+ #
1463
+ # 经济意义与用途:
1464
+ # 衡量货币体系的脆弱性:
1465
+ # 比率越高,说明广义货币规模远超储备资产,可能面临资本外流时央行干预能力不足的风险(例如外汇储备无法覆盖货币兑换需求)。
1466
+ # 典型案例:1997年亚洲金融危机中,泰国、韩国等国因该比率过高(外汇储备不足),导致本币大幅贬值。
1467
+ # 评估货币政策与汇率稳定性:
1468
+ # 高比率可能表明:
1469
+ # 央行依赖资本管制或外债来维持汇率稳定;
1470
+ # 若遭遇市场恐慌(如外资撤离),本币贬值压力加大。
1471
+ # 国际比较与预警指标:
1472
+ # 新兴市场通常关注该比率,因其资本流动波动性大。
1473
+ # 经验阈值:若比率超过 5倍(500%),可能被视为风险较高(需结合外债、经常账户等指标综合判断)。
1474
+ #
1475
+ # 与“M2/GDP”对比:“M2/GDP”反映经济货币化程度,而“M2/总储备”侧重外部风险。
1476
+
1477
+ # 国际贸易==============================================================
1478
+ ['TM.TAX.MRCH.SM.AR.ZS','所有商品的实际平均关税%',
1479
+ 'Tariff rate, applied, simple mean, all products (%)',
1480
+ 'Tariff rate, applied, simple mean, all products (%)'],
1481
+
1482
+ ['TM.TAX.MRCH.SM.FN.ZS','所有商品的最惠国平均关税%',
1483
+ 'Tariff rate, most favored nation, simple mean, all products (%)',
1484
+ 'Tariff rate, most favored nation, simple mean, all products (%)'],
1485
+ # 注意:最惠国关税是从最惠国进口商品名义上的最高关税水平,不是实际水平。
1486
+ # 这里是简单平均!
1487
+ # 因此,实际关税水平很可能低于最惠国名义关税水平。原因在于:
1488
+ # 最惠国待遇(MFN)与特殊关税安排:
1489
+ # 最惠国待遇(MFN):最惠国待遇是世界贸易组织(WTO)框架下的基本原则之一,要求成员方给予任何一个成员方的优惠,必须自动给予所有其他成员方。因此,'TM.TAX.MRCH.SM.FN.ZS' 反映的是中国对最惠国待遇下的商品征收的关税水平。
1490
+ # 特殊关税安排:中国与其他国家或地区之间可能存在自由贸易协定(FTA)、关税优惠协定或其他特殊贸易安排,这些安排允许某些商品享受比最惠国税率更低的关税甚至零关税。这些特殊安排下的商品关税水平被反映在实际关税水平指标'TM.TAX.MRCH.SM.AR.ZS'中。
1491
+ # 关税配额制度:
1492
+ # 关税配额:中国可能对某些商品实施关税配额制度,即在一定配额内享受较低的关税税率,超过配额部分则按较高税率征收。这种制度使得实际关税水平低于最惠国税率。
1493
+ # 非关税壁垒的影响:
1494
+ # 非关税壁垒:虽然非关税壁垒(如进口配额、技术标准、卫生检疫要求等)不直接降低关税水平,但它们可能间接影响实际关税水平。例如,某些商品可能因为非关税壁垒而进口量较少,从而使得实际关税收入占比较低。
1495
+
1496
+ ['TM.TAX.MRCH.WM.AR.ZS','所有商品的实际加权平均关税%',
1497
+ 'Tariff rate, applied, weighted mean, all products (%)',
1498
+ 'Tariff rate, applied, weighted mean, all products (%)'],
1499
+
1500
+ ['TM.TAX.MRCH.WM.FN.ZS','所有商品的最惠国加权平均关税%',
1501
+ 'Tariff rate, most favored nation, weighted mean, all products (%)',
1502
+ 'Tariff rate, most favored nation, weighted mean, all products (%)'],
1503
+
1504
+ ['NE.EXP.GNFS.ZS','出口商品和服务占GDP%',
1505
+ 'Exports of goods and services (% of GDP)',
1506
+ 'Exports of goods and services (% of GDP)'],
1507
+
1508
+ ['NE.IMP.GNFS.ZS','进口商品和服务占GDP%',
1509
+ 'Imports of goods and services (% of GDP)',
1510
+ 'Imports of goods and services (% of GDP)'],
1511
+
1512
+
1513
+
1514
+
1515
+
1516
+ # 贫困和贫富分化========================================================
1517
+ ['SI.POV.GINI','基尼指数',
1518
+ 'Gini index',
1519
+ 'Gini index'],
1520
+ # 基尼指数:0-100,用于衡量收入或财富分配的不平等程度。
1521
+ # 0表示完全平等,100表示完全不平等。基尼系数高通常意味着贫富差距较大。
1522
+ # 注意不是基尼系数(0-1)。
1523
+
1524
+
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+
1531
+
1532
+
1533
+
1092
1534
 
1093
1535
 
1094
1536
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: siat
3
- Version: 3.8.26
3
+ Version: 3.8.27
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
@@ -40,6 +40,14 @@ Requires-Dist: translators
40
40
  Requires-Dist: nbconvert
41
41
  Requires-Dist: ipywidgets
42
42
  Requires-Dist: playwright
43
+ Dynamic: author
44
+ Dynamic: author-email
45
+ Dynamic: description
46
+ Dynamic: description-content-type
47
+ Dynamic: home-page
48
+ Dynamic: license
49
+ Dynamic: requires-dist
50
+ Dynamic: summary
43
51
 
44
52
 
45
53
  # What is siat?
@@ -19,7 +19,7 @@ siat/capm_beta.py,sha256=cxXdRVBQBllhbfz1LeTJAIWvyRYhW54nhtNUXv4HwS0,29063
19
19
  siat/capm_beta2.py,sha256=wGF_HmK_AiGWjpSAx79XHIxDghtI_ueYozvh06-2JEQ,33707
20
20
  siat/capm_beta_test.py,sha256=ImR0c5mc4hIl714XmHztdl7qg8v1E2lycKyiqnFj6qs,1745
21
21
  siat/cmat_commons.py,sha256=Nj9Kf0alywaztVoMVeVVL_EZk5jRERJy8R8kBw88_Tg,38116
22
- siat/common.py,sha256=J8swDUe7K-9wqm6x29y9o_AlhCs2NW7aNQ4_n53vo-4,181182
22
+ siat/common.py,sha256=z_oMRdzzA05OJnN0kJ9ZFwYCdEfiyeR59a1OCZiblYE,181182
23
23
  siat/compare_cross.py,sha256=3iP9TH2h3w27F2ARZc7FjKcErYCzWRc-TPiymOyoVtw,24171
24
24
  siat/compare_cross_test.py,sha256=xra5XYmQGEtfIZL2h-GssdH2hLdFIhG3eoCrkDrL3gY,3473
25
25
  siat/concepts_iwencai.py,sha256=m1YEDtECRT6FqtzlKm91pt2I9d3Z_XoP59BtWdRdu8I,3061
@@ -30,7 +30,7 @@ siat/cryptocurrency_test.py,sha256=3AikTNJ7j-HwLGLIYEfyXZ3bLVuLeru9mwiwHQi2SdA,2
30
30
  siat/derivative.py,sha256=qV8n09799eqLc26ojR6vN5n_X-xd7rGwdYjgq-wBih8,41483
31
31
  siat/economy-20230125.py,sha256=vxZZlPnLkh7SpGMVEPLwxjt0yYLSVmdZrO-s2NYLyoM,73848
32
32
  siat/economy.py,sha256=BFVQDxOTbuizyumpCgpZIauH6sqnwUXebpqRMmQCzys,84198
33
- siat/economy2.py,sha256=N0Ak2SqTggA7IqgBX2_6KMhmAzTIbgwhHuYDwRKxg8c,49422
33
+ siat/economy2.py,sha256=1wEYdfsgTxTy6FtXXOoCfd4v6xWQYUXLDR7GJSOHwGg,75147
34
34
  siat/economy_test.py,sha256=6vjNlPz7W125pJb7simCddobSEp3jmLIMvVkLRZ7zW8,13339
35
35
  siat/esg.py,sha256=GMhaonIKtvOK83rhpQUH5aJt2OL3HQBSVfD__Yw-0oo,19040
36
36
  siat/esg_test.py,sha256=Z9m6GUt8O7oHZSEG9aDYpGdvvrv2AiRJdHTiU6jqmZ0,2944
@@ -144,8 +144,8 @@ siat/valuation_china.py,sha256=CVp1IwIsF3Om0J29RGkyxZLt4n9Ug-ua_RKhLwL9fUQ,69624
144
144
  siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
145
145
  siat/var_model_validation.py,sha256=R0caWnuZarrRg9939hxh3vJIIpIyPfvelYmzFNZtPbo,14910
146
146
  siat/yf_name.py,sha256=laNKMTZ9hdenGX3IZ7G0a2RLBKEWtUQJFY9CWuk_fp8,24058
147
- siat-3.8.26.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
148
- siat-3.8.26.dist-info/METADATA,sha256=CUxAmvmU5B0Ey8GnKHmRZ1FSRk8gtKT8XsVATp9muws,8144
149
- siat-3.8.26.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
150
- siat-3.8.26.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
151
- siat-3.8.26.dist-info/RECORD,,
147
+ siat-3.8.27.dist-info/LICENSE,sha256=NTEMMROY9_4U1szoKC3N2BLHcDd_o5uTgqdVH8tbApw,1071
148
+ siat-3.8.27.dist-info/METADATA,sha256=3SUzT5YcBbrdG3S5mrpUgvkFvBqEZPm2D8fZp9-i7mU,8321
149
+ siat-3.8.27.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
150
+ siat-3.8.27.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
151
+ siat-3.8.27.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
File without changes