Building Trading Strategies Algo Orders VWAP

VWAP

The Volume Weighted Average Price (VWAP) is a trading algorithm used to determine an average price of an instrument weighted by volume over a specified period. This benchmark is often used by institutional investors to gauge market sentiment and execute orders in a way that minimizes market impact.

The VWAP algorithm is similar to the Time Weighted Average Price (TWAP) algorithm in that it attempts to spread a large order's execution throughout a specified time horizon. However, while TWAP divides an order evenly over time, VWAP adjusts execution speed based on historical and current volume patterns.

TypeScript Representation

import { VwapOrder } from '@botmain/execution';

const vwapOrder = new VWAPOrder({
  instrument: 'ETHUSD',
  size: 100,
  side: 'buy',
  startTime: new Date(),
  endTime: new Date('2024-03-12T16:00:00') 
});

await this.tradingApi.sendOrder(vwapOrder);