Python Backtesting framework - Matlab, R project and Python | futures io social day trading
futures io futures trading


Python Backtesting framework
Updated: Views / Replies:7,924 / 28
Created: by ericbrown 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
 

Python Backtesting framework

  #21 (permalink)
Elite Member
Singapore
 
Futures Experience: Beginner
Platform: Multicharts, R
Favorite Futures: EUR / USD
 
Posts: 185 since Feb 2010
Thanks: 106 given, 98 received


Darthtrader4beta View Post
This notebook goes over tick data in pandas
http://nbviewer.ipython.org/github/changhiskhan/talks/blob/master/pydata2012/pandas_timeseries.ipynb

For tick data the idea would be the same but maybe you would want to have an H5 file for each instrument and then store the dataframe by date?

if I recall correctly from Big Mikes cutom development platform thread, he reviewed the use of H5 versus MySql with Toku engine and found that Toku was far more performant. But would have to check.

Currently I am just using MySql with the default engine which is good enough for me as I am only just collecting daily data. But when I start to think about collecting lower level data I will crtainly investigate different storage technologies.

I would certainly be interested in discussing concepts and ideas. Given we all have various implementations snd are at differing stages, sharing code might too difficult to align.

Reply With Quote
The following user says Thank You to diverdan for this post:
 
  #22 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


diverdan View Post
if I recall correctly from Big Mikes cutom development platform thread, he reviewed the use of H5 versus MySql with Toku engine and found that Toku was far more performant. But would have to check.

Currently I am just using MySql with the default engine which is good enough for me as I am only just collecting daily data. But when I start to think about collecting lower level data I will crtainly investigate different storage technologies.

I would certainly be interested in discussing concepts and ideas. Given we all have various implementations snd are at differing stages, sharing code might too difficult to align.

Regarding alternative storage technologies - I started a thread exploring one of such possibilities:
https://futures.io/platforms-indicators/35558-time-series-database-tick-trade-data.html
My logic behind this choice is that a database designed with time series in mind should provide the best performance for tick data. Didn't find anyone with experience in these on this forum - so I will have to wait for some free time on my hands to experiment.

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #23 (permalink)
Trading Apprentice
western NY
 
Futures Experience: Intermediate
Platform: NinjaTrader, Python
Favorite Futures: equities, bonds, currency, commodities
 
Posts: 42 since Apr 2015
Thanks: 9 given, 25 received


I guess for me the bottleneck is between my ears anyway so pytables is perfectly fine speed wise. I just like that you can store things like a dictionary and be done with it.

If performance really became an issue I would probably start thinking of using something other than python too.

I think there is an interesting intellectual challenge with storing large amounts of tick data in and of itself but there is also a time decay to it's usefulness. If you have 10 years of tick data are you ever going to go back and look at all the ticks on 5/1/2006 between 1:00pm and 1:15pm? All that work makes no sense if you just end up re-sampling to 5 minute bars anyway.

Reply With Quote
The following 2 users say Thank You to Darthtrader4beta for this post:
 
  #24 (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

If you are testing level 1 or level 2 tick data in python. My biggest question is how are you going to process the backtest or any optimization in parallel? Using only a single core is going to be highly inefficient. You must be able to deal with the GIL.

I think that storage wise. You can try mongoDB for non relational database. It is very fast at writing but slow on the query side. Although due to its structure you can save a lot of meta data, news events or other info along with the prices. But most people will probably want to go with a relational or SQL varient.

Reply With Quote
 
  #25 (permalink)
Trading Apprentice
western NY
 
Futures Experience: Intermediate
Platform: NinjaTrader, Python
Favorite Futures: equities, bonds, currency, commodities
 
Posts: 42 since Apr 2015
Thanks: 9 given, 25 received

I think I am going to give this a try with Mongo just as a project to learn Mongo.
This talk is just what the doctor ordered

"Python and MongoDB as a Platform for Financial Market Data"
https://www.youtube.com/watch?v=FVyIxdxsyok

Reply With Quote
 
  #26 (permalink)
Elite Member
Marbella/Spain
 
Futures Experience: Beginner
Platform: None
Favorite Futures: Emini ES,Stocks,FX
 
Posts: 1 since Mar 2014
Thanks: 1 given, 1 received


Darthtrader4beta View Post

"Python and MongoDB as a Platform for Financial Market Data"
https://www.youtube.com/watch?v=FVyIxdxsyok

For those interested in this... Man AHL opensourced the tick datastore that's discussed in this talk at https://github.com/ahlmss/arctic

Reply With Quote
The following user says Thank You to smallsteps for this post:
 
  #27 (permalink)
