Examples of Quote


Examples of org.springframework.nanotrader.data.domain.Quote

        Assert.assertNotNull("Expected 'Quote' identifier to no longer be null", obj.getQuoteid());
    }

  @Test
    public void testDeleteQuote() {
        Quote obj = dod.getRandomQuote();
        Assert.assertNotNull("Data on demand for 'Quote' failed to initialize correctly", obj);
        Integer id = obj.getQuoteid();
        Assert.assertNotNull("Data on demand for 'Quote' failed to provide an identifier", id);
        obj = quoteService.findQuote(id);
        quoteService.deleteQuote(obj);
        quoteRepository.flush();
        Assert.assertNull("Failed to remove 'Quote' with identifier '" + id + "'", quoteService.findQuote(id));
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

  @Autowired
    QuoteRepository quoteRepository;

  public Quote getNewTransientQuote(int index) {
        Quote obj = new Quote();
        setChange1(obj, index);
        setCompanyname(obj, index);
        setHigh(obj, index);
        setLow(obj, index);
        setOpen1(obj, index);
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

            index = 0;
        }
        if (index > (data.size() - 1)) {
            index = data.size() - 1;
        }
        Quote obj = data.get(index);
        Integer id = obj.getQuoteid();
        return quoteService.findQuote(id);
    }
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

        return quoteService.findQuote(id);
    }

  public Quote getRandomQuote() {
        init();
        Quote obj = data.get(rnd.nextInt(data.size()));
        Integer id = obj.getQuoteid();
        return quoteService.findQuote(id);
    }
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

            return;
        }
       
        data = new ArrayList<Quote>();
        for (int i = 0; i < 10; i++) {
            Quote obj = getNewTransientQuote(i);
            try {
                quoteService.saveQuote(obj);
            } catch (ConstraintViolationException e) {
                StringBuilder msg = new StringBuilder();
                for (Iterator<ConstraintViolation<?>> iter = e.getConstraintViolations().iterator(); iter.hasNext();) {
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

        BigDecimal quantity = BigDecimal.valueOf(index);
        obj.setQuantity(quantity);
    }

  public void setQuote(Order obj, int index) {
        Quote quote = quoteDataOnDemand.getRandomQuote();
        obj.setQuote(quote);
    }
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

 
  @Test

  public void testFindMarketSummary() {
   
        Quote quote = new Quote();
        quote.setSymbol("symbol1");
        quote.setPrice(BigDecimal.valueOf(50.01) );
        quote.setChange1( BigDecimal.valueOf(5.00));
        quote.setVolume( BigDecimal.valueOf(50000));
        quote.setChange1( BigDecimal.valueOf(4.00));
        quote.setOpen1( BigDecimal.valueOf(49.00));
        quoteService.saveQuote(quote);
    entityManager.flush();
    entityManager.clear(); // force reload
        Quote quote2 = new Quote();
        quote2.setSymbol("symbol2");
        quote2.setPrice(BigDecimal.valueOf(150.00));
        quote2.setChange1(BigDecimal.valueOf(15.00));
        quote2.setVolume(BigDecimal.valueOf(150000));
        quote2.setChange1(BigDecimal.valueOf(4.00));
        quote2.setOpen1(BigDecimal.valueOf(120.00));
        quoteService.saveQuote(quote2);
        entityManager.flush();
    entityManager.clear(); // force reload
    MarketSummary marketSummary = tradingService.findMarketSummary();
    // need to harden this test!!
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

  
  public Message<Quote> aggregate(List<Message<?>> messages) {
    log.info("Aggregator released " + messages.size() + " message(s) at: " + new Date(System.currentTimeMillis()));
    //Just use the last message in the List of Messages
    Quote quote = (Quote) messages.get(messages.size() -1).getPayload();
    Message<Quote> aggregatedMessage = MessageBuilder.withPayload(quote).build();
    if (log.isDebugEnabled()) {
      log.debug("QuoteAggregator.aggregate() released aggregate quote = " + quote);
    }
    return aggregatedMessage;
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

  @Autowired
  QuoteRepository quoteRepository;

  @Before
  public void setupMocks() {
    Quote quote = new Quote();
    quote.setSymbol("VMW");
    quote.setPrice(BigDecimal.valueOf(120.0));
    quote.setVolume(BigDecimal.valueOf(1000));
    quote.setOpen1(BigDecimal.valueOf(115.0));
    quote.setHigh(BigDecimal.valueOf(130.0));
    quote.setLow(BigDecimal.valueOf(1.0));
    Mockito.when(quoteRepository.findBySymbol("VMW")).thenReturn(quote);
  }
View Full Code Here

Examples of org.springframework.nanotrader.data.domain.Quote

    Holding holding = holdingDataOnDemand.getNewTransientHolding(100);
    holding.setPurchasedate(new java.sql.Date(System.currentTimeMillis()));
    tradingService.saveHolding(holding);
    entityManager.flush();
    entityManager.clear(); // force reload
        Quote quote = new Quote();
        quote.setSymbol("quoteSymbol_100");
        quote.setPrice(BigDecimal.valueOf(50.00));
        quote.setChange1(BigDecimal.valueOf(5.00));
        quote.setVolume( BigDecimal.valueOf(50000));
        quoteService.saveQuote(quote);
        entityManager.flush();
    entityManager.clear(); // force reload
        Assert.assertNotNull("Expected 'Quote' identifier to no longer be null", quote.getQuoteid());
    PortfolioSummary portfolioSummary = tradingService.findPortfolioSummary(100);
    Assert.assertTrue("Expected 'PortfolioSummary' holding count to be equal to 1", portfolioSummary.getNumberOfHoldings() == 1);


  }
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.