Package com.xeiam.xchange.dto.Order

Examples of com.xeiam.xchange.dto.Order.OrderType


   * @return
   */
  public static LimitOrder adaptOrder(BigDecimal amount, BigDecimal price, String tradedCurrency, String transactionCurrency, String orderTypeString, String id, Date timestamp) {

    // place a limit order
    OrderType orderType = SIDE_BID.equalsIgnoreCase(orderTypeString) ? OrderType.BID : OrderType.ASK;
    CurrencyPair currencyPair = adaptCurrencyPair(tradedCurrency, transactionCurrency);

    LimitOrder limitOrder = new LimitOrder(orderType, amount, currencyPair, id, timestamp, price);

    return limitOrder;
View Full Code Here


   * @param anxTrade
   * @return
   */
  public static Trade adaptTrade(ANXTrade anxTrade) {

    OrderType orderType = adaptSide(anxTrade.getTradeType());
    BigDecimal amount = anxTrade.getAmount();
    BigDecimal price = anxTrade.getPrice();
    CurrencyPair currencyPair = adaptCurrencyPair(anxTrade.getItem(), anxTrade.getPriceCurrency());
    Date dateTime = DateUtils.fromMillisUtc(anxTrade.getTid());
    final String tradeId = String.valueOf(anxTrade.getTid());
View Full Code Here

  private static UserTrade adaptUserTrade(ANXTradeResult t) {

    BigDecimal tradedCurrencyFillAmount = t.getTradedCurrencyFillAmount();
    CurrencyPair currencyPair = adaptCurrencyPair(t.getCurrencyPair());
    BigDecimal price = t.getSettlementCurrencyFillAmount().divide(tradedCurrencyFillAmount, PRICE_SCALE, BigDecimal.ROUND_HALF_EVEN);
    OrderType type = adaptSide(t.getSide());
    // for fees, getWalletHistory should be used.
    return new UserTrade(type, tradedCurrencyFillAmount, currencyPair, price, t.getTimestamp(), t.getTradeId(), t.getOrderId(), null, null);
  }
View Full Code Here

  public static Trade adaptTrade(BTCChinaTrade btcChinaTrade, CurrencyPair currencyPair) {

    BigDecimal amount = btcChinaTrade.getAmount();
    BigDecimal price = btcChinaTrade.getPrice();
    Date date = adaptDate(btcChinaTrade.getDate());
    OrderType orderType = btcChinaTrade.getOrderType().equals("sell") ? OrderType.ASK : OrderType.BID;

    final String tradeId = String.valueOf(btcChinaTrade.getTid());
    return new Trade(orderType, amount, currencyPair, price, date, tradeId);
  }
View Full Code Here

  /**
   * Adapts BTCChinaOrder to LimitOrder.
   */
  public static LimitOrder adaptLimitOrder(BTCChinaOrder order, CurrencyPair currencyPair) {

    OrderType orderType = order.getType().equals("bid") ? OrderType.BID : OrderType.ASK;
    BigDecimal amount = order.getAmount();
    String id = Long.toString(order.getId());
    Date date = adaptDate(order.getDate());
    BigDecimal price = order.getPrice();

View Full Code Here

    // could also be 'rebate' or other
    if (!(type.startsWith("buy") || type.startsWith("sell"))) {
      return null;
    }

    final OrderType orderType = type.startsWith("buy") ? OrderType.BID : OrderType.ASK;
    final CurrencyPair currencyPair = adaptCurrencyPair(transaction.getMarket());

    final BigDecimal amount;
    final BigDecimal money;
    final int scale;
View Full Code Here

  private LimitOrder adaptOrder(CoinfloorOrder order) throws ExchangeException {

    String baseCurrency = order.getBase().toString();
    String counterCurrency = order.getCounter().toString();

    OrderType type = null;
    if (order.getBaseQty().doubleValue() > 0) {
      type = OrderType.BID;
    }
    else if (order.getBaseQty().doubleValue() <= 0) {
      type = OrderType.ASK;
View Full Code Here

          }
        }
      }
      cachedOrderBook = new OrderBook(new Date(), askList, bidList);

      OrderType type = (rawRetObj.getBidId() > rawRetObj.getAskId() ? OrderType.BID : OrderType.ASK);
      BigDecimal limitPrice = rawRetObj.getPrice();

      trade =
          new Trade(type, rawRetObj.getBaseQty(), new CurrencyPair(rawRetObj.getBase().toString(), rawRetObj.getCounter().toString()), limitPrice, new Date(), String.valueOf(rawRetObj.getId()));
View Full Code Here

    // Interested in the private trading functionality (authentication)
    PollingTradeService tradeService = krakenExchange.getPollingTradeService();

    // place a marketOrder with volume 0.01
    OrderType orderType = (OrderType.BID);
    BigDecimal tradeableAmount = new BigDecimal("0.01");

    MarketOrder marketOrder = new MarketOrder(orderType, tradeableAmount, CurrencyPair.BTC_EUR);

    String orderID = tradeService.placeMarketOrder(marketOrder);
View Full Code Here

    // Interested in the private trading functionality (authentication)
    KrakenTradeServiceRaw tradeService = (KrakenTradeServiceRaw) krakenExchange.getPollingTradeService();

    // place a marketOrder with volume 0.01
    OrderType orderType = (OrderType.BID);
    BigDecimal tradeableAmount = new BigDecimal("0.01");

    MarketOrder marketOrder = new MarketOrder(orderType, tradeableAmount, CurrencyPair.BTC_EUR);

    KrakenOrderResponse orderID = tradeService.placeKrakenMarketOrder(marketOrder);
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.dto.Order.OrderType

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.