I can see nothing wrong with your PriceCondition code. It should just work the way you had it, but you can check the (deprecated but still superior) documentation at .
The API version your code shows (176 introduced in 10.19.01) is very close to the TWS version you use, but you might still want to log MaxVersion and serverVersion at run-time to make sure your client does not pickup a different library or something goes wrong during the connection setup.
We had posts about TWS 10.30 a couple weeks back where messages between TWS and clients got out of sync in some scenarios, but that was related to messages from TWS to the client. I don't think that your problem is related to that, since in my setup, PriceConditions work just fine with TWS 30.10.1l and the Java API.
But you could try with an instance of "Offline TWS 10.19.2o" just to be sure. You can control versioning with the offline versions, since they don;t randomly update on you. Also, the "stable" TWS version 10.19.2o is? uses the same API level as your client seems to use.
The most definite evidence for what is going on (and probably most expedient way for debugging) is the API log entry from? TWS for the placeOrder request. Below the message TWS receives for a MKT order for ESU4 with a PriceCondition of "OR Price < 2000 with Trigger LAST". I ran this on "Offline TWS 10.30.1l", the message is broken into a few lines (for clarity), and the portion where the array of order conditions is located in the message is highlighted :
- A "1" for and array of order conditions of size 1
- The price order condition highlighted in green
- The conditionsIgnoreRth field that your TWS reports as the error location and conditionsCancelOrder
Let us know what you find.
´³¨¹°ù²µ±ð²Ô
?
3-3-568550526-ES-FUT-20240920-0.0--50-CME--USD-ESU4-ES---BUY-1-MKT---GTC
----0--1-0-0-0-0-0-0-0--1.7976931348623157E308--------0---1-0---0---0-0--0------0--
2147483647---0-2147483647----------0---0-0---0--0-0-0-1-
1-o-0-2000-568550526-CME-2-1-0
--1.7976931348623157E308-1.7976931348623157E308-1.7976931348623157E308
-1.7976931348623157E308-1.7976931348623157E308-0---------0-0-0--2147483647-2147483647-0---
?
?
On Sun, Aug 18, 2024 at 10:07 AM, Robby wrote:
toggle quoted message
Show quoted text
I think you suggestion makes sense. It is most like caused by the compatibility between the TWS API library i am using and the TWS software itself. TWS keeps upgrading itself automatically but my TWS API was from a snapshot a little while ago.
?
There is no officially TWS API C# library build. I think I simply got the source code and compile it myself. I can see the Constants is defined as below.
?
namespace IBApi
{
? ? public static class Constants
? ? {
? ? ? ? public const int ClientVersion = 66;//API v. 9.71
? ? ? ? public const byte EOL = 0;
? ? ? ? public const string BagSecType = "BAG";
? ? ? ? public const int REDIRECT_COUNT_MAX = 2;
? ? ? ? public const string INFINITY_STR = "Infinity";
? ? ? ? public const int FaGroups = 1;
? ? ? ? public const int FaProfiles = 2;
? ? ? ? public const int FaAliases = 3;
? ? ? ? public const int MinVersion = 100;
? ? ? ? public const int MaxVersion = MinServerVer.MIN_SERVER_VER_BOND_ISSUERID;
? ? ? ? public const int MaxMsgSize = 0x00FFFFFF;
? ? }
}
MIN_SERVER_VER_BOND_ISSUERID's value is 176 in MinServerVer.
?
?
My TWS is update to date and her is the version information.
?
Trader Workstation Copyright ? 2000-2024 LICENSOR to Interactive Brokers ALL RIGHTS RESERVED ?Build 10.30.1l, Aug 13, 2024 4:01:03 PM Jolt Build 1.18.11, Nov 17, 2023 03:25:51 PM Nia Build 2.25.1, May 31, 2024 06:07:02 PM ModelNav Build 1.13.2, Jan 24, 2022 04:59:21 PM Riskfeed Build 2.45.10, Jun 7, 2024 10:46:27 AM ?Java Version: 1.8.0_202, OS: Windows 10 (amd64, 10.0), Memory: heap max 4096Mb, current 184Mb?
?
Can anyone give me an example how you use the PriceCondition? I used to be able to find some on Interactive Broker's documentation but after they reorganized their API documentation, I don't see any such example now.
?
?