Skip to content

Commit

Permalink
Support adding price as a String
Browse files Browse the repository at this point in the history
  • Loading branch information
thody1994 committed Jan 9, 2024
1 parent 3c2c3a1 commit b17384e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

}
}

0 comments on commit b17384e

Please sign in to comment.