Search in sources :

Example 1 with LatokenTrades

use of org.knowm.xchange.latoken.dto.marketdata.LatokenTrades 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)

Example 2 with LatokenTrades

use of org.knowm.xchange.latoken.dto.marketdata.LatokenTrades in project XChange by knowm.

the class LatokenMarketDataService method getTrades.

@Override
public Trades getTrades(CurrencyPair pair, Object... args) throws IOException {
    try {
        int limit = maxTrades;
        if (args != null && args.length == 1) {
            Object arg0 = args[0];
            if (!(arg0 instanceof Integer)) {
                throw new ExchangeException("Maximal number of trades must be an Integer!");
            } else {
                limit = (Integer) arg0;
            }
        }
        LatokenTrades latokenTrades = getLatokenTrades(pair, limit);
        return LatokenAdapters.adaptTrades(this.exchange, latokenTrades);
    } catch (LatokenException e) {
        throw LatokenErrorAdapter.adapt(e);
    }
}
Also used : LatokenException(org.knowm.xchange.latoken.dto.LatokenException) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) LatokenTrades(org.knowm.xchange.latoken.dto.marketdata.LatokenTrades)

Aggregations

ExchangeException (org.knowm.xchange.exceptions.ExchangeException)2 LatokenTrades (org.knowm.xchange.latoken.dto.marketdata.LatokenTrades)2 BigDecimal (java.math.BigDecimal)1 RoundingMode (java.math.RoundingMode)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 Exchange (org.knowm.xchange.Exchange)1 Currency (org.knowm.xchange.currency.Currency)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 OrderStatus (org.knowm.xchange.dto.Order.OrderStatus)1 OrderType (org.knowm.xchange.dto.Order.OrderType)1 Balance (org.knowm.xchange.dto.account.Balance)1 OrderBook (org.knowm.xchange.dto.marketdata.OrderBook)1 Ticker (org.knowm.xchange.dto.marketdata.Ticker)1 Trade (org.knowm.xchange.dto.marketdata.Trade)1 Trades (org.knowm.xchange.dto.marketdata.Trades)1 TradeSortType (org.knowm.xchange.dto.marketdata.Trades.TradeSortType)1 CurrencyPairMetaData (org.knowm.xchange.dto.meta.CurrencyPairMetaData)1 LimitOrder (org.knowm.xchange.dto.trade.LimitOrder)1