IbcAlpha / IBC

Automation of Interactive Brokers TWS. You can download the latest release here: https://github.com/ibcalpha/ibc/releases/latest
GNU General Public License v3.0
1.03k stars 181 forks source link

Not handled WARNING dialog in paper-trade #8

Closed radekwlsk closed 6 years ago

radekwlsk commented 6 years ago

IB Gateway logs:

2018-05-24 22:00:03.719 [BW] INFO  [AWT-EventQueue-0] - Parent for Dialog does not implement IToFrontAsGroupWindow, isAlwaysOnTop: false parent: ibgateway.ao[frame1,162,109,700x550,invalid,layout=java.awt.BorderLayout,title=IB Gateway.  API Account: stef4810,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,700x550,layout=jtscomponents.plaf.ae,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
2018-05-24 22:00:03.719 [BW] INFO  [AWT-EventQueue-0] - Parent for Dialog is not isAlwaysOnTop: ibgateway.ao[frame1,162,109,700x550,invalid,layout=java.awt.BorderLayout,title=IB Gateway.  API Account: stef4810,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,700x550,layout=jtscomponents.plaf.ae,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

The pop-up dialog that shows up and does not get handled automatically.: popup

I have accepted it manually, but on each new order it keeps reappearing. Can't use the IB Gateway in headless mode with that.

IBC: 3.6.0 IB Gateway: 963, 969, 972 - all behave the same IBApi: 9.73.6

rlktradewright commented 6 years ago

I've never seen this dialog before. Please state which version of the Gateway you're using.

The message seems to indicate that you're trying to place orders outside regular trading hours without setting the relevant attribute on the order. Please confirm whether this is the case. And if it is the case, is your intention that the order will not be processed until the next market open?

radekwlsk commented 6 years ago

@rlktradewright just added the versions to first post.

I am not placing them outside trading hours. Orders are Forex and Gold/Silver placed few seconds after market open, also manual placing during the day displays the same dialog.

Orders have default settings for RTH from ib-insync, which are False (don't trade outside regular trading hours), so the statement in the dialog:

The order attribute to "Allow orders to trade outside of RTH" is now checked

is false.

radekwlsk commented 6 years ago

@rlktradewright Problem is that when it is dismissed for one Order, then following pass through. But on IB Gateway restart the information that I've accepted the dialog is not preserved and it shows up again.

Am I doing something wrong regarding settings saving maybe? Or stuff like that does not sit in the settings file.

rlktradewright commented 6 years ago

The version numbers you've given are incorrect. Please correct them. I presume you mean 963, 969 and 972?

When did this start happening? Were you previously running successfully without it happening?

By the way, I think the statement in the dialog should probably say 'is NOT checked' rather than 'is NOW checked': it makes more sense to me that way.

The question is why this isn't happening for eveyone using the gateway? I'm just installing 972 and will switch my paper account over to the Gateway to see if all's well.

radekwlsk commented 6 years ago

@rlktradewright You are right, I've updated the versions.

When did this start happening? Were you previously running successfully without it happening?

It was working without problems on that account for over a month. Problems with that dialog were found this Monday (21 May) but probably happening last week also but diagnosed only this week.

By the way, I think the statement in the dialog should probably say 'is NOT checked' rather than 'is NOW checked': it makes more sense to me that way.

I think that the bullet points are just descriptions of what does it meant that the account is:

no longer operating in "Preview" mode

rlktradewright commented 6 years ago

Well, I'm baffled. I've tried my paper trading account with Gateway 972 and it's fine. A couple of points:

  1. Can you please check the trading hours in the contract details for the relevant contracts (or tell me exactly what contracts you're using if you don't happen to have a convenient means of doing this without programming). It may be that IBKR's view of the trading hours is not what you're expecting, so that this is in fact a valid message.

  2. IBC could of course be enhanced to handle this dialog, but before doing so I'd like to be sure that we understand what's going on here. It could be that this is actually a bug in Gateway, and IBKR should fix it.

  3. It's really irritating that IBKR insist on displaying these 'informational' pop-ups from the Gateway. I think it would be worth raising an enhancement request that Gateway should never pop-up anything (except the login dialog).

radekwlsk commented 6 years ago

@rlktradewright Contract trading hours should not be a problem, earlier orders placed outside of trading hours just got cancelled (rejected). That is some dialog related to account, but the problem is I have not changed any account's setting.

I guess the 'accept' button is the left one, so maybe it would be a good idea for IBC to log the dialog info to some file and then automatically press the left button no matter what dialog it is.

But anyway:

Both open almost 24/7. I am placing orders 5 seconds after opening hours.

rlktradewright commented 6 years ago

Maybe your computer clock is not well enough synchronised, and what you think is 5 seconds after the open is actually just before?

Also you could try setting the ignoreRTH to true and see if it then works.

Maybe I'm clutching at straws here, but the fact is that this problem seems only to affect you, and it's really quite unlikely that the Gateway would issue such a message erroneously, especially if it was working fine before. In other words, there is some condition here that you need to get to the bottom of. Putting a kludge fix into IBC is not the right solution. If you're absolutely sure the message is incorrect, you should probably contact IBKR to find out what's causing it.

[I'm going to be away from the computer for the next few hours.]

radekwlsk commented 6 years ago

The solution proposed by IB Support was to run IB Gateway manually, place order manually, then discard that popup properly and make sure that IB Gateway is shut down manually so that server can synchronize with it and save the settings. It may have been caused by killing the process instead of shutting down nicely. That way the IB Servers had no way to register the popup acceptance.

What is strange to me is that from what they say the popup acceptance is only registered on logout and not when it is actually done.