Elite Member
Zurich, Switzerland
 
Futures Experience: Intermediate
Platform: R, C#
Favorite Futures: Futures
 
Posts: 53 since Dec 2013
Thanks: 73 given, 71 received

The following framework showed up on my blog roll today: https://github.com/mementum/backtrader

Does anyone have experience with Backtrader and knows how it compares against the other solutions mentioned in this thread? Thanks

Reply With Quote
 
  #28 (permalink)
Trading Apprentice
Munich Germany
 
Futures Experience: Advanced
Platform: Sierra Chart
Favorite Futures: Futures
 
Posts: 4 since Jul 2015
Thanks: 0 given, 10 received


volemont View Post
The following framework showed up on my blog roll today: backtrader

Does anyone have experience with Backtrader and knows how it compares against the other solutions mentioned in this thread? Thanks

Hi, first post ... I saw my platform github page having been visited from this thread.

I am the author of backtrader and really doubt anyone has experience with my platform since I only decided to put a link in reddit a couple of days ago, motivated by my internal belief the platform (and associated API) is stable enough for public usage and open to suggestions (the project started on some boring evenings after long skiing sessions at the beginning of 2015)

The motivation to write it, as pointed out by a message in this same thread, was to have something I would have full control of and therefore understand what was going on, whilst also giving me (and later users) "unparalleled" of use (left to the users to judge that) I had toyed with PyAlgoTrade (CANNOT POST LINKS YET) which I found useful but too cumbersome for my own taste.

Being previously unaware of "bt" (will get added to my README.rst) I see that many choices have been the same at least when it comes down to the naming of methods ("run", "plot") but I believe the platforms differ on the approach.

Looking at "bt" Examples section (CANNOT POST LINKS YET) I see that for example the Moving Average is taken from "Pandas" and the approach is kind of a "filter" and execute. Had I to quickly say something I would put "bt" in a more "functional" realm than backtrader.

Without trying to compare the platforms (which I think doesn't make much sense) I can quickly comment on what backtrader can offer to anyone. And like I said ... development is open to suggestions.

But first ... "bt" (and PyAlgoTrade too) seem to excel in statistics. This is a weak point in backtrader, simply because it is a very weak point in my own trading too. A lot of room for improvement there.
  • Data type agnostic and timeframe agnostic (unless you mix/operate on the original timeframes)
  • Multiple datas
  • Mixing different timeframes
  • Data Resampling Data Replaying
  • Multiple strategies simultaneously
  • An already long list (and will grow) list of Indicators
  • A broker simulation which I deem to be very realistic
  • Commission schemes for stocks, futures (whether any can be applied to Forex ... it's not my cup of tea)
  • Vectorized (in the form of single for loops) and step by step execution modes
  • Strategy optimization (single core ... but multicore is on my head)

Note: PyAlgoTrade can use multiple cores and multiple MACHINES for optimization.

Data loading is now restricted to "csv" files but I see no problem in creating a Pandas adapter (I have simply never used Pandas before)

One of my major goals was to make development of indicators (and therefore trading ideas) look like a breeze. Following the publication in reddit and with it having gotten some feedback I went for a blog where I will try to describe this ease of use (I have put a first example about how the "Trix" indicator is developed ... just follow the link to the website in the github page)

Having said much I am open to answer any question and take any suggestions which may make the platform useful to anyone besides myself.

Best regards

Reply With Quote
The following 6 users say Thank You to mementum for this post:
 
  #29 (permalink)
Trading Apprentice
Munich Germany
 
Futures Experience: Advanced
Platform: Sierra Chart
Favorite Futures: Futures
 
Posts: 4 since Jul 2015
Thanks: 0 given, 10 received

Following my own post I gave myself a push and backtrader performs strategy optimization with the added benefit of using all available cores unless the user explicitly forbids it.

Best regards

Reply With Quote
The following 3 users say Thank You to mementum for this post:

Reply



futures io > > > > Python Backtesting framework

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
Event driven backtesting in Python or R Big Mike Matlab, R project and Python 28 November 13th, 2014 01:26 AM
Hotkey Manager Framework gomi The Elite Circle 14 March 8th, 2014 12:19 AM
GomdRecorder framework and database Mrbaffalo The Elite Circle 6 March 11th, 2013 04:38 PM
Microtends Ninjatrader Framework kandlekid Trading Reviews and Vendors 2 September 17th, 2012 02:23 PM


All times are GMT -4. The time now is 04:27 AM.

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-14 in 0.14 seconds with 19 queries on phoenix via your IP 54.91.38.173