Event driven backtesting in Python or R - Matlab, R project and Python | futures io social day trading
futures io futures trading


Event driven backtesting in Python or R
Updated: Views / Replies:11,794 / 28
Created: by Big Mike Attachments:0

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

Reply
 
Thread Tools Search this Thread
 

Event driven backtesting in Python or R

  #1 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received

Event driven backtesting in Python or R

I've been doing some research on event driven backtesting libraries for either Python or R. I was wondering if anyone cares to comment on the ones they prefer to use, and why?

I would much rather include an existing library instead of writing my own. It must also be multi-threaded.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #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)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received




Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #4 (permalink)
Elite Member
Sydney Nsw Australia
 
Futures Experience: Intermediate
Platform: Amibroker, Multicharts
Broker/Data: I.B, CQG
Favorite Futures: NQ, 6E, SPI
 
Posts: 18 since Jun 2012
Thanks: 50 given, 8 received

Hi Mike

check out some of these links for python

Quantopian is the most developed although still free. Use with I.B
https://www.quantopian.com

Zipline is the back test engine from quantopian
http://nbviewer.ipython.org/github/quantopian/zipline/blob/master/docs/tutorial.ipynb

Others worth a look:
https://code.google.com/p/profitpy/

Trading with Python

Quantwiki

there are more solutions.

Im developing my own backtest and execution model to work with Interactive Brokers. Its not very hard to do develop a relatively uncomplicated system. I think the complexity is similar to easy language or c# technically. Im converting some systems I developed in Multicharts easy language.

I will probably compare my solution against quantopian in the future.

python has some real advantages for more complex trading apps over R imo. R may be faster to prototype and has some really nice libraries ( although comparable to python imo )

Reply With Quote
The following 2 users say Thank You to Turbosteve for this post:
 
  #5 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received


Turbosteve View Post
Hi Mike

check out some of these links for python

Quantopian is the most developed although still free. Use with I.B
https://www.quantopian.com

Zipline is the back test engine from quantopian
http://nbviewer.ipython.org/github/quantopian/zipline/blob/master/docs/tutorial.ipynb

Others worth a look:
https://code.google.com/p/profitpy/

Trading with Python

Quantwiki

there are more solutions.

Im developing my own backtest and execution model to work with Interactive Brokers. Its not very hard to do develop a relatively uncomplicated system. I think the complexity is similar to easy language or c# technically. Im converting some systems I developed in Multicharts easy language.

I will probably compare my solution against quantopian in the future.

python has some real advantages for more complex trading apps over R imo. R may be faster to prototype and has some really nice libraries ( although comparable to python imo )

Yes I know of all these, but what I was wanting was a discussion on which ones you guys are using and why.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #6 (permalink)
Elite Member
Sydney Nsw Australia
 
Futures Experience: Intermediate
Platform: Amibroker, Multicharts
Broker/Data: I.B, CQG
Favorite Futures: NQ, 6E, SPI
 
Posts: 18 since Jun 2012
Thanks: 50 given, 8 received

yes I thought you probably would Mike.

I like the Quantopian solution best at this stage as I can use their Zipline backtest engine locally on my pc to develop then shift my systems to their server to execute remotely ( against I.B ) and therefore mitigating any potential issues with internet / hardware issues at my end.

Are you looking to develop more on Python Mike? I did like your thread on your R development very much. You were several months ahead of me there and gave me a great insight and head start, so a BIG thanks for that.

Cheers

Reply With Quote
The following 2 users say Thank You to Turbosteve for this post:
 
  #7 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received


Turbosteve View Post
yes I thought you probably would Mike.

I like the Quantopian solution best at this stage as I can use their Zipline backtest engine locally on my pc to develop then shift my systems to their server to execute remotely ( against I.B ) and therefore mitigating any potential issues with internet / hardware issues at my end.

Are you looking to develop more on Python Mike? I did like your thread on your R development very much. You were several months ahead of me there and gave me a great insight and head start, so a BIG thanks for that.

Cheers

