Securities Investment Analysis Tools (siat)
Project description
What is siat?
siat is a Python plug-in for security investment analysis, specially designed for teaching and learning purposes in universities for undergraduate and postgraduate programs.
Most of the results by siat are in the form of figures and/or tables.
Version history
Version structure: X.Y.Z
X is the major version for architecture upgrade only. Y is the functional version for functional enhancement. Z is the minor version just for bug fixing.
Quick examples of using siat
# Enable siat
from siat import *
# Set language to English, default is Chinese
set_language("English")
Example 1: Apple stock price for the recent month
# Simple way: show Apple's stock price in recent month
apple=security_trend("AAPL")
You may expect to more information, such as price trend in a recent year (MRY), with the high/low point, current price and average price, like below:
apple=security_trend("AAPL", start="MRY",
mark_top=True, mark_bottom=True, mark_end=True,
average_value=True)
Example 2: Comparing Price changes among Apple, Microsoft and NVidia
You may expect compare the price changes for the recent quarter (MRQ) for the three stocks.
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.
comp=security_trend(['AAPL','MSFT','NVDA'],
start='MRQ',
indicator='Adj Close',
preprocess='scaling',
mark_top=True, mark_bottom=True,
annotate=True, annotate_value=True)
Example 4: Bollinger band for Apple in the recent quarter
# Script security_technical only supports 4 popular technical indicators: MACD, Bollinger band, KDJ and RSI.
apple=security_technical("AAPL",
technical="Bollinger",
start="MRQ",
facecolor="white",
loc1="upper left", loc2="lower right")
Example 5: CCI for Apple in recent quarter
# Script security_technical2 supports about 20 popular technical methods.
apple=security_technical2("AAPL",
technical="CCI",
start="MRM",
loc1="upper left", loc2="lower right")
What security product does siat support?
- Public company profile: world-wide
- Stock & stock market index: world-wide
- Stock valuation: primarily in China (mainland and HK) and the U.S.
- Stock option chain: primarily in the U.S.
- Bond: primarily in China and the U.S.
- Markowitz portfolio: with all the supported stocks and bonds
- Fund: primarily in China and the U.S.
- Futures: primarily in China and the U.S.
- Options: primarily in China and the U.S.
- Digital currency: world-wide (some may be restricted by data sources)
- Balance sheet: in China (full function) and world-wide (basic function)
- Income statement: in China mainland (full function) and world-wide (basic function)
- Cash flow statement: in China mainland (full function) and world-wide (basic function)
- DuPont Identity: world-wide
- Sector trend and valuation: primarily in China
What analytical methodology does siat support?
- Trend analysis
- Panel comparation
- Return analysis: rolling returns, holding period returns
- Risk analysis: rolling volatility, holding period volatility, LPSD
- Technical analysis: more than 15 indicators
- Risk-adjusted return: sharpe, sortino, treynor, Jensen alpha
- Portfolio optimization: four risk-adjusted returns
- CAPM beta trend
- Beta adjustments: simple adjustment, Scholes-Williams, Dimson
- Beta leverage: Hamada Model
- Fama-French three-factor model
- Fama-French-Carhart four-factor model
- Fama-French five-factor model
- Future pricing
- Option pricing: European style, American style, with/without dividends
- VaR & ES: variance-covariance, historic simulation, Monte Carlo, multiple periods
- Liquidity risk: Roll spread, Amihud, Pastor-Stambaugh
- ESG: basic functions
Do I have to download data first before using siat?
NO! siat will search the internet data sources for all the required data during analysis. The main data sources siat uses:
- Yahoo Finance
- Sina Finance
- East Money
- Stooq (Polish)
- FRED
- OECD
- IMF
- Shanghai Stock Exchange
- Shenzhen Stock Exchange
- Tokyo Stock Exchange
- HKEX
- Sustainalytics
Thanks the above websites for their valuable data supply!
How to install siat?
The author strongly recommends using siat together with Jupyter Notebook or Jupyter Lab in Anaconda. In order to install siat for the very first time, open a Jupyter Notebook, and type in the following command:
!pip install siat
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:
pip install siat
How to upgrade siat?
In Jupyter Notebook or Jupyter Lab:
upgrade_siat()
If you suffer from slow internet connection (often in campus classrooms with many students), try to use alternative sources, such as:
upgrade_siat(alternative="tsinghua")
upgrade_siat(alternative="alibaba")
If the above methods do not work for your environment, you have to goto the traditional ways to use command-line script, such as:
pip install --upgrade siat
*** For users in China The pypi mirror websites may provide siat installing and upgrading in a much faster speed in the following commands: taking aliyun as an example
pip install siat -i https://mirrors.aliyun.com/pypi/simple/
pip install --upgrade siat https://mirrors.aliyun.com/pypi/simple/
*** Warning
- The pip command itself may need upgrade as well.
- The pip command sometimes may have conflicts with some vpn programs. If in this case, try quit vpn program, and try again.
Are there more detailed case studies on using siat?
YES!
There are hundreds of video case studies in the author's channel (most in Chinese, some in English).
https://space.bilibili.com/284812153
Welcome to follow the channel!
How to report a bug or look for help?
Write to the author, Prof. WANG Dehong, wdehong2000@163.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.