Package com.opengamma.core.position.impl

Examples of com.opengamma.core.position.impl.SimplePosition


  @Test
  public void getRequirements() {
    FunctionCompilationContext fcctx = mock(FunctionCompilationContext.class);
    DV01_test_fun dv01 = new DV01_test_fun();

    assertTrue(dv01.canApplyTo(fcctx, new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition())));

    ComputationTargetSpecification cts = new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("a", "b"));
    ComputationTarget ct = mock(ComputationTarget.class);
    when(ct.toSpecification()).thenReturn(cts);
View Full Code Here


  @Test
  public void getResultsTest_2() {
    FunctionCompilationContext fcctx = mock(FunctionCompilationContext.class);
    DV01_test_fun dv01 = new DV01_test_fun();

    assertTrue(dv01.canApplyTo(fcctx, new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition())));

    ComputationTargetSpecification cts = new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("a", "b"));
    ComputationTarget ct = mock(ComputationTarget.class);
    when(ct.toSpecification()).thenReturn(cts);
    ValueProperties valueProperties = ValueProperties.builder().with("A", "1").with("B", "1").with(ValuePropertyNames.FUNCTION, "PV01_Function").get();
View Full Code Here

  public void testNull() {
    assertEncodeDecodeCycle(ComputationTarget.class, ComputationTarget.NULL);
  }

  public void testBasic() {
    assertEncodeDecodeCycle(ComputationTarget.class, new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "Foo"), BigDecimal.ONE, ExternalId.of("Sec", "Bar"))));
  }
View Full Code Here

  public void testNested_1() {
    assertEncodeDecodeCycle(ComputationTarget.class,
        new ComputationTarget(
            new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Prt", "Foo")).containing(ComputationTargetType.POSITION, UniqueId.of("Pos", "Foo")),
            new SimplePosition(UniqueId.of("Pos", "Foo"), BigDecimal.ONE, ExternalId.of("Sec", "Bar"))));
  }
View Full Code Here

    assertEncodeDecodeCycle(
        ComputationTarget.class,
        new ComputationTarget(
            new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Prt", "Foo")).containing(ComputationTargetType.PORTFOLIO_NODE, UniqueId.of("Prt", "Bar")).containing(
                ComputationTargetType.POSITION, UniqueId.of("Pos", "Foo")),
            new SimplePosition(UniqueId.of("Pos", "Foo"), BigDecimal.ONE, ExternalId.of("Sec", "Bar"))));
  }
View Full Code Here

    final DependencyNode n1 = new DependencyNode(t1.toSpecification());
    n1.setFunction(new MockFunction("F1", t1));
    n1.addOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    n1.addTerminalOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    graph.addDependencyNode(n1);
    final ComputationTarget t2 = new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "0"), BigDecimal.ONE, ExternalId.of("Security", "Foo")));
    final DependencyNode n2 = new DependencyNode(t2.toSpecification());
    n2.setFunction(new MockFunction("F2", t1));
    n2.addOutputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputNode(n2);
View Full Code Here

  }

  private FunctionRepository createFunctionRepository() {
    final InMemoryFunctionRepository functions = new InMemoryFunctionRepository();
    functions.addFunction(new MockFunction("F1", new ComputationTarget(ComputationTargetType.PORTFOLIO_NODE, new SimplePortfolioNode(UniqueId.of("Node", "0"), "node"))));
    functions.addFunction(new MockFunction("F2", new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "0"), BigDecimal.ONE, ExternalId.of("Security", "Foo")))));
    functions.addFunction(new MockFunction("F3", new ComputationTarget(ComputationTargetType.SECURITY, createSecurity(UniqueId.of("Pos", "0"), ExternalId.of("Security", "Foo")))));
    return functions;
  }
View Full Code Here

    return new TargetResolverPosition(targetResolver, this);
  }

  @Override
  protected SimplePosition simpleObject() {
    return new SimplePosition(this);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.position.impl.SimplePosition

Copyright © 2018 www.massapicom. 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.