A stock-picking system based on Warren Buffett's principles and the Piotroski score.
Project description
Stock Picking System
The Stock Picking System is inspired by the investment philosophy outlined in the book "The New Tao of Warren Buffett". This book delves into the mindset of Warren Buffett, one of the most successful investors of all time. It emphasizes key metrics such as Earnings Per Share (EPS), the current stock price, and future growth potential to evaluate companies.
To illustrate, consider a stock priced at $100 with an EPS of $2. This means for every dollar invested, you make 2 cents in earnings, which is not as attractive as the returns from fixed bonds or savings accounts. However, the real appeal of such stocks lies in their growth potential. This is especially true for tech stocks, where investors are willing to overlook lower immediate returns for the possibility of exponential future growth.
This project implements a stock-picking strategy that aims to identify companies with both:
- High Stock Returns: Calculated as
EPS / Stock Price, this ratio highlights companies with strong returns relative to their stock price. - High Piotroski Score: A metric that evaluates a company’s financial health. A higher Piotroski Score indicates that the stock is financially sound and has better chances of growth.
By combining these two factors, this system helps pinpoint stocks that not only offer strong returns but also have a solid foundation for future success.
Installation
You can easily install the package using pip:
pip install stock-picking
Usage
Example 1: Analyze a List of Stocks by Ticker Symbols
You can input a list of stock tickers to analyze and filter based on the Piotroski Score threshold:
from stock_picking import get_top_stocks
# Example 1
tickers = ["AAPL", "MO", "CINF", "WYNN"]
get_top_stocks(tickers= tickers, exchange='NYSE', piotroski_score_threshold=5, generate_csv=True)
Example 2: Analyze Stocks from a CSV File
If you have a CSV file containing a list of stock tickers, you can pass the file path to the function:
# Example 2
data_path = "./data/sp_500.csv"
get_top_stocks(tickers = data_path, exchange='NYSE', piotroski_score_threshold=5, generate_csv=True)
Example 3: Analyze Stocks from a DataFrame
If you have the stock data in a DataFrame (e.g., loaded from a CSV), you can directly pass the DataFrame to the function:
# Example 3
df = pd.read_csv("./data/nifty_50.csv")
get_top_stocks(tickers = df, exchange='NSE', piotroski_score_threshold=5, generate_csv=True)
Contributing
Contributions to improve the stock-picking logic or enhance the functionality of this system are welcome! Feel free to fork the repository, submit issues, or open pull requests with suggestions or improvements.
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_picking-0.1.1.tar.gz.
File metadata
- Download URL: stock_picking-0.1.1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
213b06f5ee84e4e7d355546c6fdf5fb15040b8caa77810dc884fb3c2499b453e
|
|
| MD5 |
06b9ecb12e28419f2a9a4e3690d79526
|
|
| BLAKE2b-256 |
c3784d8e143c8503cde723b17ec98708aadf208ff78c541efcac670ded7d3238
|
File details
Details for the file stock_picking-0.1.1-py3-none-any.whl.
File metadata
- Download URL: stock_picking-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62c65446c58ac58cf7b884023ff12f7a25837728c79f2df4eeceae9dfba07a59
|
|
| MD5 |
b41b97e400bf17afcb796d558ffcc33c
|
|
| BLAKE2b-256 |
744c733fea9e0503dccaddf37530100fb81e4bcad22bf97a939140d059362991
|