December 2018
Beginner to intermediate
684 pages
21h 9m
English
Time bars smooth some of the noise contained in the raw tick data but may fail to account for the fragmentation of orders. Execution-focused algorithmic trading may aim to match the volume weighted average price (VWAP) over a given period, and will divide a single order into multiple trades and place orders according to historical patterns. Time bars would treat the same order differently, even though no new information has arrived in the market.
Volume bars offer an alternative by aggregating trade data according to volume. We can accomplish this as follows:
trades_per_min = trades.shares.sum()/(60*7.5) # min per trading daytrades['cumul_vol'] = trades.shares.cumsum()df = trades.reset_index()by_vol = df.groupby(df.cumul_vol.div(trades_per_min).round().astype( ...