orderflow: add comment with insight about imbalances

This commit is contained in:
Joe Schr
2024-05-28 20:22:26 +02:00
parent 24707ab7b9
commit 07034ed7a6

View File

@@ -208,6 +208,7 @@ def trades_orderflow_to_imbalances(df: pd.DataFrame, imbalance_ratio: int, imbal
:return: dataframe with bid and ask imbalance
"""
bid = df.bid
# compares bid and ask diagonally
ask = df.ask.shift(-1)
bid_imbalance = (bid / ask) > (imbalance_ratio)
# overwrite bid_imbalance with False if volume is not big enough