Orders belong to the Account owning the equity and margin used to generate those orders.
Any IContext created and connected to an Account should have access to all Order information connected with that Account.
This is both logical and correct.
Strategies are logical groupings of execution flow often operating on the same Account.
If there is a need to distinguish Account activity on a strategy by strategy basis then commenting and/or labelling the activities we wish to later identify is the answer.
The 'problem' described in the post above is a non-issue if we make use of the ability to add Comments and/or Labels to order submissions.
Consider the following options which make it possible for strategies to see all orders but at the same time isolate the ones that originate with them through string prefix-, -suffix or
contains checking:
Interface IEngineIOrder submitOrder(
String label, Instrument instrument, IEngine.OrderCommand orderCommand, double amount)
IOrder submitOrder(
String label, Instrument instrument, IEngine.OrderCommand orderCommand, double amount, double price)
IOrder submitOrder(
String label, Instrument instrument, IEngine.OrderCommand orderCommand, double amount, double price, double slippage)
IOrder submitOrder(
String label, Instrument instrument, IEngine.OrderCommand orderCommand, double amount, double price, double slippage, double stopLossPrice, double takeProfitPrice)
IOrder submitOrder(
String label, Instrument instrument, IEngine.OrderCommand orderCommand, double amount, double price, double slippage, double stopLossPrice, double takeProfitPrice, long goodTillTime)
IOrder submitOrder(
String label, Instrument instrument, IEngine.OrderCommand orderCommand, double amount, double price, double slippage, double stopLossPrice, double takeProfitPrice, long goodTillTime,
String comment)
- label - user defined identifier for the order. Label must be unique for the given user account among the current orders. Allowed characters: letters, numbers and "_". Label must have at most 256 characters.
- comment - comment that will be saved in order
Interface IOrderString getComment()
Returns comment that was set when order was submitted
String getLabel()
Returns label