Hello All-
Is there a way to get the current volume imbalance between buy and sell orders for a stock?
Thanks!
Hello All-
Is there a way to get the current volume imbalance between buy and sell orders for a stock?
Thanks!
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