public static FixedRateLoanOrder adaptFixedRateLoanOrder( String currency, BigDecimal amount, int dayPeriod, String direction, String id, BigDecimal rate) { OrderType orderType = direction.equalsIgnoreCase("loan") ? OrderType.BID : OrderType.ASK; return new FixedRateLoanOrder(orderType, currency, amount, dayPeriod, id, null, rate); }
public BitfinexOfferStatusResponse placeBitfinexFixedRateLoanOrder( FixedRateLoanOrder loanOrder, BitfinexOrderType orderType) throws IOException { String direction = loanOrder.getType() == OrderType.BID ? "loan" : "lend"; BitfinexOfferStatusResponse newOrderResponse = bitfinex.newOffer( apiKey, payloadCreator, signatureCreator, new BitfinexNewOfferRequest( String.valueOf(exchange.getNonceFactory().createValue()), loanOrder.getCurrency(), loanOrder.getOriginalAmount(), loanOrder.getRate(), loanOrder.getDayPeriod(), direction)); return newOrderResponse; }
switch (updatedLoanOrder.getType()) { case ASK: it = fixedRateAsks.iterator(); while (it.hasNext()) { FixedRateLoanOrder order = it.next(); if (order.getRate().equals(updatedLoanOrder.getRate()) && order.getDayPeriod() == updatedLoanOrder.getDayPeriod()) { it.remove(); break; while (it.hasNext()) { FixedRateLoanOrder order = it.next(); if (order.getRate().equals(updatedLoanOrder.getRate()) && order.getDayPeriod() == updatedLoanOrder.getDayPeriod()) { it.remove(); break; updateTimestamp(updatedLoanOrder.getTimestamp());
@Override public int compareTo(FixedRateLoanOrder fixedRateLoanOrder) { if (!this.getRate().equals(fixedRateLoanOrder.getRate())) { return this.getRate().compareTo(fixedRateLoanOrder.getRate()); } else { return this.getDayPeriod() - fixedRateLoanOrder.getDayPeriod(); } }
@Override public int compareTo(FixedRateLoanOrder fixedRateLoanOrder) { if (!this.getRate().equals(fixedRateLoanOrder.getRate())) { return this.getRate().compareTo(fixedRateLoanOrder.getRate()); } else { return this.getDayPeriod() - fixedRateLoanOrder.getDayPeriod(); } }
public BitfinexOfferStatusResponse placeBitfinexFixedRateLoanOrder( FixedRateLoanOrder loanOrder, BitfinexOrderType orderType) throws IOException { String direction = loanOrder.getType() == OrderType.BID ? "loan" : "lend"; BitfinexOfferStatusResponse newOrderResponse = bitfinex.newOffer( apiKey, payloadCreator, signatureCreator, new BitfinexNewOfferRequest( String.valueOf(exchange.getNonceFactory().createValue()), loanOrder.getCurrency(), loanOrder.getOriginalAmount(), loanOrder.getRate(), loanOrder.getDayPeriod(), direction)); return newOrderResponse; }
public static FixedRateLoanOrder adaptFixedRateLoanOrder( String currency, BigDecimal amount, int dayPeriod, String direction, String id, BigDecimal rate) { OrderType orderType = direction.equalsIgnoreCase("loan") ? OrderType.BID : OrderType.ASK; return new FixedRateLoanOrder(orderType, currency, amount, dayPeriod, id, null, rate); }
switch (updatedLoanOrder.getType()) { case ASK: it = fixedRateAsks.iterator(); while (it.hasNext()) { FixedRateLoanOrder order = it.next(); if (order.getRate().equals(updatedLoanOrder.getRate()) && order.getDayPeriod() == updatedLoanOrder.getDayPeriod()) { it.remove(); break; while (it.hasNext()) { FixedRateLoanOrder order = it.next(); if (order.getRate().equals(updatedLoanOrder.getRate()) && order.getDayPeriod() == updatedLoanOrder.getDayPeriod()) { it.remove(); break; updateTimestamp(updatedLoanOrder.getTimestamp());
new FixedRateLoanOrder( OrderType.BID, "USD", new BigDecimal("0.01"), 2, "", null, new BigDecimal("0.01")), BitfinexOrderType.LIMIT);
public static LoanInfo adaptPoloniexLoans(HashMap<String, PoloniexLoan[]> poloniexLoans) { Map<String, List<LoanOrder>> loans = new HashMap<>(); for (Map.Entry<String, PoloniexLoan[]> item : poloniexLoans.entrySet()) { List<LoanOrder> loanOrders = new ArrayList<>(); for (PoloniexLoan poloniexLoan : item.getValue()) { Date date = PoloniexUtils.stringToDate(poloniexLoan.getDate()); loanOrders.add( new FixedRateLoanOrder( OrderType.ASK, poloniexLoan.getCurrency(), poloniexLoan.getAmount(), poloniexLoan.getRange(), poloniexLoan.getId(), date, poloniexLoan.getRate())); // TODO } loans.put(item.getKey(), loanOrders); } return new LoanInfo(loans.get("provided"), loans.get("used")); }
public static FixedRateLoanOrder adaptFixedRateLoanOrder( String currency, BigDecimal amount, int dayPeriod, String direction, String id, BigDecimal rate) { OrderType orderType = direction.equalsIgnoreCase("loan") ? OrderType.BID : OrderType.ASK; return new FixedRateLoanOrder(orderType, currency, amount, dayPeriod, id, null, rate); }
public static FixedRateLoanOrder adaptFixedRateLoanOrder( String currency, BigDecimal amount, int dayPeriod, String direction, String id, BigDecimal rate) { OrderType orderType = direction.equalsIgnoreCase("loan") ? OrderType.BID : OrderType.ASK; return new FixedRateLoanOrder(orderType, currency, amount, dayPeriod, id, null, rate); }
public static LoanInfo adaptPoloniexLoans(HashMap<String, PoloniexLoan[]> poloniexLoans) { Map<String, List<LoanOrder>> loans = new HashMap<>(); for (Map.Entry<String, PoloniexLoan[]> item : poloniexLoans.entrySet()) { List<LoanOrder> loanOrders = new ArrayList<>(); for (PoloniexLoan poloniexLoan : item.getValue()) { Date date = PoloniexUtils.stringToDate(poloniexLoan.getDate()); loanOrders.add( new FixedRateLoanOrder( OrderType.ASK, poloniexLoan.getCurrency(), poloniexLoan.getAmount(), poloniexLoan.getRange(), poloniexLoan.getId(), date, poloniexLoan.getRate())); // TODO } loans.put(item.getKey(), loanOrders); } return new LoanInfo(loans.get("provided"), loans.get("used")); }