Hi all
Right now I am trying to create a custom fee model that can help me calculate the fee based on a certain percentage of the total net profits at year end. However, the current custom fee model can only be done for a specific security/when a certain order is made.
Tried: self.Portfolio.FeeModel = CustomFeeModel(self) but couldn't work. I also realised that self.Portfolio has no SetUpFeeModel. Hence was unable to set up the fee model for the portfolio.
Can someone please advise how I can go about doing this? Thank you! Appreciate your help here!
Shile Wen
Hi Jenny,
One way to solve this is by defining a SecurityInitializer function and setting the fee model in that function (docs). First, we define a custom SecurityInitializer function:
def CustomSecurityInitializer(self, security):
security.SetFeeModel(CustomFeeModel())
Then, we set our algorithm’s SecurityInitlializer with this line:
self.SetSecurityInitializer(self.CustomSecurityInitializer)
Please see the attached backtest for an implementation.
Best,
Shile Wen
Jenny
Hi Shile Wen
Thank you for your reply. However, what i meant was i wanted to implement the fee model that calculate the fee only at the end of each year rather than each time when an order was placed for the specific security. For instance, the 2/20 fee which will only be computed at the end of each year based on the portfolio value. Was wondering if this is possible?
Thank you.
Arthur Asenheimer
Hi Jenny,
I think you've talked at cross purposes. The Custom Fee Model is inappropiate for your intentions as it refers to the fees of order executions. As far as I know there is no such thing as a "Management Fee Model" for Financial Advisors.
Of course you can add your own management fee model to your algorithm. But we are not able to modify the objects TotalPortfolioValue or TotalFees directly as they are read-only. But we can use a workaround and create our own variable which stores the fee-adjusted equity.
I've build a simple algorithm for you which should give you a good starting point. You can see a plot (black line) of the fee adjusted equity in the attached backtest after you've cloned the algo and run your own backtest.
https://i.imgur.com/1nwjajk.pngShile Wen
Hi Jenny,
I include the answer to this in the newer thread, so I will close this thread.
Best,
Shile Wen
Jenny
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!