¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Getting invalid prices by following the relevant market rules.


 

Hi,

Had this problem before but it seems to never go away. I'm getting
order rejects due to incorrect limit price precision, even though I'm
following the rules as I understand them.

Example:
Contract ID : 79715545)
Market Rule ID : 1918
Limit Price : 1077.6

Response to my buy? "463: You must enter a valid price".

1918 clearly states that beyond a price of 500, price increments are
0.2 (Low Edge: 500, Increment: 0.2).

So 1077.6 is not a multiple of 0.2?

Is there any way to accurately determine what the price resolution is
via IB's API, or do I just have to go and manually look these up
whenever a new stock comes into my universe?

Really frustrating.

Best,
G.


Nick
 

You might want to check the api log files to verify what is being sent to tws. If the price is the result of a calculation it might be sent as something like 1077.599998.

On 7/29/2020 2:55 PM, Graham Bygrave wrote:
Hi,

Had this problem before but it seems to never go away. I'm getting
order rejects due to incorrect limit price precision, even though I'm
following the rules as I understand them.

Example:
Contract ID : 79715545)
Market Rule ID : 1918
Limit Price : 1077.6

Response to my buy? "463: You must enter a valid price".

1918 clearly states that beyond a price of 500, price increments are
0.2 (Low Edge: 500, Increment: 0.2).

So 1077.6 is not a multiple of 0.2?

Is there any way to accurately determine what the price resolution is
via IB's API, or do I just have to go and manually look these up
whenever a new stock comes into my universe?

Really frustrating.

Best,
G.



 

Unfortunately not - I'm rounding according to the market rules right
before the price goes out (of my app).

When I go to trade the contract in TWS, the prices that appear in the
order entry screen are rounded to 0.5 (annoyingly, I originally had a
0.5 price, but I changed it to be compliant with the prescribed rules
i.e. from 1077.5 -> 1077.6).

Or to put it another way, IB's published market rules just plain wrong.


On Wed, 29 Jul 2020 15:08:59 -0400
"Nick" <news1000@...> wrote:

You might want to check the api log files to verify what is being
sent to tws. If the price is the result of a calculation it might be
sent as something like 1077.599998.


On 7/29/2020 2:55 PM, Graham Bygrave wrote:
Hi,

Had this problem before but it seems to never go away. I'm getting
order rejects due to incorrect limit price precision, even though
I'm following the rules as I understand them.

Example:
Contract ID : 79715545)
Market Rule ID : 1918
Limit Price : 1077.6

Response to my buy? "463: You must enter a valid price".

1918 clearly states that beyond a price of 500, price increments are
0.2 (Low Edge: 500, Increment: 0.2).

So 1077.6 is not a multiple of 0.2?

Is there any way to accurately determine what the price resolution
is via IB's API, or do I just have to go and manually look these up
whenever a new stock comes into my universe?

Really frustrating.

Best,
G.






 

Apols for replying to myself here, but just in case anyone goes
trawling the archives....

I've had a look at the prices being rejected and what I think is
happening is the market rules IB are publishing are just incomplete -
they don't go high enough, but their own logic does.

1918 says anything > 500 in increments of 0.2. There's nothing after
500. But the changes keep coming anyway.

So anything > 1000 is in increments of 0.5.
Anything > 2000 in increments of 1.
Anything > 10000 in increments of 5.

Not found any other examples yet, but I imagine this is what's
happening.

Would be good if IB could get their act together on this. In the
meantime, I guess building some override logic would be sensible.

Best,
G.

On Wed, 29 Jul 2020 20:26:50 +0100
"Graham Bygrave via groups.io" <graham@...> wrote:

Unfortunately not - I'm rounding according to the market rules right
before the price goes out (of my app).

When I go to trade the contract in TWS, the prices that appear in the
order entry screen are rounded to 0.5 (annoyingly, I originally had a
0.5 price, but I changed it to be compliant with the prescribed rules
i.e. from 1077.5 -> 1077.6).

Or to put it another way, IB's published market rules just plain
wrong.


On Wed, 29 Jul 2020 15:08:59 -0400
"Nick" <news1000@...> wrote:

You might want to check the api log files to verify what is being
sent to tws. If the price is the result of a calculation it might be
sent as something like 1077.599998.


On 7/29/2020 2:55 PM, Graham Bygrave wrote:
Hi,

Had this problem before but it seems to never go away. I'm
getting order rejects due to incorrect limit price precision,
even though I'm following the rules as I understand them.

Example:
Contract ID : 79715545)
Market Rule ID : 1918
Limit Price : 1077.6

Response to my buy? "463: You must enter a valid price".

1918 clearly states that beyond a price of 500, price increments
are 0.2 (Low Edge: 500, Increment: 0.2).

So 1077.6 is not a multiple of 0.2?

Is there any way to accurately determine what the price resolution
is via IB's API, or do I just have to go and manually look these
up whenever a new stock comes into my universe?

Really frustrating.

Best,
G.








 

Perhaps they just have the wrong market rule associated with this contract?

Probably best to raise it with IB. Their contract database is by no means
infallible, and they may be grateful for being notified of problems like
this.

Richard

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Graham Bygrave
Sent: 29 July 2020 20:40
To: [email protected]
Subject: Re: [TWS API] Getting invalid prices by following the relevant
market
rules.

Apols for replying to myself here, but just in case anyone goes trawling
the
archives....

I've had a look at the prices being rejected and what I think is happening
is
the market rules IB are publishing are just incomplete - they don't go
high
enough, but their own logic does.

1918 says anything > 500 in increments of 0.2. There's nothing after 500.
But
the changes keep coming anyway.

So anything > 1000 is in increments of 0.5.
Anything > 2000 in increments of 1.
Anything > 10000 in increments of 5.

Not found any other examples yet, but I imagine this is what's happening.

Would be good if IB could get their act together on this. In the
meantime, I
guess building some override logic would be sensible.

Best,
G.

On Wed, 29 Jul 2020 20:26:50 +0100
"Graham Bygrave via groups.io" <graham@...> wrote:

Unfortunately not - I'm rounding according to the market rules right
before the price goes out (of my app).

When I go to trade the contract in TWS, the prices that appear in the
order entry screen are rounded to 0.5 (annoyingly, I originally had a
0.5 price, but I changed it to be compliant with the prescribed rules
i.e. from 1077.5 -> 1077.6).

Or to put it another way, IB's published market rules just plain
wrong.


On Wed, 29 Jul 2020 15:08:59 -0400
"Nick" <news1000@...> wrote:

You might want to check the api log files to verify what is being
sent to tws. If the price is the result of a calculation it might be
sent as something like 1077.599998.


On 7/29/2020 2:55 PM, Graham Bygrave wrote:
Hi,

Had this problem before but it seems to never go away. I'm
getting order rejects due to incorrect limit price precision, even
though I'm following the rules as I understand them.

Example:
Contract ID : 79715545)
Market Rule ID : 1918
Limit Price : 1077.6

Response to my buy? "463: You must enter a valid price".

1918 clearly states that beyond a price of 500, price increments
are 0.2 (Low Edge: 500, Increment: 0.2).

So 1077.6 is not a multiple of 0.2?

Is there any way to accurately determine what the price resolution
is via IB's API, or do I just have to go and manually look these
up whenever a new stock comes into my universe?

Really frustrating.

Best,
G.









 

I've had this issue repeatedly, particularly with one specific European exchange. Orders get rejected even though the price conforms to the published market rule and price increment at the time. IB eventually admitted there was an issue and that they had "fixed" it. This was for an attempted LIVE order I attempted to place a month and a half earlier lol.
The way I could resolve it in some cases was by manually changing the market rule I used for that exchange to the rule used for a different exchange where I never had a problem, but that doesn't always work.
I would say that the issue lies either with the exchange not informing IB of an update to the market rules, but if you enter an order manually via the TWS then it tells you what the allowed price increment is, so it's odd that TWS know the correct increment, but the API doesn't know...


 

Agreed. I think it's poor show. For live trading it's inexcusable.

I (hopefully) solved my issue by tacking on increments to the 1918 rule
I get back from IB: [1000, 0.5];[2000, 1.0];[10000, 5.0]. Will see in
the trade this afternoon.

Best,
G.

On Thu, 30 Jul 2020 03:17:22 -0700
dominic.keeley@... wrote:

