For some if not all margin accounts, Interactive Brokers in particular and I think CommSec, proceeds of share sales are paid into the margin account and not to a separate account. I can see a potential problem with this from a tax point of view.
Margin interest is tax deductible ONLY if it is used to purchase income producing assets.
So lets say I buy $10K of shares in company A and $10K of shares in company B using a $20K margin loan (forget about LVRs etc., this question doesn't relate to them). The interest on my margin loan is tax deductible in full. Lets say that the price of company B's shares double and I want to cash them out and withdraw the $10K profit. I still want to own my A shares on margin. I sell all my shares in B, realising $20K. This reduces my margin loan to zero. I then withdraw $10K from the margin account, which is the profit made on B. I still hold shares in A.
As I understand the tax system, the $10K owing on my margin account is no longer tax deductible as I withdrew that $10K for personal needs not investment purposes. This problem arises as the sale proceeds were paid directly to my margin account, effectively paying off the loan in its entirety. If it had been paid to a separate account, one would simply have transferred $10K to the margin account to pay off the amount owing on B, but the amount owing on A is left untouched.
Is my understanding on this correct? I can't see how you can quarantine the proceeds of the sales of some shares from the amount owing on all shares collectively, so that one can maintain in full the tax-deductible of the interest on the amount "owed" on those other shares.