interday_tick_qry1.sql

Determines the volume-weighted price of a security considering only the ticks in a specific three-day interval.

Output

The results of this query are:

TRADING_SYMBOL   VOLUME_WEIGHTED_PRICE
AAA                   49.6641081572369

SQL Statements

-- 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;