R vs Python vs matlab: the quant language war - Matlab, R project and Python | futures io social day trading
futures io futures trading


R vs Python vs matlab: the quant language war
Updated: Views / Replies:21,178 / 26
Created: by treydog999 Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

View Poll Results: Which Quantitative Development Language?
R 36 39.56%
Python 43 47.25%
Matlab 12 13.19%
Voters: 91. You may not vote on this poll

Reply
 1  
 
Thread Tools Search this Thread
 

R vs Python vs matlab: the quant language war

  #1 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received

R vs Python vs matlab: the quant language war

There are 3 major players in this arena, not including c/c++. C/C++ i did not include because they are almost always used at the institutional level for infrastructure or HFT/UHFT strategies anyway. But for the strategy development, modeling, and prototyping I think these are the 3 major languages out there. All of them are high level languages with time series, linear / matrix computation, and trading system development packages. I will list a few pros and cons of each and then let the voting start.

R
PROS:
End To End development to execution (some brokers packages allows execution, IB)
Rapid development speed (60% less lines vs python, ~500% less than C)
Large number of Open Source Packages
Mature quantitative trading packages( quantstrat, quantmod, performanceanalyitics, xts)
Largest Community
Can integrate into C++/C with rcpp

Cons:
Slow vs Python especially in iterative loops and non vectorized funtions
Worse plotting than matlab and difficult to implement interactive charts
Limited capabilities in creating stand alone applications


Python

PROS:
End To End development to execution (some brokers packages allows execution, IB)
Open source packages( Pandas, Numpy, scipy)
Trading Packages(zipline, pybacktest, pyalgotrade)
best for general programming and application development
can be a "glue" language to connect R, C++ and others (cython, Rpy etc)
Fastest general speed especially in iterative loops

CONS:
immature packages especially trading packages
some packages are not compatible with others or contain overlap
smaller community than R in finance
More code required for same operations vs R or Matlab
Silent errors that can take a very long time to track down (even with visual debuggers / IDE)

MATLAB

PROS:
Fastest mathematical and computational platform especially vectorized operations/ linear matrix algebra
Commercial level packages for all fields of mathematics and trading
Very short scripts considering high integration of all packages
Best visualization of plots and interactive charts
Well tested and supported due to it being a commercial product
Easy to manage multithreaded support and garbage collection
Best debugger

CONS:
Can not execute - must be translated into another language
Expensive ~1000 per license and 50+ per additional individual package
Can not integrate well with other langauages
Hard to detect biases in trading systems (it was built for math and engineering simulations) so extensive testing may be required. EG. look ahead bias
Worst performance for iterative loops
Can not develop stand alone applications at all.


WHICH DO YOU PREFER? WHY? vote and answer below.

Reply With Quote
The following 9 users say Thank You to treydog999 for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Manchester, NH
 
Futures Experience: Beginner
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: Stocks
 
Posts: 902 since Jul 2012
Thanks: 603 given, 1,785 received


Concise summary, thanks.


Last edited by artemiso; November 1st, 2014 at 02:33 AM.
Reply With Quote
 
  #4 (permalink)
Elite Member
Chemnitz, Germany
 
Futures Experience: Intermediate
Platform: Python
Favorite Futures: ALL the futures (and options)
 
Posts: 80 since Sep 2014
Thanks: 304 given, 48 received

I know Matlab pretty well. R doesn't seem to bring anything new to the table for me. I know Python but haven't really done much in that language, since we use Java at work. But I also simply prefer Matlab over Python due to all the advantages listed in the "PROS" section. Right now my concern is developing and testing my strategies, for which Matlab (or R) s just way less work than Python. Don't get me wrong, Matlab is an infuriating PoS at times. But it's very easy/quick to implement the basic math and algos for analysis of price data.

The big downside of Matlab for me is that it's a massive resource hog and relatively clunky to use, especially that the entire IDE freezes when I execute code. And the error messages are pretty much unintelligible. And I guess if you don't have Matlab and all the pacages, the cost could be an issue.



treydog999 View Post
Can not execute - must be translated into another language

I disagree. You can load and write data. You can import any Java library. You can also compile Matlab code directly to C, .Net etc libraries.



treydog999 View Post
Hard to detect biases in trading systems (it was built for math and engineering simulations) so extensive testing may be required. EG. look ahead bias

Can you give more insight into this? Look-ahead bias is not a language specific problem.



treydog999 View Post
Can not develop stand alone applications at all.

I believe you need an add-on package for it but it is possible to deploy applications that don't even need Matlab to run. There is also a server you can run you Matlab app on.


