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 -
longQuantity
andshortQuantity
. 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 Currency
getCurrency()
Gets the currency of the position.double
getLongQuantity()
Gets the long quantity of the security.double
getQuantity()
Gets the net quantity of the security.EtdSecurity
getSecurity()
Gets the underlying ETD security.default SecurityId
getSecurityId()
Gets the security identifier.double
getShortQuantity()
Gets the short quantity of the security.default EtdType
getType()
Gets the type of the contract - future or option.EtdPosition
withInfo(PortfolioItemInfo info)
Returns an instance with the specified info.default EtdPosition
withQuantities(double longQuantity, double shortQuantity)
Returns an instance with the specified quantities.EtdPosition
withQuantity(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:
getSecurityId
in interfacePosition
- Specified by:
getSecurityId
in 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:
getQuantity
in interfacePosition
- Specified by:
getQuantity
in 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:
withInfo
in interfacePortfolioItem
- Specified by:
withInfo
in 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:
withQuantity
in 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
-
-