예제 #1
0
 @Test
 public void testGetBulkSecuritiesByUniqueId() {
   final FudgeMsgEnvelope fme =
       getSecuritySourceResource()
           .getSecurities(Lists.newArrayList(_uid1.toString(), _uid2.toString()));
   assertNotNull(fme);
   final FudgeMsg msg = fme.getMessage();
   assertNotNull(msg);
   FudgeMsgFormatter.outputToSystemOut(msg);
   final Collection<FudgeField> securities = msg.getAllByName(SECURITYSOURCE_SECURITY);
   assertNotNull(securities);
   assertEquals(2, securities.size());
   FudgeDeserializer deserializer =
       new FudgeDeserializer(getSecuritySourceResource().getFudgeContext());
   for (FudgeField fudgeField : securities) {
     assertNotNull(fudgeField);
     ObjectsPair<UniqueId, Security> objectsPair =
         ObjectsPairFudgeBuilder.buildObject(
             deserializer, (FudgeMsg) fudgeField.getValue(), UniqueId.class, Security.class);
     assertNotNull(objectsPair);
     UniqueId uniqueId = objectsPair.getKey();
     assertNotNull(uniqueId);
     Security security = objectsPair.getValue();
     assertNotNull(security);
   }
 }
 public VolatilitySurfaceData(
     final String definitionName,
     final String specificationName,
     final UniqueIdentifiable target,
     final X[] xs,
     final String xLabel,
     final Y[] ys,
     final String yLabel,
     final Map<Pair<X, Y>, Double> values) {
   ArgumentChecker.notNull(definitionName, "Definition Name");
   ArgumentChecker.notNull(specificationName, "Specification Name");
   ArgumentChecker.notNull(target, "Target");
   ArgumentChecker.notNull(xs, "X axis values");
   ArgumentChecker.notNull(xLabel, "x label");
   ArgumentChecker.notNull(ys, "Y axis values");
   ArgumentChecker.notNull(yLabel, "y label");
   ArgumentChecker.notNull(values, "Volatility Values Map");
   _definitionName = definitionName;
   _specificationName = specificationName;
   _target = target;
   _values = Maps.newHashMap(values);
   _xs = xs;
   _xLabel = xLabel;
   _ys = ys;
   _yLabel = yLabel;
   _uniqueXs = new TreeSet<X>();
   _strips = Maps.newHashMap();
   for (Map.Entry<Pair<X, Y>, Double> entries : values.entrySet()) {
     if (_strips.containsKey(entries.getKey().getFirst())) {
       _strips
           .get(entries.getKey().getFirst())
           .add(ObjectsPair.of(entries.getKey().getSecond(), entries.getValue()));
     } else {
       _uniqueXs.add(entries.getKey().getFirst());
       final List<ObjectsPair<Y, Double>> list = Lists.newArrayList();
       list.add(ObjectsPair.of(entries.getKey().getSecond(), entries.getValue()));
       _strips.put(entries.getKey().getFirst(), list);
     }
   }
 }
 @Override
 public ObjectsPair<Collection<LiveDataSpecification>, Collection<LiveDataSpecification>>
     splitShouldFake(
         FakeSubscriptionBloombergLiveDataServer server,
         Collection<LiveDataSpecification> uniqueIds) {
   Collection<LiveDataSpecification> real = uniqueIds;
   Set<LiveDataSpecification> fakes = new HashSet<LiveDataSpecification>();
   for (FakeSubscriptionSelector subSelector : _fakeSubscriptionSelectors) {
     ObjectsPair<Collection<LiveDataSpecification>, Collection<LiveDataSpecification>> split =
         subSelector.splitShouldFake(server, real);
     real = split.first;
     fakes.addAll(split.second);
     if (real.isEmpty()) {
       break;
     }
   }
   return ObjectsPair.of(real, (Collection<LiveDataSpecification>) fakes);
 }
 public Double getVolatility(final X x, final Y y) {
   return _values.get(ObjectsPair.of(x, y));
 }
 /**
  * Returns the issuer/currency pair for the bond.
  *
  * @return The pair.
  */
 public Pair<String, Currency> getIssuerCurrency() {
   return ObjectsPair.of(getIssuer(), getCurrency());
 }