Package com.xeiam.xchange.dto.marketdata

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


    System.out.println(ticker);

    OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
    System.out.println(orderBook);

    Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD);
    System.out.println(trades);
  }
View Full Code Here


    // Get the latest order book data for BTC/LTC
    OrderBook orderBook = justcoinGenericMarketDataService.getOrderBook(CurrencyPair.BTC_LTC);
    System.out.println("Order book: " + orderBook);

    Trades trades = justcoinGenericMarketDataService.getTrades(CurrencyPair.BTC_LTC, 92734);
    System.out.println(trades);
  }
View Full Code Here

  private static final long DAY_IN_MILLIS = 1000 * 60 * 60 * 24;

  public static void generic(PollingMarketDataService marketDataService) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {

    Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD, System.currentTimeMillis() - DAY_IN_MILLIS);
    System.out.println(trades);
  }
View Full Code Here

        throw new ExchangeException("args[0] must be of type Long!");
      }
    }

    KrakenPublicTrades krakenTrades = getKrakenTrades(currencyPair, since);
    Trades trades = KrakenAdapters.adaptTrades(krakenTrades.getTrades(), currencyPair, krakenTrades.getLast());
    return trades;
  }
View Full Code Here

  @Test
  public void testAdaptTradesBTCTradeTradeArrayCurrencyPair() throws IOException {

    BTCTradeTrade[] btcTradeTrades = mapper.readValue(getClass().getResource("dto/marketdata/trades.json"), BTCTradeTrade[].class);

    Trades trades = BTCTradeAdapters.adaptTrades(btcTradeTrades, CurrencyPair.BTC_CNY);
    List<Trade> tradeList = trades.getTrades();

    assertEquals(new Date(1403397140L * 1000L), tradeList.get(0).getTimestamp());
    assertEquals(new BigDecimal("3703"), tradeList.get(0).getPrice());
    assertEquals(new BigDecimal("3.50000000000"), tradeList.get(0).getTradableAmount());
    assertEquals("2895575", tradeList.get(0).getId());
View Full Code Here

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

    Trades trades = CryptonitAdapters.adaptTrades(cryptonitTrades, CurrencyPair.BTC_USD);
    assertThat(trades.getTrades().size()).isEqualTo(100);

    // Verify all fields filled
    assertThat(trades.getlastID()).isEqualTo(268133L);
    assertThat(trades.getTrades().get(0).getPrice().doubleValue() == 605.997);
    assertThat(trades.getTrades().get(0).getTradableAmount().doubleValue() == 1.189100000);
    assertThat(trades.getTrades().get(0).getCurrencyPair().baseSymbol == "BTC");
    assertThat(DateUtils.toUTCString(trades.getTrades().get(0).getTimestamp())).isEqualTo("2014-06-20 00:09:10 GMT");
  }
View Full Code Here

    List<Trade> tradesList = new ArrayList<Trade>();
    for (BTCETrade BTCETrade : BTCETrades) {
      // Date is reversed order. Insert at index 0 instead of appending
      tradesList.add(0, adaptTrade(BTCETrade));
    }
    return new Trades(tradesList, TradeSortType.SortByID);
  }
View Full Code Here

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

    final ObjectMapper mapper = new ObjectMapper();
    final JavaType tickersType = mapper.getTypeFactory().constructParametricType(MintPalBaseResponse.class, mapper.getTypeFactory().constructCollectionType(List.class, MintPalPublicTrade.class));
    final MintPalBaseResponse<List<MintPalPublicTrade>> tradesResponse = mapper.readValue(is, tickersType);

    final List<MintPalPublicTrade> trades = tradesResponse.getData();
    final Trades adaptedTrades = MintPalAdapters.adaptPublicTrades(CurrencyPair.LTC_BTC, trades);
    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);
View Full Code Here

          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

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.