开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Duplicate Order ID


 

Hello guys,

I'm new here and I'm looking forward that someone might be possible to help me. I'm using Excel for my trading and I'm struggling with the error: Duplicate order id.

1. In my algorithm i place a order to get all the margin information.
2. First i make a request to get the next valid order id
3. I'm waiting 1 sec for the answer and place then an order with this order id

At normal (99%) there is no problem with this but sometimes i get the failure Duplicate order id.
Since yesterday i can't mange this anymore and i was looking in the TWS-logfile and found this:

My request to get the Order id:

2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:INFO] Handling incoming ReqNextValidId(8) message.

2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Started reading message:
2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished reading message:
2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] ReqNextValidId(8)::[version=1,numIds=1]
2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Start validating message:
2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished validating message:
2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Started processing message:

Get the next valid order id
11535:

2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:9:1:INFO] Sending next valid order id.

2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:9:1:DET] [9;1;11535]
2022-07-28 07:00:02.971 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished processing message:
2022-07-28 07:00:05.895 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:INFO] Handling incoming PlaceOrder(3) message.
2022-07-28 07:00:05.895 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Started reading message:
2022-07-28 07:00:05.895 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished reading message:

Place an order with id
11536 (plus 1 increment: I did this only by hoping that it could help to add one more increment...its not necessary and bullshit i know):

2022-07-28 07:00:05.895 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] PlaceOrder(3)::[version=151,ID=11536,reqDesc=Symbol=DAX? Type=FUT? Expiry=202209? Strike=0.0? Put/Call=?? Exchange=EUREX? CompExch=null? Currency=EUR? Multiplier=5? IbLocalSymbol=null? IbTradingClass=null? SecIdType=NULL? SecId=null? includeExpired=false? needLeadFutureMonth=false? needContinuousLeadFutureOnly=false? newsSource=null? Legs=null? Special Info=null,transmit=true,parent=0,combo=null]

2022-07-28 07:00:05.895 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] [151;11536;0;DAX;FUT;202209;0;2;5;EUREX;null;EUR;null;null;NULL;null;1;1;STP;Default;1.7976931348623157E308;Value;1.0;1.7976931348623157E308;1.0;0;U7646634.;true;0;null;ExpireDateTime [null];Reduce on Fill without Block;null;true;null;null;None;1.7976931348623157E308;1.7976931348623157E308;Infinity;DarkPoolOnly=false;AllOrNone=false;Volatility=1.7976931348623157E308;SoftDollars=;NbboPriceCap=1.7976931348623157E308;OptionAcctAttrib=c;StockRefPrice=1.7976931348623157E308;VolatilityType=None;ETradeOnly=false;AdjustableTrailingUnit=amt;MinimumQuantity=2147483647;DeltaNeutralOrderType=None;DeltaNeutralAuxPrice=1.7976931348623157E308;Clearing=/IB;SweepToFill=false;OutsideRth=false;ContinuousUpdate=false;StockRangeUpper=1.7976931348623157E308;OpenCloseAttrib=O;TriggerMethod=Default;OptOutSmartRouting=false;NotHeld=false;Hidden=false;StockRangeLower=1.7976931348623157E308;StartingPrice=1.7976931348623157E308;DisplaySize=2147483647;RelativeDiscretionary=false;PercentOffset=1.7976931348623157E308;FirmQuoteOnly=false;Delta=1.7976931348623157E308;BlockOrder=false;ReferencePriceType=None;{}]
2022-07-28 07:00:05.895 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Start validating message:
2022-07-28 07:00:05.896 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished validating message:
2022-07-28 07:00:05.896 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Started processing message:
2022-07-28 07:00:05.896 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Continue processing message
2022-07-28 07:00:05.896 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:INFO] Placing orderId - 11536
2022-07-28 07:00:05.896 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:INFO] Processing of order {11536} completed.
2022-07-28 07:00:05.896 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished processing message:

From here on i do not understand what's going on and why it try's to place a second order. I definitely do no request from excel again. I do the request only one time after i get the valid order id. Then i wait for the answer but the log show me that he place this order again:

2022-07-28 07:00:06.017 [KK] INFO? [JTS-CCPDispatcherS2-35] - Calling doAsSoonAsPossible for preset request

