Search in sources :

Example 96 with Exchange

use of org.knowm.xchange.Exchange in project XChange by knowm.

the class TheRockExampleUtils method createTestExchange.

public static Exchange createTestExchange() {
    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(TheRockExchange.class);
    exchange.getExchangeSpecification().setApiKey("API Key");
    exchange.getExchangeSpecification().setSecretKey("Secret==");
    exchange.getExchangeSpecification().setUserName("user");
    exchange.applySpecification(exchange.getExchangeSpecification());
    return exchange;
}
Also used : Exchange(org.knowm.xchange.Exchange) TheRockExchange(org.knowm.xchange.therock.TheRockExchange)

Example 97 with Exchange

use of org.knowm.xchange.Exchange in project XChange by knowm.

the class TheRockAccountDemo method main.

public static void main(String[] args) throws IOException {
    Exchange loyalbitExchange = TheRockExampleUtils.createTestExchange();
    generic(loyalbitExchange);
    raw(loyalbitExchange);
}
Also used : Exchange(org.knowm.xchange.Exchange)

Example 98 with Exchange

use of org.knowm.xchange.Exchange in project XChange by knowm.

the class MarketDataServiceIntegration method getTicker.

private static void getTicker() throws IOException {
    Exchange exchange = getExchange();
    MarketDataService marketDataService = exchange.getMarketDataService();
    try {
        Ticker coinsuperTicker = marketDataService.getTicker(CurrencyPair.ETH_BTC);
        System.out.println("======get ticker======");
        System.out.println(coinsuperTicker);
        System.out.println("getVolume=" + coinsuperTicker.getVolume());
        System.out.println("getTimestamp=" + coinsuperTicker.getTimestamp());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : EXXExchange(org.knowm.xchange.exx.EXXExchange) Exchange(org.knowm.xchange.Exchange) MarketDataService(org.knowm.xchange.service.marketdata.MarketDataService) Ticker(org.knowm.xchange.dto.marketdata.Ticker) IOException(java.io.IOException)

Example 99 with Exchange

use of org.knowm.xchange.Exchange in project XChange by knowm.

the class MarketDataServiceIntegration method getTickers.

private static void getTickers() throws IOException {
    Exchange exchange = getExchange();
    MarketDataService marketDataService = exchange.getMarketDataService();
    try {
        Params params = null;
        List<Ticker> tickers = marketDataService.getTickers(params);
        System.out.println("======get tickers======");
        System.out.println(tickers);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : EXXExchange(org.knowm.xchange.exx.EXXExchange) Exchange(org.knowm.xchange.Exchange) MarketDataService(org.knowm.xchange.service.marketdata.MarketDataService) Ticker(org.knowm.xchange.dto.marketdata.Ticker) Params(org.knowm.xchange.service.marketdata.params.Params) IOException(java.io.IOException)

Example 100 with Exchange

use of org.knowm.xchange.Exchange in project XChange by knowm.

the class MarketDataServiceIntegration method getOrderbook.

private static void getOrderbook() throws IOException {
    Exchange coinsuper = getExchange();
    MarketDataService marketDataService = coinsuper.getMarketDataService();
    try {
        OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.ETH_BTC);
        System.out.println("Current Order Book size for ETH_USD: " + (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);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : EXXExchange(org.knowm.xchange.exx.EXXExchange) Exchange(org.knowm.xchange.Exchange) OrderBook(org.knowm.xchange.dto.marketdata.OrderBook) MarketDataService(org.knowm.xchange.service.marketdata.MarketDataService) IOException(java.io.IOException)

Aggregations

Exchange (org.knowm.xchange.Exchange)416 MarketDataService (org.knowm.xchange.service.marketdata.MarketDataService)155 Test (org.junit.Test)120 ExchangeSpecification (org.knowm.xchange.ExchangeSpecification)93 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)64 TradeService (org.knowm.xchange.service.trade.TradeService)62 Ticker (org.knowm.xchange.dto.marketdata.Ticker)50 AccountService (org.knowm.xchange.service.account.AccountService)38 OrderBook (org.knowm.xchange.dto.marketdata.OrderBook)31 IOException (java.io.IOException)28 LimitOrder (org.knowm.xchange.dto.trade.LimitOrder)27 BigDecimal (java.math.BigDecimal)25 Trades (org.knowm.xchange.dto.marketdata.Trades)22 CoinsuperExchange (org.knowm.xchange.coinsuper.CoinsuperExchange)15 KrakenExchange (org.knowm.xchange.kraken.KrakenExchange)15 OpenOrders (org.knowm.xchange.dto.trade.OpenOrders)12 MercadoBitcoinExchange (org.knowm.xchange.mercadobitcoin.MercadoBitcoinExchange)12 CoinmateExchange (org.knowm.xchange.coinmate.CoinmateExchange)10 UserTrades (org.knowm.xchange.dto.trade.UserTrades)10 ArrayList (java.util.ArrayList)9