[QFJ-411] Issue with formatting of Double Fields like the price field etc. Created: 04/Mar/09  Updated: 15/Nov/12  Resolved: 15/Jan/10

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.3.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Ketan Chaudhry Assignee: Unassigned
Resolution: Not a bug Votes: 0
Labels: None
Environment:

OS: Solaris Software: Java JRE 1.5.0_10



 Description   

Hi,
We are using QuickFIX/J version 1.3.3 as the FIX Engine in our Financial application, which services QuoteRequests and Trade Requests received from our counterparty. While our application passes along precisely rounded (to 2 decimal places) Price field value in the Execution Report to QFJ, this precision is lost when QFJ creates the string FIX message(4.21 becomes 4.299999999998). Our counterparty truncates the values received, instead of rounding it, thus receiving 4.28 instead of 4.29). This creates a considerable pricing issue depending on the precision.

However, we would like to know if this issue been taken care of ? Are there any immediate fixes available?
Would really appreciate your help on this.

Thanks



 Comments   
Comment by Toli Kuznets [ 04/Mar/09 ]

I believe this is an inherent problem with using doubles.
You can recompile QFJ to use BigDecimals instead, which preserves the values correctly, and then puts them on the wire as a string in the right format before sending the message out.

You can recompile QFJ with -Dgenerator.decimal=true to get BigDecimals instead
See http://www.quickfixj.org/quickfixj/usermanual/usage/codegen.html ( the flag in 1.3.3 is -Dgenerator.decimal)

that should solve your problem. this is what we do.

Comment by Jörg Thönnes [ 06/Mar/09 ]

Alternatively, you can use setString() to set the String value from the BigDecimal directly.
In this way you bypass the double conversion.

Of course, Tolis suggestions to use the BigDecimal build is the more general one.

Generated at Sat Nov 23 15:40:36 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.