开云体育

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

Re: Duplicate Order ID


 

As you mentioned: " I think the object "contract" out of the??is not correct used. I tried different ways but I'm not sure if i can use the complete object or if i have to take all the information out and put this in a new object.?"

I do think the same as you.?
You need to "extract" the information received to fill the new object for the order to be sent.?

I think?the most important is this one, in my implementation which may differ from yours:
(The object conDetails comes from the Contract detail request)

? ? Dim contract As TWSLib.IContract
? ? Set contract = conDetails.contract
? ? Debug.print "Api contractDetails " & contract.localSymbol & "-" & contract.Exchange & "-" & contract.secType
? ? Debug.print " ? ? ?-----------> " & conDetails.lastTradeTime & ";" & conDetails.contractMonth & ";" & contract.lastTradeDateOrContractMonth & ";" & conDetails.timeZoneId & ";" & contract.conId & ";" & conDetails.priceMagnifier

This above piece of code will display on your excel debugger log some of the information which sends your the TWS once the request of contract details is received. Hope that helps you to fill the proper information for the new order request

Hope that helps

El dom, 31 jul 2022 a las 18:58, Metrodus79 (<robert.metasch@...>) escribió:
Hello Folks,

summarized briefly I could figure out that the problem was a confirmation what i had to do in my account. After that i could set the order placement.

@Richard: Unfortunately I forgot to say that i had no problem on my paper account. Only on my live account and only for the future contracts. There absolutely no failure log were i could figure out why the order was not accepted. But i thank you for your time and that you tried this for me!

@Jürgen: The hind with the order-ID is great and i implemented this in my program. I tried to implement the too but still now i couldn't manage this. Maybe you can give me a hind again.

1. I made the request for the contract details and i get a object called contract: m_TWSControl_contractDetailsEx(ByVal lngreqId As Long, ByVal contract As ComContractDetails)
2. In the next step i tried to use this object in the request for order placement
3. I create the object with the order information out of the class m_orderCom. This object comes for the class ComOrder and is defined as? Public m_orderCom As TWSLib.ComOrder:
Set objTWSControl.m_orderCom = objTWSControl.m_TWSControl.createOrder
4. I fill that object with the significant order information

??????????????? With objTWSControl.m_orderCom
?? ?
??????????????????? .Action = "BUY" 'strOrderAktion? 'BUY, SELL, SSHORT"
??????????????????? .totalQuantity = 1 'lngOrderAnzahl 'ORDER ANZAHL
??????????????????? .orderType = "STP" 'strOrderTyp? 'MKT, MKTCLS, LMT, LMTCLS, PEGMKT, SCALE, STP, STPLMT, TRAIL, REL, VWAP, TRAILLIMIT
??????????????????? .auxPrice = 1 'dblOrderStoppPreis 'Stopp price
??????????????????? .timeInForce = "DAY" 'Order ist nur für den Tag der Orderer?ffnung aktiv
??????????????????? .whatIf = 1 'bolwhatIf
?????????????? ?
??????????????? End With
5. I put the two objects (contract and objTWSControl.m_orderCom) in the request for the order placement and it doesn't work
?? ???????????
?????????????? Set objTWSControl.m_orderCom.orderMiscOptions = objTWSControl.m_TWSControl.createTagValueList()
?????????????? Call objTWSControl.m_TWSControl.placeOrderEx(lngOrderId, contract, objTWSControl.m_orderCom)

I think the object "contract" out of the is not correct used. I tried different ways but I'm not sure if i can use the complete object or if i have to take all the information out and put this in a new object.

You helped me a lot to solve my problem. If this need to much time its absolute ok for me. i will figure out how it works by time.

THANKS A LOT AGAIN!

Robert
???

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