none2003
none2003
Hi @edtechre, I hope you're doing well! It's wonderful to see that version 1.2.11 has been released, and I truly appreciate the effort you’ve put into including the feature mentioned...
Hi @edtechre, > Thanks [@none2003](https://github.com/none2003). I looked at this again, but I think adding *args and **kwargs to the set_before_exec and set_after_exec signatures make them convoluted since a Mapping of...
> You can bind a lookback variable to your optimization function. > > ``` > def optimization(ctxs: dict[str, ExecContext], lookback: int): > ... > > fn = functools.partial(optimization, lookback=...) >...
> Hi [@none2003](https://github.com/none2003), > > Yes, I can do this. But how would it simulate real trading behavior? The problem I see is such a feature would add lookahead-bias by...
> I looked more into this. Any changes made to the context that's passed through to the stop function would still be applied on the following bar, not the bar...
Here are my thoughts. At line [1144](https://github.com/edtechre/pybroker/blob/master/src/pybroker/portfolio.py#L1144) of check_stops, "_trigger_stop" been called, and at line [1220](https://github.com/edtechre/pybroker/blob/master/src/pybroker/portfolio.py#L1220), the position entry with a stop loss was cleared because the stop loss was...
> Yes, the issue is that any changes applied to the context by the stop_loss_fn will only take effect the following bar. So if your stop_loss_fn sells shares, the shares...