Hi,
I'm placing orders with the order function during the handle_data function call and understand that the order is not filled until after the current handle_data function call is finished. That's fine.
However, during the next call of handle_data, when I examine the .filled attribute of the previous order that was placed I notice that there is a difference between the .amount and .filled attributes. I understand that this conforms to your slippage model. Also fine.
What I'd like to know now is what happens on subsequent calls to handle_data. Will the system automatically continue to fill the previous order until .filled == .amount? Of do I manually have to place further orders that contain a quantity for the difference between .filled and .amount?
Also, I'm trying to code a trailing stop into my algo. I've noticed that when I place an order (style=MarketOrder) and then another separate order (style=StopOrder) within the same handle_data call, the subsequent call to handle_data both orders have been merged into one.
How should I go about changing the StopOrder price should the price evolve? Will an subsequent order (style=StopOrder) with a different price get merged with the original order or will there be multiple separate orders? Does anyone have any example code for what I'm trying to do?
Any clarification will be appreciated.
Thanks.