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

permaticker and the current column.

currentstr

The column of securities holding the current value; also the name of the value column of history and of the result.

historypl.DataFrame

permaticker, date and the old value under current, as changes returns (renamed).

Returns:
pl.DataFrame

permaticker, start (inclusive, null when open), end (exclusive, null when open) and current: 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"}))