本文整理汇总了Java中com.ib.client.EReader类的典型用法代码示例。如果您正苦于以下问题:Java EReader类的具体用法?Java EReader怎么用?Java EReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EReader类属于com.ib.client包,在下文中一共展示了EReader类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startMsgProcessingThread
import com.ib.client.EReader; //导入依赖的package包/类
private void startMsgProcessingThread() {
final EReaderSignal signal = new EJavaSignal();
final EReader reader = new EReader(client(), signal);
reader.start();
new Thread() {
@Override
public void run() {
while (client().isConnected()) {
signal.waitForSignal();
try {
reader.processMsgs();
} catch (IOException e) {
error(e);
}
}
}
}.start();
}
示例2: createReader
import com.ib.client.EReader; //导入依赖的package包/类
/** Replace the input stream with ont that logs all data to m_inLogger. */
@Override public EReader createReader(EClientSocket socket, DataInputStream dis) {
try {
Field realIsField = FilterInputStream.class.getDeclaredField( "in");
realIsField.setAccessible( true);
InputStream realIs = (InputStream)realIsField.get( dis);
realIsField.set( dis, new MyIS( realIs) );
}
catch( Exception e) {
e.printStackTrace();
}
return super.createReader(socket, dis);
}
示例3: onConnect
import com.ib.client.EReader; //导入依赖的package包/类
void onConnect() {
m_bIsFAAccount = false;
// get connection parameters
ConnectDlg dlg = new ConnectDlg( this);
dlg.setVisible(true);
if( !dlg.m_rc) {
return;
}
// connect to TWS
m_disconnectInProgress = false;
m_client.OptionalCapabilities(dlg.m_retOptCapts);
m_client.eConnect( dlg.m_retIpAddress, dlg.m_retPort, dlg.m_retClientId);
if (m_client.isConnected()) {
m_TWS.add("Connected to Tws server version " +
m_client.serverVersion() + " at " +
m_client.TwsConnectionTime());
}
m_reader = new EReader(m_client, m_signal);
m_reader.start();
new Thread() {
public void run() {
processMessages();
int i = 0;
System.out.println(i);
}
}.start();
}
示例4: main
import com.ib.client.EReader; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
EWrapperImpl wrapper = new EWrapperImpl();
final EClientSocket m_client = wrapper.getClient();
final EReaderSignal m_signal = wrapper.getSignal();
//! [connect]
m_client.eConnect("127.0.0.1", 7496, 0);
//! [connect]
//! [ereader]
final EReader reader = new EReader(m_client, m_signal);
reader.start();
new Thread() {
public void run() {
while (m_client.isConnected()) {
m_signal.waitForSignal();
try {
reader.processMsgs();
} catch (Exception e) {
System.out.println("Exception: "+e.getMessage());
}
}
}
}.start();
//! [ereader]
Thread.sleep(1000);
//orderOperations(wrapper.getClient(), wrapper.getCurrentOrderId());
//contractOperations(wrapper.getClient());
//hedgeSample(wrapper.getClient(), wrapper.getCurrentOrderId());
//testAlgoSamples(wrapper.getClient(), wrapper.getCurrentOrderId());
//bracketSample(wrapper.getClient(), wrapper.getCurrentOrderId());
//bulletins(wrapper.getClient());
//reutersFundamentals(wrapper.getClient());
//marketDataType(wrapper.getClient());
//historicalDataRequests(wrapper.getClient());
//accountOperations(wrapper.getClient());
Thread.sleep(100000);
m_client.eDisconnect();
}