Calculate buy/sell signal indicators for a stock!
Project description
Stocksignals
Calculate buy/sell signal indicators for a stock!
Authors:
- Ruslan Dimitrov
- Robin Dhillon
- Peng Zhang
- Chenyang Wang
This data science project is created for DSCI 524 (Collaborative Software Development); a course in the Master of Data Science program at the University of British Columbia.
Introduction
The goal of this project is to develop a package which can be used as a starting point for identifying stock buy/sell signals. Stock investing is a complex process which requires ongoing efforts and there is no one formula or indicator that works all the time. There exists extensive research on how to identify opportunities and profit from stocks. Methodologies for evaluating financial instruments range widely. An investor can utilize macroeconomic research, fundamental analysis, news, analyst reports, or technical analysis. In all those approaches numerical analysis is the underlying common theme.
In this project, the team aims to evaluate three key technical indicators that can be used to evaluate where the stock price is relative to its historic performance. These indicators use only the stock's historic price and are by no means an exhaustive approach to investing. These indicators are:
- 200-day price moving average
- 10 vs 20-day price moving average
- 20-day Bollinger bands
Typically when the market and stocks in particular are trading below 200-day moving average, they are considered in a down trend. When they trade above the 200-day moving average stocks are considered in an uptrend. The 10-20 day indicator, indicates short term price trend reversals, and can be utilized to trade stocks on a short term basis. Finally, the Bollinger bands indicate whether a stock price is above or below two standard deviations from its 20 day average price. Bbands can be used as indicator for short term overbought/oversold stocks.
Package details
The package consists of 6 functions:
get_data: The function downloads all available historic price data for a selected stock and saves it as acsvfile. It utilizes theyfinancepython package to automate the process.moving_average: The function (insidecalc_moving_average.pymodule) calculates a moving average, i.e. the average stock closing price over a specified period, which is passed as argumentsizein the function call. It uses the data saved viaget_data.plot_ma_200days: The function plots the 200-day moving average together with the stock price for a specified period, say the past 200 trading days. It uses the output from the functioncalc_moving_avgto plot the chart.plot_ma_10_20: The function plots the 10 and 20-day moving average together with the stock price for a specified period, say the past 200 trading days. It uses the output from functionmove_ave_10_20to plot the chart.get_bbands: The function (insidebbands.pymodule) calculates the 20 day Bollinger bands for the existing period of the data and returns a Pandas DataFrame with the respective upper and lower band. It uses data saved viaget_data.plot_bbands: The function plots upper and lower Bollinger bands together with the stock closing price for over the past 200 days. It uses the output from functionbbandsto plot the chart.
Python ecosystem
There are multiple packages related to utilizing finance data. For example, past projects in DSCI524 have explored various transformations to help analyzing stocks like this one: https://github.com/UBC-MDS/stockAnalyzer. Other packages like this one https://github.com/UBC-MDS/Stock-Price-Trend-Volatility-Analysis have explored volatility analysis.
Our aim is to explore specific technical analysis indicators and streamline the process by providing a hands-on package which can be used in daily stock analysis. Furthermore, this package will help streamline the process in order to help automation of the basics of stock screening.
Installation
$ pip install stocksignals
Usage
import stocksignals
import matplotlib.pyplot as plt
import yfinance as yf
stock_ticker = "MSFT" # the stock we're interested in.
size = 100 # size of window for moving average
# Generage signals and plots
get_data.get_data(stock_ticker)
calc_moving_average.moving_average(stock_ticker, size)
plot_ma_10_20.plot_ma_10_20(stock_ticker)
plot_ma_200days.plot_ma_200days(stock_ticker)
bbands.get_bbands(stock_ticker)
plot_bbands.plot_bbands(stock_ticker)
Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
stocksignals was created by Ruslan Dimitrov, Robin Dhilon, Peng Zhang, Chenyang Wang. It is licensed under the terms of the MIT license.
Credits
stocksignals was created with cookiecutter and the py-pkgs-cookiecutter template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stocksignals-0.0.5.tar.gz.
File metadata
- Download URL: stocksignals-0.0.5.tar.gz
- Upload date:
- Size: 380.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0be8aa4a9b4d23f779c7a3a933f51c36fa026657173b18a4a2f4c100d3feb37
|
|
| MD5 |
f3f15b15429f44c5bcf6a9de6b6e1a56
|
|
| BLAKE2b-256 |
dae91c747bbd4a9cf47e030d6edf4a0628e7714c29d7d2ce356771f8fc924db4
|
File details
Details for the file stocksignals-0.0.5-py3-none-any.whl.
File metadata
- Download URL: stocksignals-0.0.5-py3-none-any.whl
- Upload date:
- Size: 385.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c44c5f23fa4a07694e10cc0c9b0bb1ec05e244f0388f3ff895f47fba3d2077df
|
|
| MD5 |
21d6aad21664c1ca9adbcc7753a1ce1b
|
|
| BLAKE2b-256 |
02d98dc66927d9c7ebda01eb560c09d1823056afae9f4e7af6b9ffda5c6b4744
|