@Override public InstrumentDerivative convert( final IRFutureOptionSecurity security, final InterestRateFutureOptionMarginTransactionDefinition definition, final ZonedDateTime now, final String[] curveNames, final HistoricalTimeSeriesBundle timeSeries) { final HistoricalTimeSeries ts = timeSeries.get( MarketDataRequirementNames.MARKET_VALUE, security.getExternalIdBundle()); if (ts == null) { throw new OpenGammaRuntimeException( "Could not get price time series for " + security); } final int length = ts.getTimeSeries().size(); if (length == 0) { throw new OpenGammaRuntimeException( "Price time series for " + security.getUnderlyingId() + " was empty"); } final double lastMarginPrice = ts.getTimeSeries().getLatestValue(); return definition.toDerivative(now, lastMarginPrice, curveNames); }