¿ªÔÆÌåÓý

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

Re: opt out from: Secure Login required for trading

 

¿ªÔÆÌåÓý

Thank you for the info.

There are some websites that claim they can connect to an IB account without PW/2FA, by providing a photoID+IB account#+form signed by the account holder, and then the connection would happen without supplying PW/2FA. eg ?claims this.?
I verified with IB in the past as I was suspicious and IB confirmed they indeed have a ¡®backend integration¡¯ with that site (they didn¡¯t say more or how it is done, likely for security purposes). I didn¡¯t understand how this was possible since all IB APIs require the auth, but it might be the ¡®account of accounts¡¯ approach you mention.?

Anyone has any insight if IB would add an existing account you don¡¯t own under your master account to allow trading in it by providing this information, likely only for certain ¡®approved¡¯ entities?



On Jul 29, 2022, at 10:45 AM, Richard L King via groups.io <rlking@...> wrote:

Just to add to what ´³¨¹°ù²µ±ð²Ô said, you can get IBC from its GitHub repository at:
?
?
Richard
?
From:?[email protected]?<[email protected]>?On Behalf Of?´³¨¹°ù²µ±ð²Ô Reinold via?
Sent:?29 July 2022 18:27
To:?[email protected]
Subject:?Re: [TWS API] opt out from: Secure Login required for trading
?

We don't have a need for "other users" to connect to our back-end and it would probably be quite a challenge to make that secure.

While each TWS/IBGW instance can only log into one account, that can be an "account of accounts" in case the various accounts are linked together. That does not necessarily mean all accounts have to have the same owner. In that case, a single client can trade for all linked accounts by simply adding the relevant account number when placing orders. And during login, 2FA is only required for that "account of accounts".

If the accounts are not linked, individual instances of TWS/IBGW plus client application have to be started. You can automate that with Richard King's IBC and there are several discussions over at?/g/ibcalpha/topics?how to setup IBC such that 2FA during login takes place on a mobile device that can be far away from where IBC/TWS/IBGW run.

´³¨¹°ù²µ±ð²Ô

On Fri, Jul 29, 2022 at 11:29 AM, bart??wrote:
Jurgen, I totally agree with your assessment about the need for 2FA.??
?
One question: is your system allowing other users to connect to your backend? If so how do you handle them entering their PW/2FA code securely so your backend can connect to their accounts? There are some robotrading sites that do that and just wonder how it is implemented.?
?



Re: TWS Closing

 

Are you getting any error messages, such as code 1100 before TWS closes?
Any clues in the TWS logs?
Could there be network disruptions between TWS and IBKR (such as router/modem restarts, DHCP IP renewals, ...)?

Is it possible you experience Java JVM crashes?

We see brief TWS disconnects every night during the , which is at 23:45 - 00:45 ET during the week for US based IBKR systems. These are always brief enough so that TWS never closes and stays authenticated without causing client disconnects. This week they took place at (Central Time)

SUN??? 2022-07-24 23:16:37.843-0500
MON??? 2022-07-25 23:27:09.827-0500
TUE??? 2022-07-26 23:15:38.260-0500
WED??? 2022-07-27 23:17:11.020-0500
THU??? 2022-07-28 23:20:24.056-0500

´³¨¹°ù²µ±ð²Ô


On Fri, Jul 29, 2022 at 08:43 AM, Mike wrote:
All,

My TWS is closing at night, between 11 PM and 4 AM EST causing my app to disconnect.? Has anyone experienced issues with TWS closing?? What is the best way to diagnose whether the issue is TWS or elsewhere?

Mike


Re: opt out from: Secure Login required for trading

 

¿ªÔÆÌåÓý

Just to add to what ´³¨¹°ù²µ±ð²Ô said, you can get IBC from its GitHub repository at:

?

?

Richard

?

From: [email protected] <[email protected]> On Behalf Of ´³¨¹°ù²µ±ð²Ô Reinold via groups.io
Sent: 29 July 2022 18:27
To: [email protected]
Subject: Re: [TWS API] opt out from: Secure Login required for trading

?

We don't have a need for "other users" to connect to our back-end and it would probably be quite a challenge to make that secure.

While each TWS/IBGW instance can only log into one account, that can be an "account of accounts" in case the various accounts are linked together. That does not necessarily mean all accounts have to have the same owner. In that case, a single client can trade for all linked accounts by simply adding the relevant account number when placing orders. And during login, 2FA is only required for that "account of accounts".

