Package com.opengamma.financial.security

Examples of com.opengamma.financial.security.FinancialSecurity.accept()


      FinancialSecurityVisitor<Double> visitorAdapter = FinancialSecurityVisitorAdapter.<Double>builder()
        .equitySecurityVisitor(_equitySecurityVisitor)
        .equityOptionVisitor(_equityOptionSecurityVisitor)
        .create();
      FinancialSecurity security = (FinancialSecurity) position.getSecurityLink().resolve(_secSource);
      Double currMarketCap = security.accept(visitorAdapter);
      String classification = getCurrentMarketCapCategory(currMarketCap);
      return classification == null ? NO_CUR_MKT_CAP : classification;
    }
  }
View Full Code Here


        .equityOptionVisitor(_equityOptionSecurityVisitor)
        .create();
      FinancialSecurity security1 = (FinancialSecurity) position1.getSecurityLink().resolve(_secSource);
      FinancialSecurity security2 = (FinancialSecurity) position2.getSecurityLink().resolve(_secSource);
      Double currMktCap1 = security1.accept(visitorAdapter);
      Double currMktCap2 = security2.accept(visitorAdapter);
      return CompareUtils.compareWithNullLow(currMktCap1, currMktCap2);
    }
  }

View Full Code Here

      }

    };
    if (position.getSecurity() instanceof FinancialSecurity) {
      final FinancialSecurity security = (FinancialSecurity) position.getSecurity();
      return security.accept(visitor);
    }
    return NA;
  }

  @Override
View Full Code Here

  public String classifyPosition(final Position position) {
    final Security security = position.getSecurity();
    if (security instanceof FinancialSecurity) {
      final FinancialSecurity finSec = (FinancialSecurity) security;

      return finSec.accept(new FinancialSecurityVisitorAdapter<String>() {
        @Override
        public String visitAgricultureFutureSecurity(final AgricultureFutureSecurity security) {
          return AGRICULTURAL_FUTURES;
        }
View Full Code Here

    } else {
      position.getSecurityLink().resolve(_secSource);
      final FinancialSecurityVisitor<String> visitor = new Visitor(position);
      if (position.getSecurity() instanceof FinancialSecurity) {
        final FinancialSecurity finSec = (FinancialSecurity) position.getSecurity();
        return finSec.accept(visitor);
      }
      return NOT_LONG_SHORT;
    }
  }
View Full Code Here

      }

    };
    if (position.getSecurity() instanceof FinancialSecurity) {
      final FinancialSecurity security = (FinancialSecurity) position.getSecurity();
      return security.accept(visitor);
    }
    return NA;
  }

  @Override
View Full Code Here

    final double strike = security.getStrike();
    final boolean isKnockOut = security.isKnockOut();
    final boolean isPayer = security.isPayer();
    final CDSOptionExerciseType optionExerciseType = convertExerciseType(security.getExerciseType());
    final FinancialSecurity underlyingSecurity = (FinancialSecurity) _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId())); //TODO version correction
    final CreditDefaultSwapDefinition underlyingCDS = underlyingSecurity.accept(_underlyingConverter);
    //    underlyingCDS = underlyingCDS.withMaturityDate(maturityDate.plusYears(10));
    //    underlyingCDS = underlyingCDS.withEffectiveDate(maturityDate.plusDays(1));
    //    underlyingCDS = underlyingCDS.withStartDate(maturityDate);
    return new CreditDefaultSwapOptionDefinition(buySellProtection, protectionBuyer, protectionSeller, currency, startDate, maturityDate, notional, strike,
        isKnockOut, isPayer, optionExerciseType, underlyingCDS);
View Full Code Here

      } catch (final DateTimeException e) {
        s_logger.error("Could not parse date {} - must be in form YYYY-MM-DD", date);
        return null;
      }
      final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
      final InstrumentDefinition<?> definition = security.accept(_visitor);
      return _definitionConverter.getConversionTimeSeriesRequirements(security, definition);
    }

    // CompiledFunctionDefinition
View Full Code Here

    securityRequest.setSortOrder(SecuritySearchSortOrder.NAME_ASC);

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

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final Clock snapshotClock = executionContext.getValuationClock();
    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
    final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
    final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String putCurveName = desiredValue.getConstraint(PUT_CURVE);
    final String callCurveName = desiredValue.getConstraint(CALL_CURVE);
    final String surfaceName = desiredValue.getConstraint(ValuePropertyNames.SURFACE);
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.