Examples of Holding


Examples of net.helipilot50.stocktrade.model.Holding

     
      @Override
      public void scanCallback(String namespace, String set, byte[] digest,
          Map<String, Object> bins, int generation, int expirationDate,
          Object userData) {
        Holding holding = new Holding();
        holding.set("customerName", bins.get("CustomerName"));
        holding.set("stockName", bins.get("StockName"));
        holding.set("quantity", bins.get("Quantity"));
        holding.set("price", bins.get("Price"));
        holdings.add(holding);
       
      }
    }, null);
    customer.setHoldingList(holdings);
View Full Code Here

Examples of net.helipilot50.stocktrade.model.Holding

    return customer;

  }
 
  public static Holding toHoldingDTO(StockTradeBusinessClasses.Holding holding){
    Holding holdingDTO = new Holding(holding.getCustomerName().toString(),
        holding.getStockName(),
        holding.getQuantity(),
        holding.getPrice());
    return holdingDTO;
  }
View Full Code Here

Examples of net.helipilot50.stocktrade.shared.Holding

     * @param pPrice Type: float
     */
    public void decrementHolding(String pCustomerName, String pStockName, int pQuantity, float pPrice) {
        try {
            Customer oneCustomer = null;
            Holding custHolding = null;
            float incomeFromStock = pQuantity*pPrice;
   
            oneCustomer = this.getCustomer(pCustomerName);
            //custHolding = self.GetHolding(pCustomer=oneCustomer,
            //        pGetHoldStockName=pStockName);
            custHolding = customerDAO.SQLSelectHolding(pCustomerName, pStockName);
   
            if (custHolding.getQuantity() > pQuantity) {
                custHolding.setQuantity(custHolding.getQuantity()-pQuantity);
                oneCustomer.setCashBalance(oneCustomer.getCashBalance()+incomeFromStock);
                customerDAO.SQLUpdateHolding(custHolding);
                customerDAO.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());
   
            }
            else if (custHolding.getQuantity() == pQuantity) {
              customerDAO.SQLDeleteHolding(custHolding);
   
                //oneCustomer.HoldingList.DeleteRow(object=custHolding);
                oneCustomer.setCashBalance(oneCustomer.getCashBalance()+incomeFromStock);
                customerDAO.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());
   
            }
            else if (custHolding.getQuantity() < pQuantity) {
                InvalidTradeException badOrder = new InvalidTradeException("Customer "+pCustomerName+" does not own enough stock to place SELL Order");
                throw badOrder;
            }
        }
        catch (NoSuchHoldingException noHolding) {
View Full Code Here

Examples of net.helipilot50.stocktrade.shared.Holding

     * @param pQuantity Type: int
     * @param pPrice Type: float
     */
    public void incrementHolding(String pCustomerName, String pStockName, int pQuantity, float pPrice) {
        Customer oneCustomer = null;
        Holding custHolding = null;

        float costOfStock = pQuantity*pPrice;

        oneCustomer = this.getCustomer(pCustomerName);

        if (oneCustomer.getCashBalance() > costOfStock) {
            try {
                oneCustomer.setCashBalance(oneCustomer.getCashBalance()-costOfStock);
                //    custHolding = self.GetHolding(pCustomer=oneCustomer,pGetHoldStockName=pStockName);
                custHolding = customerDAO.SQLSelectHolding(pCustomerName, pStockName);
                custHolding.setQuantity(custHolding.getQuantity()+pQuantity);
                customerDAO.SQLUpdateHolding(custHolding);
                customerDAO.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());

            }
            catch (NoSuchHoldingException noHolding) {
                    Holding newHolding = new Holding();
                    newHolding.setCustomerName(pCustomerName);
                    newHolding.setPrice(pPrice);
                    newHolding.setQuantity(pQuantity);
                    newHolding.setStockName(pStockName);
                    customerDAO.SQLInsertHolding(newHolding);
                    customerDAO.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());


                    //        oneCustomer.HoldingList.AppendRow(object=newHolding);
View Full Code Here

Examples of net.helipilot50.stocktrade.shared.Holding

        // select * into :aHolding from Holding
        //           where CustomerName = :pSelHoldCustName
        //           and StockName = :pSelHoldStockName
        //           on session DBConnection
        // -- ============================================
        Holding aHolding = (Holding) getJpaTemplate().find("from holding where customerName = ? and StockName = ?", pSelHoldCustName, pSelHoldStockName);
        if (aHolding == null){
            NoSuchHoldingException noHolding = new NoSuchHoldingException("Customer " + pSelHoldCustName + " does not own this stock");
            throw noHolding;
        }
        return aHolding;
View Full Code Here

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

    return new DataCreationProgressCache();
  }

  @Bean
  public Holding holding() {
    Holding holding = new Holding();
    holding.setHoldingid(HOLDING_ID);
    holding.setAccountAccountid(ACCOUNT_ID);
    holding.setPurchasedate(new Date(1329759342904l));
    holding.setQuoteSymbol(SYMBOL);
    holding.setPurchaseprice(PURCHASE_PRICE);
    holding.setQuantity(QUANTITY);
    return holding;
  }
View Full Code Here

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

  @Autowired
    HoldingRepository holdingRepository;

  public Holding getNewTransientHolding(int index) {
        Holding obj = new Holding();
        setAccountAccountid(obj, index);
        setPurchasedate(obj, index);
        setPurchaseprice(obj, index);
        setQuantity(obj, index);
        setQuoteSymbol(obj, index);
View Full Code Here

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

            index = 0;
        }
        if (index > (data.size() - 1)) {
            index = data.size() - 1;
        }
        Holding obj = data.get(index);
        Integer id = obj.getHoldingid();
        return holdingRepository.findOne(id);
    }
View Full Code Here

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

        return holdingRepository.findOne(id);
    }

  public Holding getRandomHolding() {
        init();
        Holding obj = data.get(rnd.nextInt(data.size()));
        Integer id = obj.getHoldingid();
        return holdingRepository.findOne(id);
    }
View Full Code Here

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

            return;
        }
       
        data = new ArrayList<Holding>();
        for (int i = 0; i < 10; i++) {
            Holding obj = getNewTransientHolding(i);
            try {
                holdingRepository.save(obj);
            } catch (ConstraintViolationException e) {
                StringBuilder msg = new StringBuilder();
                for (Iterator<ConstraintViolation<?>> iter = e.getConstraintViolations().iterator(); iter.hasNext();) {
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.