My TimeInForce part of the order:
"GTD" + " " + yyyymmdd + " " + hh:mm:ss + " " + "GMT"
worked well in the past, but now with new TWS Release Notes 10.17/ TWS Api Build 10.18.1 an error message occurs:
Error 343: Endtime: The date, time, or time-zone entered ist invalid. The correct format is yyyymmdd hh:mm:ss xxx where yyyymmdd and xxx is optional. E.g.: 20031126 15:59:00 US/Eastern Note that there is a space the date and time and betwe --> here stops the message
after deleting + " " + "GMT"
Error 2174: You submitted request with date-time attributes without explicit time zone. Please switch to use yyyymmdd-hh:mm:ss in UTC or use instrument timezone, like US/Eastern. Implied time zone functionally will be removed in the n --> here stops the message
Please remark: time zone of the instrument's exchange instead of the user's time zone is needed in order-code
TWS Release Notes | Interactive Brokers LLC
TWS API v9.72+: Guide Updates (interactivebrokers.github.io)
IB has changed the timezone format in TWS 10.17+. By the way, it's not recommended to use the latest TWS version, instead use the latest stable version (10.12 atm)
With the release of TWS 10.17 and TWS API 10.18 clients now can send date/time in different formats:
API allows UTC format "yyyymmdd-hh:mm:ss" in date/time fields.
API allows date/time field format with instrument's exchange timezone (for all non-operator fields) and operator's time zone (for all fields).
Example: IBM 20220930-15:00:00 US/Eastern
At the moment you could simply replace GMT by adequate timezone (something like Europe/London ?). However note that support for implicit (default/user) timezone will be completely removed in the next major API version so due to ever-changing TWS API it's best to specify time with an explicit time zone appended. Personally I always use instrument timezone.
thanks for your message. I thought, I solved the problem, but in the last days I learned that the code plays with me cat and mouse.
I replaced my "old" well running solution which was: "GTD YYYYMMDD hh:mm:ss GMT" with different code-changes like:
yyyymmdd hh:mm:ss uct
yyyymmdd hh:mm:ss met
yyyymmdd hh:mm:ss us/central and of cours also with "-" between date and time and
also where hour is the exchange/instrument timezone, e.g. -x hours. combined with UCT or US/Central.
The remarkable: what wworked well yesterday the next day didn't work :very surprised:
Maybe the issue is the "GTD" . You mention "IBM" in example.
What I did not understand yet is, where is my default in my code line?
Remove GTD? But where place it?
When I want to implement the instrument timezone: in hour-field is to use the hour of exchange of instrument e.g. GLOBEX and add name of exchange timezone GLOBEX = US/ Central. Is to use US/Central or UCT?
As written above I tried a lot what was written in TWS-information sources, but nothing worked well. The information I got from github/ tws-api didn't help me to solve the problem completly.
Now I installed TWS version 10.12.2 and will use my "old" code line:
GTD YYYYMMDD hh:mm:ss GMT and it works... But it is not a solution for the next versions...
Would you be so kind and recomend me a link, where I can get some more information about the changes which will be in the next TWS versions and how I have to change my code?
First as I wrote it's not recommended to use unstable TWS versions, anything could happen. Not only the API is different but IBKR servers and message format you connect to/with can vary, and they may be updated anytime by IB. This could explain why you get different results for each connection (this happened to me years ago with data, lesson learned). Simply use a stable version it should be stable .
Second I've given you the official info about the new format
New Orders Date/Time Format
Here are other docs, re TWS:
Last the format I posted (YYYYMMDD-HH:MM:SS TZ with TZ e.g US/Central US/Eastern UTC MET etc) should work in future versions. My advice: either use UTC or instrument timezone, nothing else.
PS: TWS v 981 works fine, no reason to upgrade yet.
thanks for your answer und sorry for my late response
Yes, as written in my post, I switched to stable version, this is version 10.12.2. Now my "old" code works well. I use the version 10.xxx because there were problems with auto-restart TWS.
The needed change of the code in the future I will keep an eye on it, because even if I have changed the code into what should be right like written in the files at interactivebrokers, sometimes it worked and somtimes id didn't work. Like you wrote ... We will see ...
Once more : thanks a lot for your messages
Unfortunately, I was advised by IB to use the latest version due to my quotes on futures not updating properly. Anyway, I am getting that exact same MSG 36 Error 2174 error message in the plugin status. I am not sending anything to IB via code. Is there a way to fix this error in Amibroker or is it with the IB plugin?
What IB support says not always is the right thing to do. In case of any problems with IB, first thing to try is to DOWNGRADE, not upgrade, because it is IB "tradition" to introduce bugs and incompatibilities in newer releases that only get eventually fixed later if more people report problems to them. Older versions are usually more reliable than new ones.
Yes, old version worked well ... until today
I reinstalled stable version (10.19.1g) - older are not loadable - but same problem.
Which correction in code is needed? I would be very happy, if anyone could pblish a working solution.