A small python package for stock market analysis
Project description
Stock Analysis Package
The Stock Analysis Package is a Python library designed to simplify the process of analyzing stock market data. This package provides a range of tools that allow users to perform detailed trend analysis, calculate moving averages, examine trading volumes, assess volatility, and evaluate investment performance through various financial metrics.
Features
- Moving Averages: Calculate and plot simple and exponential moving averages.
- Performance Metrics: Compute key metrics such as the Sharpe Ratio to assess the risk-adjusted returns of stocks.
- Trend Analysis: Visualize linear trends in stock price data to identify potential buying or selling opportunities.
- Volatility Analysis: Measure and visualize the volatility of stock prices, an important indicator of risk.
- Volume Analysis: Analyze and plot trading volumes to understand market activity levels.
- Comparison Analysis: Compare the performance of two stocks over a given period to help make informed investment decisions.
Installation
To use the Stock Analysis Package, you will need Python 3.6 or later. The package can be installed via pip from PyPI:
pip install stock_analysis_package
Alternatively, if you have cloned or downloaded this GitHub repository, navigate to the root directory of the package and run:
pip install .
This command installs the package along with all required dependencies.
Quick Start
Here is a quick example to get you started with the Stock Analysis Package:
import yfinance as yf
from stock_analysis import moving_averages, performance_metrics, comparison_analysis
# Download historical data for Apple Inc. and Google LLC.
data_aapl = yf.download('AAPL', start='2021-01-01', end='2021-12-31')
data_googl = yf.download('GOOGL', start='2021-01-01', end='2021-12-31')
# Calculate 50-day and 200-day moving averages for Apple
ma50_aapl = moving_averages.calculate_moving_average(data_aapl, window_size=50)
ma200_aapl = moving_averages.calculate_moving_average(data_aapl, window_size=200)
# Calculate the Sharpe Ratio for Apple
returns_aapl = data_aapl['Adj Close'].pct_change().dropna()
sharpe_ratio_aapl = performance_metrics.sharpe_ratio(returns_aapl)
print(f"Apple Sharpe Ratio: {sharpe_ratio_aapl}")
# Compare Apple and Google
comparison_analysis.compare_two_stocks('AAPL', 'GOOGL', '2021-01-01', '2021-12-31')
Documentation
For more detailed documentation on each module and its functions, please refer to the inline comments within the code or the official documentation.
Contributing
Contributions to the Stock Analysis Package are welcome! Please refer to CONTRIBUTING.md for guidelines on how to make contributions.
Support
If you encounter any issues or have questions about the package, please file an issue on the GitHub repository issue tracker.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 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 stock_analysis_package-0.2.0.tar.gz.
File metadata
- Download URL: stock_analysis_package-0.2.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc7f8061956f8c04cedb82e4b0bf1248b498c1aaa1f9671c720f5a1e25d7c065
|
|
| MD5 |
f92c2c7e3ee88f5de400122d529b0cbc
|
|
| BLAKE2b-256 |
31ac830f94711da93bad0645be353761c49ebb7a42861a3937f07b4b5d7af0e7
|
File details
Details for the file stock_analysis_package-0.2.0-py3-none-any.whl.
File metadata
- Download URL: stock_analysis_package-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2de3ff1ea3c47c123cee0a8fc4cc4f400ab03bb1fe3d85223076ca8eb8a1b9e
|
|
| MD5 |
8fd12fe5388c85c80d9970a8f8c39f6a
|
|
| BLAKE2b-256 |
fb1fecc3230e961bead66e7b7d5bb58130725c992ed4c00bfca505bada2f60c4
|