Package com.opengamma.strata.product
Class SecurityTrade
- java.lang.Object
-
- com.opengamma.strata.product.SecurityTrade
-
- All Implemented Interfaces:
CalculationTarget,ResolvableCalculationTarget,PortfolioItem,ResolvableSecurityTrade,SecurityQuantity,SecurityQuantityTrade,Trade,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class SecurityTrade extends Object implements ResolvableSecurityTrade, org.joda.beans.ImmutableBean, Serializable
A trade representing the purchase or sale of a security, where the security is referenced by identifier.This trade represents a trade in a security, defined by a quantity and price. The security is referenced using
SecurityId. The identifier may be looked up inReferenceData.The reference may be to any kind of security, including equities, bonds and exchange traded derivatives (ETD).
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSecurityTrade.BuilderThe bean-builder forSecurityTrade.static classSecurityTrade.MetaThe meta-bean forSecurityTrade.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SecurityTrade.Builderbuilder()Returns a builder used to create an instance of the bean.booleanequals(Object obj)TradeInfogetInfo()Gets the additional trade information, defaulted to an empty instance.doublegetPrice()Gets the price agreed when the trade occurred.doublegetQuantity()Gets the quantity that was traded.SecurityIdgetSecurityId()Gets the identifier of the security that was traded.inthashCode()static SecurityTrade.Metameta()The meta-bean forSecurityTrade.SecurityTrade.MetametaBean()static SecurityTradeof(TradeInfo tradeInfo, SecurityId securityId, double quantity, double price)Obtains an instance from trade information, identifier, quantity and price.PortfolioItemSummarysummarize()Summarizes the portfolio item.SecurityTrade.BuildertoBuilder()Returns a builder that allows this bean to be mutated.StringtoString()SecurityTradewithInfo(PortfolioItemInfo info)Returns an instance with the specified info.SecurityTradewithPrice(double price)Returns an instance with the specified price.SecurityTradewithQuantity(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.ResolvableSecurityTrade
resolveTarget
-
-
-
-
Method Detail
-
of
public static SecurityTrade of(TradeInfo tradeInfo, SecurityId securityId, double quantity, double price)
Obtains an instance from trade information, identifier, quantity and price.- Parameters:
tradeInfo- the trade informationsecurityId- the identifier of the underlying securityquantity- the quantity that was tradedprice- the price that was traded- Returns:
- the trade
-
summarize
public PortfolioItemSummary summarize()
Description copied from interface:PortfolioItemSummarizes the portfolio item.This provides a summary, including a human readable description.
- Specified by:
summarizein interfacePortfolioItem- Specified by:
summarizein interfaceTrade- Returns:
- the summary of the item
-
withInfo
public SecurityTrade withInfo(PortfolioItemInfo info)
Description copied from interface:ResolvableSecurityTradeReturns an instance with the specified info.- Specified by:
withInfoin interfacePortfolioItem- Specified by:
withInfoin interfaceResolvableSecurityTrade- Specified by:
withInfoin interfaceSecurityQuantityTrade- Specified by:
withInfoin interfaceTrade- Parameters:
info- the new info- Returns:
- the instance with the specified info
-
withQuantity
public SecurityTrade withQuantity(double quantity)
Description copied from interface:ResolvableSecurityTradeReturns an instance with the specified quantity.- Specified by:
withQuantityin interfaceResolvableSecurityTrade- Specified by:
withQuantityin interfaceSecurityQuantityTrade- Parameters:
quantity- the new quantity- Returns:
- the instance with the specified quantity
-
withPrice
public SecurityTrade withPrice(double price)
Description copied from interface:ResolvableSecurityTradeReturns an instance with the specified price.- Specified by:
withPricein interfaceResolvableSecurityTrade- Specified by:
withPricein interfaceSecurityQuantityTrade- Parameters:
price- the new price- Returns:
- the instance with the specified price
-
meta
public static SecurityTrade.Meta meta()
The meta-bean forSecurityTrade.- Returns:
- the meta-bean, not null
-
builder
public static SecurityTrade.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public SecurityTrade.Meta metaBean()
- Specified by:
metaBeanin 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:
getInfoin interfacePortfolioItem- Specified by:
getInfoin interfaceTrade- Returns:
- the value of the property, not null
-
getSecurityId
public SecurityId getSecurityId()
Gets the identifier of the security that was traded.This identifier uniquely identifies the security within the system.
- Specified by:
getSecurityIdin interfaceSecurityQuantity- 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:
getQuantityin interfaceSecurityQuantity- Returns:
- the value of the property
-
getPrice
public double getPrice()
Gets the price agreed when the trade occurred.This is the price agreed when the trade occurred.
- Specified by:
getPricein interfaceSecurityQuantityTrade- Returns:
- the value of the property
-
toBuilder
public SecurityTrade.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-