siat 3.10.125__py3-none-any.whl → 3.10.126__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.
Files changed (87) hide show
  1. siat/common.py +106 -2
  2. siat/exchange_bond_china.pickle +0 -0
  3. siat/fund_china.pickle +0 -0
  4. siat/stock.py +10 -2
  5. siat/stock_info.pickle +0 -0
  6. {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/METADATA +234 -226
  7. siat-3.10.126.dist-info/RECORD +76 -0
  8. {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/WHEEL +1 -1
  9. {siat-3.10.125.dist-info → siat-3.10.126.dist-info/licenses}/LICENSE +0 -0
  10. {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/top_level.txt +0 -0
  11. siat/__init__ -20240701.py +0 -65
  12. siat/__init__.py.backup_20250214.py +0 -73
  13. siat/alpha_vantage_test.py +0 -24
  14. siat/assets_liquidity_test.py +0 -44
  15. siat/barrons_scraping_test.py +0 -276
  16. siat/beta_adjustment_test.py +0 -77
  17. siat/bond_test.py +0 -142
  18. siat/capm_beta_test.py +0 -49
  19. siat/cmat_commons.py +0 -961
  20. siat/compare_cross_test.py +0 -117
  21. siat/concepts_iwencai.py +0 -86
  22. siat/concepts_kpl.py +0 -93
  23. siat/cryptocurrency_test.py +0 -71
  24. siat/derivative.py +0 -1111
  25. siat/economy-20230125.py +0 -1206
  26. siat/economy_test.py +0 -360
  27. siat/esg_test.py +0 -63
  28. siat/fama_french_test.py +0 -115
  29. siat/financial_statements_test.py +0 -31
  30. siat/financials2 - /321/205/320/231/320/277/321/206/320/254/320/274.py" +0 -341
  31. siat/financials_china2_test.py +0 -67
  32. siat/financials_china2_test2.py +0 -88
  33. siat/financials_china2_test3.py +0 -87
  34. siat/financials_china_test.py +0 -475
  35. siat/financials_china_test2.py +0 -197
  36. siat/financials_china_test2_fin_indicator.py +0 -197
  37. siat/financials_test.py +0 -713
  38. siat/fred_test.py +0 -40
  39. siat/fund_china_test.py +0 -175
  40. siat/fund_test.py +0 -40
  41. siat/future_china_test.py +0 -37
  42. siat/global_index_test.py +0 -66
  43. siat/grafix_test.py +0 -112
  44. siat/holding_risk_test.py +0 -13
  45. siat/local_debug_test.py +0 -100
  46. siat/markowitz2-20240620.py +0 -2614
  47. siat/markowitz_ccb_test.py +0 -37
  48. siat/markowitz_ef_test.py +0 -136
  49. siat/markowitz_old.py +0 -871
  50. siat/markowitz_simple-20230709.py +0 -370
  51. siat/markowitz_test.py +0 -164
  52. siat/markowitz_test2.py +0 -69
  53. siat/ml_cases_example1.py +0 -60
  54. siat/option_china_test.py +0 -447
  55. siat/option_pricing_test.py +0 -81
  56. siat/option_sina_api_test.py +0 -112
  57. siat/proxy_test.py +0 -84
  58. siat/quandl_test.py +0 -39
  59. siat/risk_adjusted_return_test.py +0 -81
  60. siat/risk_evaluation_test.py +0 -96
  61. siat/risk_free_rate_test.py +0 -127
  62. siat/sector_china_test.py +0 -203
  63. siat/security_price.py +0 -831
  64. siat/security_prices_test.py +0 -310
  65. siat/security_trend2-20240620.py +0 -493
  66. siat/setup.py +0 -41
  67. siat/shenwan index history test.py +0 -41
  68. siat/stock_china_test.py +0 -38
  69. siat/stock_info_test.py +0 -189
  70. siat/stock_list_china_test.py +0 -33
  71. siat/stock_technical-20240620.py +0 -2736
  72. siat/stock_test.py +0 -487
  73. siat/temp.py +0 -36
  74. siat/test2_graphviz.py +0 -484
  75. siat/test_graphviz.py +0 -411
  76. siat/test_markowitz_simple.py +0 -198
  77. siat/test_markowitz_simple_revised.py +0 -215
  78. siat/test_markowitz_simple_revised2.py +0 -218
  79. siat/transaction_test.py +0 -436
  80. siat/translate-20230125.py +0 -2107
  81. siat/translate-20230206.py +0 -2109
  82. siat/translate-20230215.py +0 -2158
  83. siat/translate_20240606.py +0 -4206
  84. siat/translate_241003_keep.py +0 -4300
  85. siat/universal_test.py +0 -100
  86. siat/valuation_market_china_test.py +0 -36
  87. siat-3.10.125.dist-info/RECORD +0 -152
siat/stock_info_test.py DELETED
@@ -1,189 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- import os; os.chdir("S:/siat/siat")
4
-
5
- import akshare as ak
6
- from siat.common import *
7
-
8
- zs=ak.index_investing_global_country_name_url("中国")
9
- df = ak.index_investing_global(country="中国", index_name="上证指数", period="每日", start_date="2021-01-01", end_date="2021-06-05")
10
- print(index_investing_global_df)
11
-
12
- df=ak.stock_us_daily(symbol='^DJI', adjust="")
13
-
14
-
15
- #==============================================================================
16
- if __name__=='__main__':
17
- symbol='AAPL'
18
- fromdate='2020-12-1'
19
- todate='2021-1-31'
20
-
21
- def get_price_ak_us(symbol, fromdate, todate, adjust=""):
22
- """
23
- 抓取单个美股股价
24
- """
25
-
26
- #检查日期期间
27
- result,start,end=check_period(fromdate,todate)
28
- if not result:
29
- print(" #Error(get_price_ak_us): invalid date period from",fromdate,'to',todate)
30
- return None
31
-
32
- import akshare as ak
33
- print(" Searching info in Sina Finance for",symbol,"... ...")
34
- try:
35
- df=ak.stock_us_daily(symbol=symbol, adjust="")
36
- except:
37
- print(" #Warning(get_price_ak_us): no info found for",symbol)
38
- return None
39
- else:
40
- print(" Successfully retrieved",len(df),"records for",symbol)
41
-
42
- #选取时间范围
43
- df1=df[df.index >=start]
44
- df2=df1[df1.index <=end]
45
-
46
- df2.rename(columns={'open':'Open','high':'High','low':'Low','close':'Close','volume':'Volume'},inplace=True)
47
- df2['Ticker']=symbol
48
-
49
- return df2
50
-
51
- #==============================================================================
52
- if __name__=='__main__':
53
- symbol='0700.HK'
54
- fromdate='2020-12-1'
55
- todate='2021-1-31'
56
-
57
- def get_price_ak_hk(symbol, fromdate, todate, adjust=""):
58
- """
59
- 抓取单个港股股价
60
- """
61
-
62
- #检查日期期间
63
- result,start,end=check_period(fromdate,todate)
64
- if not result:
65
- print(" #Error(get_price_ak_hk): invalid date period from",fromdate,'to',todate)
66
- return None
67
-
68
- import akshare as ak
69
- print(" Searching info in Sina Finance for",symbol,"... ...")
70
- symbol1 = symbol.strip('.HK')
71
- symbol2 = symbol1.strip('.hk')
72
- symbol3='0'+symbol2
73
- try:
74
- df=ak.stock_hk_daily(symbol=symbol3, adjust="")
75
- except:
76
- print(" #Warning(get_price_ak_hk): no info found for",symbol)
77
- return None
78
- else:
79
- print(" Successfully retrieved",len(df),"records for",symbol)
80
-
81
- #选取时间范围
82
- df1=df[df.index >=start]
83
- df2=df1[df1.index <=end]
84
-
85
- df2.rename(columns={'open':'Open','high':'High','low':'Low','close':'Close','volume':'Volume'},inplace=True)
86
- df2['Ticker']=symbol
87
-
88
- return df2
89
-
90
- if __name__=='__main__':
91
- df=get_price_ak_hk(symbol, fromdate, todate)
92
- #==============================================================================
93
- def str_replace(str1):
94
- """
95
- 删除给定字符串中的子串
96
- """
97
- replist=['Ltd.','Ltd','Co.','LTD.','CO.',' CO','LTD','Inc.','INC.', \
98
- 'CORPORATION','Corporation','LIMITED','Limited','Company', \
99
- 'COMPANY','(GROUP)','Corp.','CORP','GROUP','Group']
100
-
101
- for rc in replist:
102
- str2=str1.replace(rc, '')
103
- str1=str2
104
-
105
- twlist=[' ',',',',']
106
- for tw in twlist:
107
- str2 = str2.strip(tw)
108
-
109
- return str2
110
-
111
- #==============================================================================
112
- def get_all_stock_names():
113
- """
114
- 获得股票代码和名称:中国A股、港股、美股
115
- """
116
- import akshare as ak
117
- import pandas as pd
118
-
119
- #上证A股
120
- df_ss=ak.stock_info_sh_name_code()
121
- df_ss.rename(columns={'COMPANY_ABBR':'CNAME','ENGLISH_ABBR':'ENAME','LISTING_DATE':'LISTING'},inplace=True)
122
- df_ss['SYMBOL']=df_ss['COMPANY_CODE']+'.SS'
123
- df_ss_1=df_ss[['SYMBOL','CNAME','ENAME','LISTING']]
124
-
125
- #深证A股
126
- df_sz=ak.stock_info_sz_name_code(indicator="A股列表")
127
- df_sz['SYMBOL']=df_sz['A股代码']+'.SZ'
128
- df_sz.rename(columns={'A股简称':'CNAME','英文名称':'ENAME','A股上市日期':'LISTING'},inplace=True)
129
- df_sz_1=df_sz[['SYMBOL','CNAME','ENAME','LISTING']]
130
-
131
- #美股
132
- df_us=ak.get_us_stock_name()
133
- df_us['LISTING']=' '
134
- df_us.rename(columns={'symbol':'SYMBOL','name':'ENAME','cname':'CNAME'},inplace=True)
135
- df_us_1=df_us[['SYMBOL','CNAME','ENAME','LISTING']]
136
-
137
- #港股
138
- df_hk=ak.stock_hk_spot()
139
- df_hk['LISTING']=' '
140
- last4digits=lambda x:x[1:5]
141
- df_hk['symbol1']=df_hk['symbol'].apply(last4digits)
142
- df_hk['SYMBOL']=df_hk['symbol1']+'.HK'
143
- df_hk.rename(columns={'name':'CNAME','engname':'ENAME'},inplace=True)
144
- df_hk_1=df_hk[['SYMBOL','CNAME','ENAME','LISTING']]
145
-
146
- #合成
147
- df=pd.concat([df_ss_1,df_sz_1,df_us_1,df_hk_1])
148
- df.sort_values(by=['SYMBOL'], ascending=True, inplace=True )
149
- df.reset_index(drop=True,inplace=True)
150
-
151
- rep=lambda x:str_replace(x)
152
- df['CNAME']=df['CNAME'].apply(rep)
153
- df['ENAME']=df['ENAME'].apply(rep)
154
-
155
- #保存:应保存在文件夹S:/siat/siat中,重新生成siat轮子
156
- df.to_pickle('stock_info.pickle')
157
-
158
- """
159
- #读出文件
160
- with open('stock_info.pickle','rb') as test:
161
- df = pickle.load(test)
162
- """
163
-
164
- return df
165
- #==============================================================================
166
- if __name__=='__main__':
167
- symbol='0700.HK'
168
- def get_names(symbol):
169
- """
170
- 从文件中查询证券代码的短名称
171
- """
172
- import pickle
173
- with open('stock_info.pickle','rb') as test:
174
- df = pickle.load(test)
175
-
176
- df1=df[df['SYMBOL']==symbol]
177
- if len(df1)==0:
178
- return None
179
- else:
180
- name=df1['CNAME'].values[0]
181
-
182
- return name
183
- #==============================================================================
184
- # 股票预测插件
185
- from stocker import Stocker
186
- amazon=Stocker("AMZN")
187
- amazon.plot_stock()
188
- model,model_data=amazon.create_prophet_model(days=90)
189
- amazon.evaluate_prediction()
@@ -1,33 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Created on Thu Oct 22 00:20:06 2020
4
-
5
- @author: Peter
6
- """
7
-
8
- #爬虫网址:https://my.oschina.net/akshare/blog/4341023
9
-
10
- import akshare as ak
11
-
12
- #股票列表-A股:沪深交易所
13
- stock_info_a_code_name_df = ak.stock_info_a_code_name()
14
-
15
- #股票列表-上证
16
- stock_info_sh_a_df = ak.stock_info_sh_name_code(indicator="主板A股")
17
-
18
- stock_info_sh_b_df = ak.stock_info_sh_name_code(indicator="主板B股")
19
-
20
- stock_info_sh_kcb_df = ak.stock_info_sh_name_code(indicator="科创板")
21
-
22
- #股票列表-深证
23
- stock_info_sz_a_df = ak.stock_info_sz_name_code(indicator="A股列表")
24
-
25
- stock_info_sz_b_df = ak.stock_info_sz_name_code(indicator="B股列表")
26
-
27
- stock_info_sz_listed_df = ak.stock_info_sz_name_code(indicator="上市公司列表")
28
-
29
- stock_info_sz_main_df = ak.stock_info_sz_name_code(indicator="主板")
30
-
31
- stock_info_sz_smb_df = ak.stock_info_sz_name_code(indicator="中小企业板")
32
-
33
- stock_info_sz_cyb_df = ak.stock_info_sz_name_code(indicator="创业板")