Matt, add ICompletionDelegate to the command to trace completion events. I see no problem with the code... Are you using pooled connection factory or a plain connection factory?
-Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Mike
Thanks for taking the time to look at my issue
I use a plain ConnectionFactory
I added the delegate
Here is the result. I get no data...but i should get data right? Also note the long 3 minutes between when i logged in and when i get no data
Thank you
Running com.strateer.mktdata.polling.impl.OTServiceTest
2008-06-17 15:53:07,506 INFO [main] (OTServiceTest.java:74) - testHistTicks..........
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
2008-06-17 15:53:10,211 INFO [main] (TraceMethodCallAspect.java:27) - in [com.strateer.mktdata.polling.impl.OTSession@1
774b9b] execution(getConnection)()
2008-06-17 15:53:10,215 INFO [main] (OTSession.java:76) - getConnection...connection:null,state:disconnected
2008-06-17 15:53:10,216 INFO [main] (OTSession.java:79) - getConnection...synchronized (this)
2008-06-17 15:53:10,217 INFO [main] (OTSession.java:82) - getConnection...connection:null,state:disconnected
2008-06-17 15:53:10,232 INFO [main] (OTSession.java:87) - connecting with hostUrl:feed1.opentick.com,hostPort:10015,log
in:strateer,password:delfin1
2008-06-17 15:53:10,317 INFO [Thread-1] (SessionConnectionStateListener.java:31) - onConnecting to hostUrl:feed1.openti
ck.com
2008-06-17 15:53:10,365 INFO [main] (TraceMethodCallAspect.java:46) - out [com.strateer.mktdata.polling.impl.OTSession@
1774b9b] execution(getConnection)()
2008-06-17 15:53:10,386 INFO [Thread-1] (OTSession.java:40) - setSessionState...Connecting
2008-06-17 15:53:11,768 INFO [Thread-1] (SessionConnectionStateListener.java:24) - onConnected to hostUrl:feed1.opentic
k.com
2008-06-17 15:53:11,778 INFO [Thread-1] (OTSession.java:40) - setSessionState...Connected
2008-06-17 15:53:11,784 INFO [Thread-1] (SessionConnectionStateListener.java:47) - onLogin
2008-06-17 15:53:11,789 INFO [Thread-1] (OTSession.java:40) - setSessionState...LogedIn
# Error: OTError: requestId=1, code=1003, desc=No data
2008-06-17 15:54:56,628 INFO [Thread-1] (SessionConnectionStateListener.java:37) - onError: shutdown
2008-06-17 15:54:56,629 INFO [Thread-1] (OTSession.java:59) - shutdown...
2008-06-17 15:54:56,631 INFO [Thread-1] (OTSession.java:62) - synchronized (this)...shutdown...
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 109.2 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.strateer.mktdata.polling.impl.OTServiceTest
2008-06-17 16:11:12,584 INFO [main] (OTServiceTest.java:75) - testHistTicks..........
2008-06-17 16:11:12,669 INFO [Thread-0] (TestSessionConnectionStateListener.java:20) - onConnecting to hostUrl:
2008-06-17 16:11:14,321 INFO [Thread-0] (TestSessionConnectionStateListener.java:16) - onConnected to hostUrl:
2008-06-17 16:11:14,325 INFO [Thread-0] (TestSessionConnectionStateListener.java:28) - onLogin
# Error: OTError: requestId=1, code=1003, desc=No data
2008-06-17 16:13:26,970 INFO [Thread-0] (TestSessionConnectionStateListener.java:24) - onError: shutdown
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 134.474 sec
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This error code comes from opentick server. Following could be the cause of the problem:
1) you have no historical data subscription. Its free, but you should indicate this in your account settings - check your account details on opentick.com
2) your dates are wrong (no trading at that date).
Here, I am able to succesfuly retrieve few hundred OTTrade events for Q/MSFT. I put the groovy example (that works for me) into the source repository:
I suggest you update your setup to use the dates from the groovy script (make sure date parser assumes EDT timezone). If it still does not work, then something is wrong with your opentick id.
Another useful excersize is to run groovy scripts from opentick-script package. They all should work, and they are easy to hack to try different symbols/exchanges/dates...
-Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oh, just noticed. You are trying to get TODAY's data. Its not gonna work. I believe opentick updates their historical database overnight. So you should get something for yesterday's date. For today, you can only get the current snapshot or realtime stream.
-Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm, just tried today's date. And opentick returned some data for me... I did not give the proper credit to the opentick service: apparently they do update their historical database quite often. Please play with the histticks.groovy script to check that it works for you.
About delay in answering: depending on the request complexity, it may take significant time for the opentick server to start sending data. For fine-grained requests (like OTTrade), use small time intervals when testing (a minute on a liquid symbol like MSFT should be enough...
-Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Mike
It seems that HistCommand is not working
That would be great if you could give me any pointers. Please note the 3 minutes between the OnLogin and OnError
On a side note, I tried SnapshotCommand and OTBBO and it works.
Thank you
I am running the following unit test
@Test public void testHistTicks()
throws InterruptedException
{
log.info("testHistTicks..........");
Date start = DateUtil.getDate(2008, 6, 17);
Date end = DateUtil.getDate(2008, 6, 17);
if(context == null)
context = new ClassPathXmlApplicationContext("beanRefContext.xml");
if(otService == null)
otSession = (OTSession)context.getBean("otSession");
IConnection connection = otSession.getConnection();
HistTicksCommand command = new HistTicksCommand();
command.setExchangeCode("Q");
command.setSymbolCode("MSFT");
command.setStartDate(start);
command.setEndDate(end);
command.setTradeDelegate(new IDataDelegate<OTTrade>() {
public void onData(OTTrade data) {
System.out.println(data);
}
});
try {
IRequest request = connection.prepareRequest(command);
request.submit();
request.waitForCompletion();
} finally {
connection.shutdown();
connection.waitForCompletion();
}
}
And i get the following trace:
2008-06-17 14:30:28,905 INFO [main] (OTSession.java:76) - getConnection...connection:null,state:disconnected
2008-06-17 14:30:28,910 INFO [main] (OTSession.java:79) - getConnection...synchronized (this)
2008-06-17 14:30:28,911 INFO [main] (OTSession.java:82) - getConnection...connection:null,state:disconnected
2008-06-17 14:30:28,933 INFO [main] (OTSession.java:87) - connecting with hostUrl:feed1.opentick.com,hostPort:10015,log
in:strateer,password:delfin1
2008-06-17 14:30:28,985 INFO [Thread-1] (SessionConnectionStateListener.java:31) - onConnecting to hostUrl:feed1.openti
ck.com
2008-06-17 14:30:29,069 INFO [Thread-1] (OTSession.java:40) - setSessionState...Connecting
2008-06-17 14:30:29,069 INFO [main] (TraceMethodCallAspect.java:46) - out [com.strateer.mktdata.polling.impl.OTSession@
32784a] execution(getConnection)()
2008-06-17 14:30:30,229 INFO [Thread-1] (SessionConnectionStateListener.java:24) - onConnected to hostUrl:feed1.opentic
k.com
2008-06-17 14:30:30,229 INFO [Thread-1] (OTSession.java:40) - setSessionState...Connected
2008-06-17 14:30:30,232 INFO [Thread-1] (SessionConnectionStateListener.java:47) - onLogin
2008-06-17 14:30:30,232 INFO [Thread-1] (OTSession.java:40) - setSessionState...LogedIn
2008-06-17 14:31:33,638 INFO [Thread-1] (SessionConnectionStateListener.java:37) - onError: shutdown
2008-06-17 14:31:33,638 INFO [Thread-1] (OTSession.java:59) - shutdown...
2008-06-17 14:31:33,642 INFO [Thread-1] (OTSession.java:62) - synchronized (this)...shutdown...
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 67.74 sec
Matt, add ICompletionDelegate to the command to trace completion events. I see no problem with the code... Are you using pooled connection factory or a plain connection factory?
-Mike
Mike
Thanks for taking the time to look at my issue
I use a plain ConnectionFactory
I added the delegate
Here is the result. I get no data...but i should get data right? Also note the long 3 minutes between when i logged in and when i get no data
Thank you
Running com.strateer.mktdata.polling.impl.OTServiceTest
2008-06-17 15:53:07,506 INFO [main] (OTServiceTest.java:74) - testHistTicks..........
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
2008-06-17 15:53:10,211 INFO [main] (TraceMethodCallAspect.java:27) - in [com.strateer.mktdata.polling.impl.OTSession@1
774b9b] execution(getConnection)()
2008-06-17 15:53:10,215 INFO [main] (OTSession.java:76) - getConnection...connection:null,state:disconnected
2008-06-17 15:53:10,216 INFO [main] (OTSession.java:79) - getConnection...synchronized (this)
2008-06-17 15:53:10,217 INFO [main] (OTSession.java:82) - getConnection...connection:null,state:disconnected
2008-06-17 15:53:10,232 INFO [main] (OTSession.java:87) - connecting with hostUrl:feed1.opentick.com,hostPort:10015,log
in:strateer,password:delfin1
2008-06-17 15:53:10,317 INFO [Thread-1] (SessionConnectionStateListener.java:31) - onConnecting to hostUrl:feed1.openti
ck.com
2008-06-17 15:53:10,365 INFO [main] (TraceMethodCallAspect.java:46) - out [com.strateer.mktdata.polling.impl.OTSession@
1774b9b] execution(getConnection)()
2008-06-17 15:53:10,386 INFO [Thread-1] (OTSession.java:40) - setSessionState...Connecting
2008-06-17 15:53:11,768 INFO [Thread-1] (SessionConnectionStateListener.java:24) - onConnected to hostUrl:feed1.opentic
k.com
2008-06-17 15:53:11,778 INFO [Thread-1] (OTSession.java:40) - setSessionState...Connected
2008-06-17 15:53:11,784 INFO [Thread-1] (SessionConnectionStateListener.java:47) - onLogin
2008-06-17 15:53:11,789 INFO [Thread-1] (OTSession.java:40) - setSessionState...LogedIn
# Error: OTError: requestId=1, code=1003, desc=No data
2008-06-17 15:54:56,628 INFO [Thread-1] (SessionConnectionStateListener.java:37) - onError: shutdown
2008-06-17 15:54:56,629 INFO [Thread-1] (OTSession.java:59) - shutdown...
2008-06-17 15:54:56,631 INFO [Thread-1] (OTSession.java:62) - synchronized (this)...shutdown...
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 109.2 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
Mike
I even removed all my code. Here is the unit test and the trace below
@Test public void testHistTicks()
throws InterruptedException
{
log.info("testHistTicks..........");
Date start = DateUtil.getDate(2008, 6, 17);
Date end = DateUtil.getDate(2008, 6, 17);
TestSessionConnectionStateListener testSessionConnectionStateListener = new TestSessionConnectionStateListener();
OTConnectionFactory factory = new OTConnectionFactory();
factory.getHostList().add(new OTHost("feed1.opentick.com",10015));
factory.setUsername("strateer");
factory.setPassword("delfin1");
IConnection connection= factory.connect(testSessionConnectionStateListener);
HistTicksCommand command = new HistTicksCommand();
command.setExchangeCode("Q");
command.setSymbolCode("MSFT");
command.setStartDate(start);
command.setEndDate(end);
command.setTradeDelegate(new IDataDelegate<OTTrade>() {
public void onData(OTTrade data) {
System.out.println(data);
}
});
command.setCompletionDelegate(new ICompletionDelegate() {
public void onDataEnd(OTError error) {
if(error != null) {
System.out.println("# Error: " + error);
}
}
});
try {
IRequest request = connection.prepareRequest(command);
request.submit();
request.waitForCompletion();
} finally {
connection.shutdown();
connection.waitForCompletion();
}
}
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.strateer.mktdata.polling.impl.OTServiceTest
2008-06-17 16:11:12,584 INFO [main] (OTServiceTest.java:75) - testHistTicks..........
2008-06-17 16:11:12,669 INFO [Thread-0] (TestSessionConnectionStateListener.java:20) - onConnecting to hostUrl:
2008-06-17 16:11:14,321 INFO [Thread-0] (TestSessionConnectionStateListener.java:16) - onConnected to hostUrl:
2008-06-17 16:11:14,325 INFO [Thread-0] (TestSessionConnectionStateListener.java:28) - onLogin
# Error: OTError: requestId=1, code=1003, desc=No data
2008-06-17 16:13:26,970 INFO [Thread-0] (TestSessionConnectionStateListener.java:24) - onError: shutdown
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 134.474 sec
This error code comes from opentick server. Following could be the cause of the problem:
1) you have no historical data subscription. Its free, but you should indicate this in your account settings - check your account details on opentick.com
2) your dates are wrong (no trading at that date).
Here, I am able to succesfuly retrieve few hundred OTTrade events for Q/MSFT. I put the groovy example (that works for me) into the source repository:
http://otfeed.svn.sourceforge.net/viewvc/otfeed/trunk/otfeed-all/otfeed-script/src/main/samples/histticks.groovy?view=log
I suggest you update your setup to use the dates from the groovy script (make sure date parser assumes EDT timezone). If it still does not work, then something is wrong with your opentick id.
Another useful excersize is to run groovy scripts from opentick-script package. They all should work, and they are easy to hack to try different symbols/exchanges/dates...
-Mike
Oh, just noticed. You are trying to get TODAY's data. Its not gonna work. I believe opentick updates their historical database overnight. So you should get something for yesterday's date. For today, you can only get the current snapshot or realtime stream.
-Mike
Hmm, just tried today's date. And opentick returned some data for me... I did not give the proper credit to the opentick service: apparently they do update their historical database quite often. Please play with the histticks.groovy script to check that it works for you.
About delay in answering: depending on the request complexity, it may take significant time for the opentick server to start sending data. For fine-grained requests (like OTTrade), use small time intervals when testing (a minute on a liquid symbol like MSFT should be enough...
-Mike
Mike
Thank you for your help and sorry to get back so late
So it works now
1. My settings were wrong with opentick
2. I had forgotten to specify the time in addition to the date
Best
Matt