Determines the volume-weighted price of a security considering only the ticks in a specific three-day interval.
The results of this query are:
TRADING_SYMBOL VOLUME_WEIGHTED_PRICE AAA 49.6641081572369
The output displayed in this section is derived by running the query with the large set of sample data provided in the Sybase RAP Samples component.
These are the SQL statements for this query.
-- Determine the volume weighted price of a security considering -- only the ticks in a specified three day interval. commit; SELECT TRADING_SYMBOL, SUM(TRADE_SIZE*TRADE_PRICE)/SUM(TRADE_SIZE) as VOLUME_WEIGHTED_PRICE FROM STOCK_TRADE WHERE TRADE_DATE BETWEEN '2005-11-10' AND '2005-11-14' AND TRADING_SYMBOL ='AAA' GROUP BY TRADING_SYMBOL;