Examples of FinancialSecurity


Examples of com.opengamma.financial.security.FinancialSecurity

      final ZonedDateTime now = ZonedDateTime.now(executionContext.getValuationClock());
      final ValueRequirement desiredValue = desiredValues.iterator().next();
      final String samplingPeriod = desiredValue.getConstraint(ValuePropertyNames.SAMPLING_PERIOD);
      final String scheduleCalculator = desiredValue.getConstraint(ValuePropertyNames.SCHEDULE_CALCULATOR);
      final String samplingFunction = desiredValue.getConstraint(ValuePropertyNames.SAMPLING_FUNCTION);
      final FinancialSecurity security = (FinancialSecurity) position.getSecurity();
      final MultipleCurrencyAmount mca = (MultipleCurrencyAmount) inputs.getValue(ValueRequirementNames.FX_CURRENCY_EXPOSURE);
      final LocalDateDoubleTimeSeries timeSeries = (LocalDateDoubleTimeSeries) inputs.getValue(ValueRequirementNames.HISTORICAL_FX_TIME_SERIES);
      final LocalDate startDate = now.toLocalDate().minus(Period.parse(samplingPeriod));
      final Schedule schedule = ScheduleCalculatorFactory.getScheduleCalculator(scheduleCalculator);
      final TimeSeriesSamplingFunction sampling = TimeSeriesSamplingFunctionFactory.getFunction(samplingFunction);
      final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
      final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
      final CurrencyPairs currencyPairs = OpenGammaExecutionContext.getCurrencyPairsSource(executionContext).getCurrencyPairs(CurrencyPairs.DEFAULT_CURRENCY_PAIRS);
      final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(putCurrency, callCurrency);
      final Currency currencyNonBase = currencyPair.getCounter(); // The non-base currency
      final double delta = mca.getAmount(currencyNonBase);
      DoubleTimeSeries<?> result = getPnLSeries(startDate, now.toLocalDate(), schedule, sampling, timeSeries);
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

  @Override
  public String classifyPosition(final Position position) {
    final Security security = position.getSecurity();
    if (security instanceof FinancialSecurity) {
      final FinancialSecurity finSec = (FinancialSecurity) security;
      return finSec.accept(new FinancialSecurityVisitor<String>() {

        @Override
        public String visitGovernmentBondSecurity(final GovernmentBondSecurity security) {
          return BONDS;
        }
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

          .standardVanillaCDSSecurityVisitor(_standardVanillaCdsSecurityVisitor)
          .legacyVanillaCDSSecurityVisitor(_legacyVanillaCdsSecurityVisitor)
          .creditDefaultSwapOptionSecurityVisitor(_cdsOptionSecurityVisitor)
          .creditDefaultSwapIndexSecurityVisitor(_cdsIndexSecurityVisitor)
          .create();
      FinancialSecurity security = (FinancialSecurity) position.getSecurityLink().resolve(_secSource);
      try {
        String classification = security.accept(visitorAdapter);
        return classification == null ? UNKNOWN : classification;
      } catch (UnsupportedOperationException uoe) {
        return UNKNOWN;
      }
    }
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

      return target.getPosition().getSecurity() instanceof FXDigitalOptionSecurity;
    }

    @Override
    public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target) {
      final FinancialSecurity security = (FinancialSecurity) target.getPosition().getSecurity();
      final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
      final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
      final Currency currencyBase = _currencyPairs.getCurrencyPair(putCurrency, callCurrency).getBase();
      final ValueProperties properties = createValueProperties()
          .with(ValuePropertyNames.CALCULATION_METHOD, FXDigitalCallSpreadBlackFunction.CALL_SPREAD_BLACK_METHOD)
          .withAny(FXOptionBlackFunction.PUT_CURVE)
          .withAny(FXOptionBlackFunction.PUT_CURVE_CALC_CONFIG)
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

          .with(InterpolatedDataProperties.LEFT_X_EXTRAPOLATOR_NAME, leftExtrapolatorNames.iterator().next())
          .with(InterpolatedDataProperties.RIGHT_X_EXTRAPOLATOR_NAME, rightExtrapolatorNames.iterator().next())
          .with(FXDigitalCallSpreadBlackFunction.PROPERTY_CALL_SPREAD_VALUE, callSpreads.iterator().next()).get();
      final ValueRequirement fxCurrencyExposureRequirement = new ValueRequirement(
          ValueRequirementNames.FX_CURRENCY_EXPOSURE, ComputationTargetType.SECURITY, target.getPosition().getSecurity().getUniqueId(), exposureConstraints);
      final FinancialSecurity security = (FXDigitalOptionSecurity) target.getPosition().getSecurity();
      final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
      final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
      final ValueRequirement fxSpotRequirement = ConventionBasedFXRateFunction.getHistoricalTimeSeriesRequirement(putCurrency, callCurrency);
      return ImmutableSet.of(fxCurrencyExposureRequirement, fxSpotRequirement);
    }
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

      final ValueRequirement desiredValue = desiredValues.iterator().next();
      final String samplingPeriod = desiredValue.getConstraint(ValuePropertyNames.SAMPLING_PERIOD);
      final String scheduleCalculator = desiredValue.getConstraint(ValuePropertyNames.SCHEDULE_CALCULATOR);
      final String samplingFunction = desiredValue.getConstraint(ValuePropertyNames.SAMPLING_FUNCTION);
      final MultipleCurrencyAmount mca = (MultipleCurrencyAmount) inputs.getValue(ValueRequirementNames.FX_CURRENCY_EXPOSURE);
      final FinancialSecurity security = (FinancialSecurity) position.getSecurity();
      final LocalDate startDate = now.toLocalDate().minus(Period.parse(samplingPeriod));
      final Schedule schedule = ScheduleCalculatorFactory.getScheduleCalculator(scheduleCalculator);
      final TimeSeriesSamplingFunction sampling = TimeSeriesSamplingFunctionFactory.getFunction(samplingFunction);
      final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
      final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
      final CurrencyPair currencyPair = _currencyPairs.getCurrencyPair(putCurrency, callCurrency);
      final Currency currencyNonBase = currencyPair.getCounter(); // The non-base currency
      final double delta = mca.getAmount(currencyNonBase);
      final HistoricalTimeSeries timeSeries = (HistoricalTimeSeries) inputs.getValue(ValueRequirementNames.HISTORICAL_FX_TIME_SERIES);
      DateDoubleTimeSeries<?> result = getPnLSeries(startDate, now.toLocalDate(), schedule, sampling, timeSeries);
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

    final Set<ValueRequirement> requirements = super.getRequirements(context, target, desiredValue);
    if (requirements == null) {
      return null;
    }
    // Add live market_value of the option
    final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
    final ComputationTargetReference securityTarget = new ComputationTargetSpecification(ComputationTargetType.SECURITY, security.getUniqueId());
    final ValueRequirement securityValueReq = new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, securityTarget);
    requirements.add(securityValueReq);

    return requirements;
  }
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

  }

  @Override
  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
    final Set<ValueSpecification> results = super.getResults(context, target, inputs);
    final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
    final String bbgTicker = EquitySecurityUtils.getIndexOrEquityNameFromUnderlying(security);
    final Set<ValueSpecification> resultsWithExtraProperties = Sets.newHashSetWithExpectedSize(results.size());
    for (final ValueSpecification spec : results) {
      final String name = spec.getValueName();
      final ComputationTargetSpecification targetSpec = spec.getTargetSpecification();
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

    SecuritySearchRequest securityRequest = new SecuritySearchRequest();
    securityRequest.setName(name);
    securityRequest.setSortOrder(SecuritySearchSortOrder.NAME_ASC);

    for (SecurityDocument doc : SecuritySearchIterator.iterable(securityMaster, securityRequest)) {
      FinancialSecurity security = (FinancialSecurity) doc.getSecurity();
      try {
        security.accept(new FuturePriceCurveCreatorVisitor(configMaster, bbgRefData, _curveSpecificationNames, _curveDefinitionNames, dryRun));
      } catch (Exception ex) {
        s_logger.error("Error processing " + security.getName() + ": " + ex.getLocalizedMessage());
        continue;
      }
    }
  }
