When a strategy wishes to add an exit, it must override the onOrderFilled()
method, use the text property of the order to infer which order was filled
(make sure it was an entry not an exit) and then guess at an appropriate
exit. All of these are known at the time when the order is placed, and so
this should all be entered when the initial order is made.
Perhaps:
JOrder entry = buyOrder();
JOrder exit = sellStopOrder(exitPrice);
entry.addExit(exit)
sendOrder(entry);
Then OrderManager would be responsible for issuing the exit order whenever
the entry is filled. It should issue an exit for partial fills as well,
and do some sort of order consolidation. This is complex and should all be
placed in a single location instead of scattered everywhere.
Original issue reported on code.google.com by tyrotra...@gmail.com on 28 Apr 2007 at 12:14
Original issue reported on code.google.com by
tyrotra...@gmail.com
on 28 Apr 2007 at 12:14