VWAP Algorithm

Simulates a market order VWAP execution algorithm using futures data in TIBCO StreamBase

Compatible Products

TIBCO StreamBase®


TIBCO Software

Supported Versions

TIBCO StreamBase 7.0


TIBCO Component Exchange License


This TIBCO StreamBase VWAP algorithms application divides an order into slices based on historical volume distributions, and trades these slices throughout the trading day. It incoporates intelligent volume splicing, simple anti-gaming techniques and a minimum volume threshold so as not to move the market.

License Details


Release v1

Published: May 2016

Initial release

There are currently no reviews for this content.

Why not be the first to review it - click here to login


Volume-Weighted Average Price (VWAP) is the ratio of the value traded (price*volume) to the total volume traded over a particular time horizon.

The VWAP execution algorithm attempts to transact with the market and achieve an average execution benchmarked to the VWAP throughout the day or for a defined time period. In order to do this, the algorithm examines a historical volume distribution and then uses this to splice up new orders over the desired trading horizon. A graph of this distribution can be viewed by opening the file VolumeDistributionPlot.pdf. The algorithm then trades the spliced orders over the time desired period while attempting to achieve the VWAP benchmark.


This particular demonstration has a number of interesting features:

  1. Anti-gaming - Randomized trading sub-intervals to deter gaming by counterparties 
  2. Volume Threshold - A minimum volume must be present in the market for the algorithm to place a trade
  3. Cancel - The ability to immediately cancel the rest of the order 

Application components:




Calculates the time and size of the next trade


Only used for simulation purposes in order to simulate price/trades feed


Keeps track of the latest price of a security on the market


Keeps track of VWAP of the market and the transacted trades


Splices an order into smaller orders using a historical volume distribution


Main program that puts all the above modules together




Feed simulation that mimics a price and a trades feed


New orders coming into the system (usually placed by a trader)



Intermediate Orders

The spliced orders over the life of the VWAP algorithm

Final Statistics

Summary statistics comparing the VWAP obtained versus the market VWAP


Steps to testing the algorithm:

  1. Run the VWAP.sbapp module

  2. Run the PriceFeed feed simulation 

  3. Input orders via the OrderInput stream according to the following:


    Can either be OIL, CORN or GOLD


    Can be any positive whole number


    Must be at least 10 minutes from the current time


    Maximum number of 30 second time periods between orders


    An upper bound on the order size based on the volume transacted in the market since the last VWAP trade (Order size must be x percent of the total volume over the last trading interval where 0.0 <= x <= 1.0)

  4. One should expect the following output:

    1. A tuple at the beginning signifying a new parent order has been placed

    2. Intermediate tuples whenever a child order is placed 

    3. A final tuple (comparing VWAP benchmarks) when the parent order has been completed or cancelled


  • The metadata section's for each StreamBase application has been extensively commented. 

View the Wiki Page