I'd like to make my testing more realistic by accounting for taxes. In my algorithm, I've come up with a method for determining the amount of tax due when a sale occurs. My problem is that I can't figure out how to pay the taxes.
I've tried reducing the amount of cash in my portfolio with code like this in the handle_data method:
if context.taxes_due != None: context.portfolio.cash = context.portfolio.cash - context.taxes_due context.taxes_due = None
But on the next pass through handle_data, the cash is back in my portfolio. I suspect I'm missing something pretty simple here, can anyone tell me how to remove cash from my portfolio?
Thanks in advance,