Search in sources :

Example 26 with Exchange

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

the class InteractiveAuthenticatedExchange method createInstanceFromDefaultInput.

public static Exchange createInstanceFromDefaultInput() {
    Exchange mercadoBitcoin = ExchangeFactory.INSTANCE.createExchange(MercadoBitcoinExchange.class);
    ExchangeSpecification exchangeSpecification = mercadoBitcoin.getExchangeSpecification();
    Scanner s = new Scanner(System.in);
    System.out.println("Enter your API key (chave):");
    exchangeSpecification.setApiKey(s.next().trim().toLowerCase());
    System.out.println("Enter your secret code (código):");
    exchangeSpecification.setSecretKey(s.next().trim().toLowerCase());
    System.out.println("Enter your PIN (IMPORTANT: This is your PIN, not your user password):");
    exchangeSpecification.setPassword(s.next().trim().toLowerCase());
    exchangeSpecification.setUserName("<optional username>");
    System.out.println("Please wait...");
    return mercadoBitcoin;
}
Also used : Exchange(org.knowm.xchange.Exchange) MercadoBitcoinExchange(org.knowm.xchange.mercadobitcoin.MercadoBitcoinExchange) Scanner(java.util.Scanner) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

Example 27 with Exchange

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

the class MercadoBitcoinAccountDemo method main.

public static void main(String[] args) throws IOException {
    Exchange mercadoBitcoin = InteractiveAuthenticatedExchange.createInstanceFromDefaultInput();
    AccountService accountService = mercadoBitcoin.getAccountService();
    generic(accountService);
    raw((MercadoBitcoinAccountServiceRaw) accountService);
}
Also used : Exchange(org.knowm.xchange.Exchange) InteractiveAuthenticatedExchange(org.knowm.xchange.examples.mercadobitcoin.InteractiveAuthenticatedExchange) AccountService(org.knowm.xchange.service.account.AccountService)

Example 28 with Exchange

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

the class DepthDemo method main.

public static void main(String[] args) throws IOException {
    // Use the factory to get Mercado Bitcoin exchange API using default settings
    Exchange mercadoBitcoin = ExchangeFactory.INSTANCE.createExchange(MercadoBitcoinExchange.class);
    // Interested in the public market data feed (no authentication)
    MarketDataService marketDataService = mercadoBitcoin.getMarketDataService();
    generic(marketDataService);
    raw((MercadoBitcoinMarketDataServiceRaw) marketDataService);
}
Also used : Exchange(org.knowm.xchange.Exchange) MercadoBitcoinExchange(org.knowm.xchange.mercadobitcoin.MercadoBitcoinExchange) MarketDataService(org.knowm.xchange.service.marketdata.MarketDataService)

Example 29 with Exchange

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

the class TradesDemo method main.

public static void main(String[] args) throws IOException {
    // Use the factory to get Mercado Bitcoin exchange API using default settings
    Exchange mercadoBitcoin = ExchangeFactory.INSTANCE.createExchange(MercadoBitcoinExchange.class);
    // Interested in the public market data feed (no authentication)
    MarketDataService marketDataService = mercadoBitcoin.getMarketDataService();
    Long now = new Date().getTime();
    generic(now, marketDataService);
    raw(now, (MercadoBitcoinMarketDataServiceRaw) marketDataService);
}
Also used : Exchange(org.knowm.xchange.Exchange) MercadoBitcoinExchange(org.knowm.xchange.mercadobitcoin.MercadoBitcoinExchange) MarketDataService(org.knowm.xchange.service.marketdata.MarketDataService) Date(java.util.Date)

Example 30 with Exchange

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

the class LakeBTCTickersDemo method main.

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

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