From 4443775b6714c2df0a44cdb161ce02fb45fc9806 Mon Sep 17 00:00:00 2001 From: Victor Philip Date: Thu, 16 Jul 2020 10:40:06 -0400 Subject: [PATCH] renames the OrderLegCollection class to better represent order legs --- .../java/com/studerw/tda/model/account/Order.java | 14 +++++++------- .../{OrderLegCollection.java => OrderLeg.java} | 2 +- .../studerw/tda/model/account/OrderStrategy.java | 8 ++++---- .../com/studerw/tda/client/FetchOrdersTestIT.java | 14 +++++++------- .../com/studerw/tda/parse/TdaJsonParserTest.java | 10 +++++----- 5 files changed, 24 insertions(+), 24 deletions(-) rename src/main/java/com/studerw/tda/model/account/{OrderLegCollection.java => OrderLeg.java} (98%) diff --git a/src/main/java/com/studerw/tda/model/account/Order.java b/src/main/java/com/studerw/tda/model/account/Order.java index e76fff5..58cf3cb 100644 --- a/src/main/java/com/studerw/tda/model/account/Order.java +++ b/src/main/java/com/studerw/tda/model/account/Order.java @@ -93,7 +93,7 @@ public class Order implements Serializable { private TaxLotMethod taxLotMethod; @JsonProperty("orderLegCollection") - private List orderLegCollection = new ArrayList<>(); + private List orderLegs = new ArrayList<>(); @JsonProperty("activationPrice") private BigDecimal activationPrice; @@ -308,13 +308,13 @@ public void setTaxLotMethod(TaxLotMethod taxLotMethod) { this.taxLotMethod = taxLotMethod; } - public List getOrderLegCollection() { - return orderLegCollection; + public List getOrderLegs() { + return orderLegs; } - public void setOrderLegCollection( - List orderLegCollection) { - this.orderLegCollection = orderLegCollection; + public void setOrderLegs( + List orderLegs) { + this.orderLegs = orderLegs; } public BigDecimal getActivationPrice() { @@ -466,7 +466,7 @@ public String toString() { .append("priceLinkType", priceLinkType) .append("price", price) .append("taxLotMethod", taxLotMethod) - .append("orderLegCollection", orderLegCollection) + .append("orderLegs", orderLegs) .append("activationPrice", activationPrice) .append("specialInstruction", specialInstruction) .append("orderStrategyType", orderStrategyType) diff --git a/src/main/java/com/studerw/tda/model/account/OrderLegCollection.java b/src/main/java/com/studerw/tda/model/account/OrderLeg.java similarity index 98% rename from src/main/java/com/studerw/tda/model/account/OrderLegCollection.java rename to src/main/java/com/studerw/tda/model/account/OrderLeg.java index feef3f7..bee7dc3 100644 --- a/src/main/java/com/studerw/tda/model/account/OrderLegCollection.java +++ b/src/main/java/com/studerw/tda/model/account/OrderLeg.java @@ -12,7 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; @JsonInclude(JsonInclude.Include.NON_EMPTY) -public class OrderLegCollection implements Serializable { +public class OrderLeg implements Serializable { private final static long serialVersionUID = -6019542088004898750L; diff --git a/src/main/java/com/studerw/tda/model/account/OrderStrategy.java b/src/main/java/com/studerw/tda/model/account/OrderStrategy.java index 3d00afa..a413642 100644 --- a/src/main/java/com/studerw/tda/model/account/OrderStrategy.java +++ b/src/main/java/com/studerw/tda/model/account/OrderStrategy.java @@ -83,7 +83,7 @@ public class OrderStrategy implements Serializable { private TaxLotMethod taxLotMethod; @JsonProperty("orderLegCollection") - private List orderLegCollection = new ArrayList<>(); + private List orderLegs = new ArrayList<>(); @JsonProperty("activationPrice") private BigDecimal activationPrice; @@ -213,8 +213,8 @@ public TaxLotMethod getTaxLotMethod() { return taxLotMethod; } - public List getOrderLegCollection() { - return orderLegCollection; + public List getOrderLegCollection() { + return orderLegs; } public BigDecimal getActivationPrice() { @@ -305,7 +305,7 @@ public String toString() { .append("priceLinkType", priceLinkType) .append("price", price) .append("taxLotMethod", taxLotMethod) - .append("orderLegCollection", orderLegCollection) + .append("orderLegs", orderLegs) .append("activationPrice", activationPrice) .append("specialInstruction", specialInstruction) .append("orderStrategyType", orderStrategyType) diff --git a/src/test/java/com/studerw/tda/client/FetchOrdersTestIT.java b/src/test/java/com/studerw/tda/client/FetchOrdersTestIT.java index 3c9753e..b859dcd 100644 --- a/src/test/java/com/studerw/tda/client/FetchOrdersTestIT.java +++ b/src/test/java/com/studerw/tda/client/FetchOrdersTestIT.java @@ -7,9 +7,9 @@ import com.studerw.tda.model.account.EquityInstrument; import com.studerw.tda.model.account.Instrument; import com.studerw.tda.model.account.Order; -import com.studerw.tda.model.account.OrderLegCollection; -import com.studerw.tda.model.account.OrderLegCollection.Instruction; -import com.studerw.tda.model.account.OrderLegCollection.QuantityType; +import com.studerw.tda.model.account.OrderLeg; +import com.studerw.tda.model.account.OrderLeg.Instruction; +import com.studerw.tda.model.account.OrderLeg.QuantityType; import com.studerw.tda.model.account.OrderRequest; import com.studerw.tda.model.account.OrderStrategyType; import com.studerw.tda.model.account.OrderType; @@ -134,10 +134,10 @@ private Order simpleOrder() { order.setDuration(Duration.DAY); order.setOrderStrategyType(OrderStrategyType.SINGLE); - OrderLegCollection olc = new OrderLegCollection(); + OrderLeg olc = new OrderLeg(); olc.setInstruction(Instruction.SELL); olc.setQuantity(new BigDecimal("360.888")); - order.getOrderLegCollection().add(olc); + order.getOrderLegs().add(olc); Instrument instrument = new EquityInstrument(); instrument.setSymbol("F"); @@ -154,11 +154,11 @@ private Order simpleOrder2() { order.setOrderStrategyType(OrderStrategyType.SINGLE); order.setStopPrice(new BigDecimal("4.7")); - OrderLegCollection olc = new OrderLegCollection(); + OrderLeg olc = new OrderLeg(); olc.setInstruction(Instruction.SELL); olc.setQuantity(new BigDecimal("360.888")); olc.setQuantityType(QuantityType.SHARES); - order.getOrderLegCollection().add(olc); + order.getOrderLegs().add(olc); Instrument instrument = new EquityInstrument(); instrument.setSymbol("F"); diff --git a/src/test/java/com/studerw/tda/parse/TdaJsonParserTest.java b/src/test/java/com/studerw/tda/parse/TdaJsonParserTest.java index c3d54a1..9616a9e 100644 --- a/src/test/java/com/studerw/tda/parse/TdaJsonParserTest.java +++ b/src/test/java/com/studerw/tda/parse/TdaJsonParserTest.java @@ -16,9 +16,9 @@ import com.studerw.tda.model.account.Order; import com.studerw.tda.model.account.OrderActivity; import com.studerw.tda.model.account.OrderActivity.ExecutionType; -import com.studerw.tda.model.account.OrderLegCollection; -import com.studerw.tda.model.account.OrderLegCollection.Instruction; -import com.studerw.tda.model.account.OrderLegCollection.OrderLegType; +import com.studerw.tda.model.account.OrderLeg; +import com.studerw.tda.model.account.OrderLeg.Instruction; +import com.studerw.tda.model.account.OrderLeg.OrderLegType; import com.studerw.tda.model.account.OrderStrategyType; import com.studerw.tda.model.account.Position; import com.studerw.tda.model.account.SecuritiesAccount; @@ -270,7 +270,7 @@ public void testParseOrders() throws IOException { assertThat(order.getEditable()).isFalse(); assertThat(order.getQuantity()).isEqualTo("15.0"); - OrderLegCollection olc = order.getOrderLegCollection().get(0); + OrderLeg olc = order.getOrderLegs().get(0); assertThat(olc.getOrderLegType()).isEqualTo(OrderLegType.EQUITY); assertThat(olc.getInstruction()).isEqualTo(Instruction.BUY); assertThat(olc.getQuantity()).isEqualTo("15.0"); @@ -296,7 +296,7 @@ public void testParseOrders2() throws IOException { assertThat(order.getQuantity()).isEqualTo("360.0"); - OrderLegCollection olc = order.getOrderLegCollection().get(0); + OrderLeg olc = order.getOrderLegs().get(0); assertThat(olc.getOrderLegType()).isEqualTo(OrderLegType.EQUITY); assertThat(olc.getInstruction()).isEqualTo(Instruction.SELL); assertThat(olc.getQuantity()).isEqualTo("360.0");