Search in sources :

Example 16 with ExchangeSpecification

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

the class OkexOrdersDemo method main.

public static void main(String[] args) throws IOException {
    ExchangeSpecification exSpec = new ExchangeSpecification(OkexExchange.class);
    exSpec.setSecretKey("");
    exSpec.setApiKey("");
    exSpec.setExchangeSpecificParametersItem("passphrase", "");
    Exchange okexExchange = ExchangeFactory.INSTANCE.createExchange(exSpec);
    generic(okexExchange);
}
Also used : OkexExchange(org.knowm.xchange.okex.v5.OkexExchange) Exchange(org.knowm.xchange.Exchange) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

Example 17 with ExchangeSpecification

use of org.knowm.xchange.ExchangeSpecification 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 18 with ExchangeSpecification

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

the class LgoEnv method prod.

public static ExchangeSpecification prod() {
    ExchangeSpecification result = baseSpecification();
    result.setSslUri("https://exchange-api.exchange.lgo.markets");
    result.setHost("exchange-api.exchange.lgo.markets");
    result.setExchangeSpecificParametersItem(KEYS_URL, "https://storage.googleapis.com/lgo-markets-keys");
    result.setExchangeSpecificParametersItem(WS_URL, "wss://ws.exchange.lgo.markets/");
    return result;
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

Example 19 with ExchangeSpecification

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

the class LgoEnv method sandbox.

public static ExchangeSpecification sandbox() {
    ExchangeSpecification result = baseSpecification();
    result.setSslUri("https://exchange-api.sandbox.lgo.markets");
    result.setHost("exchange-api.sandbox.lgo.markets");
    result.setExchangeSpecificParametersItem(KEYS_URL, "https://storage.googleapis.com/lgo-sandbox_batch_keys");
    result.setExchangeSpecificParametersItem(WS_URL, "wss://ws.sandbox.lgo.markets/");
    return result;
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

Example 20 with ExchangeSpecification

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

the class dydxStreamingExchange method connect.

@Override
public Completable connect(ProductSubscription... args) {
    if (args == null || args.length == 0)
        throw new UnsupportedOperationException("The ProductSubscription must be defined!");
    ExchangeSpecification exchangeSpec = getExchangeSpecification();
    switch((String) exchangeSpec.getExchangeSpecificParametersItem("version")) {
        case V3:
            this.streamingService = new dydxStreamingService(API_URI_V3);
            this.streamingMarketDataService = new info.bitrich.xchangestream.dydx.service.v3.dydxStreamingMarketDataService(streamingService);
            break;
        case V3_ROPSTEN:
            this.streamingService = new dydxStreamingService(API_URI_ROPSTEN_V3);
            this.streamingMarketDataService = new info.bitrich.xchangestream.dydx.service.v3.dydxStreamingMarketDataService(streamingService);
            break;
        default:
            this.streamingService = new dydxStreamingService(API_URI_V1);
            this.streamingMarketDataService = new dydxStreamingMarketDataService(streamingService);
            break;
    }
    streamingService.subscribeMultipleCurrencyPairs(args);
    return streamingService.connect();
}
Also used : info.bitrich.xchangestream.dydx.service.v1.dydxStreamingMarketDataService(info.bitrich.xchangestream.dydx.service.v1.dydxStreamingMarketDataService) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

Aggregations

ExchangeSpecification (org.knowm.xchange.ExchangeSpecification)327 Exchange (org.knowm.xchange.Exchange)93 Test (org.junit.Test)66 IOException (java.io.IOException)22 MarketDataService (org.knowm.xchange.service.marketdata.MarketDataService)20 StreamingExchange (info.bitrich.xchangestream.core.StreamingExchange)17 BigDecimal (java.math.BigDecimal)16 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)16 Before (org.junit.Before)15 CoinsuperExchange (org.knowm.xchange.coinsuper.CoinsuperExchange)15 TradeService (org.knowm.xchange.service.trade.TradeService)14 Disposable (io.reactivex.disposables.Disposable)12 ProductSubscription (info.bitrich.xchangestream.core.ProductSubscription)11 OrderBook (org.knowm.xchange.dto.marketdata.OrderBook)9 LimitOrder (org.knowm.xchange.dto.trade.LimitOrder)9 Ticker (org.knowm.xchange.dto.marketdata.Ticker)8 OkCoinExchange (org.knowm.xchange.okcoin.OkCoinExchange)7 BitcoiniumExchange (org.knowm.xchange.bitcoinium.BitcoiniumExchange)6 CoinfloorExchange (org.knowm.xchange.coinfloor.CoinfloorExchange)6 DVChainExchange (org.knowm.xchange.dvchain.DVChainExchange)6