Hi folks,
I'm looking forward to start live trading on QC. One thing that is missing from backtests and even paper trading, is how to handle existing positions on your brokerage. I was wondering if someone could provide some more details.
In particular, I'm trying to understand if QC updates self.Portfolio.CashBook from the broker once, upon the start of the algorithm, or if it periodically pulls updates from your brokerage account? Is this specific to Crypto brokers/markets or QC general behavior?
Thanks!
Derek Melchin
Hi Joao,
The Portfolio is populated with information from the brokerage when the algorithm is initially deployed. After deployment, we can create manual orders from the QC live trading GUI under the "Holdings" tab.
Best,
Derek Melchin
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.
Joao Antunes
Thank you for your answer but I'm still not clear on whether it periodically pulls updates *from* the brokerage account or if it's just done during initialization. Let's say I buy holdings directly with the broker (not from QC). Will those holdings be reflected later on on QCAlgorithm instance (during the same live execution)? If not, is there a way to "force" sync the QCAlgorithm portfolio from the broker (without restarting the algorithm)?
Jared Broad
It syncs cash every day at 0745ET, but holdings only once. If there are any orders after the algorithm starts the algorithm is shutdown. There is no way to retrigger sync of the holdings after it started.
Mind sharing why you need to do it so we can understand your application?
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.
Joao Antunes
Hi Jared! Thanks for chiming in.
I just want to better understand the details and limitations of the interaction between QCAlgorithm and the broker before I go live. For example, looks like once I start live trading I cannot place orders outside QC or the algorithm is shutdown. Is Portfolio.Cash and/or Portfolio.CashBook synced every day? I'm also worried about the holdings value drifting off due to imprecision fee calculation (eg, BTC). If the algo were to also synchronize its holding positions, this could be minimized.
Is there a FAQ or document where I can find this kind of information? I couldnt find this level of detail on the docs (have I missed any important docs?).
Jared Broad
Assets are filled and priced from the brokerage and live feeds so no imprecision there. Fees are modeled as the brokerage models. The only imprecisions are random brokerage withdrawals like data fees etc from the cash books which we sync daily.
We've run 100k live strategies at this point we're pretty solid in the backtest-live modeling. If you can share a specific imprecision with a support ticket we can address it =)
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.
Joao Antunes
That's an impressive number of live algos. :) I have not yet traded live, so no imprecisions or issues to report. Just trying to understand the potential differences between backtesting or paper trading and actual live trading.
Thanks Jared and Derek
Joao Antunes
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!