quantlab.execution.approximate.simulate#

quantlab.execution.approximate.simulate(targets, decisions, entry, close, cost)[source]#

Simulate the targets decided at decisions in one pass over the bars; (value, traded, fill_value, filled).

targets[k] ([K, S]; an all-NaN row holds) is decided at row decisions[k] (in time order, each before the last row) and fills at the next row’s entry price; close is the forward-filled valuation price. A fill costs cost times its traded weight against the previous book marked at the fill’s prices. Returns the value per bar (1.0 before the first fill); for each fill, in order, the signed weight traded in each symbol ([F, S], the target less the previous book marked at the fill’s prices) and the value it was traded against (the book before the fill’s costs); and which decisions filled.