backtestStrategy: rebalance function keeps track of past & current open position
2 ビュー (過去 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!