contango.stream.indicators.calculations.vwap
contango.stream.indicators.calculations.vwap
VWAP
VWAP(k: float)
Bases: Indicator[VWAPSnapshot | None]
VWAP with standard deviation bands.
Returns None on the first bar of each session (no deviation yet).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
float
|
Band-width multiplier in standard deviations. |
required |
Source code in src\contango\stream\indicators\calculations\vwap.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
value
property
value: VWAPSnapshot | None
Returns the latest value for the VWAP.
update
update(event: MarketDataEvent) -> VWAPSnapshot | None
Takes in a new bar and returns the current VWAP snapshot. Returns None on the first bar of the session (standard deviation undefined).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
MarketDataEvent
|
The underlying event to update the VWAP with. |
required |
Returns:
| Type | Description |
|---|---|
VWAPSnapshot | None
|
VWAPSnapshot | None: If the VWAP is settled, returns a snapshot containing the VWAP alongside the upper and lower VWAP bounds. |
Source code in src\contango\stream\indicators\calculations\vwap.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
VWAPSnapshot
Bases: NamedTuple
A single snapshot of VWAP with bands.
Attributes:
| Name | Type | Description |
|---|---|---|
vwap |
float
|
The current volume-weighted average price. |
upper |
float
|
VWAP + k standard deviations. |
lower |
float
|
VWAP - k standard deviations. |