/
ResolvableSecurityPosition.java
60 lines (54 loc) · 2.26 KB
/
ResolvableSecurityPosition.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
/*
* Copyright (C) 2018 - 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.ReferenceDataNotFoundException;
import com.opengamma.strata.basics.ResolvableCalculationTarget;
/**
* A position that has a security identifier that can be resolved using reference data.
* <p>
* This represents those positions that hold a security identifier. It allows the position
* to be resolved, returning an alternate representation of the same position with complete
* security information.
*/
public interface ResolvableSecurityPosition
extends Position, ResolvableCalculationTarget {
/**
* Resolves the security identifier using the specified reference data.
* <p>
* This takes the security identifier of this position, looks it up in reference data,
* and returns the equivalent position with full security information.
* If the security has underlying securities, they will also have been resolved in the result.
* <p>
* The resulting position is bound to data from reference data.
* If the data changes, the resulting position form will not be updated.
* Care must be taken when placing the resolved form in a cache or persistence layer.
*
* @param refData the reference data to use when resolving
* @return the resolved position
* @throws ReferenceDataNotFoundException if an identifier cannot be resolved in the reference data
* @throws RuntimeException if unable to resolve due to an invalid definition
*/
@Override
public abstract SecuritizedProductPosition<?> resolveTarget(ReferenceData refData);
//-------------------------------------------------------------------------
/**
* Returns an instance with the specified info.
*
* @param info the new info
* @return the instance with the specified info
*/
@Override
public abstract ResolvableSecurityPosition withInfo(PortfolioItemInfo info);
/**
* Returns an instance with the specified quantity.
*
* @param quantity the new quantity
* @return the instance with the specified quantity
*/
@Override
public abstract ResolvableSecurityPosition withQuantity(double quantity);
}