Adding Barrier Options

I was trying to add Barrier Options (Equity) via web interface, but realized that this option is not available. Figured out that I need to start from scratch to add these options — something similar to what is being done in VanillaFXOptionPortfolioGeneratorTool. I tried something similar in EquityEuropeanDigitalsPortfolioGenerator
final ExerciseType european = new EuropeanExerciseType();

      ExternalId test1 = ExternalSchemes.syntheticSecurityId("TestingOption1");

      final EquityBarrierOptionSecurity barrierOption1 = new EquityBarrierOptionSecurity(OptionType.CALL,100,Currency.USD,test1,european,new Expiry(DateUtils.getUTCDate(2013, 5, 11)),0,"",BarrierType.UP,BarrierDirection.KNOCK_OUT,MonitoringType.DISCRETE,SamplingFrequency.ONE_LOOK,103);

again repeat of similar lines for other options. I override also similar methods as was done in that class.
Also in ExampleDatabasePopulator.java I added the following code (which is called in doRun())
private void loadBarrierPortfolio()
{
final Log log = new Log(“Creating example Barrier portfolio”);
try {
portfolioGeneratorTool().run(getToolContext(), BARRIER_PORTFOLIO_NAME, “EquityEuropeanDigitals”, true, null);
log.done();
} catch (final RuntimeException t) {
log.fail(t);
}
}

I haven’t configured the view definitions as I was just trying to see if the db is populated with this new security. Apparently the command ant init-database throws an exception saying it can’t find the instance

 [java] com.opengamma.OpenGammaRuntimeException: Couldn't create generator tool instance for EquityEuropeanDigitals
 [java] 	at com.opengamma.financial.generator.AbstractPortfolioGeneratorTool.getInstance(AbstractPortfolioGeneratorTool.java:222)
 [java] 	at com.opengamma.financial.generator.AbstractPortfolioGeneratorTool.getInstance(AbstractPortfolioGeneratorTool.java:227)
 [java] 	at com.opengamma.financial.generator.AbstractPortfolioGeneratorTool.run(AbstractPortfolioGeneratorTool.java:231)

Any suggestions on how to resolve this error? Thanks in advance for your help.

Ok figured out one mistake which solved the problem partially.

EquityEuropeanDigitalsPortfolioGenerator should have been EquityEuropeanDigitalsPortfolioGeneratorTool as AbstractPortfolioGeneratorTool had hardcoded “PortfolioGeneratorTool” to concatenate and then search for that class

Still the part with viewdefinition is a bit complicated. I don’t see anything on the screen when I Load the view in “Analytics”

I am still not able to get the ViewProcessor associated with this? For example if I add to the view definition FairValue of barrier option, how it is calculated or what model is used? I am not sure how this connection is made. Any guidance will be helpful.

Hi,

I’ve asked one of my colleagues to take a look and advise you on how to do this. For starters, you’ll probably want ‘Present Value’ rather than ‘Fair Value’ (the former tends to be a model valuation rather than a market price). I suspect though, that you’ll also require a volatility surface definition and specification and a portfolio (which I see you’re trying to generate above). You’ll then need some pseudo market data to build a volatility surface, there are various ways of doing this.

Jim

thanks jim. waiting for ur colleagues reply.

btw I also tried this…in the file ExampleStandardFunctionConfiguration.java
I think it is required for model specification…

functionConfigs.add(functionConfiguration(BlackScholesMertonModelFunction.class));
functionConfigs.add(new ParameterizedFunctionConfiguration(BlackScholesMertonModelFunction.class.getName(),Arrays.asList(ValueRequirementNames.PRESENT_VALUE,ValueRequirementNames.DELTA)));

anyway now i am getting an error message

11:00:53.477 [main] ERROR c.o.e.f.config.RepositoryFactory - Unable to add function definition ParameterizedFunctionConfiguration[_parameter=[Present Value, Delta],_definitionClassName=com.opengamma.financial.analytics.model.option.BlackScholesMertonModelFunction], ignoring

Might be due to missing data.