Skip to main content

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

Metadata

Release files for yfinance-fetch 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yfinance-fetch 0.0.3
File Size Uploaded Provenance Actions
yfinance_fetch-0.0.3.tar.gz 12.6 kB Without provenance Details for yfinance_fetch-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yfinance-fetch 0.0.3
File Interpreter ABI Platform Actions
yfinance_fetch-0.0.3-py3-none-any.whl Python 3 none any Details for yfinance_fetch-0.0.3-py3-none-any.whl

Total release size: 25.4 kB

Release files / yfinance_fetch-0.0.3.tar.gz

Download URL yfinance_fetch-0.0.3.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9b2100cefc9f7265af4f7c072cc6524ec149c3f09d7e05644ef00d955e4aa75f
BLAKE2b-256 checksum
How to use checksums
edc283f947131a1572f1019a4f2d3dc6ab2c6a5c1520039878e163388ba27768
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / yfinance_fetch-0.0.3-py3-none-any.whl

Download URL yfinance_fetch-0.0.3-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbe60520de12cdde7ad9505dc27dc7f9361d96cf90e4047031ca4a3794a90be2
BLAKE2b-256 checksum
How to use checksums
9d271bc4b6e39ad1766614ae323d43b8eac1abab2ce15461cb59f101d180e6e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for yfinance-fetch 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page