Interface EtdPosition
-
- All Superinterfaces:
CalculationTarget,PortfolioItem,Position,SecurityQuantity
- All Known Implementing Classes:
EtdFuturePosition,EtdOptionPosition
public interface EtdPosition extends Position
A position in an ETD, where the security is embedded ready for mark-to-market pricing.This represents a position in an ETD, defined by long and short quantity. The ETD security is embedded directly.
The net quantity of the position is stored using two fields -
longQuantityandshortQuantity. These two fields must not be negative. In many cases, only a long quantity or short quantity will be present with the other set to zero. However it is also possible for both to be non-zero, allowing long and short positions to be treated separately. The net quantity is available viagetQuantity().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default CurrencygetCurrency()Gets the currency of the position.doublegetLongQuantity()Gets the long quantity of the security.doublegetQuantity()Gets the net quantity of the security.EtdSecuritygetSecurity()Gets the underlying ETD security.default SecurityIdgetSecurityId()Gets the security identifier.doublegetShortQuantity()Gets the short quantity of the security.default EtdTypegetType()Gets the type of the contract - future or option.EtdPositionwithInfo(PortfolioItemInfo info)Returns an instance with the specified info.default EtdPositionwithQuantities(double longQuantity, double shortQuantity)Returns an instance with the specified quantities.EtdPositionwithQuantity(double quantity)Returns an instance with the specified net quantity.-
Methods inherited from interface com.opengamma.strata.product.PortfolioItem
getId
-
-
-
-
Method Detail
-
getCurrency
default Currency getCurrency()
Gets the currency of the position.This is the currency of the security.
- Returns:
- the trading currency
-
getSecurity
EtdSecurity getSecurity()
Gets the underlying ETD security.- Returns:
- the ETD security
-
getType
default EtdType getType()
Gets the type of the contract - future or option.- Returns:
- the type, future or option
-
getSecurityId
default SecurityId getSecurityId()
Gets the security identifier.This identifier uniquely identifies the security within the system.
- Specified by:
getSecurityIdin interfacePosition- Specified by:
getSecurityIdin interfaceSecurityQuantity- Returns:
- the security identifier
-
getQuantity
double getQuantity()
Gets the net quantity of the security.This returns the net quantity of the underlying security. The result is positive if the net position is long and negative if the net position is short.
This is calculated by subtracting the short quantity from the long quantity.
- Specified by:
getQuantityin interfacePosition- Specified by:
getQuantityin interfaceSecurityQuantity- Returns:
- the net quantity of the underlying security
-
getLongQuantity
double getLongQuantity()
Gets the long quantity of the security.This is the quantity of the underlying security that is held. The quantity cannot be negative, as that would imply short selling.
- Returns:
- the long quantity
-
getShortQuantity
double getShortQuantity()
Gets the short quantity of the security.This is the quantity of the underlying security that has been short sold. The quantity cannot be negative, as that would imply the position is long.
- Returns:
- the short quantity
-
withInfo
EtdPosition withInfo(PortfolioItemInfo info)
Returns an instance with the specified info.- Specified by:
withInfoin interfacePortfolioItem- Specified by:
withInfoin interfacePosition- Parameters:
info- the new info- Returns:
- the instance with the specified info
-
withQuantity
EtdPosition withQuantity(double quantity)
Returns an instance with the specified net quantity.- Specified by:
withQuantityin interfacePosition- Parameters:
quantity- the new net quantity- Returns:
- the instance with the specified net quantity
-
withQuantities
default EtdPosition withQuantities(double longQuantity, double shortQuantity)
Returns an instance with the specified quantities.- Parameters:
longQuantity- the new long quantityshortQuantity- the new short quantity- Returns:
- the instance with the specified quantities
-
-