¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Some Paper trade Orders not filling after updating to 10.30


 

Hi, I'm new on this forum. I found after updating, that some of my orders never filled despite the price conditions and time conditions being hit. I do an exit sell order using an OCA Group; one an optimistic LMT order, another is a pessimistic STP order and lastly have a MKT order set 3 minutes in the future. This worked well up until I updated to 10.30; The MKT and STP orders don't activate on some stocks while using a Paper Trading account. I read that some users here had issues with 10.30 and moved onto a later version. I would like to at least try that. For people that found success moving on to a new version what version did you move on to where you didn't have any issues?


 

Are there any errors or warning messages when you place your orders ? Either displayed by TWS or sent to the error callbacks of your API client ?

Did you check if there are new TWS API settings that you should check so that your application can continue to work as previously ?

Are there any timezone issues that may be affecting the time conditions of your orders ?

Have you confirmed if those issues persist with TWS version 10.35 available for download from the IB website ?

I have archived TWS versions 10.31 and higher which I can provide but it would be important to understand if some order parameters are not being accepted by TWS. This will be shown in error/warning messages that you are probably logging with your API client.

--


 

Hi,
?
Thanks for your reply.
?
I don't have any errors/warnings.
I log all errors coming from IBKR server and there are none for that order and/or OCA Group.
?
TWS version id Trader Workstation 10.35.1g April 3 2025 17:26:33.
?

All orders have same TimeZone settings. Most orders are fine.

?

Seems as this error message is possibly the wrong error message?

?

The other error message I get that's similar but not the same is:

Rejected by System: The contract is not available for short sale.

?

?

If can try another TWS version if you think it could resolve my issue.

?

?

Thanks a lot

?

?


 

