API Support Forum
OEC API > API Support > Order rejection not captured
Author Topic: Order rejection not captured
(4 messages, Page 1 of 1)
Moderators: VPfau
WTeng
Posts: 8
Joined: Nov 28, 2014


Posted: Aug 10, 2015 @ 06:02 AM             Msg. 1 of 4
Hi all,

I'm using C# to write my own program.

However, when I try sending some invalid orders through the SendOrder method, I did not receive any OrderState.Rejected notification through the OnOrderStateChanged event.

Which is the right event to use for capturing order rejections?

Thanks.

Wu liang Teng
VPfau
Moderator
Posts: 164
Joined:


Posted: Aug 11, 2015 @ 01:59 PM             Msg. 2 of 4
Hello,

please check out our Basic example here: https://github.com/oecapi/BasicExample

On VS console I have this output:

OnOrderStateChanged: -2: Unknown -> Sent
Order sent with temp ID: -2
OnOrderConfirmed: -2 -> 203255678
OnOrderStateChanged: 203255678: Sent -> Sent
OnOrderStateChanged: 203255678: Sent -> Sent
OnOrderStateChanged: 203255678: Sent -> Accepted
OnOrderStateChanged: 203255678: Accepted -> Rejected


The order has changed status on OECClient.OnOrderStateChanged event.

Does it work for you?

Vitaliy Pfau
WTeng
Posts: 8
Joined: Nov 28, 2014


Posted: Aug 11, 2015 @ 09:47 PM             Msg. 3 of 4
Yes, I eventually figured out that in C#, the latest state is stored in the Order.States.Current.OrderState argument rather than the OrderState argument.

The arguments I'm referring to come from the event
OnOrderStateChangedEvent(OEC.API.Order order, OEC.Data.OrderState state)

Thanks anyway.
VPfau
Moderator
Posts: 164
Joined:


Posted: Aug 12, 2015 @ 08:48 AM             Msg. 4 of 4
Yes, our documentation has a delegate declaration where the parameter with OrderState type has name "oldOrderState".

public delegate void OnOrderStateChangedEvent(
Order order,
OrderState oldOrderState
)


http://futures.gaincapital.com/api/api/html/T_OEC_API_OnOrderStateChangedEvent.htm[\url]

Vitaliy Pfau