Package org.springframework.nanotrader.data.domain

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


    order.setQuote(quote());
    return order;
  }

  public Quote quote() {
    Quote quote = new Quote();
    quote.setQuoteid(QUOTE_ID);
    quote.setSymbol(SYMBOL);
    quote.setCompanyname(COMPANY_NAME);
    quote.setHigh(HIGH);
    quote.setOpen1(OPEN);
    quote.setVolume(VOLUME);
    quote.setPrice(CURRENT_PRICE);
    return quote;
  }
View Full Code Here


        Assert.assertTrue("Counter for 'Quote' incorrectly reported there were no entries", count > 0);
    }

  @Test
    public void testFindQuote() {
        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);
        Assert.assertNotNull("Find method for 'Quote' illegally returned null for id '" + id + "'", obj);
        Assert.assertEquals("Find method for 'Quote' returned the incorrect identifier", id, obj.getQuoteid());
    }
View Full Code Here

    }

  @Test
    public void testSaveQuote() {
        Assert.assertNotNull("Data on demand for 'Quote' failed to initialize correctly", dod.getRandomQuote());
        Quote obj = dod.getNewTransientQuote(Integer.MAX_VALUE);
        Assert.assertNotNull("Data on demand for 'Quote' failed to provide a new transient entity", obj);
        Assert.assertNull("Expected 'Quote' identifier to be null", obj.getQuoteid());
        quoteService.saveQuote(obj);
        quoteRepository.flush();
        Assert.assertNotNull("Expected 'Quote' identifier to no longer be null", obj.getQuoteid());
    }
View Full Code Here

        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

  @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

            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

        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

            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

        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

 
  @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

TOP

Related Classes of org.springframework.nanotrader.data.domain.Quote

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.