Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Volume Imbalance?

Hello All-
Is there a way to get the current volume imbalance between buy and sell orders for a stock?
Thanks!

3 responses

This isn't really possible because there is no distinction between buy and sell volume. There are ways you can estimate the value but it is usually done with tick data. In my opinion it's not possible without also looking at derivatives markets as well, it's impossible to know if a sell is an actual sell or a hedge in a more complex trade.

For lower frequencies bulk classification of trading volume algos might be relevant. It basically tries to lump the volume from within a bar into buy/sell buckets based on the price change over the bar. Below is a simple implementation of the algorithm.

import scipy

def bulk_classify(p, v):  
    """  
    p: prices  
    v: volumes  
    """  
    dprice = p.diff().dropna()  
    v = v.iloc[1:]  
    v_buy = v * scipy.stats.norm.cdf(dprice / dprice.std())  
    v_sell = v - v_buy  
    bvpin = (v_sell - v_buy).abs() / v  
    return v_buy, v_sell, bvpin  

David-
Thanks for the reply. That's too bad. But thanks for the paper and code, that looks like a reasonable way to estimate it!

Aren't hedge and sell orders influence the price in the same way? Like during the Flash Crash :)