Skip to content

marcos99b/vwap-indicator-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

VWAP Indicator for Indian Stocks (Python)

A lightweight Python library for calculating Volume Weighted Average Price (VWAP) on NSE and BSE listed stocks. Designed specifically for Indian market sessions and time zones.

What is VWAP?

VWAP is a trading benchmark that represents the average price a security has traded at throughout the day, weighted by volume. It is widely used by institutional traders in India to assess execution quality and by retail traders to identify intraday trends.

The formula is straightforward:

VWAP = Cumulative(Price × Volume) / Cumulative(Volume)

Where Typical Price = (High + Low + Close) / 3 for each candle.

Features

  • Indian market session handling — auto-detects NSE/BSE trading hours (9:15 AM to 3:30 PM IST)
  • Multi-timeframe VWAP — calculate on 1-min, 5-min, 15-min, or any custom interval
  • Anchored VWAP — anchor to specific events like earnings dates or breakout candles
  • Standard deviation bands — configurable 1σ, 2σ, and 3σ bands around VWAP
  • Pandas integration — accepts and returns DataFrames for easy pipeline integration
  • CSV and API input — load data from local CSV files or compatible market data APIs

Installation

pip install -r requirements.txt

Quick Start

from vwap import VWAPCalculator

calc = VWAPCalculator(market="NSE", timezone="Asia/Kolkata")

# From a CSV file with OHLCV columns
result = calc.from_csv("reliance_5min.csv")
print(result[["timestamp", "vwap", "upper_band_1", "lower_band_1"]])

# From a pandas DataFrame
import pandas as pd
df = pd.read_csv("tatamotors_1min.csv")
vwap_df = calc.calculate(df)

Anchored VWAP Example

Anchored VWAP lets you set a custom start point instead of the session open. This is useful for measuring price action from a specific event:

# Anchor VWAP from a specific timestamp
anchored = calc.anchored_vwap(df, anchor="2026-03-15 10:30:00")

How Traders Use VWAP in India

Indian intraday traders rely on VWAP as a dynamic support/resistance level. When price is above VWAP, the session has bullish bias; when below, bearish. Institutional algo desks on NSE use VWAP benchmarks to minimize market impact on large orders.

Common strategies include:

  • VWAP pullback — enter long when price pulls back to VWAP in an uptrend
  • VWAP breakout — trade the direction of a strong move through VWAP with volume confirmation
  • Mean reversion — fade moves to the outer standard deviation bands

Configuration

Parameter Default Description
market "NSE" Market identifier (NSE or BSE)
timezone "Asia/Kolkata" Timezone for session boundaries
bands [1, 2] Standard deviation multipliers for bands
session_start "09:15" Market open time
session_end "15:30" Market close time

Further Reading and Resources

Contributing

Contributions are welcome. Please open an issue first to discuss changes. Run tests with pytest before submitting a PR.

License

MIT License — see LICENSE for details.

About

Python VWAP calculator for NSE/BSE stocks with standard deviation bands and anchored VWAP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages