Investment Interest Expense

I have investment interest expense that is less than my net investment income for the year and TT enters it and allows full deductibility.  The interest was from a margin loan I took out to bridge between purchase and sale of primary residence.  It was not to purchase securities.  Am I right to take the deduction given this purpose?