I am new to java though I have some experience with R.
I have taken part of a java course and have read a book or two as well as the API guides published by interactive brokers. This API is higher level than anything I have worked with before, obviously.
The very first thing I want to do is simply connect to the software. I have been able to do this with the test GUI that Interactive Brokers provides. However, when writing my own script, I am getting an error: Uncompilable source code - Erroneous sym type. I have imported the javaclient/com directory into my new project.
The line that is causing the error is econnect(port=7496, clientid=0);
Reading the documentation, this should work, but obviously does not.
Below is the full code. All of the import calls were copied from a sample file that IB provided. onHowToDetermineStock() is copied from another part of the documentation. Before I can do anything, I obviously need to to connect.
Any ideas?
Thank you.
package ibapp;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.ArrayList;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import com.ib.controller.ApiConnection.ILogger;
import com.ib.controller.ApiController;
import com.ib.controller.ApiController.IBulletinHandler;
import com.ib.controller.ApiController.IConnectionHandler;
import com.ib.controller.ApiController.ITimeHandler;
import com.ib.controller.Formats;
import com.ib.controller.Types.NewsType;
import com.ib.client.EClientSocket;
/**
*
* @author
*/
void onHowToDetermineStock(){
Contract contract = new Contract();
Order order = new Order();
contract.m_symbol = "IBKR";
contract.m_secType = "STK";
contract.m_exchange = "SMART";
contract.m_currency = "USD";
order.m_action = "BUY";
order.m_totalQuantity = 100;
order.m_orderType = "LMT";
order.m_lmtPrice = enteredLmtPrice;
m_client.placeOrder(GlobalOrderId, contract, order);
}
public class IBApp {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
econnect(port=7496, clientid=0);
onHowToDetermineStock();
}
}