siat 1.3.0.6__tar.gz → 3.9.1__tar.gz
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-3.9.1/LICENSE +7 -0
- siat-3.9.1/MANIFEST.in +3 -0
- siat-3.9.1/PKG-INFO +232 -0
- siat-3.9.1/setup.py +66 -0
- siat-3.9.1/siat/__init__.py +75 -0
- siat-3.9.1/siat/allin.py +137 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/assets_liquidity.py +112 -53
- siat-3.9.1/siat/barrons_scraping_test.py +276 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/beta_adjustment.py +133 -231
- siat-3.9.1/siat/beta_adjustment_china.py +548 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/blockchain.py +1 -1
- siat-3.9.1/siat/bond.py +2839 -0
- siat-3.9.1/siat/bond_base.py +992 -0
- siat-3.9.1/siat/bond_china.py +100 -0
- siat-3.9.1/siat/bond_zh_sina.py +143 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/capm_beta.py +74 -40
- siat-3.9.1/siat/capm_beta2.py +845 -0
- siat-3.9.1/siat/cmat_commons.py +961 -0
- siat-3.9.1/siat/common.py +5005 -0
- siat-3.9.1/siat/compare_cross.py +642 -0
- siat-3.9.1/siat/concepts_iwencai.py +86 -0
- siat-3.9.1/siat/concepts_kpl.py +93 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/cryptocurrency.py +121 -37
- {siat-1.3.0.6 → siat-3.9.1}/siat/cryptocurrency_test.py +4 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/economy.py +568 -165
- siat-3.9.1/siat/economy2.py +1779 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/esg.py +6 -3
- siat-3.9.1/siat/event_study.py +757 -0
- siat-3.9.1/siat/exchange_bond_china.pickle +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/fama_french.py +259 -31
- siat-3.9.1/siat/fama_french_test.py +115 -0
- siat-3.9.1/siat/fin_stmt2_yahoo.py +982 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/financial_base.py +19 -3
- {siat-1.3.0.6 → siat-3.9.1}/siat/financial_statements.py +127 -19
- {siat-1.3.0.6 → siat-3.9.1}/siat/financials.py +654 -128
- siat-3.9.1/siat/financials2.py +1107 -0
- siat-3.9.1/siat/financials_china.py +4433 -0
- siat-3.9.1/siat/financials_china2.py +2212 -0
- siat-3.9.1/siat/fred_test.py +40 -0
- siat-3.9.1/siat/fund.py +629 -0
- siat-3.9.1/siat/fund_china.pickle +0 -0
- siat-3.9.1/siat/fund_china.py +3277 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/future_china.py +60 -17
- siat-3.9.1/siat/google_authenticator.py +47 -0
- siat-3.9.1/siat/grafix.py +3543 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/holding_risk.py +101 -43
- siat-3.9.1/siat/luchy_draw.py +638 -0
- siat-3.9.1/siat/market_china.py +1151 -0
- siat-3.9.1/siat/markowitz.py +2363 -0
- siat-3.9.1/siat/markowitz2.py +2887 -0
- siat-3.9.1/siat/markowitz_simple.py +373 -0
- siat-3.9.1/siat/ml_cases.py +2291 -0
- siat-3.9.1/siat/ml_cases_example.py +60 -0
- siat-3.9.1/siat/ml_cases_example1.py +60 -0
- siat-3.9.1/siat/option_china.py +3007 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/option_pricing.py +268 -121
- siat-3.9.1/siat/option_sina_api_test.py +112 -0
- siat-3.9.1/siat/other_indexes.py +189 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/risk_adjusted_return.py +591 -485
- siat-3.9.1/siat/risk_adjusted_return2.py +1881 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/risk_evaluation.py +443 -131
- {siat-1.3.0.6 → siat-3.9.1}/siat/risk_free_rate.py +7 -4
- siat-3.9.1/siat/sector_china.py +4127 -0
- siat-3.9.1/siat/security_price2.py +694 -0
- siat-3.9.1/siat/security_prices.py +3013 -0
- siat-3.9.1/siat/security_trend.py +402 -0
- siat-3.9.1/siat/security_trend2.py +615 -0
- siat-3.9.1/siat/shenwan index history test.py +41 -0
- siat-3.9.1/siat/stock.py +4231 -0
- siat-3.9.1/siat/stock_advice_linear.py +934 -0
- siat-3.9.1/siat/stock_base.py +26 -0
- siat-3.9.1/siat/stock_china.py +2043 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/stock_china_test.py +6 -6
- siat-3.9.1/siat/stock_info.pickle +0 -0
- siat-3.9.1/siat/stock_list_china_test.py +33 -0
- siat-3.9.1/siat/stock_prices_kneighbors.py +910 -0
- siat-3.9.1/siat/stock_prices_linear.py +386 -0
- siat-3.9.1/siat/stock_profile.py +707 -0
- siat-3.9.1/siat/stock_technical.py +3305 -0
- siat-3.9.1/siat/stooq.py +73 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/transaction.py +29 -127
- siat-3.9.1/siat/translate.py +5173 -0
- siat-3.9.1/siat/valuation.py +1374 -0
- siat-3.9.1/siat/valuation_china.py +2076 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/var_model_validation.py +90 -0
- siat-3.9.1/siat/yf_name.py +811 -0
- siat-3.9.1/siat.egg-info/PKG-INFO +232 -0
- siat-3.9.1/siat.egg-info/SOURCES.txt +96 -0
- siat-3.9.1/siat.egg-info/requires.txt +32 -0
- siat-1.3.0.6/MANIFEST.in +0 -1
- siat-1.3.0.6/PKG-INFO +0 -15
- siat-1.3.0.6/setup.py +0 -43
- siat-1.3.0.6/siat/__init__.py +0 -14
- siat-1.3.0.6/siat/allin.py +0 -79
- siat-1.3.0.6/siat/assets_liquidity_test.py +0 -36
- siat-1.3.0.6/siat/beta_adjustment_test.py +0 -68
- siat-1.3.0.6/siat/bond.py +0 -1569
- siat-1.3.0.6/siat/bond_base.py +0 -448
- siat-1.3.0.6/siat/bond_test.py +0 -121
- siat-1.3.0.6/siat/capm_beta_test.py +0 -45
- siat-1.3.0.6/siat/common.py +0 -789
- siat-1.3.0.6/siat/economy_test.py +0 -318
- siat-1.3.0.6/siat/fama_french_test.py +0 -21
- siat-1.3.0.6/siat/financial_statements_test.py +0 -31
- siat-1.3.0.6/siat/financials_test.py +0 -312
- siat-1.3.0.6/siat/fund_china.py +0 -1263
- siat-1.3.0.6/siat/fund_china_test.py +0 -101
- siat-1.3.0.6/siat/future_china_test.py +0 -35
- siat-1.3.0.6/siat/grafix.py +0 -796
- siat-1.3.0.6/siat/grafix_test.py +0 -104
- siat-1.3.0.6/siat/markowitz.py +0 -775
- siat-1.3.0.6/siat/markowitz_test.py +0 -68
- siat-1.3.0.6/siat/option_china.py +0 -334
- siat-1.3.0.6/siat/option_china_test.py +0 -37
- siat-1.3.0.6/siat/option_pricing_test.py +0 -78
- siat-1.3.0.6/siat/risk_adjusted_return_test.py +0 -74
- siat-1.3.0.6/siat/risk_evaluation_test.py +0 -18
- siat-1.3.0.6/siat/sector_china.py +0 -593
- siat-1.3.0.6/siat/sector_china_test.py +0 -150
- siat-1.3.0.6/siat/security_prices.py +0 -1407
- siat-1.3.0.6/siat/security_prices_test.py +0 -174
- siat-1.3.0.6/siat/stock.py +0 -2384
- siat-1.3.0.6/siat/stock_china.py +0 -799
- siat-1.3.0.6/siat/stock_info.pickle +0 -0
- siat-1.3.0.6/siat/stock_info_test.py +0 -189
- siat-1.3.0.6/siat/stock_test.py +0 -297
- siat-1.3.0.6/siat/transaction_test.py +0 -436
- siat-1.3.0.6/siat/translate.py +0 -1071
- siat-1.3.0.6/siat/universal_test.py +0 -10
- siat-1.3.0.6/siat.egg-info/PKG-INFO +0 -15
- siat-1.3.0.6/siat.egg-info/SOURCES.txt +0 -70
- siat-1.3.0.6/siat.egg-info/requires.txt +0 -14
- {siat-1.3.0.6 → siat-3.9.1}/setup.cfg +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/copyrights.py +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/esg_test.py +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/proxy_test.py +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/quandl_test.py +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat/risk_free_rate_test.py +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat.egg-info/dependency_links.txt +0 -0
- {siat-1.3.0.6 → siat-3.9.1}/siat.egg-info/top_level.txt +0 -0
siat-3.9.1/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright 2024 WANG Dehong
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software (siat) and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
siat-3.9.1/MANIFEST.in
ADDED
siat-3.9.1/PKG-INFO
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: siat
|
3
|
+
Version: 3.9.1
|
4
|
+
Summary: Securities Investment Analysis Tools (siat)
|
5
|
+
Home-page: https://pypi.org/project/siat/
|
6
|
+
Author: Prof. WANG Dehong, International Business School, Beijing Foreign Studies University
|
7
|
+
Author-email: wdehong2000@163.com
|
8
|
+
License: Copyright (C) WANG Dehong, 2024. For educational purpose only!
|
9
|
+
Description-Content-Type: text/markdown
|
10
|
+
License-File: LICENSE
|
11
|
+
Requires-Dist: pandas_datareader
|
12
|
+
Requires-Dist: yfinance
|
13
|
+
Requires-Dist: tqdm
|
14
|
+
Requires-Dist: plotly_express
|
15
|
+
Requires-Dist: akshare
|
16
|
+
Requires-Dist: urllib3
|
17
|
+
Requires-Dist: mplfinance
|
18
|
+
Requires-Dist: statsmodels
|
19
|
+
Requires-Dist: yahoo_earnings_calendar
|
20
|
+
Requires-Dist: pypinyin
|
21
|
+
Requires-Dist: seaborn
|
22
|
+
Requires-Dist: numpy
|
23
|
+
Requires-Dist: scipy
|
24
|
+
Requires-Dist: pandas
|
25
|
+
Requires-Dist: scikit-learn
|
26
|
+
Requires-Dist: baostock
|
27
|
+
Requires-Dist: pyproject.toml
|
28
|
+
Requires-Dist: pathlib
|
29
|
+
Requires-Dist: ruamel-yaml
|
30
|
+
Requires-Dist: prettytable
|
31
|
+
Requires-Dist: graphviz
|
32
|
+
Requires-Dist: luddite
|
33
|
+
Requires-Dist: pendulum
|
34
|
+
Requires-Dist: itables
|
35
|
+
Requires-Dist: py_trans
|
36
|
+
Requires-Dist: bottleneck
|
37
|
+
Requires-Dist: translate
|
38
|
+
Requires-Dist: translators
|
39
|
+
Requires-Dist: nbconvert
|
40
|
+
Requires-Dist: ipywidgets==8.1.6
|
41
|
+
Requires-Dist: playwright
|
42
|
+
Requires-Dist: yahooquery==2.3.7
|
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
|
51
|
+
|
52
|
+
|
53
|
+
# What is siat?
|
54
|
+
siat is a Python 3 plug-in for security investment analysis, primarily designed for teaching and learning purposes in universities for undergraduate and postgraduate programs.
|
55
|
+
|
56
|
+
siat is recommended to run in Jupyter Notebook or Jupyter Lab, and most of its results are in the forms of figures and/or tables.
|
57
|
+
# Version naming
|
58
|
+
Version structure: X.Y.Z
|
59
|
+
|
60
|
+
X is the major version for architecture upgrade only.
|
61
|
+
Y is the functional version for functional enhancements.
|
62
|
+
Z is the minor version just for bug fixing.
|
63
|
+
|
64
|
+
# Quick examples of using siat
|
65
|
+
|
66
|
+
|
67
|
+
```python
|
68
|
+
# Enable siat
|
69
|
+
from siat import *
|
70
|
+
```
|
71
|
+
|
72
|
+
|
73
|
+
```python
|
74
|
+
# Set language to English, default is Chinese
|
75
|
+
set_language("English")
|
76
|
+
```
|
77
|
+
|
78
|
+
## Example 1: Apple stock price for the recent month
|
79
|
+
|
80
|
+
|
81
|
+
```python
|
82
|
+
# Simple way: show Apple's stock price in recent month
|
83
|
+
apple=security_trend("AAPL")
|
84
|
+
```
|
85
|
+
You may expect more information, such as price trend in a recent year (MRY), with the high/low point, current price and average price, like below:
|
86
|
+
|
87
|
+
```python
|
88
|
+
apple=security_trend("AAPL", start="MRY",
|
89
|
+
mark_top=True, mark_bottom=True, mark_end=True,
|
90
|
+
average_value=True)
|
91
|
+
```
|
92
|
+
|
93
|
+
## Example 2: Comparing Price changes among Apple, Microsoft and NVidia
|
94
|
+
You may expect compare the price changes for the recent quarter (MRQ) for the three stocks.
|
95
|
+
|
96
|
+
Since there is a major stock split for NVidia in 2024 by 1:10, it is necessary to use adjusted prices (Adj Close) to compare these stock prices.
|
97
|
+
|
98
|
+
```python
|
99
|
+
comp=security_trend(['AAPL','MSFT','NVDA'],
|
100
|
+
start='MRQ',
|
101
|
+
indicator='Adj Close',
|
102
|
+
preprocess='scaling', #use scaling drawing method to avoid loss of details
|
103
|
+
mark_top=True, mark_bottom=True,
|
104
|
+
annotate=True, annotate_value=True)
|
105
|
+
```
|
106
|
+
|
107
|
+
## Example 4: Bollinger band for Apple in the recent quarter
|
108
|
+
|
109
|
+
|
110
|
+
```python
|
111
|
+
# security_technical only supports 4 popular technical indicators: MACD, Bollinger, KDJ and RSI.
|
112
|
+
apple=security_technical("AAPL",
|
113
|
+
technical="Bollinger",
|
114
|
+
start="MRQ",
|
115
|
+
facecolor="white",
|
116
|
+
loc1="upper left", loc2="lower right")
|
117
|
+
```
|
118
|
+
|
119
|
+
## Example 5: CCI for Apple in recent quarter
|
120
|
+
|
121
|
+
|
122
|
+
```python
|
123
|
+
# security_technical2 supports up to 14 popular technical indicators.
|
124
|
+
# security_technical2 uses a simplied drawing method (Dehong graph) to avoid trypophobia [藢tr瑟p蓹u'f蓹蕣bj蓹]
|
125
|
+
apple=security_technical2("AAPL",
|
126
|
+
technical="CCI",
|
127
|
+
start="MRM",
|
128
|
+
loc1="upper left", loc2="lower right")
|
129
|
+
```
|
130
|
+
|
131
|
+
# What security products does siat support?
|
132
|
+
1. Public company profile: world-wide
|
133
|
+
2. Stock & stock market index: world-wide
|
134
|
+
3. Stock valuation: primarily in China (mainland and HK) and the U.S.
|
135
|
+
4. Stock option chain: primarily in the U.S.
|
136
|
+
5. Bond: primarily in China and the U.S.
|
137
|
+
6. Markowitz portfolio: with all the supported stocks and bonds
|
138
|
+
7. Fund: primarily in China and the U.S.
|
139
|
+
8. Futures: primarily in China and the U.S.
|
140
|
+
9. Options: primarily in China and the U.S.
|
141
|
+
10. Digital currency: world-wide (some may be restricted by data sources)
|
142
|
+
11. Balance sheet: in China (full function) and world-wide (basic function)
|
143
|
+
12. Income statement: in China mainland (full function) and world-wide (basic function)
|
144
|
+
13. Cash flow statement: in China mainland (full function) and world-wide (basic function)
|
145
|
+
14. DuPont Identity: world-wide
|
146
|
+
15. Sector trend and valuation: primarily in China
|
147
|
+
# What analytical methods does siat support?
|
148
|
+
1. Trend analysis
|
149
|
+
2. Panel comparation
|
150
|
+
3. Return analysis: rolling returns, holding period returns
|
151
|
+
4. Risk analysis: rolling volatility, holding period volatility, LPSD
|
152
|
+
5. Technical analysis: more than 15 indicators
|
153
|
+
6. Risk-adjusted return: Sharpe ratio, Sortino ratio, Treynor ratio, Jensen alpha
|
154
|
+
7. Portfolio optimization: four risk-adjusted returns
|
155
|
+
8. CAPM beta trend
|
156
|
+
9. Beta adjustments: simple adjustment, Scholes-Williams, Dimson
|
157
|
+
10. Beta leverage: Hamada Model
|
158
|
+
11. Fama-French three-factor model
|
159
|
+
12. Fama-French-Carhart four-factor model
|
160
|
+
13. Fama-French five-factor model
|
161
|
+
14. Future pricing
|
162
|
+
15. Option pricing: European style, American style, with/without dividends
|
163
|
+
16. VaR & ES: variance-covariance, historic simulation, Monte Carlo, multiple periods
|
164
|
+
17. Liquidity risk: Roll spread, Amihud, Pastor-Stambaugh
|
165
|
+
18. ESG: basic functions
|
166
|
+
# Do I have to download data first before using siat?
|
167
|
+
NO!
|
168
|
+
siat will search the internet data sources for all the required data during analysis.
|
169
|
+
The main data sources siat uses:
|
170
|
+
1. Yahoo Finance
|
171
|
+
2. Sina Finance
|
172
|
+
3. East Money
|
173
|
+
4. Stooq (Polish)
|
174
|
+
5. FRED
|
175
|
+
6. OECD
|
176
|
+
7. IMF
|
177
|
+
8. Shanghai Stock Exchange
|
178
|
+
9. Shenzhen Stock Exchange
|
179
|
+
10. Hong Kong Stock Exchange
|
180
|
+
11. Beijing Stock Exchange
|
181
|
+
12. Tokyo Stock Exchange
|
182
|
+
13. London Stock Exchange
|
183
|
+
14. New York Stock Exchange
|
184
|
+
15. NASDAQ
|
185
|
+
16. Sustainalytics
|
186
|
+
|
187
|
+
Thanks the above websites for their valuable data!
|
188
|
+
# How to install siat?
|
189
|
+
The author strongly recommends using siat together with Jupyter Notebook or Jupyter Lab in Anaconda.
|
190
|
+
In order to install siat for the very first time, open a Jupyter Notebook, and type in the following command:
|
191
|
+
|
192
|
+
!pip install siat
|
193
|
+
|
194
|
+
If the above method does not work, something might be wrong in your Python path settings. Try to open an Anaconda Prompt in Windows or a Terminal App in Mac or Linux, and type in the following command:
|
195
|
+
|
196
|
+
pip install siat
|
197
|
+
# How to upgrade siat?
|
198
|
+
In Jupyter Notebook or Jupyter Lab:
|
199
|
+
|
200
|
+
upgrade_siat()
|
201
|
+
|
202
|
+
If you suffer from slow internet connection (often in campus classrooms with many students), try to use alternative sources, such as:
|
203
|
+
|
204
|
+
upgrade_siat(alternative="tsinghua")
|
205
|
+
|
206
|
+
upgrade_siat(alternative="alibaba")
|
207
|
+
|
208
|
+
If the above methods do not work for your environment, you have to goto the traditional ways to use command-line script, such as:
|
209
|
+
|
210
|
+
pip install --upgrade siat
|
211
|
+
|
212
|
+
*** For users in China
|
213
|
+
The pypi mirror websites may provide siat installing and upgrading in a much faster speed in the following commands: taking aliyun as an example
|
214
|
+
|
215
|
+
pip install siat -i https://mirrors.aliyun.com/pypi/simple/
|
216
|
+
|
217
|
+
pip install --upgrade siat https://mirrors.aliyun.com/pypi/simple/
|
218
|
+
|
219
|
+
*** Warning
|
220
|
+
1. The pip command itself may need upgrade as well.
|
221
|
+
2. The pip command sometimes may have conflicts with some vpn programs.
|
222
|
+
If in this case, try quit vpn program first, and try again.
|
223
|
+
# Are there more detailed case studies on using siat?
|
224
|
+
YES!
|
225
|
+
|
226
|
+
There are hundreds of video case studies in the author's channel (most in Chinese, some in English).
|
227
|
+
|
228
|
+
https://space.bilibili.com/284812153
|
229
|
+
|
230
|
+
Welcome to follow the channel!
|
231
|
+
# How to report a bug or look for help?
|
232
|
+
Write to the author, Prof. WANG Dehong, wdehong2000@163.com
|
siat-3.9.1/setup.py
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
@author: WANG Dehong (Peter), IBS BFSU
|
4
|
+
"""
|
5
|
+
|
6
|
+
from setuptools import setup, find_packages
|
7
|
+
from pathlib import Path
|
8
|
+
this_directory = Path(__file__).parent
|
9
|
+
long_description = (this_directory / "README.md").read_text()
|
10
|
+
#description does not support image, text only
|
11
|
+
|
12
|
+
setup(
|
13
|
+
name="siat",
|
14
|
+
version="3.9.1",
|
15
|
+
#author="Prof. WANG Dehong, Business School, BFSU (北京外国语大学 国际商学院 王德宏)",
|
16
|
+
author="Prof. WANG Dehong, International Business School, Beijing Foreign Studies University",
|
17
|
+
author_email="wdehong2000@163.com",
|
18
|
+
description="Securities Investment Analysis Tools (siat)",
|
19
|
+
url = "https://pypi.org/project/siat/",
|
20
|
+
long_description=long_description,
|
21
|
+
long_description_content_type='text/markdown',
|
22
|
+
license="Copyright (C) WANG Dehong, 2024. For educational purpose only!",
|
23
|
+
packages = find_packages(),
|
24
|
+
install_requires=[
|
25
|
+
'pandas_datareader',
|
26
|
+
'yfinance',
|
27
|
+
#'pandas_alive',
|
28
|
+
'tqdm',
|
29
|
+
'plotly_express',
|
30
|
+
#'akshare==1.3.95',#为与urllib3兼容
|
31
|
+
#'akshare==1.4.57',#为其他兼容考虑
|
32
|
+
#'akshare==1.10.3',
|
33
|
+
'akshare',
|
34
|
+
#'urllib3==1.25.11',#为其他兼容考虑
|
35
|
+
'urllib3',
|
36
|
+
#'urllib3',
|
37
|
+
'mplfinance',
|
38
|
+
'statsmodels',
|
39
|
+
'yahoo_earnings_calendar',
|
40
|
+
'pypinyin',
|
41
|
+
'seaborn',
|
42
|
+
'numpy',
|
43
|
+
'scipy',
|
44
|
+
#'pandas==1.5.3',#为其他兼容考虑
|
45
|
+
'pandas',
|
46
|
+
'scikit-learn',
|
47
|
+
'baostock',
|
48
|
+
'pyproject.toml',
|
49
|
+
#'ta-lib',#ta-lib需要单独安装,并与Python版本配套
|
50
|
+
'pathlib','ruamel-yaml','prettytable',
|
51
|
+
'graphviz',#graphviz可能还需要额外安装程序
|
52
|
+
'luddite',
|
53
|
+
'pendulum','itables','py_trans','bottleneck',
|
54
|
+
'translate','translators',
|
55
|
+
#注意:translators 5.9.5要求lxml >=5.3.0,与yahooquery的要求矛盾
|
56
|
+
'nbconvert',
|
57
|
+
'ipywidgets==8.1.6',#解决Error loading widgets
|
58
|
+
'playwright',#安装后还需要执行指令:playwright install
|
59
|
+
#'yahooquery==2.2.14',#为其他兼容考虑
|
60
|
+
'yahooquery==2.3.7',#解决数据获取失败crump限制
|
61
|
+
#注意:临时措施,yahooquery 2.3.7要求lxml 4.9.4
|
62
|
+
|
63
|
+
],
|
64
|
+
#zip_sage=False,
|
65
|
+
include_package_data=True, # 打包包含静态文件标识
|
66
|
+
)
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
功能:一次性引入SIAT的所有模块
|
4
|
+
作者:王德宏,北京外国语大学国际商学院
|
5
|
+
版权:2021-2025(C) 仅限教学使用,商业使用需要授权
|
6
|
+
联络:wdehong2000@163.com
|
7
|
+
"""
|
8
|
+
|
9
|
+
#==============================================================================
|
10
|
+
#屏蔽所有警告性信息
|
11
|
+
import warnings; warnings.filterwarnings('ignore')
|
12
|
+
#==============================================================================
|
13
|
+
from siat.allin import *
|
14
|
+
|
15
|
+
import pkg_resources
|
16
|
+
current_version=pkg_resources.get_distribution("siat").version
|
17
|
+
#current_list=current_version.split('.')
|
18
|
+
|
19
|
+
#==============================================================================
|
20
|
+
# 处理stooq.py修复问题
|
21
|
+
restart=False
|
22
|
+
tagfile='fix_package.pkl'
|
23
|
+
|
24
|
+
#判断操作系统
|
25
|
+
import sys; czxt=sys.platform
|
26
|
+
if czxt in ['win32','win64']:
|
27
|
+
os='windows'
|
28
|
+
elif czxt in ['darwin']: #MacOSX
|
29
|
+
os='mac'
|
30
|
+
elif czxt in ['linux']: #linux
|
31
|
+
os='linux'
|
32
|
+
else:
|
33
|
+
os='windows'
|
34
|
+
|
35
|
+
# 确定标记文件存放地址
|
36
|
+
import pandas
|
37
|
+
srcpath=pandas.__path__[0]
|
38
|
+
if os == 'windows':
|
39
|
+
srcpath1=srcpath.replace("\\",'/')
|
40
|
+
srcfile=srcpath1+'/'+tagfile
|
41
|
+
else:
|
42
|
+
srcpath1=srcpath
|
43
|
+
srcfile=srcpath1+'/'+file
|
44
|
+
|
45
|
+
try:
|
46
|
+
with open(srcfile,'rb') as file:
|
47
|
+
siat_ver=pickle.load(file)
|
48
|
+
if siat_ver != current_version:
|
49
|
+
restart=True
|
50
|
+
with open(srcfile,'wb') as file:
|
51
|
+
pickle.dump(current_version,file)
|
52
|
+
except:
|
53
|
+
restart=True
|
54
|
+
with open(srcfile,'wb') as file:
|
55
|
+
pickle.dump(current_version,file)
|
56
|
+
|
57
|
+
#屏蔽函数内print信息输出的类
|
58
|
+
import os, sys
|
59
|
+
class HiddenPrints:
|
60
|
+
def __enter__(self):
|
61
|
+
self._original_stdout = sys.stdout
|
62
|
+
sys.stdout = open(os.devnull, 'w')
|
63
|
+
|
64
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
65
|
+
sys.stdout.close()
|
66
|
+
sys.stdout = self._original_stdout
|
67
|
+
|
68
|
+
if not restart:
|
69
|
+
print(" Successfully enabled siat v{}".format(current_version))
|
70
|
+
else:
|
71
|
+
with HiddenPrints():
|
72
|
+
fix_package()
|
73
|
+
print(" Please RESTART Python kernel and run this command again")
|
74
|
+
|
75
|
+
#==============================================================================
|
siat-3.9.1/siat/allin.py
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
功能:一次性引入SIAT的所有模块
|
4
|
+
作者:王德宏,北京外国语大学国际商学院
|
5
|
+
版权:2022(C) 仅限教学使用,商业使用需要授权
|
6
|
+
联络:wdehong2000@163.com
|
7
|
+
"""
|
8
|
+
|
9
|
+
# 资产流动性
|
10
|
+
from siat.assets_liquidity import *
|
11
|
+
|
12
|
+
# 贝塔系数调整方法
|
13
|
+
from siat.beta_adjustment import *
|
14
|
+
from siat.beta_adjustment_china import *
|
15
|
+
|
16
|
+
# 债券
|
17
|
+
from siat.bond import *
|
18
|
+
|
19
|
+
# 资本资产定价模型
|
20
|
+
from siat.capm_beta import *
|
21
|
+
from siat.capm_beta2 import *
|
22
|
+
|
23
|
+
# 数字货币
|
24
|
+
from siat.cryptocurrency import *
|
25
|
+
|
26
|
+
# 宏观经济
|
27
|
+
from siat.economy import *
|
28
|
+
from siat.economy2 import *
|
29
|
+
|
30
|
+
|
31
|
+
# ESG
|
32
|
+
from siat.esg import *
|
33
|
+
|
34
|
+
# 资产定价-多因子模型
|
35
|
+
from siat.fama_french import *
|
36
|
+
|
37
|
+
# 财务报表:雅虎源
|
38
|
+
from siat.financial_statements import *
|
39
|
+
|
40
|
+
# 财务分析:雅虎源
|
41
|
+
from siat.financials import *
|
42
|
+
|
43
|
+
# 财务分析:雅虎源
|
44
|
+
from siat.financials2 import *
|
45
|
+
|
46
|
+
# 财务报表:雅虎源
|
47
|
+
from siat.fin_stmt2_yahoo import *
|
48
|
+
|
49
|
+
# 财务分析:中国
|
50
|
+
from siat.financials_china import *
|
51
|
+
|
52
|
+
# 财务分析:中国,资产负债结构分析
|
53
|
+
from siat.financials_china2 import *
|
54
|
+
|
55
|
+
# 中国的基金
|
56
|
+
from siat.fund_china import *
|
57
|
+
|
58
|
+
# 中国的期货(内盘与部分外盘)
|
59
|
+
from siat.future_china import *
|
60
|
+
|
61
|
+
# 中国的期权
|
62
|
+
from siat.option_china import *
|
63
|
+
|
64
|
+
# 资产的持有风险
|
65
|
+
from siat.holding_risk import *
|
66
|
+
|
67
|
+
# 投资组合理论
|
68
|
+
#from siat.markowitz import *
|
69
|
+
from siat.markowitz2 import *
|
70
|
+
|
71
|
+
# 投资组合理论自助式示意图
|
72
|
+
#from siat.markowitz_simple import *
|
73
|
+
|
74
|
+
# 期权定价
|
75
|
+
from siat.option_pricing import *
|
76
|
+
|
77
|
+
# 风险调整收益
|
78
|
+
from siat.risk_adjusted_return import *
|
79
|
+
from siat.risk_adjusted_return2 import *
|
80
|
+
|
81
|
+
# 风险评估
|
82
|
+
from siat.risk_evaluation import *
|
83
|
+
|
84
|
+
# 中国的行业分析
|
85
|
+
from siat.sector_china import *
|
86
|
+
|
87
|
+
# 股票/行业指数估值:美股,港股,A股,波兰股,指数
|
88
|
+
from siat.valuation import *
|
89
|
+
|
90
|
+
# 中国股票/市场估值
|
91
|
+
from siat.valuation_china import *
|
92
|
+
|
93
|
+
# 获取证券价格与计算
|
94
|
+
from siat.security_prices import *
|
95
|
+
from siat.security_price2 import *
|
96
|
+
from siat.other_indexes import *
|
97
|
+
|
98
|
+
# 股票分析
|
99
|
+
from siat.stock import *
|
100
|
+
|
101
|
+
# 股票趋势分析,集成函数
|
102
|
+
from siat.security_trend2 import *
|
103
|
+
|
104
|
+
# 中国的股票
|
105
|
+
from siat.stock_china import *
|
106
|
+
|
107
|
+
# 中国股票市场概况
|
108
|
+
from siat.market_china import *
|
109
|
+
|
110
|
+
# 证券交易-套壳
|
111
|
+
from siat.transaction import *
|
112
|
+
|
113
|
+
# 持有资产风险-模型验证
|
114
|
+
from siat.var_model_validation import *
|
115
|
+
|
116
|
+
# 跨种类比较分析
|
117
|
+
from siat.compare_cross import *
|
118
|
+
|
119
|
+
# 机器学习-课程案例
|
120
|
+
#from siat.ml_cases import *
|
121
|
+
#from siat.stock_advice_linear import *
|
122
|
+
|
123
|
+
# 股票技术分析
|
124
|
+
from siat.stock_technical import *
|
125
|
+
|
126
|
+
# 事件研究法
|
127
|
+
from siat.event_study import *
|
128
|
+
|
129
|
+
# 2FA: Google Authenticator
|
130
|
+
from siat.google_authenticator import *
|
131
|
+
|
132
|
+
# 提问记录
|
133
|
+
from siat.luchy_draw import *
|
134
|
+
|
135
|
+
# 搜索全球上市公司的英文名称,需要访问雅虎
|
136
|
+
from siat.yf_name import *
|
137
|
+
|