quantlab.dataset.sharadar.history.walk_back#
- quantlab.dataset.sharadar.history.walk_back(securities, current, history)[source]#
Return each security’s spells of one attribute, walked back from its current value.
- Parameters:
- securitiespl.DataFrame
permatickerand thecurrentcolumn.- currentstr
The column of
securitiesholding the current value; also the name of the value column ofhistoryand of the result.- historypl.DataFrame
permaticker,dateand the old value undercurrent, aschangesreturns (renamed).
- Returns:
- pl.DataFrame
permaticker,start(inclusive, null when open),end(exclusive, null when open) andcurrent: before each change its old value, back to the previous change; from the last change on (or always, without one) the current value.
Examples
walk_back(securities, "sic", changes(...).rename({"old": "sic"}))