Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AllowBlindTrading doesn't work #162

Closed
h5gq3 opened this issue Mar 17, 2022 · 4 comments
Closed

AllowBlindTrading doesn't work #162

h5gq3 opened this issue Mar 17, 2022 · 4 comments

Comments

@h5gq3
Copy link

h5gq3 commented Mar 17, 2022

I set the AllowBlindTrading variable to yes but the dialog with concerning message still appears when sending an order.
Testing this on paper trading on TWS version 1014 if that matters
Screenshot 2022-03-17 at 15 31 58
.

@rlktradewright
Copy link
Member

Ok thanks for that.

IBKR have changed the dialog that is shown in these circumstances since the AllowBlindTrading setting was introduced many years ago, and IBC no longer recognises it.

I'll fix this in the near future.

@h5gq3
Copy link
Author

h5gq3 commented Mar 30, 2022

is SwingUtils.findLabel the correct function to detect this text or was this dialog structure different 4 years ago?
i tried to edit with setting the new button name and remove part of the substring but doesn't work

    public void handleWindow(Window window, int eventID) {
        if (! Settings.settings().getBoolean("AllowBlindTrading", false)) return;

        if (! SwingUtils.clickButton(window, "Override and Transmit")) {
            Utils.logError("could not dismiss blind trading warning dialog.");
        }
    }

    public boolean recogniseWindow(Window window) {
        if (! (window instanceof JDialog)) return false;
        return (SwingUtils.findLabel(window, "blind trading") != null);
    }

}

@rlktradewright
Copy link
Member

Apologies, I have actually done the code changes to fix this but haven't got round to releasing it yet.

I've just done a beta build containing the fix, and you can get it from here:

https://1drv.ms/u/s!AlqfLEOWDJ9Zh-klxayDSKUDSpj0Ow?e=tPCBUf

Alternatively here's the revised code if you want to rebuild it yourself:

public void handleWindow(Window window, int eventID) {
    if (! Settings.settings().getBoolean("AllowBlindTrading", false)) return;

    if (! SwingUtils.clickButton(window, "Override and Transmit") &&
        ! SwingUtils.clickButton(window, "Yes")) {
        Utils.logError("could not dismiss blind trading warning dialog.");
    }
}

public boolean recogniseWindow(Window window) {
    if (! (window instanceof JDialog)) return false;
    return ((SwingUtils.titleContains(window, "Order Preview")) &&
            SwingUtils.findTextPane(window, "blind trading") != null)
            || 
            ((SwingUtils.findLabel(window, "blind trading") != null &&
            SwingUtils.findLabel(window, "Are you sure you want to submit this order?") != null));
}

Please let me know if this does the job.

@h5gq3
Copy link
Author

h5gq3 commented Mar 31, 2022

this does the job, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants