Skip to main content

A comprehensive price action analysis library for Indian stock market

Project description

Price Action Library

A comprehensive Python library for pure price action analysis, specifically optimized for the Indian stock market. Generate 95+ columns of price action analysis with a single function call!

Python 3.7+ License: MIT

🚀 Key Features

  • 30+ Candlestick Patterns - From basic doji to complex triple formations
  • 15+ Chart Patterns - Head & shoulders, triangles, wedges, flags, and more
  • Advanced Market Structure - BOS, ChoCh, Fair Value Gaps, Order Blocks
  • Support & Resistance - Multiple detection methods with confluence analysis
  • Volume Analysis - Volume Spread Analysis (VSA) and volume patterns
  • Price Action Setups - Pin bars, inside bars, fakey patterns, springs
  • Gap Analysis - All gap types with classification and tracking
  • Session Analysis - Indian market hours optimization (9:15 AM - 3:30 PM IST)
  • Multi-Timeframe - Analyze across different time horizons
  • Machine Learning Ready - Structured output perfect for ML models

🎯 Perfect For

  • Systematic Trading - Algorithm development and backtesting
  • Market Research - Comprehensive price action studies
  • Machine Learning - Feature engineering for ML models
  • Professional Trading - Real-time pattern recognition
  • Education - Learning price action concepts

⚡ Quick Start

Installation

# Install dependencies
pip install pandas numpy scipy

# Install the library
pip install .

Basic Usage

from price_action_lib import PriceActionAnalyzer
import pandas as pd

# Initialize analyzer
analyzer = PriceActionAnalyzer()

# Load your OHLCV data (1-minute timeframe recommended)
# df should have columns: open, high, low, close, volume with DateTime index

# Get comprehensive analysis - 95+ columns!
result = analyzer.fetch_all(df)

print(f"Generated {result.shape[1]} columns of analysis!")
print(f"Analyzed {result.shape[0]} time periods")

# Individual analysis methods also available
patterns = analyzer.detect_candlestick_patterns(df)
structure = analyzer.analyze_market_structure(df)
levels = analyzer.find_support_resistance(df)

Sample Output

The fetch_all() method returns a DataFrame with 95+ columns including:

  • Original OHLCV (optional)
  • 44+ Candlestick patterns (pattern_doji, pattern_hammer, etc.)
  • 14+ Chart patterns (chart_head_and_shoulders, chart_triangle, etc.)
  • Market structure (structure_trend, structure_bos, etc.)
  • Fair Value Gaps (fvg_bullish, fvg_bearish)
  • Order Blocks (order_block_bullish, order_block_bearish)
  • Price Action Setups (setup_pin_bar, setup_inside_bar, etc.)
  • Support/Resistance (near_support, near_resistance)
  • Volume Analysis (volume_spike, volume_climax, etc.)
  • Gap Analysis (gap_breakaway, gap_exhaustion, etc.)
  • Metadata (ATR, volatility, trend classification, price zones)

📊 Example Analysis

# Find high-probability trading setups
strong_signals = result[
    (result['near_support'] == True) &      # At key support level
    (result['setup_pin_bar'] == True) &     # Pin bar setup
    (result['volume_spike'] == True) &      # Volume confirmation
    (result['pattern_hammer'] != '')        # Hammer pattern
]

print(f"Found {len(strong_signals)} high-probability setups!")

# Analyze market structure
current_trend = result['structure_trend'].iloc[-1]
trend_strength = result['structure_trend_strength'].iloc[-1]
print(f"Current trend: {current_trend} (strength: {trend_strength:.2f})")

🇮🇳 Indian Market Optimization

  • Market Hours: 9:15 AM - 3:30 PM IST
  • Session Analysis: Pre-open, opening, regular, closing sessions
  • Holiday Handling: Automatic weekend and holiday filtering
  • NSE/BSE Compatible: Optimized for Indian stock exchanges

📈 Performance

  • Fast Processing: 400+ bars/second on typical hardware
  • Memory Efficient: Only 308KB package size
  • Vectorized Operations: Optimized pandas/numpy operations
  • Scalable: Handles datasets from 100 to 10,000+ bars

📚 Comprehensive Documentation

For detailed documentation, see DOCUMENTATION.md which includes:

  • Complete API Reference - All methods with parameters and examples
  • Pattern Recognition Guide - Details on all 30+ candlestick patterns
  • Market Structure Analysis - BOS, ChoCh, FVGs, Order Blocks explained
  • Advanced Features - Multi-timeframe, volume analysis, gap analysis
  • Best Practices - Data preparation, performance optimization
  • Troubleshooting - Common issues and solutions
  • Real-world Examples - Complete trading workflows

🔧 Requirements

  • Python: 3.7 or higher
  • pandas: >= 1.3.0
  • numpy: >= 1.21.0
  • scipy: >= 1.7.0

📋 Data Format

Your DataFrame should have:

                     open    high     low   close  volume
2024-01-15 09:15:00  1000.0  1002.5   999.0  1001.5  25000
2024-01-15 09:16:00  1001.5  1003.0  1000.5  1002.0  18000
# ... with DateTime index and proper OHLC relationships

🚦 Quick Test

Verify your installation:

from price_action_lib import PriceActionAnalyzer
analyzer = PriceActionAnalyzer()
print("✅ Price Action Library installed successfully!")

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🎉 Ready to Get Started?

  1. Install the library following the instructions above
  2. Read the comprehensive DOCUMENTATION.md
  3. Load your OHLCV data into a pandas DataFrame
  4. Run analyzer.fetch_all(df) and get 95+ columns of analysis!

Happy Trading! 📈💰

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

price_action_lib-1.0.1.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

price_action_lib-1.0.1-py3-none-any.whl (57.6 kB view details)

Uploaded Python 3

File details

Details for the file price_action_lib-1.0.1.tar.gz.

File metadata

  • Download URL: price_action_lib-1.0.1.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for price_action_lib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 83e009a633a763984f0e1b51cdc3f61c91c56f240fa037afac06341037e3955d
MD5 ff76fd99a16b14ce39b7a322ec8da531
BLAKE2b-256 011ae4c4b8effe6140039b3db9460003c7be20939ddd5f042e0ad34e3c2b98fc

See more details on using hashes here.

File details

Details for the file price_action_lib-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for price_action_lib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 971bf003cd384663c7c9b2e58bb2bf5f6ff68ae762fa0841c15e6cdf39b689d4
MD5 1df4b9ac8227c0b7de1180b62a5a14dd
BLAKE2b-256 a3c752bd5acc85812162a5698e11f0b7e728f51fffce44a002d1ce2afd6f05c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page