Package com.opengamma.financial.analytics.model.bond

Source Code of com.opengamma.financial.analytics.model.bond.BondFunctionUtils

/**
* Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.financial.analytics.model.bond;

import com.opengamma.core.id.ExternalSchemes;
import com.opengamma.engine.ComputationTarget;
import com.opengamma.financial.security.bond.BondSecurity;
import com.opengamma.id.UniqueId;

/**
*
*/
public class BondFunctionUtils {

  public static UniqueId getCountryID(ComputationTarget target) {
    final BondSecurity bond = (BondSecurity) target.getSecurity();
    final String codeAlpha2 = bond.getIssuerDomicile();
    return UniqueId.of(ExternalSchemes.ISO_COUNTRY_ALPHA2.getName(), codeAlpha2);
  }
 
  public static UniqueId getCurrencyID(final ComputationTarget target) {
    final BondSecurity bond = (BondSecurity) target.getSecurity();
    return bond.getCurrency().getUniqueId();
  }
 
  public static String getCountryName(ComputationTarget target) {
    final BondSecurity bond = (BondSecurity) target.getSecurity();
    return bond.getIssuerDomicile();
  }
 
  public static String getCurrencyName(final ComputationTarget target) {
    final BondSecurity bond = (BondSecurity) target.getSecurity();
    return bond.getCurrency().getCode();
  }
}
TOP

Related Classes of com.opengamma.financial.analytics.model.bond.BondFunctionUtils

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.