Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Error 110. The price does not conform to the minimum price variation for this contract
Hi ´³¨¹°ù²µ±ð²Ô,
Yes, I run into that all the time.? I use Excel (aarggh!) and I think it's even worse. So I round at the very last step in an order right before I'm done.? I had to do this when trading Forex on IB and it drove me nuts. As always, thanks again and be well, Lou Dudka |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Multiple symbol request speed
Hello i new here i try get data for multiple symbol,
about 580 +-, but it take allot time and not always finish this. this how i try make this.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Error 110. The price does not conform to the minimum price variation for this contract
Thank you, Lou. Glad we pointed you in the right direction. You won;t be able to "round yourself" out of the problem completely. Even double precision floating point math can be pretty tricky and randomly generates very imprecise results in certain cases. Take the 35.16, for example (one of your prices). Here a couple example with Java double values:
It is common practice in financial software to use a Decimal or fixed point data type instead of? float and double. In fact IBKR introduced a Decimal data type in TWS API 10.10 and changed the size fields for many objects from double to Decimal (probably for crypto support). Interesting though that they left all price fields unchanged as double. Here the results with a Java decimal type:
Internally, we use a Decimal type for all our applications as well. Makes calculations a little more cumbersome to code but makes for much better and controlled outcomes. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Error 110. The price does not conform to the minimum price variation for this contract
Nick/´³¨¹°ù²µ±ð²Ô,
You guys are good! Sure as anything prices of 41.3999 and 44.3999 were sent! I'll have to check my code b/c I always round up/down to the correct amount before submitting an order, except, obviously, this time. Thanks, as always, and be well, Lou Dudka |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Error 110. The price does not conform to the minimum price variation for this contract
That was my first reaction as well. The ? say: ´³¨¹°ù²µ±ð²Ô On Fri, Oct 22, 2021 at 06:09 PM, Nick wrote: ... |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Error 110. The price does not conform to the minimum price variation for this contract
Nick
You can check the api log to see what was actually sent to IB.
toggle quoted message
Show quoted text
Depending on the language and how floating point numbers are converted to text their may be differences in rounding from what you show in your logs. The api log should help you track down the issue (either sending an invalid price or an issue on IB's end). On 10/22/2021 6:50 PM, Lou Dudka wrote:
and received the error on the BKT StopLoss order STPLMT Shr:290 Limit:45.40 Aux:41.40 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Get and close all positions at a specific time
Your approach will work most of the time, but things do go wrong and you exposure yourself to some degree of risk that your orders and positions do not get closed and will stay open past the end of the trading session:
´³¨¹°ù²µ±ð²Ô |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Error 110. The price does not conform to the minimum price variation for this contract
Hi All,
There is a topic on this subject from 2016.? It just doesn't seem to add up. I tried to place a bracket Sell Order for NIO thru the API.? This is the output from my logs: BKT Entry order??? STPLMT Shr:290 Limit:38.96 Aux:38.96 BKT Profit order?? LMT??? Shr:290 Limit:35.16 BKT StopLoss order STPLMT Shr:290 Limit:45.40 Aux:41.40 and received the error on the BKT StopLoss order STPLMT Shr:290 Limit:45.40 Aux:41.40 Error 110. The price does not conform to the minimum price variation for this contract The Entry and Profit order both went thru just fine. I received this simultaneously on the test and production systems. Thanks and be well, Lou Dudka |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Get and close all positions at a specific time
Thanks Jurgen!
I saw your approach and it's a really good one. However my use-case turned out to be really straight forward (cancel all api and tws orders and close all positions at 3:45). So I ended up using reqGlobalCancel() for cancelling orders and reqAccountUpdated() alongwith updatePortfolio() to get positions on each entity and place orders opposite to positions.?? |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Fractional shares rounding issue
Just like in all API implementations, MinClientVersion and MaxClientVersion in ib_insync are constants. They are attributes of the client class and while I am not a Python practitioner, I am sure it is straight forward to extract their values in client programs on-the-fly. Along with the server version. I also did some more digging on and it looks like what you are doing requires a TWS of Version 979 or above. TWS 10.10 or API level 165 are not required. TWS 10.10 and API level 165 are required for crypto support and fractional sizes in market data related objects (Bar, TickByTick*, ...) Not sure what to suggest other than maybe going trying a stable TWS below 10.10 (say 981.3d). We had lots of issues with 10.10 versions of earlier this month. ´³¨¹°ù²µ±ð²Ô |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Get and close all positions at a specific time
Nick
¿ªÔÆÌåÓýYou could have the exit orders in an OCA group and add one more
to buy/sell at market with a "good after" time of 3:45. On 10/20/2021 3:38 PM,
movais996@... wrote:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Get and close all positions at a specific time
Take a look at the of the API Reference Guide. When you place orders, you can also use to attach a condition for when the order should become active. One such condition is the TimeCondition which allows you to place an order sometime throughout the day but that does not become active until 3:45pm (or any other time). ´³¨¹°ù²µ±ð²Ô |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Fractional shares rounding issue
Nick
Yes, that's the api log but unfortunately IB isn't showing the fields from the initial connection which is where the version numbers are. I couldn't remember if they were included or not but figured if you already had the logs it was worth a chance.
toggle quoted message
Show quoted text
Maybe you could ask in the ib_insync group and they could tell you how to get a version of the lib that has the features you need. On 10/19/2021 11:16 PM, hieuimba@... wrote:
Just so we're on the same page, |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Fractional shares rounding issue
Just so we're on the same page, I believe you are talking about this API log right:?
Due to privacy regulations, logs are?encrypted?before they are saved to disk. They can be decrypted from the associated TWS or IB Gateway session. In TWS: Classic TWS -> Account -> Diagnostics -> TWS Logs. In IB Gateway, File -> Gateway Logs.If I have it correct it should be this file: C:\Jts\oboecfmlfmiihkmhcllfnckaeplfhfnchppdchbn\api.0.20211019.162140.ibgzenc However, I couldn't find any "API" text, here are the first few lines of the log: ============================== Log file: C:\Jts\oboecfmlfmiihkmhcllfnckaeplfhfnchppdchbn\api.0.20211019.162140.ibgzenc =============================
16:21:40:453 -> ---15-1-[MyAccountID]-
16:21:40:475 -> ---9-1-8-
16:21:40:476 -> ---54-2--1-2104-Market data farm connection is OK:usfarm-
16:21:40:476 -> ---34-2--1-2106-HMDS data farm connection is OK:ushmds-
16:21:40:476 -> ---84-2--1-2158-Sec-def data farm connection is OK:secdefnj-
16:21:40:477 <- 15-1-1- 16:21:40:477 <- 61-1- |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Fractional shares rounding issue
Nick
I haven't looked at the api logs in a while. If the logs include the connect processing (ie the very first things the client sends to tws) then the version numbers will be in there.
toggle quoted message
Show quoted text
Assuming it's the newer protocol you will see the client sending the text "API" and "V100..NNN" where NNN is the max version the client can support. Then TWS will send the actual server version followed by connect time. On 10/19/2021 10:28 PM, hieuimba@... wrote:
I might have to go ask the guys at ib_insync on how to track down MinClientVersion and MaxClientVersion |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Re: Fractional shares rounding issue
Welp that explains it.
toggle quoted message
Show quoted text
I might have to go ask the guys at ib_insync on how to track down MinClientVersion and MaxClientVersion? However, the ibapi package probably came with the library because I didn't explicitly download or install it, which would imply that the API version is outdated in the package But again I'm using the same or even older version of the library on my other machine and it works fine Will have to confirm and see? On Tue, Oct 19, 2021 at 08:14 PM, ´³¨¹°ù²µ±ð²Ô Reinold wrote:
Sure, a lot of them actually, I was quite surprised when I found out about this too. Pretty much all the large and medium caps, I've only had one instance where fractional sizes weren't supported and it was with a very small stock? |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||