Class BillTrade
- java.lang.Object
-
- com.opengamma.strata.product.bond.BillTrade
-
- All Implemented Interfaces:
CalculationTarget
,Resolvable<ResolvedBillTrade>
,PortfolioItem
,ProductTrade
,ResolvableTrade<ResolvedBillTrade>
,SecuritizedProductPortfolioItem<Bill>
,SecuritizedProductTrade<Bill>
,SecurityQuantity
,SecurityQuantityTrade
,Trade
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class BillTrade extends Object implements SecuritizedProductTrade<Bill>, ResolvableTrade<ResolvedBillTrade>, org.joda.beans.ImmutableBean, Serializable
A trade representing a bill.A trade in an underlying
Bill
.Price and yield
Strata uses decimal yields and prices for bills in the trade model, pricers and market data. For example, a price of 99.32% is represented in Strata by 0.9932 and a yield of 1.32% is represented by 0.0132.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BillTrade.Builder
The bean-builder forBillTrade
.static class
BillTrade.Meta
The meta-bean forBillTrade
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BillTrade.Builder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
TradeInfo
getInfo()
Gets the additional trade information, defaulted to an empty instance.double
getPrice()
Gets the price at which the bill was traded, in decimal form.Bill
getProduct()
Gets the bill that was traded.double
getQuantity()
Gets the quantity that was traded.int
hashCode()
static BillTrade.Meta
meta()
The meta-bean forBillTrade
.BillTrade.Meta
metaBean()
static BillTrade
ofPrice(TradeInfo info, Bill product, double quantity, double price)
Generates a Bill trade instance from the price.static BillTrade
ofYield(TradeInfo info, Bill product, double quantity, double yield)
Generates a Bill trade instance where the price is computed from the traded yield.ResolvedBillTrade
resolve(ReferenceData refData)
Resolves this trade using the specified reference data.PortfolioItemSummary
summarize()
Summarizes the portfolio item.BillTrade.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
BillTrade
withInfo(PortfolioItemInfo info)
Returns an instance with the specified info.BillTrade
withPrice(double price)
Returns an instance with the specified price.BillTrade
withQuantity(double quantity)
Returns an instance with the specified quantity.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.product.PortfolioItem
getId
-
Methods inherited from interface com.opengamma.strata.product.SecuritizedProductPortfolioItem
getCurrency, getSecurityId
-
-
-
-
Method Detail
-
ofYield
public static BillTrade ofYield(TradeInfo info, Bill product, double quantity, double yield)
Generates a Bill trade instance where the price is computed from the traded yield.- Parameters:
info
- the additional trade informationproduct
- the bill that was tradedquantity
- the quantity that was tradedyield
- the yield at which the bill was traded- Returns:
- the instance
-
ofPrice
public static BillTrade ofPrice(TradeInfo info, Bill product, double quantity, double price)
Generates a Bill trade instance from the price.- Parameters:
info
- the additional trade informationproduct
- the bill that was tradedquantity
- the quantity that was tradedprice
- the price at which the bill was traded- Returns:
- the instance
-
resolve
public ResolvedBillTrade resolve(ReferenceData refData)
Description copied from interface:ResolvableTrade
Resolves this trade using the specified reference data.This converts this trade to the equivalent resolved form. All
ReferenceDataId
identifiers in this instance will be resolved. The resultingResolvedTrade
is optimized for pricing.Resolved objects may be bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. Care must be taken when placing the resolved form in a cache or persistence layer.
- Specified by:
resolve
in interfaceResolvable<ResolvedBillTrade>
- Specified by:
resolve
in interfaceResolvableTrade<ResolvedBillTrade>
- Parameters:
refData
- the reference data to use when resolving- Returns:
- the resolved trade
-
withInfo
public BillTrade withInfo(PortfolioItemInfo info)
Description copied from interface:SecuritizedProductTrade
Returns an instance with the specified info.- Specified by:
withInfo
in interfacePortfolioItem
- Specified by:
withInfo
in interfaceProductTrade
- Specified by:
withInfo
in interfaceResolvableTrade<ResolvedBillTrade>
- Specified by:
withInfo
in interfaceSecuritizedProductTrade<Bill>
- Specified by:
withInfo
in interfaceSecurityQuantityTrade
- Specified by:
withInfo
in interfaceTrade
- Parameters:
info
- the new info- Returns:
- the instance with the specified info
-
withQuantity
public BillTrade withQuantity(double quantity)
Description copied from interface:SecuritizedProductTrade
Returns an instance with the specified quantity.- Specified by:
withQuantity
in interfaceSecuritizedProductPortfolioItem<Bill>
- Specified by:
withQuantity
in interfaceSecuritizedProductTrade<Bill>
- Specified by:
withQuantity
in interfaceSecurityQuantityTrade
- Parameters:
quantity
- the new quantity- Returns:
- the instance with the specified quantity
-
withPrice
public BillTrade withPrice(double price)
Description copied from interface:SecuritizedProductTrade
Returns an instance with the specified price.- Specified by:
withPrice
in interfaceSecuritizedProductTrade<Bill>
- Specified by:
withPrice
in interfaceSecurityQuantityTrade
- Parameters:
price
- the new price- Returns:
- the instance with the specified price
-
summarize
public PortfolioItemSummary summarize()
Description copied from interface:PortfolioItem
Summarizes the portfolio item.This provides a summary, including a human readable description.
- Specified by:
summarize
in interfacePortfolioItem
- Specified by:
summarize
in interfaceTrade
- Returns:
- the summary of the item
-
meta
public static BillTrade.Meta meta()
The meta-bean forBillTrade
.- Returns:
- the meta-bean, not null
-
builder
public static BillTrade.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public BillTrade.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getInfo
public TradeInfo getInfo()
Gets the additional trade information, defaulted to an empty instance.This allows additional information to be attached to the trade.
- Specified by:
getInfo
in interfacePortfolioItem
- Specified by:
getInfo
in interfaceTrade
- Returns:
- the value of the property, not null
-
getProduct
public Bill getProduct()
Gets the bill that was traded.The product captures the contracted financial details of the trade.
- Specified by:
getProduct
in interfaceProductTrade
- Specified by:
getProduct
in interfaceSecuritizedProductPortfolioItem<Bill>
- Returns:
- the value of the property, not null
-
getQuantity
public double getQuantity()
Gets the quantity that was traded.This will be positive if buying and negative if selling.
- Specified by:
getQuantity
in interfaceSecurityQuantity
- Returns:
- the value of the property
-
getPrice
public double getPrice()
Gets the price at which the bill was traded, in decimal form.- Specified by:
getPrice
in interfaceSecurityQuantityTrade
- Returns:
- the value of the property
-
toBuilder
public BillTrade.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-