Package com.xeiam.xchange.dto.marketdata

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


      long tid = anxTrade.getTid();
      if (tid > latestTid)
        latestTid = tid;
      tradesList.add(adaptTrade(anxTrade));
    }
    return new Trades(tradesList, latestTid, TradeSortType.SortByID);
  }
View Full Code Here


      long tradeId = btcchinaTrade.getTid();
      if (tradeId > latestTradeId)
        latestTradeId = tradeId;
      tradesList.add(adaptTrade(btcchinaTrade, currencyPair));
    }
    return new Trades(tradesList, latestTradeId, TradeSortType.SortByID);
  }
View Full Code Here

      Trade trade = new Trade(OrderType.BID, bitMarketTrade.getAmount(), currencyPair, bitMarketTrade.getPrice(), new Date(bitMarketTrade.getDate()), bitMarketTrade.getTid());

      tradeList.add(trade);
    }

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

    ObjectMapper mapper = new ObjectMapper();

    ANXTradesWrapper anxTradesWrapper = mapper.readValue(is, ANXTradesWrapper.class);
    List<ANXTrade> anxTrades = anxTradesWrapper.getANXTrades();

    Trades trades = ANXAdapters.adaptTrades(anxTrades);
    assertThat(trades.getlastID()).isEqualTo(1402189349725L);

    List<Trade> tradeList = trades.getTrades();
    assertThat(tradeList.size()).isEqualTo(2);

    Trade trade = tradeList.get(0);
    assertThat(trade.getTradableAmount()).isEqualTo("0.25");
    assertThat(trade.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_USD);
View Full Code Here

    for (int i = 0; i < trades.length; i++) {
      OkCoinTrade trade = trades[i];
      tradeList.add(adaptTrade(trade, currencyPair));
    }
    long lastTid = trades.length > 0 ? (trades[trades.length - 1].getTid()) : 0L;
    return new Trades(tradeList, lastTid, TradeSortType.SortByTimestamp);
  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    BTCETradesWrapper bTCETradesWrapper = mapper.readValue(is, BTCETradesWrapper.class);

    Trades trades = BTCEAdapters.adaptTrades(bTCETradesWrapper.getTrades(com.xeiam.xchange.btce.v3.BTCEUtils.getPair(CurrencyPair.BTC_USD)), CurrencyPair.BTC_USD);
    // System.out.println(trades.getTrades().size());
    assertThat(trades.getTrades().size() == 150);

    // verify all fields filled
    assertThat(trades.getTrades().get(0).getPrice().toString()).isEqualTo("760.999");
    assertThat(trades.getTrades().get(0).getType()).isEqualTo(OrderType.ASK);
    assertThat(trades.getTrades().get(0).getTradableAmount().toString()).isEqualTo("0.028354");
    assertThat(trades.getTrades().get(0).getCurrencyPair()).isEqualTo(CurrencyPair.BTC_USD);
    // assertThat("transactionCurrency should be PLN",
    // trades.getTrades().get(0).getTransactionCurrency().equals("PLN"));
    // System.out.println(DateUtils.toUTCString(trades.getTrades().get(0).getTimestamp()));
    assertThat(DateUtils.toUTCString(trades.getTrades().get(0).getTimestamp())).isEqualTo("2013-11-23 11:10:04 GMT");
  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    BTERTradeHistory tradeHistory = mapper.readValue(is, BTERTradeHistory.class);

    Trades adaptedTrades = BTERAdapters.adaptTrades(tradeHistory, CurrencyPair.BTC_CNY);

    List<Trade> tradeList = adaptedTrades.getTrades();
    assertThat(tradeList).hasSize(2);

    Trade trade = tradeList.get(0);
    assertThat(trade.getType()).isEqualTo(OrderType.ASK);
    assertThat(trade.getTradableAmount()).isEqualTo("0.0129");
View Full Code Here

    // Interested in the public polling market data feed (no authentication)
    PollingMarketDataService marketDataService = okcoinExchange.getPollingMarketDataService();

    // Get the latest trade data for BTC_CNY
    Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD, Prompts.this_week);
    System.out.println(trades);
    System.out.println("Trades(0): " + trades.getTrades().get(0).toString());
    System.out.println("Trades size: " + trades.getTrades().size());

    // Get the latest trades data for BTC_CNY for the past couple of trades
    trades = marketDataService.getTrades(CurrencyPair.BTC_CNY, trades.getlastID() - 10);
    System.out.println(trades);
    System.out.println("Trades size: " + trades.getTrades().size());
  }
View Full Code Here

    // Use Jackson to parse it
    final ObjectMapper mapper = new ObjectMapper();
    CollectionType collectionType = mapper.getTypeFactory().constructCollectionType(List.class, JustcoinPublicTrade.class);
    final List<JustcoinPublicTrade> trades = mapper.readValue(is, collectionType);

    final Trades adaptedTrades = JustcoinAdapters.adaptPublicTrades(CurrencyPair.BTC_USD, trades);

    assertThat(adaptedTrades.getlastID()).isEqualTo(92726);

    final List<Trade> adaptedTradeList = adaptedTrades.getTrades();
    assertThat(adaptedTradeList).hasSize(2);

    final Trade adaptedTrade = adaptedTradeList.get(0);
    assertThat(adaptedTrade.getTradableAmount()).isEqualTo("0.16204");
    assertThat(adaptedTrade.getPrice()).isEqualTo("600.632");
View Full Code Here

    // Interested in the public polling market data feed (no authentication)
    PollingMarketDataService marketDataService = krakenExchange.getPollingMarketDataService();

    // Get the latest trade data for BTC_USD
    Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD);
    System.out.println(trades);
    System.out.println("Trades(0): " + trades.getTrades().get(0).toString());
    System.out.println("Trades size: " + trades.getTrades().size());

    // Get the latest trade data for BTC_USD for the past 12 hours (note: doesn't account for time zone differences, should use UTC instead)
    trades = marketDataService.getTrades(CurrencyPair.BTC_USD, (long) (System.nanoTime() - (12 * 60 * 60 * Math.pow(10, 9))));
    System.out.println(trades);
    System.out.println("Trades size: " + trades.getTrades().size());
  }
View Full Code Here

TOP

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

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.