Package com.xeiam.xchange.dto.trade

Examples of com.xeiam.xchange.dto.trade.FloatingRateLoanOrder


  public static FloatingRateLoanOrder adaptFloatingRateLoanOrder(String currency, BigDecimal amount, int dayPeriod, String direction, String id, BigDecimal rate) {

    OrderType orderType = direction.equalsIgnoreCase("loan") ? OrderType.BID : OrderType.ASK;

    return new FloatingRateLoanOrder(orderType, currency, amount, dayPeriod, id, null, rate);
  }
View Full Code Here


    switch (updatedLoanOrder.getType()) {
    case ASK:

      it = floatingRateAsks.iterator();
      while (it.hasNext()) {
        FloatingRateLoanOrder order = it.next();
        if (order.getDayPeriod() == updatedLoanOrder.getDayPeriod()) {
          it.remove();
        }
        // check if the rate has changed and whether we know if it has changed
        if (!order.getRate().equals(updatedLoanOrder.getRate()) && !rateChanged) {
          rateChanged = true;
        }
        break;
      }

      floatingRateAsks.add(updatedLoanOrder);
      Collections.sort(floatingRateAsks);
      break;
    case BID:

      it = floatingRateBids.iterator();
      while (it.hasNext()) {
        FloatingRateLoanOrder order = it.next();
        if (order.getDayPeriod() == updatedLoanOrder.getDayPeriod()) {
          it.remove();
        }
        // check if the rate has changed and whether we know if it has changed
        if (!order.getRate().equals(updatedLoanOrder.getRate()) && !rateChanged) {
          rateChanged = true;
        }
        break;
      }

      floatingRateBids.add(updatedLoanOrder);
      Collections.sort(fixedRateBids);
      break;
    default:
      break;
    }

    if (rateChanged) {
      for (FloatingRateLoanOrder order : floatingRateAsks) {
        order.setRate(updatedLoanOrder.getRate());
      }
      for (FloatingRateLoanOrder order : floatingRateBids) {
        order.setRate(updatedLoanOrder.getRate());
      }
    }

    updateTimestamp(updatedLoanOrder.getTimestamp());
  }
View Full Code Here

    BitfinexOfferStatusResponse fixedRateResponse =
        tradeService.placeBitfinexFixedRateLoanOrder(new FixedRateLoanOrder(OrderType.BID, "USD", new BigDecimal("0.01"), 2, "", null, new BigDecimal("0.01")), BitfinexOrderType.LIMIT);
    System.out.println("Fixed rate order response: " + fixedRateResponse);

    BitfinexOfferStatusResponse floatingRateResponse =
        tradeService.placeBitfinexFloatingRateLoanOrder(new FloatingRateLoanOrder(OrderType.BID, "USD", new BigDecimal("0.01"), 2, "", null, BigDecimal.ZERO), BitfinexOrderType.MARKET);
    System.out.println("Floating rate order response: " + floatingRateResponse);

    BitfinexCreditResponse[] activeCredits = tradeService.getBitfinexActiveCredits();
    System.out.println("Active credits: " + Arrays.toString(activeCredits));
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.dto.trade.FloatingRateLoanOrder

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.