backtestStrategy: rebalance function keeps track of past & current open position
4 次查看(过去 30 天)
显示 更早的评论
Hi All,
backtestStrategy provides a great workflow for defining a strategy, which includes the rebalancing function.
As part of the EngineData object, WeightsHistory can be used to derive open positions, entry price and open pnl. Nonetheless ... the same computation takes place also within the backtestEngine's runBacktest function, which provides access to a Positions table for each strategy.
Hoping not having to re-invent the wheel, is there a way to pass the Positions table into the rebalancing function, for a given strategy? This would be a good fit for an additional field into the engineData structure. Thx
0 个评论
采纳的回答
更多回答(1 个)
Akshat Dalal
2024-4-10
Hi Andy,
I believe you could use the 'UserData' field in the rebalance function to pass the Position's Table as an input argument. When you're dealing with portfolio objects or any custom backtesting framework in MATLAB that supports the 'UserData' field, you can leverage this property to include additional information that the standard properties do not cover, such as a Position's Table or any other strategy-specific data you wish to carry through the rebalancing process.
To learn more about 'backtestStrategy' and the 'rebalance' function, you can refer the following documentation: https://www.mathworks.com/help/finance/backtest-investment-strategies.html
For an example of using 'UserData', see: https://www.mathworks.com/help/finance/backteststrategy.html#backteststrategy_example2
Hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Portfolio Optimization and Asset Allocation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!