API Support Forum
OEC API > API Support > Order Reject Reason is poor and OnErrorEvent is good, but not clear what Account belong to.
Author Topic: Order Reject Reason is poor and OnErrorEvent is good, but not clear what Account belong to.
(5 messages, Page 1 of 1)
Moderators: VPfau
AAnatoly
Posts: 22
Joined: Jul 01, 2010


Posted: Jul 22, 2010 @ 07:07 AM             Msg. 1 of 5
1) When Order is rejected then we retrieve reason form Order's State Comments.

"Order breaks limit" - very genral message.

2) Then OnErrorEvent is trigered with detailed message.

[Risk violation: 1048:API001048 Max credit = 0.0000000000 USD,Order requires [2812.50000 USD] and needs additional credit of 1497.51587 USD (cash leveraged) Cash and credit balance 1314.98413 USD. (Max 38104.96826 USD | Used 36789.98413 USD) (Leveraged).]

3) The problem is how we can retrieve what is account that this error belong to. In this case it is API001048, but the messge is not some kind object or XML that can be parsed with known fields.

We need to find a way to retrieve Account from OnError message programatically.

OnError(System.Exception ex)
{
// ex.Message; - what is account this message belong to.
}

We send orders on behalf of different accounts and what to know what error belong to what account.

Please advice.

Thanks,
Anatoly




Anatoly Gutnick

Edited by AAnatoly on Jul 22, 2010 at 07:12:04
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Aug 02, 2010 @ 10:51 AM             Msg. 2 of 5
Good morning,

currently, we have no any programming interface for risk violation messages. I've submitted it to our development queue.

Victor Vins
Software Developer
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Aug 02, 2010 @ 02:57 PM             Msg. 3 of 5
Until a new functionality will be implemented, we are not going to change format of these messages. So, you can extract account information from this text.

Victor Vins
Software Developer
AAnatoly
Posts: 22
Joined: Jul 01, 2010


Posted: Aug 04, 2010 @ 03:19 AM             Msg. 4 of 5
ok.

So the message is:
"Risk violation: 1048:API001048 Max credit ..."

Our account names are actually API001048, API001049 etc
We can extract account information.
We assume that account info always after

"Risk violation: "
and till next space charachter " ".

Why it appear as 1048:API001048 and not just API001048?
Will it be the same behaviour on production environment?

Anatoly Gutnick
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Aug 04, 2010 @ 08:19 AM             Msg. 5 of 5
1048 is account id. So, format is "Risk violation: <account id>:<account spec><space><some text>".

Victor Vins
Software Developer