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.
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.
- 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
pip install -r requirements.txtfrom 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 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")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
| 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 |
- VWAP Trading Strategy for Indian Markets — detailed guide on applying VWAP setups to Nifty and Bank Nifty
- Moving Average Crossover Strategy — combine MA signals with VWAP confirmation for higher-probability entries
- Best Trading App India 2026 — platforms that offer real-time VWAP overlays on charts
Contributions are welcome. Please open an issue first to discuss changes. Run tests with pytest before submitting a PR.
MIT License — see LICENSE for details.