siat 3.10.125__py3-none-any.whl → 3.10.127__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.127.dist-info}/METADATA +235 -226
  7. siat-3.10.127.dist-info/RECORD +76 -0
  8. {siat-3.10.125.dist-info → siat-3.10.127.dist-info}/WHEEL +1 -1
  9. {siat-3.10.125.dist-info → siat-3.10.127.dist-info/licenses}/LICENSE +0 -0
  10. {siat-3.10.125.dist-info → siat-3.10.127.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/common.py CHANGED
@@ -4937,7 +4937,7 @@ async def jupyter2pdf2(notebook_dir, notebook_file):
4937
4937
  None
4938
4938
 
4939
4939
  注意1:如果指令异常,可能还要执行python -m playwright install
4940
- 注意2:调用本函数的格式是异步await开头
4940
+ 注意2:调用本函数的格式是异步await开头,例如:
4941
4941
  await jupyter2pdf2(notebook_dir, notebook_file)
4942
4942
  """
4943
4943
 
@@ -4992,6 +4992,9 @@ async def jupyter2pdf2(notebook_dir, notebook_file):
4992
4992
  page = await browser.new_page()
4993
4993
  await page.goto(f"file://{os.path.abspath(html_file)}")
4994
4994
 
4995
+ # 避免加载html文件超时,用于macOS
4996
+ page.wait_for_selector(".jp-Notebook", state="visible", timeout=60000) # 等待笔记本主体出现
4997
+
4995
4998
  await page.pdf(path=output_pdf_path1, format='A4')
4996
4999
  await page.pdf(path=output_pdf_path2, format='A3')
4997
5000
 
@@ -5000,7 +5003,7 @@ async def jupyter2pdf2(notebook_dir, notebook_file):
5000
5003
  print(f"2 PDF created in the same directory, pick 1 you think best")
5001
5004
 
5002
5005
  except Exception as e:
5003
- print(f"Conversion failed because {e}")
5006
+ print(f"PDF conversion failed because {e}")
5004
5007
  return
5005
5008
 
5006
5009
  finally:
@@ -5019,6 +5022,107 @@ if __name__ == '__main__':
5019
5022
  notebook_file = "Session 1 全球证券市场-简化版.ipynb"
5020
5023
  #await jupyter2pdf2(notebook_dir, notebook_file)
5021
5024
  # 注意:上面的await命令会导致编译失败,测试后要注释掉
5025
+
5026
+ #==============================================================================
5027
+ async def jupyter2pdf3(notebook_file):
5028
+ """
5029
+ ===========================================================================
5030
+ 将 Jupyter Notebook 转换为 PDF 文件,异步方式。
5031
+ 主要参数:
5032
+ notebook_file (str): Jupyter Notebook文件名,不含目录
5033
+
5034
+ 输出:
5035
+ 同时生成A4和A3两种幅面的pdf文件,由使用者自行挑选一个效果最好的。
5036
+ 返回:
5037
+ None
5038
+
5039
+ 注意1:如果指令异常,可能还要执行python -m playwright install
5040
+ 注意2:调用本函数的格式是异步await开头,例如:
5041
+ await jupyter2pdf3(notebook_file)
5042
+
5043
+ 注意:目前无法正确获得ipynb文件的所在目录,使用使用!!!
5044
+ """
5045
+ # 获得路径
5046
+ import os
5047
+ notebook_dir=os.getcwd()
5048
+ # 注意:上述指令无法获取当前Jupyter文件的目录
5049
+
5050
+ # 路径分割符号
5051
+ if ('/' in notebook_dir) and not ('\\' in notebook_dir):
5052
+ sep='/'
5053
+ else:
5054
+ sep='\\'
5055
+
5056
+ # ipynb文件的完整路径
5057
+ if ('.ipynb' in notebook_file):
5058
+ notebook_file1=notebook_file.replace('.ipynb','')
5059
+ else:
5060
+ notebook_file1=notebook_file
5061
+ notebook_path=notebook_dir+sep+notebook_file1+'.ipynb'
5062
+
5063
+ # pdf文件的完整路径
5064
+ output_pdf_path1=notebook_dir+sep+notebook_file1+'A4.pdf'
5065
+ output_pdf_path2=notebook_dir+sep+notebook_file1+'A3.pdf'
5066
+
5067
+ from nbconvert import HTMLExporter
5068
+
5069
+ try:
5070
+ from playwright.async_api import async_playwright
5071
+ except:
5072
+ print(" #Warning(jupyter2pdf2): playwright seems not fully installed yet")
5073
+ print(" [Solution] execute the command before re-run: playwright install")
5074
+ return
5075
+
5076
+ html_file = ""
5077
+
5078
+ try:
5079
+ # 导出 Notebook 为 HTML
5080
+ html_exporter = HTMLExporter()
5081
+ try:
5082
+ html_content, _ = html_exporter.from_filename(notebook_path)
5083
+ print("Converting notebook file to pdf in both A4 and A3 sizes ...")
5084
+
5085
+ except:
5086
+ print("File not found for {}".format(notebook_path))
5087
+ return
5088
+
5089
+ # 创建临时 HTML 文件
5090
+ html_file = "temp_notebook.html"
5091
+ with open(html_file, "w", encoding="utf-8") as f:
5092
+ f.write(html_content)
5093
+
5094
+ # 使用 Playwright 打开 HTML 并保存为 PDF
5095
+ async with async_playwright() as p:
5096
+ browser = await p.chromium.launch()
5097
+ page = await browser.new_page()
5098
+ await page.goto(f"file://{os.path.abspath(html_file)}")
5099
+
5100
+ await page.pdf(path=output_pdf_path1, format='A4')
5101
+ await page.pdf(path=output_pdf_path2, format='A3')
5102
+
5103
+ await browser.close()
5104
+
5105
+ print(f"2 PDF created in the same directory, pick 1 you think best")
5106
+
5107
+ except Exception as e:
5108
+ print(f"Conversion failed because {e}")
5109
+ return
5110
+
5111
+ finally:
5112
+ if html_file == "":
5113
+ return
5114
+ # 删除临时 HTML 文件
5115
+ elif os.path.exists(html_file):
5116
+ os.remove(html_file)
5117
+
5118
+ return
5119
+
5120
+ if __name__ == '__main__':
5121
+ # 替换为你想转存PDF的Notebook文件名
5122
+ file = "Session 1 全球证券市场-简化版.ipynb"
5123
+ #await jupyter2pdf3(file)
5124
+ # 注意:上面的await命令会导致编译失败,测试后要注释掉
5125
+
5022
5126
  #==============================================================================
5023
5127
  if __name__ == '__main__':
5024
5128
  df=security_trend("600519.SS",indicator=['Close','Open','High','Low'],graph=False)
File without changes
siat/fund_china.pickle CHANGED
File without changes
siat/stock.py CHANGED
@@ -1546,8 +1546,11 @@ if __name__ =="__main__":
1546
1546
  tickers='AAPL'
1547
1547
  measures=['Close','Adj Close']
1548
1548
 
1549
+ tickers=['000001.SS','^DJI']
1550
+ measures='Close'
1551
+
1549
1552
  fromdate='2024-5-1'
1550
- todate='2024-5-30'
1553
+ todate='2025-6-23'
1551
1554
  adjust=''
1552
1555
  twinx=False
1553
1556
  loc1='best'
@@ -1556,6 +1559,10 @@ if __name__ =="__main__":
1556
1559
  source='auto'
1557
1560
  ticker_type='auto'
1558
1561
  facecolor='whitesmoke'
1562
+
1563
+ attention_value=''; attention_value_area=''
1564
+ attention_point=''; attention_point_area=''
1565
+
1559
1566
 
1560
1567
  def compare_security(tickers,measures,fromdate,todate, \
1561
1568
  adjust='', \
@@ -1609,7 +1616,8 @@ def compare_security(tickers,measures,fromdate,todate, \
1609
1616
  measure_num = 0
1610
1617
  if isinstance(measures,str):
1611
1618
  measure_num = 1
1612
- measure1 = measures
1619
+ #measure1 = measures
1620
+ measure1 = measure2 = measures
1613
1621
  #如果measures是一个列表
1614
1622
  if isinstance(measures,list):
1615
1623
  measure_num = len(measures)
siat/stock_info.pickle CHANGED
File without changes
@@ -1,226 +1,235 @@
1
- Metadata-Version: 2.1
2
- Name: siat
3
- Version: 3.10.125
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, 2025. 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: yahooquery ==2.3.7
42
- Requires-Dist: alpha-vantage
43
- Requires-Dist: tiingo[pandas]
44
- Requires-Dist: playwright
45
-
46
-
47
- # What is siat?
48
- 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.
49
-
50
- 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.
51
- # Version naming
52
- Version structure: X.Y.Z
53
-
54
- X is the major version for architecture upgrade only.
55
- Y is the functional version for functional enhancements.
56
- Z is the minor version just for bug fixing.
57
-
58
- # Quick examples of using siat
59
-
60
-
61
- ```python
62
- # Enable siat
63
- from siat import *
64
- ```
65
-
66
-
67
- ```python
68
- # Set language to English, default is Chinese
69
- set_language("English")
70
- ```
71
-
72
- ## Example 1: Apple stock price for the recent month
73
-
74
-
75
- ```python
76
- # Simple way: show Apple's stock price in recent month
77
- apple=security_trend("AAPL")
78
- ```
79
- 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:
80
-
81
- ```python
82
- apple=security_trend("AAPL", start="MRY",
83
- mark_top=True, mark_bottom=True, mark_end=True,
84
- average_value=True)
85
- ```
86
-
87
- ## Example 2: Comparing Price changes among Apple, Microsoft and NVidia
88
- You may expect compare the price changes for the recent quarter (MRQ) for the three stocks.
89
-
90
- 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.
91
-
92
- ```python
93
- comp=security_trend(['AAPL','MSFT','NVDA'],
94
- start='MRQ',
95
- indicator='Adj Close',
96
- preprocess='scaling', #use scaling drawing method to avoid loss of details
97
- mark_top=True, mark_bottom=True,
98
- annotate=True, annotate_value=True)
99
- ```
100
-
101
- ## Example 4: Bollinger band for Apple in the recent quarter
102
-
103
-
104
- ```python
105
- # security_technical only supports 4 popular technical indicators: MACD, Bollinger, KDJ and RSI.
106
- apple=security_technical("AAPL",
107
- technical="Bollinger",
108
- start="MRQ",
109
- facecolor="white",
110
- loc1="upper left", loc2="lower right")
111
- ```
112
-
113
- ## Example 5: CCI for Apple in recent quarter
114
-
115
-
116
- ```python
117
- # security_technical2 supports up to 14 popular technical indicators.
118
- # security_technical2 uses a simplied drawing method (Dehong graph) to avoid trypophobia [藢tr瑟p蓹u'f蓹蕣bj蓹]
119
- apple=security_technical2("AAPL",
120
- technical="CCI",
121
- start="MRM",
122
- loc1="upper left", loc2="lower right")
123
- ```
124
-
125
- # What security products does siat support?
126
- 1. Public company profile: world-wide
127
- 2. Stock & stock market index: world-wide
128
- 3. Stock valuation: primarily in China (mainland and HK) and the U.S.
129
- 4. Stock option chain: primarily in the U.S.
130
- 5. Bond: primarily in China and the U.S.
131
- 6. Markowitz portfolio: with all the supported stocks and bonds
132
- 7. Fund: primarily in China and the U.S.
133
- 8. Futures: primarily in China and the U.S.
134
- 9. Options: primarily in China and the U.S.
135
- 10. Digital currency: world-wide (some may be restricted by data sources)
136
- 11. Balance sheet: in China (full function) and world-wide (basic function)
137
- 12. Income statement: in China mainland (full function) and world-wide (basic function)
138
- 13. Cash flow statement: in China mainland (full function) and world-wide (basic function)
139
- 14. DuPont Identity: world-wide
140
- 15. Sector trend and valuation: primarily in China
141
- # What analytical methods does siat support?
142
- 1. Trend analysis
143
- 2. Panel comparation
144
- 3. Return analysis: rolling returns, holding period returns
145
- 4. Risk analysis: rolling volatility, holding period volatility, LPSD
146
- 5. Technical analysis: more than 15 indicators
147
- 6. Risk-adjusted return: Sharpe ratio, Sortino ratio, Treynor ratio, Jensen alpha
148
- 7. Portfolio optimization: four risk-adjusted returns
149
- 8. CAPM beta trend
150
- 9. Beta adjustments: simple adjustment, Scholes-Williams, Dimson
151
- 10. Beta leverage: Hamada Model
152
- 11. Fama-French three-factor model
153
- 12. Fama-French-Carhart four-factor model
154
- 13. Fama-French five-factor model
155
- 14. Future pricing
156
- 15. Option pricing: European style, American style, with/without dividends
157
- 16. VaR & ES: variance-covariance, historic simulation, Monte Carlo, multiple periods
158
- 17. Liquidity risk: Roll spread, Amihud, Pastor-Stambaugh
159
- 18. ESG: basic functions
160
- # Do I have to download data first before using siat?
161
- NO!
162
- siat will search the internet data sources for all the required data during analysis.
163
- The main data sources siat uses:
164
- 1. Yahoo Finance
165
- 2. Sina Finance
166
- 3. East Money
167
- 4. Stooq (Polish)
168
- 5. FRED
169
- 6. OECD
170
- 7. IMF
171
- 8. Shanghai Stock Exchange
172
- 9. Shenzhen Stock Exchange
173
- 10. Hong Kong Stock Exchange
174
- 11. Beijing Stock Exchange
175
- 12. Tokyo Stock Exchange
176
- 13. London Stock Exchange
177
- 14. New York Stock Exchange
178
- 15. NASDAQ
179
- 16. Sustainalytics
180
-
181
- Thanks the above websites for their valuable data!
182
- # How to install siat?
183
- The author strongly recommends using siat together with Jupyter Notebook or Jupyter Lab in Anaconda.
184
- In order to install siat for the very first time, open a Jupyter Notebook, and type in the following command:
185
-
186
- !pip install siat
187
-
188
- 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:
189
-
190
- pip install siat
191
- # How to upgrade siat?
192
- In Jupyter Notebook or Jupyter Lab:
193
-
194
- upgrade_siat()
195
-
196
- If you suffer from slow internet connection (often in campus classrooms with many students), try to use alternative sources, such as:
197
-
198
- upgrade_siat(alternative="tsinghua")
199
-
200
- upgrade_siat(alternative="alibaba")
201
-
202
- If the above methods do not work for your environment, you have to goto the traditional ways to use command-line script, such as:
203
-
204
- pip install --upgrade siat
205
-
206
- *** For users in China
207
- The pypi mirror websites may provide siat installing and upgrading in a much faster speed in the following commands: taking aliyun as an example
208
-
209
- pip install siat -i https://mirrors.aliyun.com/pypi/simple/
210
-
211
- pip install --upgrade siat https://mirrors.aliyun.com/pypi/simple/
212
-
213
- *** Warning
214
- 1. The pip command itself may need upgrade as well.
215
- 2. The pip command sometimes may have conflicts with some vpn programs.
216
- If in this case, try quit vpn program first, and try again.
217
- # Are there more detailed case studies on using siat?
218
- YES!
219
-
220
- There are hundreds of video case studies in the author's channel (most in Chinese, some in English).
221
-
222
- https://space.bilibili.com/284812153
223
-
224
- Welcome to follow the channel!
225
- # How to report a bug or look for help?
226
- Write to the author, Prof. WANG Dehong, wdehong2000@163.com
1
+ Metadata-Version: 2.4
2
+ Name: siat
3
+ Version: 3.10.127
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, 2025. 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: scipy
23
+ Requires-Dist: pandas
24
+ Requires-Dist: scikit-learn
25
+ Requires-Dist: baostock
26
+ Requires-Dist: pyproject.toml
27
+ Requires-Dist: pathlib
28
+ Requires-Dist: ruamel-yaml
29
+ Requires-Dist: prettytable
30
+ Requires-Dist: graphviz
31
+ Requires-Dist: luddite
32
+ Requires-Dist: pendulum
33
+ Requires-Dist: itables
34
+ Requires-Dist: py_trans
35
+ Requires-Dist: bottleneck
36
+ Requires-Dist: translate
37
+ Requires-Dist: translators
38
+ Requires-Dist: nbconvert
39
+ Requires-Dist: ipywidgets
40
+ Requires-Dist: yahooquery==2.3.7
41
+ Requires-Dist: lxml==4.9.4
42
+ Requires-Dist: alpha_vantage
43
+ Requires-Dist: tiingo[pandas]
44
+ Requires-Dist: numpy<2
45
+ Dynamic: author
46
+ Dynamic: author-email
47
+ Dynamic: description
48
+ Dynamic: description-content-type
49
+ Dynamic: home-page
50
+ Dynamic: license
51
+ Dynamic: license-file
52
+ Dynamic: requires-dist
53
+ Dynamic: summary
54
+
55
+
56
+ # What is siat?
57
+ 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.
58
+
59
+ 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.
60
+ # Version naming
61
+ Version structure: X.Y.Z
62
+
63
+ X is the major version for architecture upgrade only.
64
+ Y is the functional version for functional enhancements.
65
+ Z is the minor version just for bug fixing.
66
+
67
+ # Quick examples of using siat
68
+
69
+
70
+ ```python
71
+ # Enable siat
72
+ from siat import *
73
+ ```
74
+
75
+
76
+ ```python
77
+ # Set language to English, default is Chinese
78
+ set_language("English")
79
+ ```
80
+
81
+ ## Example 1: Apple stock price for the recent month
82
+
83
+
84
+ ```python
85
+ # Simple way: show Apple's stock price in recent month
86
+ apple=security_trend("AAPL")
87
+ ```
88
+ 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:
89
+
90
+ ```python
91
+ apple=security_trend("AAPL", start="MRY",
92
+ mark_top=True, mark_bottom=True, mark_end=True,
93
+ average_value=True)
94
+ ```
95
+
96
+ ## Example 2: Comparing Price changes among Apple, Microsoft and NVidia
97
+ You may expect compare the price changes for the recent quarter (MRQ) for the three stocks.
98
+
99
+ 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.
100
+
101
+ ```python
102
+ comp=security_trend(['AAPL','MSFT','NVDA'],
103
+ start='MRQ',
104
+ indicator='Adj Close',
105
+ preprocess='scaling', #use scaling drawing method to avoid loss of details
106
+ mark_top=True, mark_bottom=True,
107
+ annotate=True, annotate_value=True)
108
+ ```
109
+
110
+ ## Example 4: Bollinger band for Apple in the recent quarter
111
+
112
+
113
+ ```python
114
+ # security_technical only supports 4 popular technical indicators: MACD, Bollinger, KDJ and RSI.
115
+ apple=security_technical("AAPL",
116
+ technical="Bollinger",
117
+ start="MRQ",
118
+ facecolor="white",
119
+ loc1="upper left", loc2="lower right")
120
+ ```
121
+
122
+ ## Example 5: CCI for Apple in recent quarter
123
+
124
+
125
+ ```python
126
+ # security_technical2 supports up to 14 popular technical indicators.
127
+ # security_technical2 uses a simplied drawing method (Dehong graph) to avoid trypophobia [ˌtrɪpəu'fəʊbjə]
128
+ apple=security_technical2("AAPL",
129
+ technical="CCI",
130
+ start="MRM",
131
+ loc1="upper left", loc2="lower right")
132
+ ```
133
+
134
+ # What security products does siat support?
135
+ 1. Public company profile: world-wide
136
+ 2. Stock & stock market index: world-wide
137
+ 3. Stock valuation: primarily in China (mainland and HK) and the U.S.
138
+ 4. Stock option chain: primarily in the U.S.
139
+ 5. Bond: primarily in China and the U.S.
140
+ 6. Markowitz portfolio: with all the supported stocks and bonds
141
+ 7. Fund: primarily in China and the U.S.
142
+ 8. Futures: primarily in China and the U.S.
143
+ 9. Options: primarily in China and the U.S.
144
+ 10. Digital currency: world-wide (some may be restricted by data sources)
145
+ 11. Balance sheet: in China (full function) and world-wide (basic function)
146
+ 12. Income statement: in China mainland (full function) and world-wide (basic function)
147
+ 13. Cash flow statement: in China mainland (full function) and world-wide (basic function)
148
+ 14. DuPont Identity: world-wide
149
+ 15. Sector trend and valuation: primarily in China
150
+ # What analytical methods does siat support?
151
+ 1. Trend analysis
152
+ 2. Panel comparation
153
+ 3. Return analysis: rolling returns, holding period returns
154
+ 4. Risk analysis: rolling volatility, holding period volatility, LPSD
155
+ 5. Technical analysis: more than 15 indicators
156
+ 6. Risk-adjusted return: Sharpe ratio, Sortino ratio, Treynor ratio, Jensen alpha
157
+ 7. Portfolio optimization: four risk-adjusted returns
158
+ 8. CAPM beta trend
159
+ 9. Beta adjustments: simple adjustment, Scholes-Williams, Dimson
160
+ 10. Beta leverage: Hamada Model
161
+ 11. Fama-French three-factor model
162
+ 12. Fama-French-Carhart four-factor model
163
+ 13. Fama-French five-factor model
164
+ 14. Future pricing
165
+ 15. Option pricing: European style, American style, with/without dividends
166
+ 16. VaR & ES: variance-covariance, historic simulation, Monte Carlo, multiple periods
167
+ 17. Liquidity risk: Roll spread, Amihud, Pastor-Stambaugh
168
+ 18. ESG: basic functions
169
+ # Do I have to download data first before using siat?
170
+ NO!
171
+ siat will search the internet data sources for all the required data during analysis.
172
+ The main data sources siat uses:
173
+ 1. Yahoo Finance
174
+ 2. Sina Finance
175
+ 3. East Money
176
+ 4. Stooq (Polish)
177
+ 5. FRED
178
+ 6. OECD
179
+ 7. IMF
180
+ 8. Shanghai Stock Exchange
181
+ 9. Shenzhen Stock Exchange
182
+ 10. Hong Kong Stock Exchange
183
+ 11. Beijing Stock Exchange
184
+ 12. Tokyo Stock Exchange
185
+ 13. London Stock Exchange
186
+ 14. New York Stock Exchange
187
+ 15. NASDAQ
188
+ 16. Sustainalytics
189
+
190
+ Thanks the above websites for their valuable data!
191
+ # How to install siat?
192
+ The author strongly recommends using siat together with Jupyter Notebook or Jupyter Lab in Anaconda.
193
+ In order to install siat for the very first time, open a Jupyter Notebook, and type in the following command:
194
+
195
+ !pip install siat
196
+
197
+ 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:
198
+
199
+ pip install siat
200
+ # How to upgrade siat?
201
+ In Jupyter Notebook or Jupyter Lab:
202
+
203
+ upgrade_siat()
204
+
205
+ If you suffer from slow internet connection (often in campus classrooms with many students), try to use alternative sources, such as:
206
+
207
+ upgrade_siat(alternative="tsinghua")
208
+
209
+ upgrade_siat(alternative="alibaba")
210
+
211
+ If the above methods do not work for your environment, you have to goto the traditional ways to use command-line script, such as:
212
+
213
+ pip install --upgrade siat
214
+
215
+ *** For users in China
216
+ The pypi mirror websites may provide siat installing and upgrading in a much faster speed in the following commands: taking aliyun as an example
217
+
218
+ pip install siat -i https://mirrors.aliyun.com/pypi/simple/
219
+
220
+ pip install --upgrade siat https://mirrors.aliyun.com/pypi/simple/
221
+
222
+ *** Warning
223
+ 1. The pip command itself may need upgrade as well.
224
+ 2. The pip command sometimes may have conflicts with some vpn programs.
225
+ If in this case, try quit vpn program first, and try again.
226
+ # Are there more detailed case studies on using siat?
227
+ YES!
228
+
229
+ There are hundreds of video case studies in the author's channel (most in Chinese, some in English).
230
+
231
+ https://space.bilibili.com/284812153
232
+
233
+ Welcome to follow the channel!
234
+ # How to report a bug or look for help?
235
+ Write to the author, Prof. WANG Dehong, wdehong2000@163.com