Package com.xeiam.xchange.dto.marketdata

Examples of com.xeiam.xchange.dto.marketdata.Trade


      @Override
      public void onEvent(String channelName, String eventName, String data) {

        ExchangeEvent xevt = null;
        try {
          Trade t = parseTrade(data);
          xevt = new DefaultExchangeEvent(ExchangeEventType.TRADE, data, t);
        } catch (IOException e) {
          log.error("JSON stream error", e);
        }
        if (xevt != null) {
View Full Code Here


    String tradableIdentifier = bTCETrade.getTradeableIdentifier();
    CurrencyPair currencyPair = new CurrencyPair(tradableIdentifier, currency);
    Date date = DateUtils.fromMillisUtc(bTCETrade.getDate() * 1000L);

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

    BigDecimal amount = bTCETrade.getAmount();
    BigDecimal price = bTCETrade.getPrice();
    Date date = DateUtils.fromMillisUtc(bTCETrade.getDate() * 1000L);

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

    assertThat(adaptedTrades.getlastID()).isEqualTo(0);
    assertThat(adaptedTrades.getTradeSortType()).isEqualTo(TradeSortType.SortByTimestamp);
    final List<Trade> tradesList = adaptedTrades.getTrades();
    assertThat(tradesList).hasSize(2);

    final Trade trade = tradesList.get(0);
    assertThat(trade.getTimestamp().getTime()).isEqualTo(1405056569000L);
    assertThat(trade.getType()).isEqualTo(OrderType.ASK);
    assertThat(trade.getPrice()).isEqualTo("0.00000004");
    assertThat(trade.getTradableAmount()).isEqualTo("2299494.19282106");
    assertThat(trade.getCurrencyPair()).isEqualTo(CurrencyPair.LTC_BTC);
  }
View Full Code Here

  public static Trades adaptTrade(BTCCentralTrade[] btcCentralTrades, CurrencyPair currencyPair) {

    List<Trade> trades = new ArrayList<Trade>();

    for (BTCCentralTrade btcCentralTrade : btcCentralTrades) {
      Trade trade =
          new Trade(null, btcCentralTrade.getTraded_btc(), currencyPair, btcCentralTrade.getPrice(), new Date(btcCentralTrade.getCreated_at_int()), btcCentralTrade.getUuid().toString());

      trades.add(trade);
    }

    return new Trades(trades, Trades.TradeSortType.SortByTimestamp);
View Full Code Here

    Trades adaptedTrades = adaptedTradesMap.get(CurrencyPair.DOGE_LTC);
    List<Trade> adaptedTradesList = adaptedTrades.getTrades();
    assertThat(adaptedTradesList).hasSize(2);

    Trade adaptedTrade = adaptedTradesList.get(1);
    assertThat(adaptedTrade.getCurrencyPair()).isEqualTo(CurrencyPair.DOGE_LTC);
    assertThat(adaptedTrade.getId()).isEqualTo("47692497");
    assertThat(adaptedTrade.getPrice()).isEqualTo("0.00003495");
    assertThat(adaptedTrade.getTradableAmount()).isEqualTo("2961.55892792");
    assertThat(adaptedTrade.getTimestamp()).isEqualTo(CryptsyUtils.convertDateTime("2014-05-29 21:49:34"));
    assertThat(adaptedTrade.getType()).isNull();
  }
View Full Code Here

    String tradableIdentifier = bTCETrade.getTradeableIdentifier();
    CurrencyPair currencyPair = new CurrencyPair(tradableIdentifier, currency);
    Date date = DateUtils.fromMillisUtc(bTCETrade.getDate() * 1000L);

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

      Date timeStamp = DateUtils.fromMillisUtc(result.getTimestamp() * 1000L);
      String tradeId = String.valueOf(entry.getKey());
      String orderId = String.valueOf(result.getOrderId());
      CurrencyPair currencyPair = new CurrencyPair(pair[0].toUpperCase(), pair[1].toUpperCase());

      trades.add(new Trade(type, tradableAmount, currencyPair, price, timeStamp, tradeId, orderId));
    }
    return new Trades(trades, TradeSortType.SortByTimestamp);
  }
View Full Code Here

    BigDecimal amount = bTCETrade.getAmount();
    BigDecimal price = bTCETrade.getPrice();
    Date date = DateUtils.fromMillisUtc(bTCETrade.getDate() * 1000L);

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

      BigDecimal tradableAmount = result.getAmount();
      Date timeStamp = DateUtils.fromMillisUtc(result.getTimestamp() * 1000L);
      String orderId = String.valueOf(result.getOrderId());
      String tradeId = String.valueOf(entry.getKey());
      CurrencyPair currencyPair = new CurrencyPair(pair[0].toUpperCase(), pair[1].toUpperCase());
      trades.add(new Trade(type, tradableAmount, currencyPair, price, timeStamp, tradeId, orderId));
    }
    return new Trades(trades, TradeSortType.SortByTimestamp);
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.dto.marketdata.Trade

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.