If the accounts are not linked, individual instances of TWS/IBGW plus client application have to be started. You can automate that with Richard King's IBC and there are several discussions over at /g/ibcalpha/topics how to setup IBC such that 2FA during login takes place on a mobile device that can be far away from where IBC/TWS/IBGW run.

´³¨¹°ù²µ±ð²Ô

On Fri, Jul 29, 2022 at 11:29 AM, bart decanne.com wrote:

Jurgen, I totally agree with your assessment about the need for 2FA.?

?

One question: is your system allowing other users to connect to your backend? If so how do you handle them entering their PW/2FA code securely so your backend can connect to their accounts? There are some robotrading sites that do that and just wonder how it is implemented.?

?


Re: Duplicate Order ID

 

¿ªÔÆÌåÓý

Robert

?

You have set .auxPrice = 1 for the DAX contract. The auxPrice field is the trigger price for your stop order. For EUR.USD that is a possible value since the current price for this contract is around 1.019. But the current DAX price is around 13486, so your trigger price of 1 is completely unreasonable and is almost certainly being rejected with an error message.

?

You are handling errorMsg events, presumably? If not, you stand no chance of getting the API to do anything useful¡­

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Metrodus79
Sent: 29 July 2022 13:27
To: [email protected]
Subject: Re: [TWS API] Duplicate Order ID

?

Hello ´³¨¹°ù²µ±ð²Ô,

first of all I thank you very much for your fast reply and your time! I'm absolutely with you that my kind of solution is not perfect but at the time when i started it was the best what i could manage with my knowledge.?

1. "One area I'd review is the code that determines the next order ID. As the Placing Orders chapter of the API Reference Guide suggests, clients generally maintain their own sequence of order IDs and do not make API calls for the nextOrderId unless they somehow lose the sequence. During the initial connection request, clients are automatically informed of the next valid order ID and, from that point on, simply increment an internal nextOrderId field as needed. "

So for my understanding now, it is not necessary to make always a request for a validOrderid and it save process time to increment the order id in a own sub. I get the first valid id with the first connection in the morning. I implemented this and of course the problem with the duplicate order id is gone :)

2. "our code needs to be structured event oriented as well and needs to wait for the arrival of a callback (or the corresponding error) and not sleep for a fix period of time after the request."

The Code really wait and not sleep. There is a timer in the backround who started the code again and then it follows a validation phase to check the answer from the API. I'm use unique strings that the program always know the correct sequence entry point. IMO there is no way to use multithread with excel so i have to do everything step by step. Of course this need time but still now it is not relevant for my trading.

3. Unfortunately now the wrapper send no response for my DAX contract. If i change the contract to EUR.USD i get the response without any problem. So is there a way if you can make a order request to look if you get an answer?

Kontraktinformationen:
With objTWSControl.m_contractInfo
???? .Symbol ="DAX"
???? .secType = "FUT"
???? .lastTradeDateOrContractMonth = "202209"
???? .multiplier =5
???? .exchange = "EUREX" changed from DTB on monday this week and this was the time when my problem with duplicate Order id started
???? .currency ="EUR"
End With

Orderinformationen:
With objTWSControl.m_orderInfo
???? .Action =? "BUY"
???? .totalQuantity = 1
???? .orderType = "STP"
???? .auxPrice = 1
???? .timeInForce = "DAY"
???? .whatIf = 1
End With

When I make the request with EUR.USD I get the response without any problem:

Kontraktinformationen:
With objTWSControl.m_contractInfo
???? .Symbol ="EUR"
???? .secType = "CFD"
???? .lastTradeDateOrContractMonth = ""
???? .multiplier =1
???? .exchange = "SMART"
???? .currency ="USD"
End With

Orderinformationen:
With objTWSControl.m_orderInfo
???? .Action =? "BUY"
???? .totalQuantity = 1
???? .orderType = "STP"
???? .auxPrice = 1
???? .timeInForce = "DAY"
???? .whatIf = 1
End With

My question is now if i have to change anything in the contractinfo object in the way to get a response from TWS via API. IMO it is strange that the problem started for me with the change of the exchange from DTB to EUREX. Do you or anyone know something about this or have the same issue with requests on EUREX-Exchange via API and TWS?

Thanks again for your help!!!

Robert



Re: opt out from: Secure Login required for trading

 

