Good news for user who have wanted to automate the process of running simulations! Five new Strategy API endpoints have been added:
/strategy/{id}/rerun
Rerun a Simulated Strategy backtest.
/strategy/{id}/book-rerun
Rerun a book simulation.
/strategy/{id}/trading-system
Retrieve the current settings of a strategy/book trading system.
/strategy/{id}/trading-system
Update the trading system settings of a live strategy.
/strategy/{id}/book-trading-system
Update the trading system settings of a live book.
There are now a total of 12 endpoints related to Strategies and Books. See Swagger for the details: https://api.portfolio123.com/docs/index.html#/
These endpoints will be added to the documentation in the Knowledge base soon.
Hi Tony,
I was not involved during the dev and test phase for those new Strategy endpoints, so I don't know the dates. But they are in the wrapper if you have installed the latest update (pip install --upgrade p123api).
Hi Tony,
Unfortunately, slippage is not a configurable option in that endpoint. The endpoint was intentionally scoped to cover only the simulation settings where users typically need to test a large number of variations — slippage fell outside that subset.
For the API to be really useful it must cover all settings that are available in P123 interface. What about PIT method?
Seems like the Swagger may not cover all options and some are hidden
@Danp,, there may be a bug with this endpoint.
It works fine until I use a long running sim, maybe 30 min or longer, then it never returns a confirmation that the sim was complete, even though I can see that it completed on the website. It just keeps running until the timeout param is met, which I have set to: client.set_timeout(4200)
This is how I am calling the method:
rerun_result = client.strategy_rerun(strategy_id=STRATEGY_ID, params=params)
Where Params: {'startDt': '2000-01-01', 'endDt': '2026-05-01'}
I’m not sure how else to troubleshoot it on my end.