Search in sources :

Example 6 with CurrencyPair

use of org.knowm.xchange.currency.CurrencyPair in project XChange by knowm.

the class DepthDemo method generic.

private static void generic(MarketDataService marketDataService) throws IOException {
    // Get the latest order book data for LTC/BRL
    OrderBook orderBook = marketDataService.getOrderBook(new CurrencyPair(Currency.LTC, Currency.BRL));
    System.out.println("Current Order Book size for LTC / BRL: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
    System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
    System.out.println("Last Ask: " + orderBook.getAsks().get(orderBook.getAsks().size() - 1).toString());
    System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
    System.out.println("Last Bid: " + orderBook.getBids().get(orderBook.getBids().size() - 1).toString());
    System.out.println(orderBook.toString());
}
Also used : MercadoBitcoinOrderBook(org.knowm.xchange.mercadobitcoin.dto.marketdata.MercadoBitcoinOrderBook) OrderBook(org.knowm.xchange.dto.marketdata.OrderBook) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Example 7 with CurrencyPair

use of org.knowm.xchange.currency.CurrencyPair in project XChange by knowm.

the class TickerDemo method generic.

private static void generic(MarketDataService marketDataService) throws IOException {
    Ticker ticker = marketDataService.getTicker(new CurrencyPair(Currency.LTC, Currency.BRL));
    System.out.println(ticker.toString());
}
Also used : Ticker(org.knowm.xchange.dto.marketdata.Ticker) MercadoBitcoinTicker(org.knowm.xchange.mercadobitcoin.dto.marketdata.MercadoBitcoinTicker) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Example 8 with CurrencyPair

use of org.knowm.xchange.currency.CurrencyPair in project XChange by knowm.

the class TradesDemo method generic.

private static void generic(Long now, MarketDataService marketDataService) throws IOException {
    // Get the latest trade data for LTC/BRL
    Trades trades = marketDataService.getTrades(new CurrencyPair(Currency.LTC, Currency.BRL));
    System.out.println("Trades, default. Size= " + trades.getTrades().size());
    trades = marketDataService.getTrades(new CurrencyPair(Currency.LTC, Currency.BRL), now - (24L * 60L * 60L * 1000L));
    System.out.println("Trades, last 24h= " + trades.getTrades().size());
    trades = marketDataService.getTrades(new CurrencyPair(Currency.LTC, Currency.BRL), 1406851200000L, 1409529600000L);
    System.out.println("Trades, since Aug 2014 to Sep 2014= " + trades.getTrades().size());
    System.out.println(trades.toString());
}
Also used : Trades(org.knowm.xchange.dto.marketdata.Trades) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Example 9 with CurrencyPair

use of org.knowm.xchange.currency.CurrencyPair in project XChange by knowm.

the class ItBitTradesDemo method generic.

private static void generic(MarketDataService marketDataService) throws IOException {
    Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD, 22233);
    System.out.println(trades.toString());
    Trades tradesAsXBT = marketDataService.getTrades(new CurrencyPair(Currency.XBT, Currency.USD), 22233);
    System.out.println(tradesAsXBT.toString());
}
Also used : Trades(org.knowm.xchange.dto.marketdata.Trades) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Example 10 with CurrencyPair

use of org.knowm.xchange.currency.CurrencyPair in project XChange by knowm.

the class LatokenAdapters method adaptTrades.