2022-07-28 07:00:06.017 [KK] INFO? [JTS-CCPDispatcherS2-35] - Got Synced preset response
2022-07-28 07:00:06.018 [KK] INFO? [JTS-CCPDispatcherS2-35] - Checking with faConfig for synced presets
2022-07-28 07:00:06.018 [KK] INFO? [JTS-CCPDispatcherS2-35] - Apply clearing defaults to order. Order account: U7646634.. Rule group: []
2022-07-28 07:00:06.020 [KK] INFO? [JTS-CCPDispatcherS2-35] - ENCODING STOP PRICE 1.0
2022-07-28 07:00:06.187 [KK] INFO? [JTS-CCPDispatcherS2-35] - what-if? id=650257091? mod=0? liq=false? initMargin=1.7976931348623157E308? maintMargin=1.7976931348623157E308? equityWithLoan=1.7976931348623157E308 commission=1.7976931348623157E308 min_comm=1.7976931348623157E308 max_comm=1.7976931348623157E308 currentPrice=1.7976931348623157E308 childCurrentPrice=1.7976931348623157E308
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:INFO] Handling incoming PlaceOrder(3) message.
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Started reading message:
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished reading message:
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] PlaceOrder(3)::[version=151,ID=11536,reqDesc=Symbol=DAX? Type=FUT? Expiry=202209? Strike=0.0? Put/Call=?? Exchange=EUREX? CompExch=null? Currency=EUR? Multiplier=5? IbLocalSymbol=null? IbTradingClass=null? SecIdType=NULL? SecId=null? includeExpired=false? needLeadFutureMonth=false? needContinuousLeadFutureOnly=false? newsSource=null? Legs=null? Special Info=null,transmit=true,parent=0,combo=null]
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] [151;11536;0;DAX;FUT;202209;0;2;5;EUREX;null;EUR;null;null;NULL;null;1;1;STP;Default;1.7976931348623157E308;Value;1.0;1.7976931348623157E308;1.0;0;U7646634.;true;0;null;ExpireDateTime [null];Reduce on Fill without Block;null;true;null;null;None;1.7976931348623157E308;1.7976931348623157E308;Infinity;DarkPoolOnly=false;AllOrNone=false;Volatility=1.7976931348623157E308;SoftDollars=;NbboPriceCap=1.7976931348623157E308;OptionAcctAttrib=c;StockRefPrice=1.7976931348623157E308;VolatilityType=None;ETradeOnly=false;AdjustableTrailingUnit=amt;MinimumQuantity=2147483647;DeltaNeutralOrderType=None;DeltaNeutralAuxPrice=1.7976931348623157E308;Clearing=/IB;SweepToFill=false;OutsideRth=false;ContinuousUpdate=false;StockRangeUpper=1.7976931348623157E308;OpenCloseAttrib=O;TriggerMethod=Default;OptOutSmartRouting=false;NotHeld=false;Hidden=false;StockRangeLower=1.7976931348623157E308;StartingPrice=1.7976931348623157E308;DisplaySize=2147483647;RelativeDiscretionary=false;PercentOffset=1.7976931348623157E308;FirmQuoteOnly=false;Delta=1.7976931348623157E308;BlockOrder=false;ReferencePriceType=None;{}]
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Start validating message:
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished validating message:
2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Started processing message:

Of course the answer is the duplicate order id:


2022-07-28 07:00:06.965 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:ERR]? OrderId {11536} is < 11537

2022-07-28 07:00:06.966 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:4:2:DET] Sending error.
2022-07-28 07:00:06.966 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:4:2:DET] [4;2;11536;103;Duplicate order id]
2022-07-28 07:00:06.966 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:4:2:DET] Error sent.
2022-07-28 07:00:06.966 [KK] INFO? [JTS-EServerSocket-159] - [1:151:151:1:0:0:0:DET] Finished processing message:

This is the logfile from the API aand this time stamp: It shows two requests too:

07:00:05:223 <- 3-11536-0-DAX-FUT-202209-0--5-EUREX--EUR-----BUY-1-STP--1-DAY---O-0--1-0-0-0-0-0-0-0--0--------0---1-0---0---0-0--0------0-----0-----------0---0-0---1--0-0-0-0--1.79769313486232E+308-1.79769313486232E+308-1.79769313486232E+308-1.79769313486232E+308-1.79769313486232E+308-0---------0-0-0--
07:00:06:293 <- 3-11536-0-DAX-FUT-202209-0--5-EUREX--EUR-----BUY-1-STP--1-DAY---O-0--1-0-0-0-0-0-0-0--0--------0---1-0---0---0-0--0------0-----0-----------0---0-0---1--0-0-0-0--1.79769313486232E+308-1.79769313486232E+308-1.79769313486232E+308-1.79769313486232E+308-1.79769313486232E+308-0---------0-0-0--
07:00:06:294 -> ---!4-2-11536-103-Duplicate order id-
07:00:07:418 <- 8-1-1-
07:00:07:418 -> ---

Could someone understand this log or has the same issue and might be possible to help me. I could also publish my VBA-code here with the order id- and the place order- request.

Best wishes and thx for help

Robert

Join [email protected] to automatically receive all group messages.