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.
- siat/common.py +106 -2
- siat/exchange_bond_china.pickle +0 -0
- siat/fund_china.pickle +0 -0
- siat/stock.py +10 -2
- siat/stock_info.pickle +0 -0
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/METADATA +234 -226
- siat-3.10.126.dist-info/RECORD +76 -0
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/WHEEL +1 -1
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info/licenses}/LICENSE +0 -0
- {siat-3.10.125.dist-info → siat-3.10.126.dist-info}/top_level.txt +0 -0
- siat/__init__ -20240701.py +0 -65
- siat/__init__.py.backup_20250214.py +0 -73
- siat/alpha_vantage_test.py +0 -24
- siat/assets_liquidity_test.py +0 -44
- siat/barrons_scraping_test.py +0 -276
- siat/beta_adjustment_test.py +0 -77
- siat/bond_test.py +0 -142
- siat/capm_beta_test.py +0 -49
- siat/cmat_commons.py +0 -961
- siat/compare_cross_test.py +0 -117
- siat/concepts_iwencai.py +0 -86
- siat/concepts_kpl.py +0 -93
- siat/cryptocurrency_test.py +0 -71
- siat/derivative.py +0 -1111
- siat/economy-20230125.py +0 -1206
- siat/economy_test.py +0 -360
- siat/esg_test.py +0 -63
- siat/fama_french_test.py +0 -115
- siat/financial_statements_test.py +0 -31
- siat/financials2 - /321/205/320/231/320/277/321/206/320/254/320/274.py" +0 -341
- siat/financials_china2_test.py +0 -67
- siat/financials_china2_test2.py +0 -88
- siat/financials_china2_test3.py +0 -87
- siat/financials_china_test.py +0 -475
- siat/financials_china_test2.py +0 -197
- siat/financials_china_test2_fin_indicator.py +0 -197
- siat/financials_test.py +0 -713
- siat/fred_test.py +0 -40
- siat/fund_china_test.py +0 -175
- siat/fund_test.py +0 -40
- siat/future_china_test.py +0 -37
- siat/global_index_test.py +0 -66
- siat/grafix_test.py +0 -112
- siat/holding_risk_test.py +0 -13
- siat/local_debug_test.py +0 -100
- siat/markowitz2-20240620.py +0 -2614
- siat/markowitz_ccb_test.py +0 -37
- siat/markowitz_ef_test.py +0 -136
- siat/markowitz_old.py +0 -871
- siat/markowitz_simple-20230709.py +0 -370
- siat/markowitz_test.py +0 -164
- siat/markowitz_test2.py +0 -69
- siat/ml_cases_example1.py +0 -60
- siat/option_china_test.py +0 -447
- siat/option_pricing_test.py +0 -81
- siat/option_sina_api_test.py +0 -112
- siat/proxy_test.py +0 -84
- siat/quandl_test.py +0 -39
- siat/risk_adjusted_return_test.py +0 -81
- siat/risk_evaluation_test.py +0 -96
- siat/risk_free_rate_test.py +0 -127
- siat/sector_china_test.py +0 -203
- siat/security_price.py +0 -831
- siat/security_prices_test.py +0 -310
- siat/security_trend2-20240620.py +0 -493
- siat/setup.py +0 -41
- siat/shenwan index history test.py +0 -41
- siat/stock_china_test.py +0 -38
- siat/stock_info_test.py +0 -189
- siat/stock_list_china_test.py +0 -33
- siat/stock_technical-20240620.py +0 -2736
- siat/stock_test.py +0 -487
- siat/temp.py +0 -36
- siat/test2_graphviz.py +0 -484
- siat/test_graphviz.py +0 -411
- siat/test_markowitz_simple.py +0 -198
- siat/test_markowitz_simple_revised.py +0 -215
- siat/test_markowitz_simple_revised2.py +0 -218
- siat/transaction_test.py +0 -436
- siat/translate-20230125.py +0 -2107
- siat/translate-20230206.py +0 -2109
- siat/translate-20230215.py +0 -2158
- siat/translate_20240606.py +0 -4206
- siat/translate_241003_keep.py +0 -4300
- siat/universal_test.py +0 -100
- siat/valuation_market_china_test.py +0 -36
- 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()
|
siat/stock_list_china_test.py
DELETED
@@ -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="创业板")
|