Subversion Repositories Integrator Subversion

Rev

Blame | Last modification | View Log | Download | RSS feed

package br.com.kronus.ibkr.robos;

import com.ib.client.*;

public class TesteConexaoSimples extends DefaultEWrapper {

    private final EJavaSignal signal = new EJavaSignal();
    private final EClientSocket client = new EClientSocket(this, signal);

    public static void main(String[] args) throws Exception {
        new TesteConexaoSimples().testar();
    }

    public void testar() throws Exception {
        System.out.println("Tentando conectar...");

        // TROCAR AQUI ENTRE 7496 E 7497 PARA TESTAR
        client.eConnect("127.0.0.1", 7497, 2);

        Thread.sleep(2000);

        System.out.println("isConnected = " + client.isConnected());

        client.eDisconnect();
    }

    @Override
    public void error(int id, long code, int arg2, String arg3, String msg) {
        System.err.println("IBKR ERROR: id=" + id + " code=" + arg2 + " msg=" + arg3);
    }
}