¿ªÔÆÌåÓý

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

Re: API error - Your API version does not support fractional size rules (during forex price extraction)


 

There have been many changes between TWS API V9 and V10, but the one with the most impact is the transition of most "size" fields in classes and method signatures from "int/long" or "double" types to a "Decimal" data type. You need to look at the TWS API source code for the language you are using so see what that means exactly for you, since their approach was a little different for each language. Take a look, for example, at the totalQuantity or filledQuantity fields of the Order class in one of the more recent V10 versions.

"Decimal" math assures stability to the right of the decimal point/comma well beyond what floating point math can achieve. That became important with the introduction of fractional shares and crypto trading. You don't want to lose a small fortune just because trade quantities accumulate impressions every time you do a simple math operation.

Even a simple addition such as 1.123 plus 1.456, for example, cannot be done precisely in binary floating point math::
  • You would get 2.5789999961853027 in standard "four byte float" math
  • You would get 2.5789999999999997 in standard "eight byte double" math.
  • While you get the expected 2.579 with a "Decimal" data type

"Decimal" types are generally more cumbersome to work with, though, since have to call methods even for simple arithmetic functions such as a.plus( b ).multiplyBy( c ). But details, as I said, are language specific.

´³¨¹°ù²µ±ð²Ô

On Tue, Jan 3, 2023 at 11:02 AM, Mark Murari wrote:

"IB support mentioned they changed the variable type of AUD.USD to decimal"

Having this issue myself. Could someone please shed some light on what is a 'decimal' variable type and how does differ from the variable type they used before?

Thanks!

Join [email protected] to automatically receive all group messages.