diff --git a/nanofix-client/src/main/java/com/lmax/nanofix/outgoing/FixMessageBuilder.java b/nanofix-client/src/main/java/com/lmax/nanofix/outgoing/FixMessageBuilder.java index 4cb82cc..f52853e 100644 --- a/nanofix-client/src/main/java/com/lmax/nanofix/outgoing/FixMessageBuilder.java +++ b/nanofix-client/src/main/java/com/lmax/nanofix/outgoing/FixMessageBuilder.java @@ -240,6 +240,11 @@ public FixMessageBuilder price(final BigDecimal price) return addTag(Price.getTag(), price.toPlainString()); } + public FixMessageBuilder price(final String price) + { + return addTag(Price.getTag(), price); + } + public FixMessageBuilder securityID(final String symbol) { return addTag(SecurityID.getTag(), symbol); diff --git a/nanofix-client/src/test/java/com/lmax/nanofix/outgoing/FixMessageBuilderTest.java b/nanofix-client/src/test/java/com/lmax/nanofix/outgoing/FixMessageBuilderTest.java index a20270d..2835741 100644 --- a/nanofix-client/src/test/java/com/lmax/nanofix/outgoing/FixMessageBuilderTest.java +++ b/nanofix-client/src/test/java/com/lmax/nanofix/outgoing/FixMessageBuilderTest.java @@ -67,4 +67,15 @@ public void shouldBuildAnInvalidFixMessageBecauseOfTagOrder() assertThat(fixMessage.toFixString(), is("8=FIX.4.2\u00019=24\u000134=100\u0001123=Y\u000135=4\u000136=10\u000110=065\u0001")); } + + @Test + public void shouldBuildFixMessageContainingPriceWithTrailingZeros() + { + FixMessage fixMessage = new FixMessageBuilder("FIX.4.2") + .price("10.0000") + .build(); + + assertThat(fixMessage.toFixString(), is("8=FIX.4.2\u00019=11\u000144=10.0000\u000110=237\u0001")); + + } } \ No newline at end of file