//------------------------------------------------------------------------- public virtual void test_resolveTarget() { SecurityPosition position = sut(); GenericSecurity resolvedSecurity = GenericSecurity.of(SecurityInfo.of(SECURITY_ID, 1, CurrencyAmount.of(USD, 0.01))); ImmutableReferenceData refData = ImmutableReferenceData.of(SECURITY_ID, resolvedSecurity); GenericSecurityPosition expected = GenericSecurityPosition.ofLongShort(POSITION_INFO, resolvedSecurity, LONG_QUANTITY, SHORT_QUANTITY); assertEquals(position.resolveTarget(refData), expected); }
//------------------------------------------------------------------------- public virtual void test_of() { GenericSecurity test = sut(); assertEquals(test.Info, INFO); assertEquals(test.SecurityId, INFO.Id); assertEquals(test.Currency, INFO.PriceInfo.Currency); assertEquals(test.UnderlyingIds, ImmutableSet.of()); assertEquals(test, GenericSecurity.of(INFO)); assertEquals(test.createProduct(ReferenceData.empty()), test); assertEquals(test.createTrade(TradeInfo.empty(), 1, 2, ReferenceData.empty()), GenericSecurityTrade.of(TradeInfo.empty(), GenericSecurity.of(INFO), 1, 2)); assertEquals(test.createPosition(PositionInfo.empty(), 1, ReferenceData.empty()), GenericSecurityPosition.ofNet(PositionInfo.empty(), GenericSecurity.of(INFO), 1)); assertEquals(test.createPosition(PositionInfo.empty(), 1, 2, ReferenceData.empty()), GenericSecurityPosition.ofLongShort(PositionInfo.empty(), GenericSecurity.of(INFO), 1, 2)); }
internal static GenericSecurity sut2() { return(GenericSecurity.of(INFO2)); }