Class GenericSecurityTrade
- java.lang.Object
-
- com.opengamma.strata.product.GenericSecurityTrade
-
- All Implemented Interfaces:
CalculationTarget
,PortfolioItem
,ProductTrade
,SecuritizedProductPortfolioItem<GenericSecurity>
,SecuritizedProductTrade<GenericSecurity>
,SecurityQuantity
,SecurityQuantityTrade
,Trade
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class GenericSecurityTrade extends Object implements SecuritizedProductTrade<GenericSecurity>, org.joda.beans.ImmutableBean, Serializable
A trade representing the purchase or sale of a security, where the security is embedded ready for mark-to-market pricing.This trade represents a trade in a security, defined by a quantity and price. The security is embedded directly, however the underlying product model is not available. The security may be of any kind, including equities, bonds and exchange traded derivatives (ETD).
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GenericSecurityTrade.Builder
The bean-builder forGenericSecurityTrade
.static class
GenericSecurityTrade.Meta
The meta-bean forGenericSecurityTrade
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GenericSecurityTrade.Builder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
Currency
getCurrency()
Gets the currency of the trade.TradeInfo
getInfo()
Gets the additional trade information, defaulted to an empty instance.double
getPrice()
Gets the price that was traded, in decimal form.GenericSecurity
getProduct()
Gets the underlying product that was agreed when the trade occurred.double
getQuantity()
Gets the quantity that was traded.GenericSecurity
getSecurity()
Gets the security that was traded.SecurityId
getSecurityId()
Gets the security identifier.int
hashCode()
static GenericSecurityTrade.Meta
meta()
The meta-bean forGenericSecurityTrade
.GenericSecurityTrade.Meta
metaBean()
static GenericSecurityTrade
of(TradeInfo tradeInfo, GenericSecurity security, double quantity, double price)
Obtains an instance from trade information, security, quantity and price.PortfolioItemSummary
summarize()
Summarizes the portfolio item.GenericSecurityTrade.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
GenericSecurityTrade
withInfo(PortfolioItemInfo info)
Returns an instance with the specified info.GenericSecurityTrade
withPrice(double price)
Returns an instance with the specified price.GenericSecurityTrade
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
-
-
-
-
Method Detail
-
of
public static GenericSecurityTrade of(TradeInfo tradeInfo, GenericSecurity security, double quantity, double price)
Obtains an instance from trade information, security, quantity and price.- Parameters:
tradeInfo
- the trade informationsecurity
- the security that was tradedquantity
- the quantity that was tradedprice
- the price that was traded- Returns:
- the trade
-
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
-
getSecurityId
public SecurityId getSecurityId()
Description copied from interface:SecurityQuantity
Gets the security identifier.This identifier uniquely identifies the security within the system.
- Specified by:
getSecurityId
in interfaceSecuritizedProductPortfolioItem<GenericSecurity>
- Specified by:
getSecurityId
in interfaceSecurityQuantity
- Returns:
- the security identifier
-
getProduct
public GenericSecurity getProduct()
Description copied from interface:ProductTrade
Gets the underlying product that was agreed when the trade occurred.The product captures the contracted financial details of the trade.
- Specified by:
getProduct
in interfaceProductTrade
- Specified by:
getProduct
in interfaceSecuritizedProductPortfolioItem<GenericSecurity>
- Returns:
- the product
-
withInfo
public GenericSecurityTrade 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 interfaceSecuritizedProductTrade<GenericSecurity>
- Specified by:
withInfo
in interfaceSecurityQuantityTrade
- Specified by:
withInfo
in interfaceTrade
- Parameters:
info
- the new info- Returns:
- the instance with the specified info
-
withQuantity
public GenericSecurityTrade withQuantity(double quantity)
Description copied from interface:SecuritizedProductTrade
Returns an instance with the specified quantity.- Specified by:
withQuantity
in interfaceSecuritizedProductPortfolioItem<GenericSecurity>
- Specified by:
withQuantity
in interfaceSecuritizedProductTrade<GenericSecurity>
- Specified by:
withQuantity
in interfaceSecurityQuantityTrade
- Parameters:
quantity
- the new quantity- Returns:
- the instance with the specified quantity
-
withPrice
public GenericSecurityTrade withPrice(double price)
Description copied from interface:SecuritizedProductTrade
Returns an instance with the specified price.- Specified by:
withPrice
in interfaceSecuritizedProductTrade<GenericSecurity>
- Specified by:
withPrice
in interfaceSecurityQuantityTrade
- Parameters:
price
- the new price- Returns:
- the instance with the specified price
-
getCurrency
public Currency getCurrency()
Gets the currency of the trade.This is typically the same as the currency of the product.
- Specified by:
getCurrency
in interfaceSecuritizedProductPortfolioItem<GenericSecurity>
- Returns:
- the trading currency
-
meta
public static GenericSecurityTrade.Meta meta()
The meta-bean forGenericSecurityTrade
.- Returns:
- the meta-bean, not null
-
builder
public static GenericSecurityTrade.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public GenericSecurityTrade.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
-
getSecurity
public GenericSecurity getSecurity()
Gets the security that was traded.- Returns:
- the value of the property, not null
-
getQuantity
public double getQuantity()
Gets the quantity that was traded.This is the number of contracts that were 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 that was traded, in decimal form.This is the price agreed when the trade occurred.
- Specified by:
getPrice
in interfaceSecurityQuantityTrade
- Returns:
- the value of the property
-
toBuilder
public GenericSecurityTrade.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-