This is exactly what Interactive Brokers offers today, wherein they issue you a debit card backed by the cash value in your account, and once that's exhausted, by the margin available. Instead of selling securities to pay for your purchases, you can borrow against them (to within your personal risk tolerance) at a tax-deductible rate of 3.05% for the first 100K and 2.55% for the next 900K.