HOME FORUMS BROKERS SOFTWARE BOOKS CONTACT US
Elite Trader Your Account  •  Become a Member  •  Help  •  Search    
    Forums ›› Technically Speaking ›› Programming ›› R for datamining/backtesting/trading  


Post A Reply
    Page 5 of 10:   1  2  3  4   5  6  7  8  9  10  
ssrrkk
 

Registered: Jun 2005
Posts: 431

 

03-10-12 10:46 AM


Quote from bs2167:

Thanks for taking the time with your reply. Not to put words in your mouth, but interestingly it seems as if Python may have become the most indispensable of the three languages for your work.

On the other side of things, have you considered using Python to run the strategies live instead of Java? I've read that it might be slow for such an application, but to be honest I don't have enough programming experience to understand why.

(Apologies for the mulitple questions and the partial thread hijacking, but I've read so many good things about the language that I also want to try and understand its limitations.)



I would say Python is my main back test engine, but because I am so used to plotting things and doing quick stats in R, I do use it a lot for just playing with an idea on a few days or a few months of data at a time. For example, I use R the very first time I want to check a new idea. So R is great because I can check things with a few interactive lines of code. But it is slower and the historical data handling is a little bit more cumbersome -- again this is my fault as I haven't fully developed a good SQL interface for it. (Often I write a 5 line python script using my database classes to output a text file of the data I need, then I read that into R using read.table and then analyze my idea).

By the way, I might have given the impression that I have solved every development problem I have which is far from the truth. I still struggle with it every day and sometimes I feel like I am spinning my wheels just to get a simple thing going.

Regarding replacing java for live-trading, I don't see any need for that, as I am NOT constantly redeveloping my live trading platform. The live trading platform is a different thing to me with very different considerations. It has to do with communicating with TWS, order handling, real-time data handling, building bars from ticks, account querying and cash management, logging, etc. All of this does not change every time I have a new strategy. Of course, the core loop / signaling class overlaps with the back tested strategy and that part of the code is where I change if I have a new idea to try.

The main reason I use Java is because the TWS API comes in Java or C++ only. In addition, TWS itself is written in Java. So I decided to use the native interface. There is something called IBPy that wraps all the API calls into python but it looks like it is half finished and the authors seem to have abandoned this project some years ago. As far as performance considerations, there is no question python will be slower, and I am not sure how well it will deal with the multi-threaded nature of TWS API apps -- for example, all API apps must implement callbacks that are initiated by TWS after requests are sent to it. Sometimes, I might make 30 or 50 data requests to TWS. So I will be receiving a huge amount of call backs (hundreds or thousands of times per second) each time tick data comes in for any of those 50 instruments. I would imagine that is a big load for python to handle and in addition I am not sure how well python can handle thread synchronization. Java has absolutely no problems with this and is rock solid.

    Edit/Delete Quote Complain
stevegee58
 

Registered: Feb 2004
Posts: 2405

 

03-10-12 12:07 PM

If any of you are interested, a fellow wrote some MetaTrader (MT4) support for R where you can call R functions through a dll interface.

He also provided a couple of examples called Trend-O-Mat and Arb-O-Mat.

    Edit/Delete Quote Complain
caementarius
 

Registered: Jul 2007
Posts: 476

 

03-11-12 10:28 PM

Prompted by an earlier post I decided to look further into the quantstrat module. There isn't documentation with the module itself, but it looks like the place to start are the quantstrat papers from Guy Yollin:
http://www.r-programming.org/papers

These presentations have a lot of example code and lay things out pretty well.

There's reference to quantstrat handling both streaming and historical data - so it sounds like it might help with my original query.

    Edit/Delete Quote Complain
johnnyqpublic
 

Registered: Mar 2010
Posts: 279

 

03-12-12 07:39 PM


Quote from caementarius:

Prompted by an earlier post I decided to look further into the quantstrat module. There isn't documentation with the module itself, but it looks like the place to start are the quantstrat papers from Guy Yollin:
http://www.r-programming.org/papers

These presentations have a lot of example code and lay things out pretty well.

There's reference to quantstrat handling both streaming and historical data - so it sounds like it might help with my original query.



Yes, this is almost certainly the way to go if you're going to backtest in R.

If you have questions about quantstrat or related things, and you know how to use IRC or want to learn, you can come visit the #r-finance channel on Freenode. Myself and others (including one of the quantstrat authors!) who use R for finance work, hang out there.

    Edit/Delete Quote Complain
kattypier
 

Registered: Oct 2012
Posts: 1

 

10-27-12 08:10 AM

Data binding is used by almost all modern applications. It provides simple means to separate the data layer from the presentation layer. Generally, binding means connecting a graphical control property with a data object property.
i am interested in that topic .you can check helpful tutorial in dapfor. com

    Edit/Delete Quote Complain
hft_boy
 

Registered: Apr 2012
Posts: 177

 

10-27-12 02:31 PM


Quote from ssrrkk:

The main reason I use Java is because the TWS API comes in Java or C++ only. In addition, TWS itself is written in Java. So I decided to use the native interface. There is something called IBPy that wraps all the API calls into python but it looks like it is half finished and the authors seem to have abandoned this project some years ago. As far as performance considerations, there is no question python will be slower, and I am not sure how well it will deal with the multi-threaded nature of TWS API apps -- for example, all API apps must implement callbacks that are initiated by TWS after requests are sent to it. Sometimes, I might make 30 or 50 data requests to TWS. So I will be receiving a huge amount of call backs (hundreds or thousands of times per second) each time tick data comes in for any of those 50 instruments. I would imagine that is a big load for python to handle and in addition I am not sure how well python can handle thread synchronization. Java has absolutely no problems with this and is rock solid.



Well, there are only official implementations in Java and C++. The API itself is not particularly hard to understand, or implement (although tedious). You can also check out IBrokers for R, I think the implementation is pretty good. I don't really know how slow Python is, but it should be fast enough to handle IB data. IB sends tick data out at 250 ms intervals, so you would probably be getting ticks about every 5 ms. Maybe less if the ticks trigger multiple callbacks.

Also, you can use async i/o to make your application single threaded. I believe this is the approach taken by IBrokers (since R is single threaded). Not that the Java implementation handles any sort of synchronization between threads anyways.

    Edit/Delete Quote Complain
    Page 5 of 10:   1  2  3  4   5  6  7  8  9  10  
Post A Reply


Receive an email whenever a new post is added to this thread by subscribing to it.
 
Rate This Thread:

Forum Jump:
 

 

   Conduct Rules  -  Privacy Policy  -  Day Trader -  Day Trader Forum -  Best Trading Software -  Sitemap Copyright © 2013, Elite Trader. All rights reserved.    
 
WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Brokerage & Clearing
AMP Global Clearing
Futures and FX Trading
Bright Trading
Professional Equities Trading
CTS
Futures Trading Software
DaytradingBias.com
Professional Trading Analytics
ECHOtrade
Professional Trading Firm
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
MultiCharts
Trading Software Provider
NinjaTrader
Trading Software Provider
OANDA
Currency Trading
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim by TD Ameritrade
Direct Access TradingAdvertisement
TradersStudio
System Building & Backtesting
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider