Sunday, August 19, 2012

AlgoTrader, I'm ready

By following the guide http://code.google.com/p/algo-trader/wiki/AlgoTraderQuickStartGuide , I got AlgoTrader binary run successfully. Though in Linux environment, I got to touch up the shell script, which is duplicated from Windows batch script.

I downloaded the source code according to the svn link in http://code.google.com/p/algo-trader/source/checkout . I made use of git-svn, so I can have the history in my local machine. In Eclipse, I installed the E-Git and J-Git plugins.

With the official documentation http://code.google.com/p/algo-trader/wiki/AlgoTraderDocumentation , I got my development environment setup. I also got the AlgoTrader "launchers" run in Eclipse. I spent some time skimmed through all the source code. Beautiful code, impressive!!

When I wanted to collect data (every 5 seconds) through Interactive Broker API, I got "duplicate record" error. Initially I thought Esper statement was propagating datetime with wrong precision. Later after I searched the word "duplicate" in https://groups.google.com/group/algo-trader , I found the thread "Duplicate entry error when persisting tick to DB". Andy Flury's replied "tick.setDateTime(date) in handlePersistTick sets the rounded Time".

Finally, I collected data every 5 seconds by doing the following modifications in com.algoTrader.service.MarketDataServiceImpl class's handlePersistTick(Tick tick) method:

            // get the current Date rounded to MINUTES
            //Date date = DateUtils.round(DateUtil.getCurrentEPTime(), Calendar.MINUTE);
            //tick.setDateTime(date);
            tick.setDateTime(DateUtil.getCurrentEPTime());


What's next? I guessed I got to spend sometime reading Esper Complex Event Processing's documentation at http://esper.codehaus.org/esper/documentation/documentation.html . Esper CEP is the heart of AlgoTrader, the soul of strategies building.

No comments:

Post a Comment