Back to Community
High Frequency Spot Forex

I am a newbie in this forum and would like to explore creating a high frequency statistical arb spot forex program
I can read/write python although I am not an expert by any means.

Is there a tick based program that I can use as a shell to create a back test for this?


9 responses

Hi Elliott,

The backtesting engine we use at Quantopian is called zipline, and it is open source:

If you have the forex data, you can write a new datasource in zipline and run a simulation on the cmd line. However, since forex data has a slightly different structure than equities, you will have to do a little more work to make sure the simulation behavior is valid.



The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thanks for your feedback Fawce

Do you know if anyone tried this before and willing to share some code to give me a head start?
Will the back tester support tick data?



We wrote this guide for new data sources:

I've done tick sources myself, and I can vouch for the system handling them in equity land. However, I haven't tried any forex sources. As you will see from the link above, there is a TYPE expected for events (can be a bar, or a tick) as well as other fields. You will most likely need to create a new event type for forex events.


Thanks again. I will give it a whirl!

Hello Fawce,

Not sure that I have the time/energy/interest at this point, but I gather that zipline can be run locally on my pc, right? Presumably, this is what you mean by running from the command line? Or would zipline still be running on a remote server?



Zipline is the core backtesting library that we run on Quantopian servers. It provides a cmd line only interface for running simulations, but you need to bring your own data (byod :) ).

have fun,

So does that mean that I can download the back-testing code and run python 2.7 and it will work?

Yes, and you can see an introduction here:

I'm trying to work with Forex data, I've somewhat got it running but it's ignoring the data that is outside of regular market hours (for equities). Seeing as forex runs nearly non-stop, and my data is continuous as well, how can I adjust the time frame that zipline uses?