Skip to main content

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?

  1. Public company profile: world-wide
  2. Stock & stock market index: world-wide
  3. Stock valuation: primarily in China (mainland and HK) and the U.S.
  4. Stock option chain: primarily in the U.S.
  5. Bond: primarily in China and the U.S.
  6. Markowitz portfolio: with all the supported stocks and bonds
  7. Fund: primarily in China and the U.S.
  8. Futures: primarily in China and the U.S.
  9. Options: primarily in China and the U.S.
  10. Digital currency: world-wide (some may be restricted by data sources)
  11. Balance sheet: in China (full function) and world-wide (basic function)
  12. Income statement: in China mainland (full function) and world-wide (basic function)
  13. Cash flow statement: in China mainland (full function) and world-wide (basic function)
  14. DuPont Identity: world-wide
  15. Sector trend and valuation: primarily in China

What analytical methods does siat support?

  1. Trend analysis
  2. Panel comparation
  3. Return analysis: rolling returns, holding period returns
  4. Risk analysis: rolling volatility, holding period volatility, LPSD
  5. Technical analysis: more than 15 indicators
  6. Risk-adjusted return: Sharpe ratio, Sortino ratio, Treynor ratio, Jensen alpha
  7. Portfolio optimization: four risk-adjusted returns
  8. CAPM beta trend
  9. Beta adjustments: simple adjustment, Scholes-Williams, Dimson
  10. Beta leverage: Hamada Model
  11. Fama-French three-factor model
  12. Fama-French-Carhart four-factor model
  13. Fama-French five-factor model
  14. Future pricing
  15. Option pricing: European style, American style, with/without dividends
  16. VaR & ES: variance-covariance, historic simulation, Monte Carlo, multiple periods
  17. Liquidity risk: Roll spread, Amihud, Pastor-Stambaugh
  18. 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:

  1. Yahoo Finance
  2. Sina Finance
  3. East Money
  4. Stooq (Polish)
  5. FRED
  6. OECD
  7. IMF
  8. Shanghai Stock Exchange
  9. Shenzhen Stock Exchange
  10. Hong Kong Stock Exchange
  11. Beijing Stock Exchange
  12. Tokyo Stock Exchange
  13. London Stock Exchange
  14. New York Stock Exchange
  15. NASDAQ
  16. 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

  1. The pip command itself may need upgrade as well.
  2. 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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

siat-3.7.6-py3-none-any.whl (2.2 MB view details)

Uploaded Python 3

File details

Details for the file siat-3.7.6-py3-none-any.whl.

File metadata

  • Download URL: siat-3.7.6-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.12.4

File hashes

Hashes for siat-3.7.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb18c986692f6e9bb0649950021fe217e8b6475503e13b65a7ca028c7621778
MD5 9b303ad99e2ec5d6739e4293a7b2615e
BLAKE2b-256 5feb9344b18d8fdd17425aff33bdbf7abafcbf47b019177e16903ff78a03c090

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page