VWAP Algorithm

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

Compatible Products

TIBCO StreamBase®

Provider

TIBCO Software

Supported Versions

TIBCO StreamBase 7.0

License

TIBCO Component Exchange License

Overview

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(s)

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

VWAP Algorithm README


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.

Features:

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:

Modules:

 

NextTrade

Calculates the time and size of the next trade

PriceFeed

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

PriceProcess

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

TradesFeed

Keeps track of VWAP of the market and the transacted trades

Splice

Splices an order into smaller orders using a historical volume distribution

VWAP

Main program that puts all the above modules together

Input:

 

PriceFeed

Feed simulation that mimics a price and a trades feed

OrderInput

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

Output:

 

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:

    Symbol

    Can either be OIL, CORN or GOLD

    Shares

    Can be any positive whole number

    EndTime

    Must be at least 10 minutes from the current time

    TimeThreshold

    Maximum number of 30 second time periods between orders

    VolumeThreshold

    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

Note

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

View the Wiki Page