/
SecuritizedProductTrade.java
89 lines (80 loc) · 2.58 KB
/
SecuritizedProductTrade.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* Copyright (C) 2016 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.strata.product;
import com.opengamma.strata.basics.ReferenceData;
import com.opengamma.strata.basics.currency.Currency;
/**
* A trade that is directly based on a securitized product.
* <p>
* This defines a trade in a securitized product.
* A securitized product contains the structure of a financial instrument that is traded as a {@link Security}.
* See {@link SecuritizedProduct} to understand the difference between a security and a securitized product.
* <p>
* When trading securities, the standard trade type is {@link SecurityTrade}.
* That trade type relies on securities being looked up in {@link ReferenceData}.
* One use for trade types that implement {@code SecuritizedProductTrade} is to price
* and hold trades without needing to populate reference data, because the securitized
* product representation completely models the trade.
* <p>
* Implementations of this interface must be immutable beans.
*/
public interface SecuritizedProductTrade
extends ProductTrade, SecurityQuantityTrade {
/**
* Gets the product of the security that was traded.
*
* @return the product
*/
@Override
public abstract SecuritizedProduct getProduct();
/**
* Gets the quantity that was traded.
* <p>
* This will be positive if buying and negative if selling.
*
* @return the quantity
*/
@Override
public abstract double getQuantity();
/**
* Returns an instance with the specified quantity.
*
* @param quantity the new quantity
* @return the instance with the specified quantity
*/
@Override
public abstract SecuritizedProductTrade withQuantity(double quantity);
/**
* Returns an instance with the specified price.
*
* @param price the new price
* @return the instance with the specified price
*/
@Override
public abstract SecuritizedProductTrade withPrice(double price);
//-------------------------------------------------------------------------
/**
* Gets the security identifier.
* <p>
* This identifier uniquely identifies the security within the system.
*
* @return the security identifier
*/
@Override
public default SecurityId getSecurityId() {
return getProduct().getSecurityId();
}
/**
* Gets the currency of the trade.
* <p>
* This is typically the same as the currency of the product.
*
* @return the trading currency
*/
public default Currency getCurrency() {
return getProduct().getCurrency();
}
}