Securities Investment Analysis Tools (siat)
Project description
What is siat?
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.
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.
Version naming
Version structure: X.Y.Z
X is the major version for architecture upgrade only. Y is the functional version for functional enhancements. 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 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', #use scaling drawing method to avoid loss of details
mark_top=True, mark_bottom=True,
annotate=True, annotate_value=True)
Example 4: Bollinger band for Apple in the recent quarter
# security_technical only supports 4 popular technical indicators: MACD, Bollinger, 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
# security_technical2 supports up to 14 popular technical indicators.
# security_technical2 uses a simplied drawing method (Dehong graph) to avoid trypophobia [藢tr瑟p蓹u'f蓹蕣bj蓹]
apple=security_technical2("AAPL",
technical="CCI",
start="MRM",
loc1="upper left", loc2="lower right")
What security products 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 methods 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 ratio, Sortino ratio, Treynor ratio, 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
- Hong Kong Stock Exchange
- Beijing Stock Exchange
- Tokyo Stock Exchange
- London Stock Exchange
- New York Stock Exchange
- NASDAQ
- Sustainalytics
Thanks the above websites for their valuable data!
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 first, 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.
Source Distributions
Built Distribution
File details
Details for the file siat-3.7.3-py3-none-any.whl
.
File metadata
- Download URL: siat-3.7.3-py3-none-any.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f42b32e3ed37464640b757609731894d08674bc4bc2a0b290b36f7665a2432a |
|
MD5 | 2fff7b8effd6f83ac050b778f63b5293 |
|
BLAKE2b-256 | dfe43bc8b7968893cf35e9e8c6480193ce9ecadec9502a3bce33e3d07167ce73 |