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,786 / 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

  #11 (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,354 given, 83,237 received



I've read it before, a good article!

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
 
  #12 (permalink)
Elite Member
Zurich, Switzerland
 
Futures Experience: Intermediate
Platform: R, C#
Favorite Futures: Futures
 
Posts: 53 since Dec 2013
Thanks: 73 given, 71 received

I looked at Python solutions half a year ago. Below are my notes on two projects not yet mentioned

AlehNull https://github.com/CarterBain/AlephNull
Fork of zipline with IB live trading capabilities and the code is actively being developed in alpha stage.

ultra-finance ultra-finance - Python project for real-time financial data collection, analyzing && backtesting trading strategies - Google Project Hosting
Event based Python back testing suite with a SQL database backend for storing the collected tick data, orders and trades. No broker connectivity.

Reply With Quote
The following 2 users say Thank You to volemont for this post:
 
  #13 (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,354 given, 83,237 received



volemont View Post
AlehNull https://github.com/CarterBain/AlephNull
Fork of zipline with IB live trading capabilities and the code is actively being developed in alpha stage.

Thx. But I'm not seeing the advantages of this fork over Zipline. What am I missing? You can find other libraries with IB TWS support, surely it would be better to use Quantopian's repo for this instead?

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
The following user says Thank You to Big Mike for this post:
 
  #14 (permalink)
Elite Member
Zurich, Switzerland
 
Futures Experience: Intermediate
Platform: R, C#
Favorite Futures: Futures
 
Posts: 53 since Dec 2013
Thanks: 73 given, 71 received

Yes, if you want to connect Quantopians zipline to IB yourself there is no reason to choose the above fork.

Reply With Quote
 
  #15 (permalink)
 Vendor: sentimentrader.com 
Tulsa, OK
 
Futures Experience: Advanced
Platform: Tradestation, TOS, Python
Broker/Data: IQFeed, Tradestation, TOS
Favorite Futures: ES, SPY, Options
 
ericbrown's Avatar
 
Posts: 201 since Jan 2011
Thanks: 339 given, 234 received

I'm using zipline now after trying out many other open source python backtesting engines. Zipline seems to be the most robust right now.

The Quantstart site linked to earlier has a backtesting engine available if you buy his ebook, but I wasn't terribly impressed with it....nothing new in in that you couldn't easily do in zipline.

PyAlgoTrade is on my list of engines to check out, but I haven't gotten around to it. PyAlgoTrade appears to allow easy optimization and multiprocessing but like I said...I haven't tried it out yet.

Reply With Quote
The following user says Thank You to ericbrown for this post:
 
  #16 (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,354 given, 83,237 received


ericbrown View Post
I'm using zipline now after trying out many other open source python backtesting engines. Zipline seems to be the most robust right now.

The Quantstart site linked to earlier has a backtesting engine available if you buy his ebook, but I wasn't terribly impressed with it....nothing new in in that you couldn't easily do in zipline.

PyAlgoTrade is on my list of engines to check out, but I haven't gotten around to it. PyAlgoTrade appears to allow easy optimization and multiprocessing but like I said...I haven't tried it out yet.

I am leaning towards zipline.

Can you comment on its ability to handle huge amounts of data (billions and billions of rows, ie a data frame of 50GB or so) and its ability to do it in parallel (multicore)? This server has 128GB of memory so it would all be in-memory, but I've found R to have major limitations in this area and haven't explored what Python can do yet in this area.

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
 
  #17 (permalink)
 Vendor: sentimentrader.com 
Tulsa, OK
 
Futures Experience: Advanced
Platform: Tradestation, TOS, Python
Broker/Data: IQFeed, Tradestation, TOS
Favorite Futures: ES, SPY, Options
 
ericbrown's Avatar
 
Posts: 201 since Jan 2011
Thanks: 339 given, 234 received


Big Mike View Post
I am leaning towards zipline.

