Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IOrder object identity
 Post subject: IOrder object identity Post rating: 0   New post Posted: Tue 24 May, 2011, 20:35 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
When an IOrder object is requested, is a reference to the original object returned, or are the IOrder objects constructed on request?

For example, in the following code, suppose orderA and orderB refer to IOrder objects corresponding to (the same one or two different) market orders.
assert(orderA != null && orderB != null);
boolean e1 = orderA == orderB;
boolean e2 = orderA.getId().equals(orderB.getId()));

Is it true that e1==e2, regardless of where and when orderA and orderB were obtained (e.g. from engine.submitOrder, message.getOrder, engine.getOrderById, etc)?


 
 Post subject: Re: IOrder object identity Post rating: 0   New post Posted: Fri 27 May, 2011, 10:36 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Well, after some testing on the platform the answer seems to be yes.
i.e. IOrder object identity implies order identity.
So it seems to be safe to store IOrder object references and meaningfully compare their identity to other IOrder object references later, (and use them as keys in IdentityHashMaps, etc).
It would be nice to have a guarantee though.


 
 Post subject: Re: IOrder object identity Post rating: 0   New post Posted: Fri 27 May, 2011, 11:38 

User rating: 0
Joined: Wed 18 May, 2011, 23:26
Posts: 40
Location: Switzerland,
Isak wrote:
Well, after some testing on the platform the answer seems to be yes.
i.e. IOrder object identity implies order identity.
So it seems to be safe to store IOrder object references and meaningfully compare their identity to other IOrder object references later, (and use them as keys in IdentityHashMaps, etc).
It would be nice to have a guarantee though.


Also can confirm that it appears IOrder objects are unique for a position. For example, store IOrder object on creation of position (ie, engine.submitOrder()), compared the returned IOrder to all related returned IOrder objects (ie IOrders from onMessage, history interface, etc).


 
 Post subject: Re: IOrder object identity Post rating: 0   New post Posted: Fri 27 May, 2011, 14:27 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Isak wrote:
When an IOrder object is requested, is a reference to the original object returned, or are the IOrder objects constructed on request?

The reference is returned.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com