Last edited by skoa; November 1st, 2014 at 06:27 AM.
Reply With Quote
 
  #5 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received


skoa View Post
I know Matlab pretty well. R doesn't seem to bring anything new to the table for me. I know Python but haven't really done much in that language, since we use Java at work. But I also simply prefer Matlab over Python due to all the advantages listed in the "PROS" section. Right now my concern is developing and testing my strategies, for which Matlab (or R) s just way less work than Python. Don't get me wrong, Matlab is an infuriating PoS at times. But it's very easy/quick to implement the basic math and algos for analysis of price data.

The big downside of Matlab for me is that it's a massive resource hog and relatively clunky to use, especially that the entire IDE freezes when I execute code. And the error messages are pretty much unintelligible. And I guess if you don't have Matlab and all the pacages, the cost could be an issue.



I disagree. You can load and write data. You can import any Java library. You can also compile Matlab code directly to C, .Net etc libraries.



Can you give more insight into this? Look-ahead bias is not a language specific problem.



I believe you need an add-on package for it but it is possible to deploy applications that don't even need Matlab to run. There is also a server you can run you Matlab app on.

Honestly i have very little experiance with matlab. I just have been researching it for these types of applications so I am glad you are correcting me where I may be incorrect. I just aggregated it together so that all 3 of these can be evaluated against each other. However I will try to address as much as I can.

1st point:
yes you can export into C or import java libraries however that must be done as an additional step. However python and R have very easy almost "plug and play" native packages for execution. Also I find anything that's .NET insecure but that's another topic. I do not actually know how long it takes for you to convert to C it may be a single click for all i know.

2nd:
Yes this is not language specific. However from several articles i read (not personal experience) showed that there can be hidden biases either through packages, architecture, models, or silent errors when working with time series and trading applications. It does not have to be look ahead bias it can be any bias or unintended effect that distorts the realism and results of a simulation. Look ahead was just an example. Again i do not know how package integration for specific models and the trading module work, however I know this is a common problem in Python for sure. Especially if you are not using MATLAB optimized functions that require a lot of iterative or other libraries. I may be incorrect on this point completely.

3rd:
I was not aware of an add-on package that could allow stand alone execution of MATLAB to run. A server instance in my opinion still counts as MATLAB reliant and is therefore not stand alone.


Again, I have very little experience with matlab so I appreciate someone who uses it heavily to comment.


Last edited by treydog999; November 1st, 2014 at 11:09 AM. Reason: spelling
Reply With Quote
 
  #6 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received

Backtesting Packages for each langauge comparison

Lets take this a bit deeper. Since most of us are concerned with backtesting and analysis being a big part of why we are using these programs. I am going to look at the most robust/mature packages for doing that kind of work in each language.


R - Quantstrat (including all required librarys)
Can model any financial instrument real or synthetic. (financial instrument library)
Able to have multiple currency portfolios
Standard trade stats available (performance analytic)
Order book modeling + including slippage commissions to every order
Classical Technical analysis indicators are prebuilt
Signal Driven

Python Zipline
Limited to Equities and Treasuries (no futures, forex, options , spreads or synthetics)
Can no support multiple currency portfolios
Can include slippage and commission
Classical Technical analysis indicators are prebuilt
Supported by a company quantopian
Completely Event Driven (bar)

Matlab -
All official compuational finance packages listed on website
Financial Toolbox
Econometrics Toolbox
Datafeed Toolbox
Database Toolbox
Spreadsheet Link EX (for Microsoft Excel)
Financial Instruments Toolbox
Trading Toolbox

NONE OF THEM PROVIDE A BACKTESTER. However they are phenomenal instrument pricing functions, ARIMA/GARCH, state space, forecasting and other analysis. Is just top of the line. But any backtester would probably be self written and just be a simple loop over each bar. No built in trading stats or analysis.

Reply With Quote
The following 3 users say Thank You to treydog999 for this post:
 
  #7 (permalink)
 Vendor: www.traderwerks.com 
Taipei Taiwan
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Optimus
Favorite Futures: TW
 
Posts: 693 since Jun 2009
Thanks: 440 given, 440 received


treydog999 View Post

Python Zipline
Limited to Equities and Treasuries (no futures, forex, options , spreads or synthetics)
Can no support multiple currency portfolios
Can include slippage and commission
Classical Technical analysis indicators are prebuilt
Supported by a company quantopian
Completely Event Driven (bar)