View Full Code Here

Examples of com.opengamma.financial.security.FinancialSecurity

  }

  @Override
  protected Set<ComputedValue> getResult(final InstrumentDerivative forex, final ForexOptionDataBundle<?> data, final ComputationTarget target,
      final Set<ValueRequirement> desiredValues, final FunctionInputs inputs, final ValueSpecification spec, final FunctionExecutionContext executionContext) {
    final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
    final ValueRequirement desiredValue = Iterables.getOnlyElement(desiredValues);
    final String putCurveCalculationConfigName = desiredValue.getConstraint(PUT_CURVE_CALC_CONFIG);
    final String callCurveCalculationConfigName = desiredValue.getConstraint(CALL_CURVE_CALC_CONFIG);
    final String curveCurrency = desiredValue.getConstraint(ValuePropertyNames.CURVE_CURRENCY);
    final String curveName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
    final Object curveSensitivitiesObject = inputs.getValue(ValueRequirementNames.FX_CURVE_SENSITIVITIES);
    final String resultCurveConfigName;
    final String putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor()).getCode();
    if (curveCurrency.equals(putCurrency)) {
      resultCurveConfigName = putCurveCalculationConfigName;
    } else {
      resultCurveConfigName = callCurveCalculationConfigName;
    }
View Full Code Here
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.