How to remove a delisted position in zipline

While running a backtest Zipline refuses to exit a delisted position when I run the exit command per the below:

algo.order_target_percent(sid, 0)

the sid in question is Equity(FIBBG000C0F570 [XLNX]) which was acquired and subsequently delisted. This happened while the backtest included XLNX as part of the portfolio and now it will not exit the position and remains as a stale position.

Is there a command to manually remove this from the portfolio.positions class ?

Thanks for any help.

I’m not aware of any public API to remove a position like that. It may be possible by digging into the source code, but the easiest options would be to ignore it or to modify the backtest to try to exit the position before the stock is delisted.