public final class BondFuturePosition extends Object implements SecuritizedProductPosition<BondFuture>, Resolvable<ResolvedBondFutureTrade>, org.joda.beans.ImmutableBean, Serializable
A position in an underlying BondFuture
.
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()
.
FixedCouponBond
. The bond futures delivery is a bond
for an amount computed from the bond future price, a conversion factor and the accrued interest.Modifier and Type | Class and Description |
---|---|
static class |
BondFuturePosition.Builder
The bean-builder for
BondFuturePosition . |
static class |
BondFuturePosition.Meta
The meta-bean for
BondFuturePosition . |
Modifier and Type | Method and Description |
---|---|
static BondFuturePosition.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
boolean |
equals(Object obj) |
Currency |
getCurrency()
Gets the currency of the position.
|
PositionInfo |
getInfo()
Gets the additional position information, defaulted to an empty instance.
|
double |
getLongQuantity()
Gets the long quantity of the security.
|
BondFuture |
getProduct()
Gets the future that was traded.
|
double |
getQuantity()
Gets the net quantity of the security.
|
SecurityId |
getSecurityId()
Gets the identifier of the underlying security.
|
double |
getShortQuantity()
Gets the short quantity of the security.
|
int |
hashCode() |
static BondFuturePosition.Meta |
meta()
The meta-bean for
BondFuturePosition . |
BondFuturePosition.Meta |
metaBean() |
static BondFuturePosition |
ofLongShort(PositionInfo positionInfo,
BondFuture product,
double longQuantity,
double shortQuantity)
Obtains an instance from position information, product, long quantity and short quantity.
|
static BondFuturePosition |
ofNet(PositionInfo positionInfo,
BondFuture product,
double netQuantity)
Obtains an instance from position information, product and net quantity.
|
ResolvedBondFutureTrade |
resolve(ReferenceData refData) |
PortfolioItemSummary |
summarize()
Summarizes the portfolio item.
|
BondFuturePosition.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
BondFuturePosition |
withInfo(PortfolioItemInfo info)
Returns an instance with the specified info.
|
BondFuturePosition |
withQuantity(double quantity)
Returns an instance with the specified quantity.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId
public static BondFuturePosition ofNet(PositionInfo positionInfo, BondFuture product, double netQuantity)
The net quantity is the long quantity minus the short quantity, which may be negative. If the quantity is positive it is treated as a long quantity. Otherwise it is treated as a short quantity.
positionInfo
- the position informationproduct
- the underlying productnetQuantity
- the net quantity of the underlying securitypublic static BondFuturePosition ofLongShort(PositionInfo positionInfo, BondFuture product, double longQuantity, double shortQuantity)
The long quantity and short quantity must be zero or positive, not 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.
positionInfo
- the position informationproduct
- the underlying productlongQuantity
- the long quantity of the underlying securityshortQuantity
- the short quantity of the underlying securitypublic SecurityId getSecurityId()
Position
This identifier uniquely identifies the security within the system.
getSecurityId
in interface Position
getSecurityId
in interface SecuritizedProductPortfolioItem<BondFuture>
getSecurityId
in interface SecuritizedProductPosition<BondFuture>
getSecurityId
in interface SecurityQuantity
public Currency getCurrency()
SecuritizedProductPortfolioItem
This is typically the same as the currency of the product.
getCurrency
in interface SecuritizedProductPortfolioItem<BondFuture>
public double getQuantity()
Position
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.
getQuantity
in interface Position
getQuantity
in interface SecurityQuantity
public BondFuturePosition withInfo(PortfolioItemInfo info)
SecuritizedProductPosition
withInfo
in interface PortfolioItem
withInfo
in interface Position
withInfo
in interface SecuritizedProductPosition<BondFuture>
info
- the new infopublic BondFuturePosition withQuantity(double quantity)
SecuritizedProductPosition
withQuantity
in interface Position
withQuantity
in interface SecuritizedProductPortfolioItem<BondFuture>
withQuantity
in interface SecuritizedProductPosition<BondFuture>
quantity
- the new quantitypublic PortfolioItemSummary summarize()
PortfolioItem
This provides a summary, including a human readable description.
summarize
in interface PortfolioItem
summarize
in interface Position
public ResolvedBondFutureTrade resolve(ReferenceData refData)
resolve
in interface Resolvable<ResolvedBondFutureTrade>
public static BondFuturePosition.Meta meta()
BondFuturePosition
.public static BondFuturePosition.Builder builder()
public BondFuturePosition.Meta metaBean()
metaBean
in interface org.joda.beans.Bean
public PositionInfo getInfo()
This allows additional information to be attached to the position.
getInfo
in interface PortfolioItem
getInfo
in interface Position
public BondFuture getProduct()
The product captures the contracted financial details.
getProduct
in interface SecuritizedProductPortfolioItem<BondFuture>
public double getLongQuantity()
This is the quantity of the underlying security that is held. The quantity cannot be negative, as that would imply short selling.
public 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.
public BondFuturePosition.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.