We don't have a need for "other users" to connect to our back-end and it would probably be quite a challenge to make that secure.

While each TWS/IBGW instance can only log into one account, that can be an "account of accounts" in case the various accounts are linked together. That does not necessarily mean all accounts have to have the same owner. In that case, a single client can trade for all linked accounts by simply adding the relevant account number when placing orders. And during login, 2FA is only required for that "account of accounts".

If the accounts are not linked, individual instances of TWS/IBGW plus client application have to be started. You can automate that with Richard King's IBC and there are several discussions over at /g/ibcalpha/topics how to setup IBC such that 2FA during login takes place on a mobile device that can be far away from where IBC/TWS/IBGW run.

´³¨¹°ù²µ±ð²Ô

On Fri, Jul 29, 2022 at 11:29 AM, bart decanne.com wrote:

Jurgen, I totally agree with your assessment about the need for 2FA.?
?
One question: is your system allowing other users to connect to your backend? If so how do you handle them entering their PW/2FA code securely so your backend can connect to their accounts? There are some robotrading sites that do that and just wonder how it is implemented.?
?


Re: Duplicate Order ID

 

Glad the duplicate order is gone now, Robert.

I was not suggesting a multi-threaded design to avoid "sleep" between requests and responses. Just an event-oriented design. I am not a VBA/Excel macro practitioner, but I believe they do have an event model that supports an event oriented/reactive application design that entirely removes the need for blocking/wait/sleep between request and response.

Not sure what to tell you about the DAX order not working other than the standard checklist. Are you sure your code properly catches and reports all API errors? If you can't get an error to display, this would be a good case for the TWS log, since you'd want to know what TWS thinks you have sent and what the response is.
Not sure whether the DAX contract needs additional fields initialized. We avoid the guess work, as a matter of practice, since we never create our own Contract objects. We rather make . queries when the client starts (with the fewest fields that uniquely describe the instrument, usually just with the local symbol such as "FDXM SEP 22", type, and maybe exchange) and then use the returned fully populated contract object for all requests that require one.

´³¨¹°ù²µ±ð²Ô


On Fri, Jul 29, 2022 at 07:26 AM, Metrodus79 wrote:

1. "One area I'd review is the code that determines the next order ID. As the Placing Orders chapter of the API Reference Guide suggests, clients generally maintain their own sequence of order IDs and do not make API calls for the nextOrderId unless they somehow lose the sequence. During the initial connection request, clients are automatically informed of the next valid order ID and, from that point on, simply increment an internal nextOrderId field as needed. "

So for my understanding now, it is not necessary to make always a request for a validOrderid and it save process time to increment the order id in a own sub. I get the first valid id with the first connection in the morning. I implemented this and of course the problem with the duplicate order id is gone :)

2. "
our code needs to be structured event oriented as well and needs to wait for the arrival of a callback (or the corresponding error) and not sleep for a fix period of time after the request."

The Code really wait and not sleep. There is a timer in the backround who started the code again and then it follows a validation phase to check the answer from the API. I'm use unique strings that the program always know the correct sequence entry point. IMO there is no way to use multithread with excel so i have to do everything step by step. Of course this need time but still now it is not relevant for my trading.

...
My question is now if i have to change anything in the contractinfo object in the way to get a response from TWS via API. IMO it is strange that the problem started for me with the change of the exchange from DTB to EUREX. Do you or anyone know something about this or have the same issue with requests on EUREX-Exchange via API and TWS?


Re: opt out from: Secure Login required for trading

 

¿ªÔÆÌåÓý

Jurgen, I totally agree with your assessment about the need for 2FA.?

One question: is your system allowing other users to connect to your backend? If so how do you handle them entering their PW/2FA code securely so your backend can connect to their accounts? There are some robotrading sites that do that and just wonder how it is implemented.?

On Jul 29, 2022, at 8:33 AM, ´³¨¹°ù²µ±ð²Ô Reinold via groups.io <TwsApiOnGroupsIo@...> wrote:

?

Not sure why you even want to opt out of 2FA for login. Remember, we are talking about brokerage accounts with real money and possibly significant balances. Simple password-only authentication is way too vulnerable and 2FA is pretty much the standard all over the WEB even for sites with negligible significance compared to brokerage accounts.