I've had this issue repeatedly, particularly with one specific
European exchange. Orders get rejected even though the price conforms
to the published market rule and price increment at the time. IB
eventually admitted there was an issue and that they had "fixed" it.
This was for an attempted LIVE order I attempted to place a month and
a half earlier lol. The way I could resolve it in some cases was by
manually changing the market rule I used for that exchange to the
rule used for a different exchange where I never had a problem, but
that doesn't always work. I would say that the issue lies either with
the exchange not informing IB of an update to the market rules, but
if you enter an order manually via the TWS then it tells you what the
allowed price increment is, so it's odd that TWS know the correct
increment, but the API doesn't know...



 

Actually these are related but slightly different issues.?
In you case from what I understood the increments are missing from the increments list as the prices are higher than the increments listed?
In my case my prices are within the increments listed, but the increments are just plain wrong - both ways it's not ideal! ;-)


 

Just to report back, unfortunately my "hack" didn't work and I yet
again had orders being rejected for allegedly not conforming to minimum
price variation.

But when I look in TWS, the price that was rejected via the API is
available in the pop-up list of prices when I click LMT PRICE on the
order entry screen.

Completely baffled. Have opened a support ticket with IB.

On Thu, 30 Jul 2020 05:26:51 -0700
dominic.keeley@... wrote:

Actually these are related but slightly different issues.
In you case from what I understood the increments are missing from
the increments list as the prices are higher than the increments
listed? In my case my prices are within the increments listed, but
the increments are just plain wrong - both ways it's not ideal! ;-)



 

Correcting my math in the previous post:?
?
A price of 1077 for an instrument with price multiplier 100 corresponds to:
?
LowEdge 10, Interval 1/200
?
1/200 * (100 price magnifier) = 0.5 minTick?
?
?


 

Thanks,

That's interesting - I hadn't realised there was a price multiplier - I
guess that's why I've been falling off the end of their list.

But by the sound of things, this still means my price of 1068.5 should
be ok? That's the price that got rejected. This price is available in
TWS to set as limit.

Looking at the market price rule 1918 within the context of your price
multiplier, my price of 1068.5, would be applicable to the bucket with
low edge 10.0 and increment of 0.01 (i.e. 1 pence).
That would mean I'd have to trade at either 1068 or 1069, no?

If that's true, why do I see increments of 0.5 in the TWS order entry
screen?

Bits of 1918 rule:
}, PriceIncrement {
m_lowEdge: 5.0
m_increment: 0.005
}, PriceIncrement {
m_lowEdge: 10.0
m_increment: 0.01
}, PriceIncrement {
m_lowEdge: 20.0
m_increment: 0.02
}, PriceIncrement {

Best,
G.

On Thu, 30 Jul 2020 12:43:57 -0700
"Josh via groups.io" <jb201448@...> wrote:

Correcting my math in the previous post:

A price of 1077 for an instrument with price multiplier 100
corresponds to:

LowEdge 10, Interval 1/200

1/200 * (100 price magnifier) = 0.5 minTick



 


Hello Graham, Did you find any workaround or the cause of this error? I get the same error for a particular stock (WMT) when trying to buy with a limit order on a live account even with round amount (138.00). When requesting ContractDetails I verify that the minTick is 0.01 so, that is not the problem. The same transaction goes well on the paper account but it is not accepted on the live account. Using TWS Build 981.2r, Feb 10 2021. Trying hard to find someone with a solution but no success so far. Just one guy reported that sending a request with transmit = False, waiting some time and send the same with transmit = True solved the problem.

Very?frustrating that I missed a trade yesterday due to this unpredictable transaction rejection.


 

Sorry for the double post but I wanted to let you know that I finally found the cause of this issue. It was related to the added by me in Configuration > Presets > Stock > WMT record that in some strange way interferes with the buy limit orders done by the API for WMT stock but not for the orders done by hand from the TWS. After removing this preset everything started working as expected. Unfortunately I have no time to figure out which parameter exactly was the issue but in case someone else have the same problem: you have to check also the presets in the configuration. Even though the logs in both sides show no problem with the requested price, the error message is misleading and must include information what exactly is wrong with the requested limit price.