API Support Forum
OEC API > API Support > GF COM API Orders Intermittently Remain in Sent State
Author Topic: GF COM API Orders Intermittently Remain in Sent State
(5 messages, Page 1 of 1)
Moderators: VPfau
RWare2020
Posts: 205
Joined: Feb 11, 2020


Posted: Dec 14, 2020 @ 02:44 PM             Msg. 1 of 5
I am having some issues with orders not coming back to the application in a working status and they seem to be stuck in a "Sent" status.

Orders do not come back until the entry order is filled in which case it turns into a position, but the attached OCO that is sent with it, remains in a sent status.

I have recorded some timestamps in MST where the orders are never come back in a working status remain in a sent status. This is using the NASDAQ Micro December 2020 contract in my API account with the server api.gainfutures.com

1.-------------------------
Order at 1:18 pm status was at sent
1:20 order was filled (never received a confirmed status for order)
attached stop/limit are still in sent status
Sent close all at 1:20 pm, immediately came back and cancelled sent oco orders and filled position
2.--------------------------
Again at 1:23:39 sent in an entry stop with attached stop/limit and they are currently in a sent status
Randomly filled at ~1:25:40 (order never came in, it just filled) and attached OCO are still in a sent state
1:27:40 closed all (immediately executed)
-----------------------------

Again, this is an intermittent issue and there are times when it comes back in a working status immediately and things seem to be functioning fine. But a lot of the times, it remains in this sent state.

Here is an example of an order sent with an entry stop and attached OCO:

IOrderDraftBuilderPtr draftBuilder;
draftBuilder.CreateInstance(__uuidof(OrderDraftBuilder));
draftBuilder->WithSide(OrderSide_Buy);
draftBuilder->WithQuantity(1);
draftBuilder->WithContractID(con->id);
draftBuilder->WithPrice(12530.75)
draftBuilder->WithFlags(OrderFlags_GTC)
draftBuilder->WithOrderType(OrderType_Stop)

IOrderDraftBuilderPtr draftBuilder2;
draftBuilder2.CreateInstance(__uuidof(OrderDraftBuilder));
draftBuilder2->WithSide(OrderSide_Sell);
draftBuilder2->WithQuantity(1);
draftBuilder2->WithContractID(con->id);
draftBuilder2->WithPrice(12480.75)
draftBuilder2->WithFlags(OrderFlags_GTC)
draftBuilder2->WithOrderType(OrderType_Stop)

IOrderDraftBuilderPtr draftBuilder3;
draftBuilder3.CreateInstance(__uuidof(OrderDraftBuilder));
draftBuilder3->WithSide(OrderSide_Sell);
draftBuilder3->WithQuantity(1);
draftBuilder3->WithContractID(con->id);
draftBuilder3->WithPrice(12780.75)
draftBuilder3->WithFlags(OrderFlags_GTC)
draftBuilder3->WithOrderType(OrderType_Limit)

IOrderDraftPtr draftMain = draftBuilder->Build();
IOrderDraftPtr draftStop = draftBuilder2->Build();
IOrderDraftPtr draftLimit = draftBuilder3->Build();
GFApi()->Orders->SendOSOOrders(draftMain, draftStop, draftLimit, OSOGroupingMethod::OSOGroupingMethod_ByFirstPrice);
JSmith5611
Posts: 187
Joined:


Posted: Dec 16, 2020 @ 02:01 PM             Msg. 2 of 5
I don't see how this could be happening.
If when you think your orders are stuck in 'sent' what state are they in if you log into trader?
Jason Smith
RWare2020
Posts: 205
Joined: Feb 11, 2020


Posted: Dec 17, 2020 @ 01:34 PM             Msg. 3 of 5
I will see what happens over on trader. I am currently unable to login to api.gainfutures.com and getting no response back to OnLoginCompleted, OnLoginFailed, or OnDisconnected.
RWare2020
Posts: 205
Joined: Feb 11, 2020


Posted: Dec 21, 2020 @ 01:40 PM             Msg. 4 of 5
Trader shows that the order is no longer in a sent state and in a working state. I have modified my code and I am seeing things mostly correct.

One thing that I am seeing on my end though is that I have a few working market orders that are coming from this call GFApi()->Orders->Get(). But Trader does not show them as working orders. I can't tell if they are market orders that never got executed and are just waiting to be executed, but again, GAIN Trader does not show them in a working status.

If I restart my application, then the working market orders are no longer in that list of orders.
JSmith5611
Posts: 187
Joined:


Posted: Jan 06, 2021 @ 01:08 PM             Msg. 5 of 5
I'm fairly certain that the issue here is the same as the issue we've been dealing with in the other thread.
Jason Smith