NOTE: Jira is for bug reports and feature requests.
If you are entering an issue to ask a question,
please use the QuickFIX/J support options. Thank you.

Issue Details (XML | Word | Printable)

Key: QFJ-77
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Default Default
Assignee: Steve Bate
Reporter: Steve Bate
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
QuickFIX/J

Support big decimal in message generation.

Created: 25/Sep/06 02:57 PM   Updated: 04/Jul/07 07:37 PM
Component/s: Message Generation
Affects Version/s: None
Fix Version/s: 1.2.0


 Description  « Hide
Provide a new field type that can be specified in a custom data dictionary. This field type would cause the generated code to use BigDecimal instead of doubles.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Rob Gilliam added a comment - 27/Mar/07 01:10 PM
I would suggest instead just ditching double and Double altogether and using BigDecimal instead for ALL fields of FIX type "float", as very few monetary values (for example) can actually be represented in IEEE 754 format with 100% accuracy

Also, I'm currently working round issues with, for example, "Percentage" format fields which need to be multiplied by 100 to get from the factor value that FIX specifies to the percentage value needed by our system (e.g. from "0.0386" to 3.86%) as this may introduce rounding errors and/or make previously-ignorable inaccuracies significant: for example multiplying a BidYield of 0.0386 by 100.0 and converting the result to String results in 3.8600000000000003 (%)

I'm therefore having to extract field data using Message.getString(int) and then construct a BigDecimal from the String value. My life would be MUCH easier if DoubleField.getValue() just returned a BigDecimal! OK, for backwards compatibilty it might be necessary to add a DoubleField.getBigDecimal() method instead, plus appropriate implementations of DoubleField.setValue(BigDecimal) and valueEquals(BigDecimal)


Steve Bate added a comment - 10/Jun/07 06:38 PM
There is an option for the code generator to use BigDecimal instead of double for fields like price and quantity. The generated code can be used as a replacement for the default QFJ message JARs. The enabled the feature pass a "-Dgenerator.decimal" option on the command line when running the generate.code Ant target.