pystockwatch.pystockwatch

Module Contents

Functions

percent_change(stock_ticker, start_date, end_date)

Calculates daily percentage change of a stock price within a given period of time

profit_viz(stock_ticker, start_date, end_date, benchmark_ticker)

Visualizes trend of a stock price change against the market benchmark within a given period of time

volume_change(stock_ticker, start_date, end_date)

Calculates the daily trading volume change status of a stock within a given period of time

volume_viz(stock_ticker, start_date, end_date)

Visualize the daily trading volume of a stock using bar plot within a given period of time

pystockwatch.pystockwatch.percent_change(stock_ticker, start_date, end_date)[source]

Calculates daily percentage change of a stock price within a given period of time

Parameters
  • stock_ticker (string) – Ticker of the stock such as ‘AAPL’, or ‘AAPL MSFT SPY’ for multiple tickers

  • start_date (string) – Initial date for data extraction

  • end_date (string) – Final date for stock analysis

Returns

A data frame with dates and their corresponding stock price percentage changes.

Return type

DataFrame

Examples

>>> percent_change('AAPL', '2017-01-01', '2017-01-10')
                Price Change Percentage(%)
          Date
    2017-01-03                      0.0000
    2017-01-04                     -0.1119
    2017-01-05                      0.3960
    2017-01-06                      1.5153
    2017-01-09                      2.4451
>>> percent_change('AAPL MSFT', '2017-01-01', '2017-01-10')
                Price Change Percentage(%)
                          AAPL        MSFT
          Date
    2017-01-03          0.0000      0.0000
    2017-01-04         -0.1119     -0.4474
    2017-01-05          0.3960     -0.4474
    2017-01-06          1.5153      0.4155
    2017-01-09          2.4451      0.0959
pystockwatch.pystockwatch.profit_viz(stock_ticker, start_date, end_date, benchmark_ticker)[source]

Visualizes trend of a stock price change against the market benchmark within a given period of time

Parameters
  • stock_ticker (string) – Ticker of the stock such as ‘AAPL’

  • start_date (string) – Initial date for data extraction

  • end_date (string) – Final date for stock analysis

  • benchmark_ticker (string) – Ticker for benchmark comparison such as ‘SP500’

Return type

Line plots which shows percentage change in stock price and market performance over time

Examples

>>> profit_viz('AAPL', '2015-01-01', '2021-31-12', 'SP500')
pystockwatch.pystockwatch.volume_change(stock_ticker, start_date, end_date)[source]

Calculates the daily trading volume change status of a stock within a given period of time

Parameters
  • stock_ticker (string) – Ticker of the stock such as ‘AAPL’

  • start_date (string) – Initial date for data extraction

  • end_date (string) – Final date for stock analysis

Return type

A data frame with dates and their corresponding trading volume and changes

Examples

>>> volume_change('AAPL', '2021-01-01', '2022-01-01')
Date             Volume       Volume_Change
01-01-2021        1000        Nan
01-02-2021        2000        Increase
01-03-2021        3000        Increase
01-04-2021        2500        Decrease
...
12-31-2021        4000        Increase
01-01-2022        5000        Increase
pystockwatch.pystockwatch.volume_viz(stock_ticker, start_date, end_date)[source]

Visualize the daily trading volume of a stock using bar plot within a given period of time :param stock_ticker: Ticker of the stock such as ‘AAPL’ :type stock_ticker: string :param start_date: Initial date for data extraction :type start_date: string :param end_date: Final date for stock analysis :type end_date: string

Return type

Interactive plot with overlay of line plots and bar plot

Examples

>>> volume_viz('AAPL', '2021-01-01', '2022-01-01')