We use 2FA for years and the only impact is that we have to type a few numbers during login once a week when we start TWS. After that, TWS restarts automatically once a day and no password nor 2FA is required. Client applications trade via TWS API without any need for 2FA since that is a login-only activity. You obviously want to make sure the systems that run TWS/IBGW and your client applications have adequate security measures while TWS/IBGW is authenticated with IBKR.

´³¨¹°ù²µ±ð²Ô

On Fri, Jul 29, 2022 at 09:38 AM, ajn wrote:

I cannot opt out from 2fa for trading in one of my accounts (and my relative has same issue). Note, I am not talking about disabling 2fa altogether, just for trading.


Re: opt out from: Secure Login required for trading

 

Not sure why you even want to opt out of 2FA for login. Remember, we are talking about brokerage accounts with real money and possibly significant balances. Simple password-only authentication is way too vulnerable and 2FA is pretty much the standard all over the WEB even for sites with negligible significance compared to brokerage accounts.

We use 2FA for years and the only impact is that we have to type a few numbers during login once a week when we start TWS. After that, TWS restarts automatically once a day and no password nor 2FA is required. Client applications trade via TWS API without any need for 2FA since that is a login-only activity. You obviously want to make sure the systems that run TWS/IBGW and your client applications have adequate security measures while TWS/IBGW is authenticated with IBKR.

´³¨¹°ù²µ±ð²Ô

On Fri, Jul 29, 2022 at 09:38 AM, ajn wrote:

I cannot opt out from 2fa for trading in one of my accounts (and my relative has same issue). Note, I am not talking about disabling 2fa altogether, just for trading.


Re: opt out from: Secure Login required for trading

 

I think being?forced to use 2FA for logging in to TWS is coming to North America as well.

I use IB through another introducing broker, and they sent an email last week stating that due to a policy change, everyone had to enable 2FA for logging in to TWS.

Maybe if enough people complain IB will reverse course?



On Fri, Jul 29, 2022 at 10:38 AM ajn <andrei.jefremov@...> wrote:

I cannot opt out from 2fa for trading in one of my accounts (and my relative has same issue). Note, I am not talking about disabling 2fa altogether, just for trading.

I have several other accounts where logging into tws is happening without 2fa. And that was a simple exercise of
1. making sure that _all_ users are enrolled into 2fa
2. logging as the "main" user and going into settings -> security -> secure login system and then pressing the wheel next to "Secure Login not required for trading" to configure which users to opt out

However for the account where I haven't yet done that I can't seem to be able to set it up. there is simply no wheel next to??"Secure Login not required for trading". The whole line is greyed out

I have made a ticker on the issue and got a response: "new accounts cannot opt out and we are planning to disable optout for existing accounts in the future".?

Anyone has experienced the same (I am from EU)? Is it for real or my ticker just got answered by unexperienced person and the problem is in some other place (happened many times that first answer they give is plain wrong :) )?

I am thinking: how algorithmic trading is going to work? it is a bit of a mess to be constantly present every time you app decided to start trading (or there was some outage and it needed to redo 2fa).

aj

?


opt out from: Secure Login required for trading

 

I cannot opt out from 2fa for trading in one of my accounts (and my relative has same issue). Note, I am not talking about disabling 2fa altogether, just for trading.

I have several other accounts where logging into tws is happening without 2fa. And that was a simple exercise of
1. making sure that _all_ users are enrolled into 2fa
2. logging as the "main" user and going into settings -> security -> secure login system and then pressing the wheel next to "Secure Login not required for trading" to configure which users to opt out

However for the account where I haven't yet done that I can't seem to be able to set it up. there is simply no wheel next to??"Secure Login not required for trading". The whole line is greyed out

I have made a ticker on the issue and got a response: "new accounts cannot opt out and we are planning to disable optout for existing accounts in the future".?

Anyone has experienced the same (I am from EU)? Is it for real or my ticker just got answered by unexperienced person and the problem is in some other place (happened many times that first answer they give is plain wrong :) )?

I am thinking: how algorithmic trading is going to work? it is a bit of a mess to be constantly present every time you app decided to start trading (or there was some outage and it needed to redo 2fa).

aj

?


Re: TWS Closing

 

¿ªÔÆÌåÓý

Thanks Mark. ?My auto-restart is set to 6 PM so that¡¯s not it.

On Jul 29, 2022, at 9:54 AM, mark collins <mark.collins@...> wrote:

?
Tws will restart automatically every day. It's a legacy thing that's been in tws for as long as I can remember. There are settings for selecting when and how it restarts in the preferences menu

