I'm seeing an odd behavior that I do not understand. Within my algorithm, if it is to sell a stock, it sells it all using:
order_target(stock, 0)
I track in the log output all of the current positions and I see the amount of a sold stock decrease, but never go to 0. Watch symbol TAR decrease in amount to get stuck at 7834:
2003-05-15rebalance:218INFOExiting our positions on TAR, rank 0.813213528749
2003-05-16handle_data:142INFOCurrent positions: Symbol: EMT and Amount: 41666, Symbol: SFP and Amount: 44697, Symbol: USG and Amount: 47755, Symbol: PHS and Amount: 32657, Symbol: TAR and Amount: 40825,
2003-05-23handle_data:142INFOCurrent positions: Symbol: TPC and Amount: 5725, Symbol: SFP and Amount: 44697, Symbol: TAR and Amount: 40593, Symbol: PHS and Amount: 32657, Symbol: EMT and Amount: 41666,
2003-06-02handle_data:142INFOCurrent positions: Symbol: TPC and Amount: 40350, Symbol: SFP and Amount: 44697, Symbol: TAR and Amount: 31293, Symbol: PHS and Amount: 32657, Symbol: EMT and Amount: 41666,
2003-06-09handle_data:142INFOCurrent positions: Symbol: TPC and Amount: 69375, Symbol: SFP and Amount: 44697, Symbol: TAR and Amount: 22918, Symbol: PHS and Amount: 32657, Symbol: EMT and Amount: 41666,
2003-06-16handle_data:142INFOCurrent positions: Symbol: TPC and Amount: 152950, Symbol: SFP and Amount: 44697, Symbol: TAR and Amount: 7834, Symbol: PHS and Amount: 32657, Symbol: EMT and Amount: 16591,
2003-06-23handle_data:142INFOCurrent positions: Symbol: TPC and Amount: 144870, Symbol: SFP and Amount: 44697, Symbol: TAR and Amount: 7834, Symbol: PHS and Amount: 32657, Symbol: NEU and Amount: 11925,
Am I doing this incorrectly? I'm about to share this algorithm, but would like to make sure it's as bug-free as I can first.
Janene