8000 TWS returns bad AgentDescription "0" (started 2016-01-07) and throws InvalidCastException · Issue #15 · krs43/ib-csharp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TWS returns bad AgentDescri 8000 ption "0" (started 2016-01-07) and throws InvalidCastException #15

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

Open
DrKoch opened this issue Jan 10, 2016 · 1 comment

Comments

@DrKoch
Copy link
DrKoch commented Jan 10, 2016

On Thursday 2016-01-07 my Application (usking krs.ats.ib-csharp) suddemly crashed with an InvalidCastException. I trcked this down to happen in IBClient.cs. TWS sends a bad code "0" for AgentDescription.

A possible fix looks like this:
IBClient.cs, line 3770:

                    if (version >= 9)
                    {
                        rstr = ReadStr();
                        AgentDescription ad = AgentDescription.None;
                        if (!string.IsNullOrEmpty(rstr))
                        {
                            try
                            {
                                ad = (AgentDescription)EnumDescConverter.GetEnumValue(typeof(AgentDescription), rstr);
                            }
                            catch (Exception)
                            {

                                ad = AgentDescription.None;
                            }
                        }
                        order.Rule80A = ad;
                        order.PercentOffset = ReadDouble();
@DrKoch DrKoch changed the title TWS returns bad AgentDescription "0" (started 2016-01-07) TWS returns bad AgentDescription "0" (started 2016-01-07) and throws InvalidCastException Jan 10, 2016
@marcogruhl
Copy link

Same issue here. Used your fix temporarily.

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
0