Skip to content

Commit

Permalink
jnidzwetzki#346 Add method withPriceOcoStop to order builder
Browse files Browse the repository at this point in the history
  • Loading branch information
wgolyakov committed Apr 19, 2024
1 parent 4e49bc3 commit 2860f10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class BitfinexOrderBuilder {
private int leverage;
private BigDecimal priceTrailing;
private BigDecimal priceAuxLimit;
private BigDecimal priceOcoStop;
private Set<BitfinexOrderFlag> orderFlags;
private long groupid = -1;
private String affiliateCode;
Expand Down Expand Up @@ -101,6 +102,16 @@ public BitfinexOrderBuilder withPriceAuxLimit(final BigDecimal price) {
return this;
}

public BitfinexOrderBuilder withPriceOcoStop(final double price) {
this.priceOcoStop = BigDecimal.valueOf(price);
return this;
}

public BitfinexOrderBuilder withPriceOcoStop(final BigDecimal price) {
this.priceOcoStop = price;
return this;
}

public BitfinexOrderBuilder withGroupId(final int groupId) {
this.groupid = groupId;
return this;
Expand All @@ -121,6 +132,7 @@ public BitfinexOrder build() {
order.setAmount(amount);
order.setPriceTrailing(priceTrailing);
order.setPriceAuxLimit(priceAuxLimit);
order.setPriceOcoStop(priceOcoStop);
order.setOrderFlags(orderFlags);
order.setAffiliateCode(affiliateCode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public void testOrderCommand() throws BitfinexCommandException {
.withLeverage(5)
.withPriceAuxLimit(23)
.withPriceTrailing(23)
.withPriceOcoStop(24)
.withGroupId(4)
.withAffiliateCode("qYpFPFPs")
.build();
Expand All @@ -126,6 +127,7 @@ public void testOrderCommand() throws BitfinexCommandException {
Assert.assertTrue(commandValue.length() > 10);
Assert.assertTrue(commandValue.contains("\"2.0\""));
Assert.assertTrue(commandValue.contains("\"lev\":5"));
Assert.assertTrue(commandValue.contains("\"price_oco_stop\":\"24.0\""));
Assert.assertTrue(commandValue.contains("\"aff_code\":\"qYpFPFPs\""));
}

Expand Down

0 comments on commit 2860f10

Please sign in to comment.