private Object readResolve() { return of(standardId); }
public void test_of_strings() { SecurityId test = SecurityId.of("A", "1"); assertEquals(test.getStandardId(), STANDARD_ID); assertEquals(test.getReferenceDataType(), Security.class); assertEquals(test.toString(), STANDARD_ID.toString()); }
/** * Creates an instance from a standard two-part identifier. * * @param standardId the underlying standard two-part identifier * @return the security identifier */ public static SecurityId of(StandardId standardId) { return new SecurityId(standardId); }
public void test_equalsHashCode() { SecurityId a = SecurityId.of("A", "1"); SecurityId a2 = SecurityId.of("A", "1"); SecurityId b = SecurityId.of("B", "1"); assertEquals(a.equals(a), true); assertEquals(a.equals(a2), true); assertEquals(a.equals(b), false); assertEquals(a.equals(null), false); assertEquals(a.equals(ANOTHER_TYPE), false); }
public void test_parse() { SecurityId test = SecurityId.parse(STANDARD_ID.toString()); assertEquals(test.getStandardId(), STANDARD_ID); assertEquals(test.getReferenceDataType(), Security.class); assertEquals(test.toString(), STANDARD_ID.toString()); }
@Override public default PortfolioItemSummary summarize() { // AAPL x 200 String description = getSecurityId().getStandardId().getValue() + " x " + SummarizerUtils.value(getQuantity()); return SummarizerUtils.summary(this, ProductType.SECURITY, description); }
@Override public PortfolioItemSummary summarize() { // AAPL x 200 String description = getSecurityId().getStandardId().getValue() + " x " + SummarizerUtils.value(getQuantity()); return SummarizerUtils.summary(this, ProductType.SECURITY, description); }
@Override public SecurityId getSecurityId() { return SecurityId.of(STANDARD_ID); }
public void test_of_standardId() { SecurityId test = SecurityId.of(STANDARD_ID); assertEquals(test.getStandardId(), STANDARD_ID); assertEquals(test.getReferenceDataType(), Security.class); assertEquals(test.toString(), STANDARD_ID.toString()); }
@Override public PortfolioItemSummary summarize() { // ID x 200 String description = getSecurityId().getStandardId().getValue() + " x " + SummarizerUtils.value(getQuantity()); return SummarizerUtils.summary(this, ProductType.BILL, description, getCurrency()); }
/** * Parses an {@code StandardId} from a formatted scheme and value. * <p> * This parses the identifier from the form produced by {@code toString()} * which is '{@code $scheme~$value}'. * * @param str the identifier to parse * @return the security identifier * @throws IllegalArgumentException if the identifier cannot be parsed */ @FromString public static SecurityId parse(String str) { return new SecurityId(StandardId.parse(str)); }
/** * Obtains an instance from a scheme and value. * <p> * The scheme and value are used to produce a {@link StandardId}, where more * information is available on how schemes and values relate to industry identifiers. * <p> * The scheme must be non-empty and match the regular expression '{@code [A-Za-z0-9:/+.=_-]*}'. * This permits letters, numbers, colon, forward-slash, plus, dot, equals, underscore and dash. * If necessary, the scheme can be encoded using {@link StandardId#encodeScheme(String)}. * <p> * The value must be non-empty and match the regular expression '{@code [!-z][ -z]*}'. * * @param scheme the scheme of the identifier, not empty * @param value the value of the identifier, not empty * @return the security identifier * @throws IllegalArgumentException if the scheme or value is invalid */ public static SecurityId of(String scheme, String value) { return of(StandardId.of(scheme, value)); }
@Override public PortfolioItemSummary summarize() { // ID x 200 String description = getSecurityId().getStandardId().getValue() + " x " + SummarizerUtils.value(getQuantity()); return SummarizerUtils.summary(this, ProductType.DSF, description, getCurrency()); }
private LocalDate calculateLastFixingDate(LocalDate valuationDate, ReferenceData refData) { SecurityId secId = SecurityId.of(rateId.getStandardId()); // quote must also be security IborFutureTrade trade = template.createTrade(valuationDate, secId, 1, 1, 1, refData); return trade.getProduct().getFixingDate(); }
@Override public PortfolioItemSummary summarize() { // ID x 200 String description = getSecurityId().getStandardId().getValue() + " x " + SummarizerUtils.value(getQuantity()); return SummarizerUtils.summary(this, ProductType.BOND_FUTURE, description, getCurrency()); }
@Override public IborFutureTrade trade(double quantity, MarketData marketData, ReferenceData refData) { LocalDate valuationDate = marketData.getValuationDate(); double price = marketPrice(marketData) + additionalSpread; SecurityId secId = SecurityId.of(rateId.getStandardId()); // quote must also be security return template.createTrade(valuationDate, secId, quantity, 1d, price, refData); }
@Override public PortfolioItemSummary summarize() { // ID x 200 String description = getSecurityId().getStandardId().getValue() + " x " + SummarizerUtils.value(getQuantity()); return SummarizerUtils.summary(this, ProductType.BOND, description, getCurrency()); }
.append(variant.getCode()) .toString(); return SecurityId.of(ETD_SCHEME, id);
@Override public PortfolioItemSummary summarize() { // ID x 200 String description = getSecurityId().getStandardId().getValue() + " x " + SummarizerUtils.value(getQuantity()); return SummarizerUtils.summary(this, ProductType.IBOR_FUTURE_OPTION, description, getCurrency()); }
private static SecurityTrade parseSecurityTrade(CsvRow row, TradeInfo info, TradeCsvInfoResolver resolver) { String securityIdScheme = row.findValue(SECURITY_ID_SCHEME_FIELD).orElse(DEFAULT_SECURITY_SCHEME); String securityIdValue = row.getValue(SECURITY_ID_FIELD); SecurityId securityId = SecurityId.of(securityIdScheme, securityIdValue); double price = LoaderUtils.parseDouble(row.getValue(PRICE_FIELD)); double quantity = parseTradeQuantity(row); return SecurityTrade.of(info, securityId, quantity, price); }