Can you comment on its ability to handle huge amounts of data (billions and billions of rows, ie a data frame of 50GB or so) and its ability to do it in parallel (multicore)? This server has 128GB of memory so it would all be in-memory, but I've found R to have major limitations in this area and haven't explored what Python can do yet in this area.

Mike

Multicore - zipline should handle a mutlicore environment just fine. I run zipline on a 24 core machine with all cores running a thread with no issue.

Data size - I haven't tested it with that much data, but I regularly run every symbol in the market using daily data going back 10 years. This won't get close to tick data or intraday data in size, but as long as your machine has the horsepower, I don't see it being an issue.

Reply With Quote
The following 2 users say Thank You to ericbrown for this post:
 
  #18 (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,354 given, 83,237 received


ericbrown View Post
Multicore - zipline should handle a mutlicore environment just fine. I run zipline on a 24 core machine with all cores running a thread with no issue.

Data size - I haven't tested it with that much data, but I regularly run every symbol in the market using daily data going back 10 years. This won't get close to tick data or intraday data in size, but as long as your machine has the horsepower, I don't see it being an issue.

That's great news. I'll dig in soon.

Sent from my LG Optimus G Pro

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
 
  #19 (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

I have been researching this area myself a lot lately. Determining to make the switch to Python or stick with R which I know better and have developed a lot of custom functionality for. Not to mention R is 60% more code efficient than python. I am not sure that quantstrat applyStrategy is event driven (not daily bars like zipline but the signal is the driving event). It is something I am looking into.

My biggest gripe about zipline is that it only supports equities. While quantstrat supports almost any instrument or synthetic with the FinancialInstrument package. Zipline is looking to incorporate futures but I have seen no implementation of that. According to the google group they suggest you hack around the zipline engine until they release an update or you submit your code to the SVN. Also it doesnt support other currencies, making FX or multi currency portfolios impossible

Also all margin and contract multipliers would need to be accounted for externally from zipline.

All of the other python back testers are just too immature vs quantstrat. They have no order book, account or portfolio records. Not as many risk or performance measures like PerformanceAnalytics and quantmod packages. They really are just iterative loops over a panda for each day/bar. But again, they are more for equity spaces or instruments that have a 1:1 notional multiplier.

Reply With Quote
The following 3 users say Thank You to treydog999 for this post:
 
  #20 (permalink)
 Vendor: sentimentrader.com 
Tulsa, OK
 
Futures Experience: Advanced
Platform: Tradestation, TOS, Python
Broker/Data: IQFeed, Tradestation, TOS
Favorite Futures: ES, SPY, Options
 
ericbrown's Avatar
 
Posts: 201 since Jan 2011
Thanks: 339 given, 234 received



treydog999 View Post
I have been researching this area myself a lot lately. Determining to make the switch to Python or stick with R which I know better and have developed a lot of custom functionality for. Not to mention R is 60% more code efficient than python. I am not sure that quantstrat applyStrategy is event driven (not daily bars like zipline but the signal is the driving event). It is something I am looking into.

My biggest gripe about zipline is that it only supports equities. While quantstrat supports almost any instrument or synthetic with the FinancialInstrument package. Zipline is looking to incorporate futures but I have seen no implementation of that. According to the google group they suggest you hack around the zipline engine until they release an update or you submit your code to the SVN. Also it doesnt support other currencies, making FX or multi currency portfolios impossible

Also all margin and contract multipliers would need to be accounted for externally from zipline.

All of the other python back testers are just too immature vs quantstrat. They have no order book, account or portfolio records. Not as many risk or performance measures like PerformanceAnalytics and quantmod packages. They really are just iterative loops over a panda for each day/bar. But again, they are more for equity spaces or instruments that have a 1:1 notional multiplier.

For many of the reasons you mention, I've recently been re-learning quantstrat. I still like python for most things, but for backtesting it is hard to find an engine as robust as quantstrat on the python side.

Reply With Quote
The following 2 users say Thank You to ericbrown 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 10:48 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.15 seconds with 19 queries on phoenix via your IP 54.227.51.103