Package com.xeiam.xchange.dto.trade

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


    return limitOrders;
  }

  public static LimitOrder adaptOrder(final BigDecimal amount, final BigDecimal price, final CurrencyPair currencyPair, final OrderType orderType) {

    return new LimitOrder(orderType, amount, currencyPair, null, null, price);
  }
View Full Code Here


    return new CurrencyPair(justcoinMarket.substring(0, 3), justcoinMarket.substring(3));
  }

  public static LimitOrder adaptLimitOrder(final JustcoinOrder justcoinOrder) {

    return new LimitOrder(OrderType.valueOf(justcoinOrder.getType().toUpperCase()), justcoinOrder.getRemaining(), adaptCurrencyPair(justcoinOrder.getMarket()), justcoinOrder.getId(), justcoinOrder
        .getCreatedAt(), justcoinOrder.getPrice());
  }
View Full Code Here

    OrderBook adaptedOrderBook = LakeBTCAdapters.adaptOrderBook(orderBook, CurrencyPair.BTC_USD);

    List<LimitOrder> asks = adaptedOrderBook.getAsks();
    assertThat(asks.size()).isEqualTo(3);
    LimitOrder order = asks.get(0);
    assertThat(order.getLimitPrice()).isEqualTo("564.87");
    assertThat(order.getTradableAmount()).isEqualTo("22.371");
    assertThat(order.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_USD);
  }
View Full Code Here

      OrderType orderType = vosOrder.getType().equalsIgnoreCase("bid") ? OrderType.BID : OrderType.ASK;
      String id = Integer.toString(vosOrder.getOrder_id());
      BigDecimal price = vosOrder.getPrice().getValue();
      CurrencyPair currPair = new CurrencyPair(vosOrder.getOrder_currency(), vosOrder.getPayment_currency());

      limitOrders.add(new LimitOrder(orderType, vosOrder.getUnits().getValue(), currPair, id, DateUtils.fromMillisUtc(vosOrder.getOrder_date() / 1000L), price));
    }

    return new OpenOrders(limitOrders);
  }
View Full Code Here

  private static List<LimitOrder> transformArrayToLimitOrders(BigDecimal[][] orders, OrderType orderType, CurrencyPair currencyPair) {

    List<LimitOrder> limitOrders = new ArrayList<LimitOrder>();

    for (BigDecimal[] order : orders) {
      limitOrders.add(new LimitOrder(orderType, order[1], currencyPair, null, new Date(), order[0]));
    }

    return limitOrders;
  }
View Full Code Here

    List<LimitOrder> askOrders = new ArrayList<LimitOrder>(asksLength);
    List<LimitOrder> bidOrders = new ArrayList<LimitOrder>(bidsLength);

    for (int i = asksLength - 1; i >= 0; i--) {
      BigDecimal[] ask = asks[i];
      LimitOrder order = new LimitOrder.Builder(OrderType.ASK, CurrencyPair.BTC_USD).limitPrice(ask[0]).tradableAmount(ask[1]).build();
      askOrders.add(order);
    }

    for (int i = 0; i < bidsLength; i++) {
      BigDecimal[] bid = bids[i];
      LimitOrder order = new LimitOrder.Builder(OrderType.BID, CurrencyPair.BTC_USD).limitPrice(bid[0]).tradableAmount(bid[1]).build();
      bidOrders.add(order);
    }

    return new OrderBook(timeStamp, askOrders, bidOrders);
  }
View Full Code Here

  public static LimitOrder adaptOrder(VosOrder vosOrder, CurrencyPair pair, String orderTypeString, String id) {

    // place a limit order
    OrderType orderType = orderTypeString.equalsIgnoreCase("bid") ? OrderType.BID : OrderType.ASK;

    return new LimitOrder(orderType, vosOrder.getAmount().getValue(), pair, id, null, vosOrder.getPrice().getValue());
  }
View Full Code Here

    return new Ticker.Builder().currencyPair(currencyPair).last(last).high(high).low(low).volume(volume).build();
  }

  public static LimitOrder createOrder(CurrencyPair currencyPair, List<BigDecimal> priceAndAmount, Order.OrderType orderType) {

    return new LimitOrder(orderType, priceAndAmount.get(1), currencyPair, "", null, priceAndAmount.get(0));
  }
View Full Code Here

  public static LimitOrder adaptOrder(KrakenPublicOrder order, OrderType orderType, CurrencyPair currencyPair) {

    Date timeStamp = new Date(order.getTimestamp() * 1000);
    BigDecimal volume = order.getVolume();

    return new LimitOrder(orderType, volume, currencyPair, "", timeStamp, order.getPrice());
  }
View Full Code Here

    BigDecimal tradableAmount = krakenOrder.getVolume().subtract(krakenOrder.getVolumeExecuted());
    String tradableIdentifier = adaptCurrency(orderDescription.getAssetPair().substring(0, 3));
    String transactionCurrency = adaptCurrency(orderDescription.getAssetPair().substring(3));
    Date timestamp = new Date((long) (krakenOrder.getOpenTimestamp() * 1000L));

    return new LimitOrder(type, tradableAmount, new CurrencyPair(tradableIdentifier, transactionCurrency), id, timestamp, orderDescription.getPrice());
  }
View Full Code Here

TOP

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

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.