public interface EtdPosition extends Position
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 and shortQuantity.
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 via getQuantity().
| Modifier and Type | Method and 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.
|
getIddefault Currency getCurrency()
This is the currency of the security.
EtdSecurity getSecurity()
default EtdType getType()
default SecurityId getSecurityId()
This identifier uniquely identifies the security within the system.
getSecurityId in interface PositiongetSecurityId in interface SecurityQuantitydouble getQuantity()
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.
getQuantity in interface PositiongetQuantity in interface SecurityQuantitydouble getLongQuantity()
This is the quantity of the underlying security that is held. The quantity cannot be negative, as that would imply short selling.
double getShortQuantity()
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.
EtdPosition withInfo(PortfolioItemInfo info)
withInfo in interface PortfolioItemwithInfo in interface Positioninfo - the new infoEtdPosition withQuantity(double quantity)
withQuantity in interface Positionquantity - the new net quantitydefault EtdPosition withQuantities(double longQuantity, double shortQuantity)
longQuantity - the new long quantityshortQuantity - the new short quantityCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.