Zipline can handle any time series you can load into a Pandas Dataframe so it can handle futures, etc. I think they do not have a free source like Yahoo for it, but Zipline is not limited to equities.

The big difference for me was that I can andd anything I want because it is written in Python. I have a multi currency portfolio written in Zipline. It is just code after all.

Math. A gateway drug to reality.
Reply With Quote
 
  #8 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received


traderwerks View Post
Zipline can handle any time series you can load into a Pandas Dataframe so it can handle futures, etc. I think they do not have a free source like Yahoo for it, but Zipline is not limited to equities.

The big difference for me was that I can andd anything I want because it is written in Python. I have a multi currency portfolio written in Zipline. It is just code after all.

I am comparing "official“ packages that are either on CRAN/GITHUB or published by the company itself. Official is in quotes because most of the stuff for R / Python is open source. But a majority of it has been tested and used in academia, or at the institutional level. Self written code will not have support or have had as many eyes on in order to see bugs or nuances.

Honestly you can add whatever you want to any of these, because they are all programming languages and just "code". So that is really not an advantage to any specific language. If you are going to write your own custom packages or backtester its better to just use C++, OCaml, Java, Slang or any other "lower level" language.

All of them have better speed benchmarks than MATLAB, Python, or R. But also they can be used to for trade execution as well, as most APIs are written in C/C++ or Java. R or Python APIs usually are just wrappers for the C++ version anyway. So you would increase backtesting speed, increase execution speed, and decrease your tech stack complexity.

Reply With Quote
The following user says Thank You to treydog999 for this post:
 
  #9 (permalink)
Market Wizard
Houston, TX
 
Futures Experience: Advanced
Platform: XTrader
Broker/Data: Advantage Futures
Favorite Futures: Energy
 
Posts: 2,123 since Dec 2013
Thanks: 1,749 given, 3,359 received
Forum Reputation: Legendary


treydog999 View Post
MATLAB
CONS:
Expensive ~1000 per license and 50+ per additional individual package

For those of you that think Matlab's price is a major obstacle you might want to take a look at Octave (or GNU Octave as its officially called). Functionally it's almost identical to Matlab with a compatiable language. Where it does fall short though is in the additional packages available.

GNU Octave, From Wikipedia, the free encyclopedia
GNU Octave is a high-level programming language, primarily intended for numerical computations. It provides a command-line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with MATLAB. It may also be used as a batch-oriented language. As part of the GNU Project, it is free software under the terms of the GNU General Public License.

Reply With Quote
 
  #10 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received



SMCJB View Post
For those of you that think Matlab's price is a major obstacle you might want to take a look at Octave (or GNU Octave as its officially called). Functionally it's almost identical to Matlab with a compatiable language. Where it does fall short though is in the additional packages available.

GNU Octave, From Wikipedia, the free encyclopedia
GNU Octave is a high-level programming language, primarily intended for numerical computations. It provides a command-line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with MATLAB. It may also be used as a batch-oriented language. As part of the GNU Project, it is free software under the terms of the GNU General Public License.

Although its the external packages that make MATLAB a contender in the first place the computational finance packages. Without them I do not think that MATLAB would be good for finance (pricing models) at all and much less backtesting systems directly. Still heavily focused on engineering and phyiscal system simulations, rather than financial work.

As there is no package for backtesting and writing iterative loops performs poorly in MATLAB much like R as it is vectorized and optimized for linear algebra and matrix function. So I think Octave could be a poor choice as you would need to find support for those specific packages yourself, or write them yourself. I do believe if your writing any packages by hand they should be done in C/C++ since it is the fastest and most capable language, as well as has supporting finance packages like quantlib.

Just my opinion though. Thanks for adding OCTAVE into the fray. Good to see other options.

Reply With Quote
The following user says Thank You to treydog999 for this post:

Reply



futures io > > > > R vs Python vs matlab: the quant language war

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
IB with Python jamesico Matlab, R project and Python 2 September 9th, 2014 08:19 AM
Tradier with R and or Python Keith Leesus Matlab, R project and Python 2 September 5th, 2014 01:23 AM
Python Help Wanted $ wlblount Hire a Consultant or Programmer 0 December 25th, 2013 10:14 AM
quant.stackexchange.com shodson Platforms and Indicators 3 February 11th, 2011 04:18 PM
[Other]       Open Quant / Quant Developer niterate Platforms and Indicators 2 December 5th, 2010 10:10 PM


All times are GMT -4. The time now is 05:01 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-16 in 0.18 seconds with 21 queries on phoenix via your IP 54.163.210.170