Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
797 blopes 1
package br.com.kronus.ibkr.robos;
2
 
3
import com.ib.client.*;
4
 
5
public class TesteConexaoSimples extends DefaultEWrapper {
6
 
7
    private final EJavaSignal signal = new EJavaSignal();
8
    private final EClientSocket client = new EClientSocket(this, signal);
9
 
10
    public static void main(String[] args) throws Exception {
11
        new TesteConexaoSimples().testar();
12
    }
13
 
14
    public void testar() throws Exception {
15
        System.out.println("Tentando conectar...");
16
 
17
        // TROCAR AQUI ENTRE 7496 E 7497 PARA TESTAR
18
        client.eConnect("127.0.0.1", 7497, 2);
19
 
20
        Thread.sleep(2000);
21
 
22
        System.out.println("isConnected = " + client.isConnected());
23
 
24
        client.eDisconnect();
25
    }
26
 
27
    @Override
28
    public void error(int id, long code, int arg2, String arg3, String msg) {
29
        System.err.println("IBKR ERROR: id=" + id + " code=" + arg2 + " msg=" + arg3);
30
    }
31
}