LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
I am running an algorithm that rebalances once or twice a week. It is relatively heavy in its usage of margin, so I can't withdraw without first selling off assets. I've been thinking about how to withdraw funds from the account without disrupting the flow and without too much manual work.
The most manual approach would be to:
Stop algorithm
Manually sell off part of each position to fund withdrawal
Withdraw funds
Re-start algorithm
This introduces extra orders and also the potential that the algorithm is confused by the new order quantities.I'd like to think there was a better way to do this. Ideally, I'd like to withdraw at a rebalance point, so no extra orders have to be submitted. I'm thinking something as follows:
Somehow inform algorithm that an x% withdrawal is requested (daily download of file with instructions?)
On next rebalance, tell PortfolioConstructor to generate quantity targets based on accout balance - x% (can this be done?)
Send quantity targets to Execution model, which will free up x% of the account for withdrawing
Withdraw x% of funds
As asked above, is it possible to generate quantity targets based on a fictional account balance? If not, do you have any advice on how to efficiently withdraw funds?
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.
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.
Michael Manus
10.2k Pro
,
that is actually a good idea,
yes use dropbox to tell the algo to sell some stuff.
(there are a lot of examples with dropbox acess in sample database on github as you already have seen it. that would work)
0
Edited by Michael Manus
Douglas Stridsberg
5.1k Pro
,
Hey,
My main question is about whether you can simulate a lower account balance when submitting a portfolio target. But I suspect you should be able to simply multiply the desired weight by 1-x and use that in the next rebalance instead.
I'll see if I can build something modular and perhaps share it with the community. I suspect I'm not the first to think about how to automate withdrawals.
0
Michael Manus
10.2k Pro
,
did you try to play around with:
Portfolio.TotalPortfolioValue ?
If you start your algo you could get substract from this Value x and calculate quantity for the rest?
0
Jared Broad
Pro
,
Assuming you have deep knowledge of how the algorithm works - you could manually sell some positions through the web IDE, and withdraw cash via your brokerage, and then the next morning at 0745 we will re-synchronize the portfolio cash available. Hopefully, it'll all work! The official recommendation would be the manual approach you mentioned above.
0
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.
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.
Loading...
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!