Best wishes,

M

On Fri, 29 Jul 2022, 14:43 Mike via , <m_saracena=[email protected]> wrote:
All,

My TWS is closing at night, between 11 PM and 4 AM EST causing my app to disconnect.? Has anyone experienced issues with TWS closing?? What is the best way to diagnose whether the issue is TWS or elsewhere?

Mike


Re: TWS Closing

 

Tws will restart automatically every day. It's a legacy thing that's been in tws for as long as I can remember. There are settings for selecting when and how it restarts in the preferences menu

Best wishes,

M

On Fri, 29 Jul 2022, 14:43 Mike via , <m_saracena=[email protected]> wrote:
All,

My TWS is closing at night, between 11 PM and 4 AM EST causing my app to disconnect.? Has anyone experienced issues with TWS closing?? What is the best way to diagnose whether the issue is TWS or elsewhere?

Mike


TWS Closing

 

All,

My TWS is closing at night, between 11 PM and 4 AM EST causing my app to disconnect.? Has anyone experienced issues with TWS closing?? What is the best way to diagnose whether the issue is TWS or elsewhere?

Mike


Re: Duplicate Order ID

 

Hello ´³¨¹°ù²µ±ð²Ô,

first of all I thank you very much for your fast reply and your time! I'm absolutely with you that my kind of solution is not perfect but at the time when i started it was the best what i could manage with my knowledge.?

1. "One area I'd review is the code that determines the next order ID. As the Placing Orders chapter of the API Reference Guide suggests, clients generally maintain their own sequence of order IDs and do not make API calls for the nextOrderId unless they somehow lose the sequence. During the initial connection request, clients are automatically informed of the next valid order ID and, from that point on, simply increment an internal nextOrderId field as needed. "

So for my understanding now, it is not necessary to make always a request for a validOrderid and it save process time to increment the order id in a own sub. I get the first valid id with the first connection in the morning. I implemented this and of course the problem with the duplicate order id is gone :)

2. "
our code needs to be structured event oriented as well and needs to wait for the arrival of a callback (or the corresponding error) and not sleep for a fix period of time after the request."

The Code really wait and not sleep. There is a timer in the backround who started the code again and then it follows a validation phase to check the answer from the API. I'm use unique strings that the program always know the correct sequence entry point. IMO there is no way to use multithread with excel so i have to do everything step by step. Of course this need time but still now it is not relevant for my trading.

3. Unfortunately now the wrapper send no response for my DAX contract. If i change the contract to EUR.USD i get the response without any problem. So is there a way if you can make a order request to look if you get an answer?

Kontraktinformationen:
With objTWSControl.m_contractInfo
???? .Symbol ="DAX"
???? .secType = "FUT"
???? .lastTradeDateOrContractMonth = "202209"
???? .multiplier =5
???? .exchange = "EUREX" changed from DTB on monday this week and this was the time when my problem with duplicate Order id started
???? .currency ="EUR"
End With

Orderinformationen:
With objTWSControl.m_orderInfo
???? .Action =? "BUY"
???? .totalQuantity = 1
???? .orderType = "STP"
???? .auxPrice = 1
???? .timeInForce = "DAY"
???? .whatIf = 1
End With

When I make the request with EUR.USD I get the response without any problem:

Kontraktinformationen:
With objTWSControl.m_contractInfo
???? .Symbol ="EUR"
???? .secType = "CFD"
???? .lastTradeDateOrContractMonth = ""
???? .multiplier =1
???? .exchange = "SMART"
???? .currency ="USD"
End With

Orderinformationen:
With objTWSControl.m_orderInfo
???? .Action =? "BUY"
???? .totalQuantity = 1
???? .orderType = "STP"
???? .auxPrice = 1
???? .timeInForce = "DAY"
???? .whatIf = 1
End With

My question is now if i have to change anything in the contractinfo object in the way to get a response from TWS via API. IMO it is strange that the problem started for me with the change of the exchange from DTB to EUREX. Do you or anyone know something about this or have the same issue with requests on EUREX-Exchange via API and TWS?

Thanks again for your help!!!

Robert




Re: Limitations on tick-by-tick data

 

You need to read this description of first.

  • Every account has the permission to consume 100 market lines simultaneously. In other words have 100 simultaneous subscriptions for unique instruments in TWS plus all API clients.
  • You can earn more market lines based upon the account value and your monthly commission payments
  • You can also purchase booster packs of 100 market lines each

