ITCHCPP 1.6.1
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
Loading...
Searching...
No Matches
itch::analytics::Twap Class Reference

Running time-weighted average price. More...

#include <vwap.hpp>

Public Member Functions

auto add (StandardPrice price, std::uint64_t timestamp) -> void
 Records that the price became price at timestamp (ns).
 
auto value () const -> double
 The current TWAP, or NaN when no span has elapsed.
 
auto reset () noexcept -> void
 Clears the accumulation (start a new interval).
 

Detailed Description

Running time-weighted average price.

Integrates the prevailing price over time: each sample contributes its price weighted by the elapsed time since the previous sample. The value is the time-weighted mean over the observed span.

Definition at line 65 of file vwap.hpp.

Member Function Documentation

◆ add()

auto itch::analytics::Twap::add ( StandardPrice  price,
std::uint64_t  timestamp 
) -> void
inline

Records that the price became price at timestamp (ns).

Parameters
priceThe prevailing price starting at timestamp.
timestampTime of the price change, in nanoseconds.

Definition at line 71 of file vwap.hpp.

References price, and timestamp.

◆ value()

auto itch::analytics::Twap::value ( ) const -> double
inline

The current TWAP, or NaN when no span has elapsed.

Returns
The time-weighted average price, or NaN if no sample has been added.

Definition at line 85 of file vwap.hpp.

◆ reset()

auto itch::analytics::Twap::reset ( ) -> void
inlinenoexcept

Clears the accumulation (start a new interval).

Definition at line 93 of file vwap.hpp.


The documentation for this class was generated from the following file: