@Test
  public void testPtOrderMemoryHandler() {
    PutThroughTransaction pushThroughTransactionInfo = new PutThroughTransaction();
    pushThroughTransactionInfo.setSymbol("SAM");
    pushThroughTransactionInfo.setVolume(4120.0);
    pushThroughTransactionInfo.setPrice(14000.0);
    pushThroughTransactionInfo.setFloorCode("10");
    pushThroughTransactionInfo.setTradingDate("2015019");

    PutThroughTransaction pushThroughTransactionInfo1 = new PutThroughTransaction();
    pushThroughTransactionInfo1.setSymbol("SSI");
    pushThroughTransactionInfo1.setVolume(6120.0);
    pushThroughTransactionInfo1.setPrice(24000.0);
    pushThroughTransactionInfo1.setFloorCode("10");
    pushThroughTransactionInfo1.setTradingDate("2015019");

    List<PutThroughTransaction> listOfPt = new ArrayList<PutThroughTransaction>();

    listOfPt.add(pushThroughTransactionInfo);
    listOfPt.add(pushThroughTransactionInfo1);

    SecInfo stock2 = new SecInfo();
    stock2.setCode("SAM");
    stock2.setBasicPrice(21.0);
    stock2.setCeilingPrice(21.9);
    stock2.setFloorPrice(19.5);

    SecInfo stock1 = new SecInfo();
    stock1.setCode("SSI");
    stock1.setBasicPrice(8.0);
    stock1.setCeilingPrice(8.8);
    stock1.setFloorPrice(7.5);

    memory.put("STOCK", "SSI", stock1);
    memory.put("STOCK", "SAM", stock2);

    memoryHandler.handle(pushThroughTransactionInfo);
    memoryHandler.handle(pushThroughTransactionInfo1);

    List<PutThroughTransaction> putThroughTransactions =
        (List<PutThroughTransaction>) memory.get("PutThroughTransaction", "10");
    Assert.assertEquals(listOfPt, putThroughTransactions);
  }
Пример #2
0
  @Test
  public void testGetGDTTByFloorCodeWithDataInMemory() {
    PutThrough tran1 = new PutThrough();
    tran1.setFloorCode("02");
    tran1.setStockSymbol("HAG");
    tran1.setTime("20141225");

    List<PutThrough> transactions = new ArrayList<>();
    transactions.add(tran1);

    memory.put("PutThrough", "02", transactions);

    SecInfo stock1 = new SecInfo();
    stock1.setCode("HAG");
    stock1.setBasicPrice(21.0);
    stock1.setCeilingPrice(21.9);
    stock1.setFloorPrice(19.5);

    memory.put("STOCK", "HAG", stock1);

    Map<String, List<Map<String, Object>>> adOrderList = adOrdercontroller.getPtOrder();
    Assert.assertEquals(1, adOrderList.size());
  }