public static Trades adaptTrades(Exchange exchange, LatokenTrades latokenTrades) {
    CurrencyPair pair = adaptCurrencyPair(exchange, latokenTrades.getSymbol());
    List<Trade> trades = latokenTrades.getTrades().stream().map(latokenTrade -> adaptTrade(latokenTrade, pair)).collect(Collectors.toList());
    return new Trades(trades, TradeSortType.SortByTimestamp);
}
Also used : LatokenOrderbook(org.knowm.xchange.latoken.dto.marketdata.LatokenOrderbook) OrderType(org.knowm.xchange.dto.Order.OrderType) LatokenBalance(org.knowm.xchange.latoken.dto.account.LatokenBalance) LatokenUserTrade(org.knowm.xchange.latoken.dto.trade.LatokenUserTrade) Exchange(org.knowm.xchange.Exchange) OrderBook(org.knowm.xchange.dto.marketdata.OrderBook) Balance(org.knowm.xchange.dto.account.Balance) TradeSortType(org.knowm.xchange.dto.marketdata.Trades.TradeSortType) BigDecimal(java.math.BigDecimal) CurrencyPairMetaData(org.knowm.xchange.dto.meta.CurrencyPairMetaData) LatokenCurrency(org.knowm.xchange.latoken.dto.exchangeinfo.LatokenCurrency) LatokenTrades(org.knowm.xchange.latoken.dto.marketdata.LatokenTrades) LatokenPair(org.knowm.xchange.latoken.dto.exchangeinfo.LatokenPair) OpenOrders(org.knowm.xchange.dto.trade.OpenOrders) RoundingMode(java.math.RoundingMode) LimitOrder(org.knowm.xchange.dto.trade.LimitOrder) OrderStatus(org.knowm.xchange.dto.Order.OrderStatus) Ticker(org.knowm.xchange.dto.marketdata.Ticker) LatokenOrder(org.knowm.xchange.latoken.dto.trade.LatokenOrder) LatokenOrderSide(org.knowm.xchange.latoken.dto.trade.LatokenOrderSide) UserTrades(org.knowm.xchange.dto.trade.UserTrades) UserTrade(org.knowm.xchange.dto.trade.UserTrade) LatokenOrderStatus(org.knowm.xchange.latoken.dto.trade.LatokenOrderStatus) LatokenTicker(org.knowm.xchange.latoken.dto.marketdata.LatokenTicker) Collectors(java.util.stream.Collectors) Trades(org.knowm.xchange.dto.marketdata.Trades) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) LatokenTrade(org.knowm.xchange.latoken.dto.marketdata.LatokenTrade) List(java.util.List) Currency(org.knowm.xchange.currency.Currency) Optional(java.util.Optional) Trade(org.knowm.xchange.dto.marketdata.Trade) CurrencyPair(org.knowm.xchange.currency.CurrencyPair) LatokenUserTrades(org.knowm.xchange.latoken.dto.trade.LatokenUserTrades) LatokenUserTrade(org.knowm.xchange.latoken.dto.trade.LatokenUserTrade) UserTrade(org.knowm.xchange.dto.trade.UserTrade) LatokenTrade(org.knowm.xchange.latoken.dto.marketdata.LatokenTrade) Trade(org.knowm.xchange.dto.marketdata.Trade) LatokenTrades(org.knowm.xchange.latoken.dto.marketdata.LatokenTrades) UserTrades(org.knowm.xchange.dto.trade.UserTrades) Trades(org.knowm.xchange.dto.marketdata.Trades) LatokenUserTrades(org.knowm.xchange.latoken.dto.trade.LatokenUserTrades) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Aggregations

CurrencyPair (org.knowm.xchange.currency.CurrencyPair)518 BigDecimal (java.math.BigDecimal)157 Test (org.junit.Test)125 LimitOrder (org.knowm.xchange.dto.trade.LimitOrder)121 Date (java.util.Date)108 ArrayList (java.util.ArrayList)107 Ticker (org.knowm.xchange.dto.marketdata.Ticker)91 Currency (org.knowm.xchange.currency.Currency)88 OrderType (org.knowm.xchange.dto.Order.OrderType)81 Exchange (org.knowm.xchange.Exchange)76 Order (org.knowm.xchange.dto.Order)70 TradeHistoryParamCurrencyPair (org.knowm.xchange.service.trade.params.TradeHistoryParamCurrencyPair)60 MarketDataService (org.knowm.xchange.service.marketdata.MarketDataService)58 OrderBook (org.knowm.xchange.dto.marketdata.OrderBook)57 UserTrade (org.knowm.xchange.dto.trade.UserTrade)57 List (java.util.List)54 HashMap (java.util.HashMap)53 CurrencyPairMetaData (org.knowm.xchange.dto.meta.CurrencyPairMetaData)53 UserTrades (org.knowm.xchange.dto.trade.UserTrades)51 IOException (java.io.IOException)43