Two machines with same code giving different return codes

Discuss, post your questions about TWSLink here.

Users who just registered, please write an email to
forum@trade-commander.de
with your username mentioned.
So we can distinguish you from bots.
Thank you
Post Reply
sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Two machines with same code giving different return codes

Post by sectorbets » Fri Aug 31, 2018 12:25 pm

First, I have made zero changes on either machine -- one continues to operate correctly while the second is:

1) Not finding the open positions -- it returns two messages saying that position info is not available yet
2) REGISTER_CONTRACT2 is returning 0

I had hoped that the problem was just a timing glitch that would go away, but this is the third day that one machine is running properly and the second is not, so I know it is real.

Thankyou
Rick

board_admin
Site Admin
Posts: 191
Joined: Mon Apr 24, 2017 3:24 pm

Re: Two machines with same code giving different return codes

Post by board_admin » Fri Aug 31, 2018 4:28 pm

What is different on those 2 machines ? (Same TWS,...)
What code (TWSLink function calls) is running ?
What does the logfiles tell ?

Logfiles are best place to get information.
(Usually located in C:\trade-commander\twslink2\log)

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Two machines with same code giving different return codes

Post by sectorbets » Fri Aug 31, 2018 5:33 pm

All the software is running the same versions except for Windows -- it is Windows 7 on the machine that is working correctly and Server 2012 on the other machine. There was an automatic update from IB a couple of days ago and I may roll it back to see if that fixes the problem

We have been running for months without touching anything and everything has been flawless all that time on both machines.

I have looked at the logs, and while they are mostly the same early on, they diverge. The machine that is not working is live trading so I can't turn it on during market hours until we figure out the problem.

I can send the logs after the close from the problem machine when I can bring it back up.

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Two machines with same code giving different return codes

Post by sectorbets » Fri Aug 31, 2018 9:23 pm

The problem is certainly with TWS 972.1

I went back to TWS 960, and everything seems to have gone back to normal -- I can't tell for sure of course until Tuesday when the market is open, but I am optimistic

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Two machines with same code giving different return codes

Post by sectorbets » Wed Sep 05, 2018 11:56 am

We can confirm that there is a problem when using TWSLink with the most recent release of TWS 972.1 when running with Windows server 2012. When we went back to TWS 960 everything runs as it has for the last year or so, so that is what we are doing on that machine.

This is likely to be a problem only for those of us who run in a data center with server based virtual machines, so probably not worth chasing it down, but if you want to, I can switch back to TWS 972 this week end and send you a log -- the problem arises during the CONNECT and REGISTER phases so shouldn't be too difficult to find.

board_admin
Site Admin
Posts: 191
Joined: Mon Apr 24, 2017 3:24 pm

Re: Two machines with same code giving different return codes

Post by board_admin » Wed Sep 05, 2018 12:14 pm

Hello Rick,
thank you for giving feedback.

Good possible it is because of the version of TWS (and so API).

Because TWSLink is no longer maintained, TWSLink still uses old API paradigma which will be sooner or later outdated by IB.

Probably this is now the case with version 972 .

But good possible you can use TWS 960 1,2,3,4,5,... years before IB forces you
to upgrade.

Unless you do not need a feature of newer TWS (which is unlikely to be supported by TWSLink)
you could - this way, by not upgrading TWS - stay away from all trouble introduced by
TWS updates, presumed you switch off the auto update.

--
TWSLink is free, because it will not be further developed unless serious bugs occur.
I do not consider this as bug, when it runs correctly with older version.

--
Perhaps just provide me the REGISTER_CONTRACT call, so i could do a quick check.

board_admin
Site Admin
Posts: 191
Joined: Mon Apr 24, 2017 3:24 pm

Re: Two machines with same code giving different return codes

Post by board_admin » Wed Sep 05, 2018 1:19 pm

I just made quick test:

Code: Select all

	int uid = REGISTER_CONTRACT("EUR", "CASH", "USD", "IDEALPRO", "", "", "", 0, "", 0, 0.0);
	int connected = CONNECT("", 7496, 1,20000);
	int uido = PLACE_ORDER(uid, 0, "BUY", "MKT", 100000, 0.0, 0.0, "DAY", 1, 0);
It works fine with TWS 972.1p on Windows 10 64 bit,

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Two machines with same code giving different return codes

Post by sectorbets » Wed Sep 05, 2018 4:04 pm

Yes everything works fine on Windows 7 & 10 -- just not on Server 2012. It's good to have a workaround like TWS 960. Best I can tell that is the only old release that is available for download, so I suggest everyone do that just in case even newer releases stop working on Windows 7 & 10 at some point.

Here is the link -- it is from the Ninja website since Ninja uses TWS 960 as well

https://ninjatrader.com/ConnectionGuide ... tion-Guide

I will go back to TWS 972 this weekend and send you the log -- assuming it is still failing !!

Post Reply