Take a look at this posting for how TWS can tell you what your market line limits are right now.

The table you are quoting tells you how many simultaneous TickByTick subscriptions you can have based upon your market lines limit. Each of those subscriptions has no limits and you need to be prepared for a fire-hose depending on the instrument you are subscribing to. We have seen 1,500/second and more TickByTickLast reported? for ES futures when they have a busy day. And TickByTickAskBid can be 10 times more than TickByTickLast.

´³¨¹°ù²µ±ð²Ô


Limitations on tick-by-tick data

 

I am trying to understand documentation regarding limitation on number of lines for tick-by-tick data:




Number of lines Max. Requests
0 - 399 3
400 - 499 4
500 - 599 5
600 - 699 6

So with 3 requests I can get no more than 400 lines of data. Does one line correspond to one timestamp? Is this limit per day or per month. If I exhausted my limit, can I buy extra access?


Re: Duplicate Order ID

 

The group cannot fix large chunks of code for you, but I hope we can give you pointers so you can do that yourself. In that spirit a few observations.

TWS log is always very helpful since it tells you what is going on from the TWS/IBGW point of view. But it does not tell you why your client makes these requests so you will need to find a way to add logging to your code. It is very unlikely that the source of and reason for the second order request is anywhere other than in your VBA code.

One area I'd review is the code that determines the next order ID. As the chapter of the API Reference Guide suggests, clients generally maintain their own sequence of order IDs and do not make API calls for the nextOrderId unless they somehow lose the sequence. During the initial connection request, clients are automatically informed of the next valid order ID and, from that point on, simply increment an internal nextOrderId field as needed. Doing so would reduce your order placement complexity (and increase the speed) since you eliminate the request-wait-response cycle through the API and all the way to TWS/IBGW. According to the logs it currently takes nearly three seconds from when TWS sends the nextValidOrderId to when it sees the first placeOrder request.

And finally (frequent readers of my posts will know where this is going - so hold on to your seats) a big red flag is when you say "First i make a request ... [then]? I'm waiting 1 sec for the answer ". That is wrong and I would not be surprised if this contributes to your code placing two identical orders. The TWS API is event driven and completely asynchronous with no guarantee as to the time it takes between a request and the corresponding answer nor to the order in which answers arrive in case there are multiple outstanding requests or subscriptions to data feeds. Your code needs to be structured event oriented as well and needs to wait for the arrival of a callback (or the corresponding error) and not sleep for a fix period of time after the request.

When sleep is used to synchronize requests and responses you'd expect to get exactly what you see: 99% of the time it works correctly and some times it does not. That is when the "sleep" time was too short and the response had not come in yet. And the fix is not to simply increase the sleep time. The fix is to restructure the code and to eliminate the "sleep".

By maintaining the nextOrderId in your client you will naturally avoid this issue, but it would still be interesting for you to review your current code to see what happens if the "sleep 1 second" expires before the nextOrderId callback has come in. Will your code place two orders? One right after the sleep and one triggered by when the nextOrderId callback comes later?

Hope this helps,

´³¨¹°ù²µ±ð²Ô


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


Re: DAX data feed via API

 

¿ªÔÆÌåÓý

Ninjatrader support validated new Symbol mapping for the FDAX instrument with EUREX as parameters and its solved the problem.

Thanks for help

Good holidays if any

?

De?: [email protected] <[email protected]> De la part de Matthias Frener
·¡²Ô±¹´Ç²â¨¦?: mardi 26 juillet 2022 23:37
??: [email protected]
Objet?: Re: [TWS API] DAX data feed via API

?

Exchange field on the contract as changed from DTB to EUREX.
Not sure how this works via najatrader, but if you need an exchange code this might be the reason (haven't checked if they also got new conId)


Re: 4AM opening price (not official one) but real one in timestamp

 

U made my day, mate! i been looking that for ages...Thats exctly i needed:
? "1658908800" : [ {
??? "tsInS" : 1658908800,
??? "type" : "AllLast",
??? "price" : 128.96,
??? "size" : 20,
??? "attr" : 8,
??? "exch" : "ARCA",
??? "spCond" : "? TI"

?

what request did u use to get it. Can u give me exactly how u wrote. Thanks a lot! Sorry i am not dev, just want to pass that information to my dev.