Hi, guys.
I am wondering if there's a way to optimized for long term capital gain because I'm trading on personal account, not a hedge fund entity.
Ex. if I predict a down turn and I have 1000 shares, and only 500 is eligible for long term capital gain, I would only sell the the loss ones + 500 shares.
I'm wondering what's the best way to do this and if it is possible to query the holdings and get the number of share that's hold for more than 12 months.
Thanks!
Alexandre Catarino
Hi Lawrence Tjok ,
You can save all orders that were filled in OnOrderEvent method in a list or you can use self.Transactions.GetOrders() to fetch all orders. Then you will have to create some logic to analyze the data and determine how many shares have been held for more than 12 months. Unfortunately, there is no built-in feature to help you.
Lawrence Tjok
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!