quantlab.dataset.nbbo.resample.snapshot_derived_variables#
- quantlab.dataset.nbbo.resample.snapshot_derived_variables()[source]#
Return the expressions deriving
mid,spread_bpsandimbalance.They read a bar’s snapshot columns
bid,ask,spread,bid_sizeandask_size; a null input gives a null output. Every NBBO bar panel derives these three the same way, whether it resamples records here or reads bars built elsewhere.- Returns:
- list of pl.Expr
mid,spread_bpsandimbalance, in that order.
Examples
>>> pl.DataFrame({ ... "bid": [100.0], "ask": [100.2], "spread": [0.2], ... "bid_size": [300.0], "ask_size": [100.0], ... }).select(snapshot_derived_variables()).row(0) (100.1, 19.980019980019982, 0.5)