Permalink
Browse files

Create position model (#1723)

Each type of security now needs its own position class
This allows processing in the calculation runner
  • Loading branch information...
jodastephen authored and andreiruse committed Jun 8, 2018
1 parent 690027f commit c7f04a87c87fd41316588f47b04898dc3dbebfad
Showing with 5,379 additions and 8 deletions.
  1. +15 −0 modules/product/src/main/java/com/opengamma/strata/product/GenericSecurity.java
  2. +34 −0 modules/product/src/main/java/com/opengamma/strata/product/Security.java
  3. +615 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/BondFutureOptionPosition.java
  4. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/BondFutureOptionSecurity.java
  5. +616 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/BondFuturePosition.java
  6. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/BondFutureSecurity.java
  7. +615 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/CapitalIndexedBondPosition.java
  8. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/CapitalIndexedBondSecurity.java
  9. +6 −4 modules/product/src/main/java/com/opengamma/strata/product/bond/CapitalIndexedBondTrade.java
  10. +615 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/FixedCouponBondPosition.java
  11. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/bond/FixedCouponBondSecurity.java
  12. +6 −4 modules/product/src/main/java/com/opengamma/strata/product/bond/FixedCouponBondTrade.java
  13. +616 −0 modules/product/src/main/java/com/opengamma/strata/product/dsf/DsfPosition.java
  14. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/dsf/DsfSecurity.java
  15. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/etd/EtdFutureSecurity.java
  16. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/etd/EtdOptionSecurity.java
  17. +623 −0 modules/product/src/main/java/com/opengamma/strata/product/index/IborFutureOptionPosition.java
  18. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/index/IborFutureOptionSecurity.java
  19. +622 −0 modules/product/src/main/java/com/opengamma/strata/product/index/IborFuturePosition.java
  20. +16 −0 modules/product/src/main/java/com/opengamma/strata/product/index/IborFutureSecurity.java
  21. +6 −0 modules/product/src/test/java/com/opengamma/strata/product/GenericSecurityTest.java
  22. +104 −0 modules/product/src/test/java/com/opengamma/strata/product/bond/BondFutureOptionPositionTest.java
  23. +17 −0 modules/product/src/test/java/com/opengamma/strata/product/bond/BondFutureOptionSecurityTest.java
  24. +104 −0 modules/product/src/test/java/com/opengamma/strata/product/bond/BondFuturePositionTest.java
  25. +17 −0 modules/product/src/test/java/com/opengamma/strata/product/bond/BondFutureSecurityTest.java
  26. +104 −0 modules/product/src/test/java/com/opengamma/strata/product/bond/CapitalIndexedBondPositionTest.java
  27. +104 −0 modules/product/src/test/java/com/opengamma/strata/product/bond/FixedCouponBondPositionTest.java
  28. +19 −0 modules/product/src/test/java/com/opengamma/strata/product/bond/FixedCouponBondSecurityTest.java
  29. +104 −0 modules/product/src/test/java/com/opengamma/strata/product/dsf/DsfPositionTest.java
  30. +17 −0 modules/product/src/test/java/com/opengamma/strata/product/dsf/DsfSecurityTest.java
  31. +7 −0 modules/product/src/test/java/com/opengamma/strata/product/etd/EtdFutureSecurityTest.java
  32. +7 −0 modules/product/src/test/java/com/opengamma/strata/product/etd/EtdOptionSecurityTest.java
  33. +104 −0 modules/product/src/test/java/com/opengamma/strata/product/index/IborFutureOptionPositionTest.java
  34. +17 −0 modules/product/src/test/java/com/opengamma/strata/product/index/IborFutureOptionSecurityTest.java
  35. +104 −0 modules/product/src/test/java/com/opengamma/strata/product/index/IborFuturePositionTest.java
  36. +17 −0 modules/product/src/test/java/com/opengamma/strata/product/index/IborFutureSecurityTest.java
@@ -104,6 +104,21 @@ public GenericSecurityTrade createTrade(TradeInfo info, double quantity, double
return new GenericSecurityTrade(info, this, quantity, tradePrice);
}
@Override
public GenericSecurityPosition createPosition(PositionInfo tradeInfo, double quantity, ReferenceData refData) {
return GenericSecurityPosition.ofNet(tradeInfo, this, quantity);
}
@Override
public GenericSecurityPosition createPosition(
PositionInfo positionInfo,
double longQuantity,
double shortQuantity,
ReferenceData refData) {
return GenericSecurityPosition.ofLongShort(positionInfo, this, longQuantity, shortQuantity);
}
//------------------------- AUTOGENERATED START -------------------------
/**
* The meta-bean for {@code GenericSecurity}.
@@ -107,4 +107,38 @@ public abstract SecurityQuantityTrade createTrade(
double tradePrice,
ReferenceData refData);
/**
* Creates a position based on this security from a net quantity.
* <p>
* This creates a position of a suitable type for this security.
*
* @param positionInfo the position information
* @param quantity the number of contracts in the position
* @param refData the reference data used to find underlying securities
* @return the position
*/
public abstract Position createPosition(
PositionInfo positionInfo,
double quantity,
ReferenceData refData);
/**
* Creates a position based on this security from a long and short quantity.
* <p>
* This creates a position of a suitable type for this security.
* <p>
* The long quantity and short quantity must be zero or positive, not negative.
*
* @param positionInfo the position information
* @param longQuantity the long quantity in the position
* @param shortQuantity the short quantity in the position
* @param refData the reference data used to find underlying securities
* @return the position
*/
public abstract Position createPosition(
PositionInfo positionInfo,
double longQuantity,
double shortQuantity,
ReferenceData refData);
}
Oops, something went wrong.

0 comments on commit c7f04a8

Please sign in to comment.