Package org.springframework.nanotrader.service.domain

Examples of org.springframework.nanotrader.service.domain.Holding


public class HoldingController extends BaseController {

  @RequestMapping(value = "/account/{accountId}/holding/{id}", method = RequestMethod.GET)
  public ResponseEntity<Holding> find(@PathVariable("id") final Integer id,
      @PathVariable("accountId") final Integer accountId) {
    Holding holdingResponse = new Holding();
    this.getSecurityUtil().checkAccount(accountId);
    holdingResponse = getTradingServiceFacade().findHolding(id,
        this.getSecurityUtil().getAccountFromPrincipal());
    return new ResponseEntity<Holding>(holdingResponse,
        getNoCacheHeaders(), HttpStatus.OK);
View Full Code Here


    public Holding findHolding(Integer id, Integer accountId) {
        if (log.isDebugEnabled()) {
            log.debug("TradingServiceFacade.findHolding: id=" + id);
        }
        Holding holdingResponse = new Holding();
        org.springframework.nanotrader.data.domain.Holding holding = tradingService.findHolding(id, accountId);
        if (holding == null) {
            throw new NoRecordsFoundException();
        }
        Set<String> symbol = new HashSet<String>();
        symbol.add(holding.getQuoteSymbol());
        Map<String, Quote> currentQuote = getCurrentQuotes(symbol);
        mapper.map(holding, holdingResponse);
        holdingResponse.setQuote(currentQuote.get(holding.getQuoteSymbol()));
        if (log.isDebugEnabled()) {
            log.debug("TradingServiceFacade.findHolding - after service call. Payload is: " + holdingResponse);
        }
        return holdingResponse;
    }
View Full Code Here

                symbols.add(h.getQuoteSymbol());
            }
           
            Map<String, Quote> currentQuotes = getCurrentQuotes(symbols);
            for(org.springframework.nanotrader.data.domain.Holding h: holdings) {
                Holding holding = new Holding();
                mapper.map(h, holding, HOLDING_MAPPING);
                holding.setQuote(currentQuotes.get(h.getQuoteSymbol()));
                holdingResponse.add(holding);
            }
        }
        if (log.isDebugEnabled()) {
            log.debug("TradingServiceFacade.findHoldingsByAccountId completed");
View Full Code Here

TOP

Related Classes of org.springframework.nanotrader.service.domain.Holding

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.