Hi,

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:

  1. Stop algorithm
  2. Manually sell off part of each position to fund withdrawal
  3. Withdraw funds
  4. 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:
  1. Somehow inform algorithm that an x% withdrawal is requested (daily download of file with instructions?)
  2. On next rebalance, tell PortfolioConstructor to generate quantity targets based on accout balance - x% (can this be done?)
  3. Send quantity targets to Execution model, which will free up x% of the account for withdrawing
  4. 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?