/**
 * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies
 * 
 * Please see distribution for license.
 */
package com.opengamma.examples.generator;

import com.opengamma.financial.generator.AbstractPortfolioGeneratorTool;
import com.opengamma.financial.generator.FXForwardSecurityGenerator;
import com.opengamma.financial.generator.LeafPortfolioNodeGenerator;
import com.opengamma.financial.generator.PortfolioNodeGenerator;
import com.opengamma.financial.generator.PositionGenerator;
import com.opengamma.financial.generator.SimplePositionGenerator;
import com.opengamma.financial.generator.StaticNameGenerator;
import com.opengamma.financial.security.fx.FXForwardSecurity;

/**
 * Utility for constructing a random FX Forward portfolio.
 */
public class FxForwardPortfolioGeneratorTool extends AbstractPortfolioGeneratorTool {

  @Override
  public PortfolioNodeGenerator createPortfolioNodeGenerator(final int portfolioSize) {
    final FXForwardSecurityGenerator securities = new FXForwardSecurityGenerator();
    configure(securities);
    final PositionGenerator positions = new SimplePositionGenerator<FXForwardSecurity>(securities, getSecurityPersister(), getCounterPartyGenerator());
    return new LeafPortfolioNodeGenerator(new StaticNameGenerator("FX Forwards"), positions, portfolioSize);
  }

}

Add FX Forward generator tool
Add FX Forward generator tool
