Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-300

"BigDecimal" build of QuickFIX/J doesn't preserve precision in quantities

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Default
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.3.2
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      ant -Dgenerator.decimal=true

      Description

      When you use a "BigDecimal" build of QuickFIX/J, it should preserve the scale of the number inside a message. For example, if I set the Price field to be "10.3000" I should get that same value (with the trailing zeroes) back from fieldMap.getDecimal(), and similar calls. Included is a simple test.

      	public void testQuickFIXAssumptions() throws FieldNotFound, InvalidMessage{
      		BigDecimal originalPrice = new BigDecimal("10.3000");
      		assertEquals(4, originalPrice.scale());
      		Message message = new Message();
      		message.setField(new Price(new BigDecimal("10.3000")));
      		BigDecimal extractedPrice = message.getDecimal(Price.FIELD);
      		assertEquals(4, extractedPrice.scale());
      		assertEquals(new BigDecimal("10.3000"), extractedPrice);
      		String newOrderString = message.toString();
      		Message rehydratedMessage = new Message(newOrderString);
      		BigDecimal rehydratedPrice = rehydratedMessage.getDecimal(Price.FIELD);
      		assertEquals(new BigDecimal("10.3000"), rehydratedPrice);
      		assertEquals(4, rehydratedPrice.scale());
      	}
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gmillermarket Graham Miller
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: