A module for analyzing stock technical, financial, and candlestick pattern data with yfinance and Google Sheets integration.
Project description
Stock Analysis
A Python module for analyzing stock data, including technical indicators, financial fundamentals, and candlestick patterns, using yfinance and saving results to Google Sheets.
Installation
pip install yfinance-fetch
Usage
Create a usage script (e.g., example_usage.py) and define configuration parameters:
from yfinance_fetch import run_all, process_technical_data, process_financial_data, process_candlestick_patterns
# ====== CONFIGURATION SECTION ======
creds_path = 'credentials.json' # Path to Google Sheets API credentials JSON file
spreadsheet_name = 'Yahoo Finance' # Target Google Spreadsheet name
worksheet_name = ['Technical Data', 'Financial Data', 'Candlestick Patterns'] # Worksheet tabs to update
use_csv = False # Set True to use CSV input instead of manual tickers(False True)
csv_url = 'https://archives.nseindia.com/content/indices/ind_nifty500list.csv' # Source URL for stock list CSV
# List of manual tickers (used when use_csv=False)
manual_tickers = ["HDFCBANK.NS", "ICICIBANK.NS", "RELIANCE.NS", "INFY.NS", "BHARTIARTL.NS", "LT.NS", "ITC.NS", "SBIN.NS", "AXISBANK.NS", "KOTAKBANK.NS"]
api_failed_retries = 3 # Number of retry attempts for failed API calls
batch_size = 15 # Number of stocks to process per batch
sleep_time = 1 # Sleep time (in seconds) between API requests to avoid rate limits
days_to_check_patterns = 7 # Days window to scan for candlestick patterns
# ====== RUN PIPELINE ======
# Run all modules (technical, financial, and candlestick pattern analysis)
run_all(creds_path, spreadsheet_name, worksheet_name, use_csv, csv_url, manual_tickers, batch_size, sleep_time, days_to_check_patterns)
# # Process and update Technical Data sheet only
# process_technical_data(creds_path, spreadsheet_name, worksheet_name, use_csv, csv_url, manual_tickers, batch_size, sleep_time, days_to_check_patterns)
# # Process and update Financial Data sheet only
# process_financial_data(creds_path, spreadsheet_name, worksheet_name, use_csv, csv_url, manual_tickers, batch_size, sleep_time)
# # Process and update Candlestick Patterns sheet only
# process_candlestick_patterns(creds_path, spreadsheet_name, worksheet_name, use_csv, csv_url, manual_tickers, batch_size, sleep_time, days_to_check_patterns)
Prerequisites
- Google API credentials JSON file for Google Sheets access.
- Python 3.8 or higher.
Dependencies
See requirements.txt for a full list of dependencies.
License
MIT License
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 yfinance_fetch-0.0.3.tar.gz.
File metadata
- Download URL: yfinance_fetch-0.0.3.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b2100cefc9f7265af4f7c072cc6524ec149c3f09d7e05644ef00d955e4aa75f
|
|
| MD5 |
bb916a737af0102280c7ee24c347f20c
|
|
| BLAKE2b-256 |
edc283f947131a1572f1019a4f2d3dc6ab2c6a5c1520039878e163388ba27768
|
File details
Details for the file yfinance_fetch-0.0.3-py3-none-any.whl.
File metadata
- Download URL: yfinance_fetch-0.0.3-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbe60520de12cdde7ad9505dc27dc7f9361d96cf90e4047031ca4a3794a90be2
|
|
| MD5 |
143213db7e0f2d8344dbc7a8916b3d72
|
|
| BLAKE2b-256 |
9d271bc4b6e39ad1766614ae323d43b8eac1abab2ce15461cb59f101d180e6e0
|