All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.knowm.xchange.examples.enigma.EnigmaDemoUtils Maven / Gradle / Ivy

Go to download

Provides a set of examples that demonstrate how to use XChange in client applications

The newest version!
package org.knowm.xchange.examples.enigma;

import java.io.IOException;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.enigma.EnigmaExchange;
import org.knowm.xchange.enigma.service.EnigmaAccountService;

public class EnigmaDemoUtils {

  private static String username = "iSemyonova";
  private static String password = "irinaEnigmaSecuritiesRestApi123!";
  private static String infra = "dev";

  public static Exchange createExchange() {

    EnigmaExchange enigmaExchange = new EnigmaExchange();
    ExchangeSpecification exchangeSpec = enigmaExchange.getDefaultExchangeSpecification();
    exchangeSpec.setExchangeSpecificParametersItem("infra", infra);
    exchangeSpec.setUserName(username);
    exchangeSpec.setPassword(password);
    enigmaExchange.applySpecification(exchangeSpec);
    try {
      ((EnigmaAccountService) enigmaExchange.getAccountService()).login();
    } catch (IOException e) {
      throw new RuntimeException("Login exception", e);
    }
    return enigmaExchange;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy