quantlab.portfolio.approximate.PanelPrices#
- class quantlab.portfolio.approximate.PanelPrices(previous, previous_entry, close, entry)[source]#
Bases:
objectThe book filled before a panel and the prices its holdings drift with: what
decidereads besides the panel.A rule whose decision reads the holdings (a turnover penalty) solves its bars in time order: the holdings at a bar are the book of the last bar it decided (or
previous), its weights at their fill prices, marked at the bar’scloseover the book’s value, cash included (quantlab.execution.approximate.mark_book). A bar it decides fills at itsentryprices; a bar it holds leaves the book as it was.- Attributes:
- previousnp.ndarray
[symbols]: the book’s weights decided before the first bar, cash excluded; zeros for none.- previous_entrynp.ndarray
[symbols]: the pricespreviousfilled at.- closenp.ndarray
[bars, symbols]: each bar’s valuation price, forward-filled.- entrynp.ndarray
[bars, symbols]: the price each bar’s weights fill at.
Examples
>>> prices = PanelPrices( ... previous=np.array([0.5, 0.5]), previous_entry=np.array([10.0, 20.0]), ... close=np.array([[11.0, 20.0]]), entry=np.array([[11.0, 19.0]]), ... ) >>> prices.close.shape (1, 2)