I know R better than Python, but I am open to either if there is a good reason. I just want to utilize an existing framework to do event driven backtesting and was interested in a pros/cons list from users that have gone down the same path.

There is also R's Quantstrat but it isn't event driven.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #8 (permalink)
Elite Member
Sydney Nsw Australia
 
Futures Experience: Intermediate
Platform: Amibroker, Multicharts
Broker/Data: I.B, CQG
Favorite Futures: NQ, 6E, SPI
 
Posts: 18 since Jun 2012
Thanks: 50 given, 8 received

A major reason why I use python more then R is the debugging of code is easier in python ( imo ) as its a more 'standard' OOP language and can use IDE's such as pycharm or sublime text ( or a few other good ones )

After writing my trade_log (from backtest) to a pandas Data Frame I like to analyse the results in ipython notebook. iPython Notebook is a fantastic tool imo and together with pandas makes python very powerful for analysis. Also with python its easier to stick a UI on your app if so inclined ( or do pretty much anything you want )

Without Pandas and ipython Notebook I would probably mainly use R for analysis and then code the solution in C#.net against Trader Workstation API

Reply With Quote
The following user says Thank You to Turbosteve for this post:
 
  #9 (permalink)
Elite Member
Brussels / Dublin
 
Futures Experience: Intermediate
Platform: ninjatrader
Favorite Futures: Stdev + 2
 
Posts: 467 since Jun 2010
Thanks: 842 given, 592 received

Hi Mike,

Firstly i began originally with ninjatrader used for a while too buggy then started evaluating a new platform (after 2 years).

Either r or pandas was my choice as that is what the institutions generally use. I started with R but found it too clunky even though it does have some fantastic libraries and is well recommended. However i was against r in terms of running a live strategy with it as i found it clunky.

I moved towards python due to the excellent pandas and numpy. Python Data Analysis Library ? pandas: Python Data Analysis Library

Still hacking about with it (as have a baby so things go slower) i found python with cython to be infinetly faster than r (mind you i never got around to using the multithreaded r ).

I want a system that does the same for backtest and live and there are plenty of possibilities with python. With python hdf5 is rapid unbelievably so.

The libraries for python are excellent using beautiful soup for instance and tracking comments on bloomberg and testing against them is literally a few lines of code.

I honestly do not believe r is better than python but this is like a windows linux argument no one will win! It does what i need it to do.

This is interesting comment and id agree somewhat with it it stats r is better but for certain things:

R vs Python for data analysis - Programmers Stack Exchange

I wonder mike how many lines of code in R to do this ? Ninjatrader would even be more lines of code!
Using Python, IBPy and the Interactive Brokers API to Automate Trades - QuantStart

When i viewed the performance metrics been able to call native c code easily is a winner .

Also using pydev with eclipse makes things so easy a proper IDE .

Big drawback of R was the lack of a robust reliable IDE with typical usage. Pydev is excellent for this.

Reply With Quote
The following 2 users say Thank You to leinster for this post:
 
  #10 (permalink)
Elite Member
Brussels / Dublin
 
Futures Experience: Intermediate
Platform: ninjatrader
Favorite Futures: Stdev + 2
 
Posts: 467 since Jun 2010
Thanks: 842 given, 592 received


http://www.quantstart.com/articles/Event-Driven-Backtesting-with-Python-Part-I

Reply With Quote
The following 2 users say Thank You to leinster for this post:

Reply



futures io > > > > Event driven backtesting in Python or R

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
Python: Strategy backtesting baxline Matlab, R project and Python 4 October 18th, 2017 02:37 AM
Test Driven Development shansen NinjaTrader Programming 7 July 4th, 2014 07:21 PM
Test Driven Development shansen NinjaTrader 0 June 30th, 2014 07:29 AM
Python Help Wanted $ wlblount Hire a Consultant or Programmer 0 December 25th, 2013 10:14 AM
How to Trade This Headline Driven Stock Market Quick Summary News and Current Events 0 November 7th, 2011 09:00 PM


All times are GMT -4. The time now is 01:39 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-17 in 0.13 seconds with 19 queries on phoenix via your IP 54.226.113.250