Are there any errors or warning messages when you place your orders ? Either displayed by TWS or sent to the error callbacks of your API client ?
I haven't seen any error messages. I haven't seen any popups come come up from IBGateway. I normally send order rejections to my phone separately and haven't seen any.
?
Did you check if there are new TWS API settings that you should check so that your application can continue to work as previously ?
I took pictures of my old configuration and have done my best to match it. After having a few failures with this bug, I also found that under "C:\Jts\ibgateway\1019" there is a folder that uses all (seemingly random) lowercase characters which contains user settings; I have copied this to "C:\Jts\ibgateway\1030" to copy the previous version's user settings.?
?
Are there any timezone issues that may be affecting the time conditions of your orders ?
I did have some issues before but now I have updated my Time Zone under IBGateway's More Options to "America/Los Angeles" timezone as it was before on the previous version. (I'm in Seattle)
?
Have you confirmed if those issues persist with TWS version 10.35 available for download from the IB website ?
I haven't checked it on 10.35 yet.?
?
I have archived TWS versions 10.31 and higher which I can provide but it would be important to understand if some order parameters are not being accepted by TWS. This will be shown in error/warning messages that you are probably logging with your API client.
Understood. Again, I haven't seen any error messages. The strangest part about this is that some of exit MKT order and exit STP orders do fill. Others just don't fill despite their conditions being hit.
?
?
?
Here's a sample of the exit order
?
?
void Strategy::ExitOrder(OrderId optimisticOrderId, OrderId backupOrderId, OrderId slippingOrderId, Contract contract, double quantity, double limitPrice,? double auxPrice)
{
string orderRef = "Exit";
StockThread* relatedStockThread = monitorHash[contract.symbol];
?
unique_lock<mutex> unclosedOrdersMutex11Lock(unclosedOrdersMutex11);
?
system_clock::time_point currentTime = getTime();
system_clock::time_point activeTime = ceil<chrono::seconds>(currentTime + seconds(4));
string activeTimeString = StockThread::TimeToString(activeTime) + relatedStockThread->timezoneString;
?
?
//ensure this isn't after market close.
string goodAfterTimeString = StockThread::TimeToString(min(
(currentTime + ExitLeighway), StockThread::marketClose(getTime())-minutes(1)
)) + relatedStockThread->timezoneString;
?
string afterMarketHoursEndOfDayTimeString = StockThread::TimeToString(StockThread::afterMarkeClose(getTime())) + relatedStockThread->timezoneString;
?
?
cout << "placing main hours exit order" << endl;
cout << "activeTimeString:" << activeTimeString << endl;
cout << "goodAfterTimeString:" << goodAfterTimeString << endl;
cout << "afterMarketHoursEndOfDayTimeString:" << afterMarketHoursEndOfDayTimeString << endl;
?
Order optimisticOrder;
optimisticOrder.action = quantity > 0 ? "SELL" : "BUY";
optimisticOrder.orderType = "LMT";
optimisticOrder.totalQuantity = DecimalFunctions::doubleToDecimal(abs(quantity));
optimisticOrder.lmtPrice = StockThread::roundToNDecimalPlaces(limitPrice, 2);
?
optimisticOrder.tif = "GTD"; //required for goodTillDate and goodAfterTime
optimisticOrder.goodTillDate = afterMarketHoursEndOfDayTimeString; //removed temporarily
?
//optimisticOrder.goodAfterTime = activeTimeString; //reintroduce this if there are overfill problems; ibGateway has been updated to prevent overFill but we'll see if it works.
optimisticOrder.orderRef = orderRef + optimisticRef;
?
?
Order backupOrder;
backupOrder.action = quantity > 0 ? "SELL" : "BUY";
backupOrder.orderType = "MKT"; //open this order if the first doesn't close quick enough
backupOrder.totalQuantity = DecimalFunctions::doubleToDecimal(abs(quantity));
?
//backupOrder.tif = "DAY";
backupOrder.tif = "GTD"; //required for goodTillDate and goodAfterTime
backupOrder.goodTillDate = afterMarketHoursEndOfDayTimeString; //removed temporarily
?
backupOrder.goodAfterTime = goodAfterTimeString;
backupOrder.orderRef = orderRef + backupRef;
?
?
Order slippingOrder;
slippingOrder.action = quantity > 0 ? "SELL" : "BUY";
slippingOrder.orderType = "STP";// "MIT"; //open this order if the price drops enough
slippingOrder.totalQuantity = DecimalFunctions::doubleToDecimal(abs(quantity));
slippingOrder.auxPrice = StockThread::roundToNDecimalPlaces(auxPrice, 2);
?
slippingOrder.tif = "GTD"; //required for goodTillDate and goodAfterTime
slippingOrder.goodTillDate = afterMarketHoursEndOfDayTimeString; //removed temporarily
?
//slippingOrder.goodAfterTime = activeTimeString;
slippingOrder.orderRef = orderRef + slippingRef;
?
?
?
orderIdToStockSymbol[optimisticOrderId] = contract.symbol;
orderIdToStockSymbol[backupOrderId] = contract.symbol;
orderIdToStockSymbol[slippingOrderId] = contract.symbol;
?
?
relatedStockThread->orderIdToOrder[optimisticOrderId] = optimisticOrder;
relatedStockThread->orderIdToOrder[backupOrderId] = backupOrder;
relatedStockThread->orderIdToOrder[slippingOrderId] = slippingOrder;
?
?
//setup both orders for a one cancels all order. All orders with that oca name will?
//be cancelled
?
optimisticOrder.ocaGroup = contract.symbol + "OCAExit" + to_string(optimisticOrderId);
optimisticOrder.ocaType = 3;
?
backupOrder.ocaGroup = contract.symbol + "OCAExit" + to_string(optimisticOrderId);
backupOrder.ocaType = 3;
?
slippingOrder.ocaGroup = contract.symbol + "OCAExit" + to_string(optimisticOrderId);
slippingOrder.ocaType = 3;
?
if (!runningTestSuite)
{
m_pClient->placeOrder(backupOrderId, contract, backupOrder); //place the delayed order first to prevent slippage
m_pClient->placeOrder(optimisticOrderId, contract, optimisticOrder);
m_pClient->placeOrder(slippingOrderId, contract, slippingOrder);
}
?
//add the order to the unclosedOrders Hash
relatedStockThread->unclosedOrders[backupOrderId] = true;?
relatedStockThread->unclosedOrders[optimisticOrderId] = true;
relatedStockThread->unclosedOrders[slippingOrderId] = true;
?
string log = "Placing exit order with ids: " + to_string(optimisticOrderId) + ", " + to_string(slippingOrderId) + ", and " + to_string(backupOrderId) +
" of " + to_string(quantity) + " shares at " + StockThread::TimeToString(getTime()) + " with prices:" +
to_string(limitPrice) + " and " + to_string(auxPrice) +
" with opt goodAfterTime as " + activeTimeString + " backup goodAfterTime as " +
goodAfterTimeString + " and goodTillDate as " + afterMarketHoursEndOfDayTimeString;
string positionStatus = "positionCurrentShareCount:" + to_string(monitorHash[contract.symbol]->positioncurrentShareCount) +
" and currentShareCount:" + to_string(monitorHash[contract.symbol]->currentShareCount);
monitorHash[contract.symbol]->orderLogs.emplace_back(log + positionStatus);
}
?
?


 

Hi Patrick. Did you reply to the wrong thread by chance?


 

geee, not sure, I'm new here since Today, so that's possible.
I was creating a thread, but here everything seems mixed up.
I received several responses to my original question, but I don't see them here.


 

I received an email regarding this message thread thinking it was for my question, you can delete all my messages, sorry.
Have a great day ;)


 

Let' not delete messages. They already have been sent to the 6,000++ members and will not be deleted in their inboxes. And future readers are going to miss context.
?
´³¨¹°ù²µ±ð²Ô
?
?
On Tue, Apr 22, 2025 at 03:40 PM, <patrick.lapointe@...> wrote:

I received an email regarding this message thread thinking it was for my question, you can delete all my messages, sorry.
Have a great day ;)


 

In Classic TWS, if you do a mouse right-click over an API order placed by your application, then follow Modify -> Order Ticket and finally review all fields and tabs in the Order Ticket dialog do you confirm that all are set exactly as submitted by your application ?

--


 

Thanks Orion.
The Order seems correct. I found one such case (AREB) which should have closed at 9:26:15 or a few seconds later. The MKT order (highlighted) was submitted at 9:23:15, should have become active at 9:26:15, but was then closed at 9:26:42 by the app and then replaced with a new order. The Start Time and End Time are showing in the Exchange's timezone (EST) and the Compltd Tm is showing in the local time (PST). Is there more detail I should look at?
?