API Support Forum
OEC API > API Support > No errors reported on risk violation
Author Topic: No errors reported on risk violation
(6 messages, Page 1 of 1)
Moderators: VPfau
XGong81
Posts: 6
Joined: Apr 24, 2013


Posted: Jul 15, 2020 @ 03:28 AM             Msg. 1 of 6
Hi, when I am placing an order which exceed buying power I am not getting any risk violation errors or notifications. I am using the new GFAPI and here is some code snippet:

gfClient.Logging.ErrorOccurred += this.ErrorOccured;
gfClient.Messaging.Notifications.NotificationMessageReceived += NotificationMessageReceived;

private void ErrorOccured(object sender, GF.Api.Utils.ErrorEventArgs e)
{
//Not getting called
string sErrorMessage = e.Exception.Message;
}
private void NotificationMessageReceived(IGFClient client, GF.Api.Messaging.Notifications.NotificationMessageEventArgs e)
{
//Not getting called
string sMessage = e.NotificationMessage.Message;
}

The API version is as follows:
GF.Api.dll 4.0.3.21
GF.Api.Impl.dll 4.0.3.33
GF.Api.Values.dll 4.0.3.10
GF.Common.dll 4.0.3.3

Thanks in advance,

xg
Xingyu Gong
ETrifonov
Posts: 63
Joined:


Posted: Jul 17, 2020 @ 02:38 PM             Msg. 2 of 6
Hello Xingyu,

If you placing an order which exceed buying power, it will be rejected and will should receive order update.
Not sure why you expecting reject message via GF.Api.Messaging.Notifications.
Please GF API Notification documentation https://gainfutures.com/GFAPI/
https://gainfutures.com/GFAPI/?topic=html/d75ea6d3-3433-401e-a3ac-42681240e1e9.htm

Thank you.
Evgeny
XGong81
Posts: 6
Joined: Apr 24, 2013


Posted: Jul 17, 2020 @ 04:40 PM             Msg. 3 of 6
In the OEC api, I will get an error message from the OECClient.OnError handler. I thought GFApi will be similar.
Xingyu Gong
ETrifonov
Posts: 63
Joined:


Posted: Jul 20, 2020 @ 08:03 AM             Msg. 4 of 6
That handler is moved to GFClient.Logging.ErrorOccurred.
Evgeny
XGong81
Posts: 6
Joined: Apr 24, 2013


Posted: Jul 20, 2020 @ 04:06 PM             Msg. 5 of 6
Hi Evgeny,

Initially I was trying to catch the error from GFClient.Logging.ErrorOccured but it does not gets raised (Test and Production server) and then I tried Messaging.

Xingyu
Xingyu Gong
ETrifonov
Posts: 63
Joined:


Posted: Jul 27, 2020 @ 01:54 PM             Msg. 6 of 6
Hi Xingyu,

Please use ITradersApi.TraderError event to receive risk violation errors.
https://gainfutures.com/GFAPI/?topic=html/E_GF_Api_Traders_ITradersApi_TraderError.htm
Client.Traders.OnTraderError += this.ErrorOccured

Thank you.
Evgeny