Forex data ?

Will it be possible to import Forex data for backtesting ?

86 responses

Avinash,

After we deliver live trading for equities, we will turn our focus to adding additional security types. Top of the list are futures and forex.

thanks,
fawce

Disclaimer

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.

+1 on forex guys

forex vote

+1 for FX

There is an revealing discussion here regarding Forex versus other security types. One comment by James Jack is particularly interesting:

I can't help but think that Quantopian aiming at stocks is the wrong
way to go -- ignoring any of the requirements, I've heard several prop
less than 100k because there is not enough return.

Sound correct? What do folks think about Quantopian's plan to launch their product offering with trading in U.S. equities? Seems like it'll take a lot of capital, which will exclude newbies.

Grant

Most of the algorithms being coded on Quantopian assume its okay to change positions on a daily basis: the fact is for retail traders, each change of position in a stock will cost something like a minimum of 9.99 (whether that be USD or GBP, its going to be relative...). So if you hold 10 stocks and rebalance daily that's 100 a day just in fees. So whatever return you're hoping for, you're going to require a huge capital. And I rather suspect that takes out the majority of those interested in Quantopian (maybe I'm wrong?)

CFDs and Spread Betting represent far better scaling since most of the brokers seem to charge a percentage (e.g. 0.1%) of the amount traded, so instantly it scales to those with big and small accounts. Its almost the same as trading stocks anyway (and, at least in the UK, has the benefit of almost no tax).

Forex is more viable for small accounts also.

Absolutely need Forex. This is mandatory.

Seems like the retail cost of $10 per trade should come down eventually. It's all basically electronic, right? Why should automated shuffling of electronic records cost the same as a sandwich? Maybe Quantopian has a path to get the cost down by an order of magnitude or two? Here's an example algorithm with daily portfolio re-balancing and no commissions. --Grant 1367 Loading... Backtest from to with initial capital Total Returns -- Alpha -- Beta -- Sharpe -- Sortino -- Max Drawdown -- Benchmark Returns -- Volatility --  Returns 1 Month 3 Month 6 Month 12 Month  Alpha 1 Month 3 Month 6 Month 12 Month  Beta 1 Month 3 Month 6 Month 12 Month  Sharpe 1 Month 3 Month 6 Month 12 Month  Sortino 1 Month 3 Month 6 Month 12 Month  Volatility 1 Month 3 Month 6 Month 12 Month  Max Drawdown 1 Month 3 Month 6 Month 12 Month # Backtest ID: 514ad3b0e6a167095d9564dc This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes. There was a runtime error. Here's the same example algorithm with daily portfolio re-balancing, but with a$10 per trade commission.

Assuming that the algorithm is handling commissions correctly (I need to check this), James Jack is correct--$10 per trade sucks the life out of the algorithm. --Grant 1367 Loading... Backtest from to with initial capital Total Returns -- Alpha -- Beta -- Sharpe -- Sortino -- Max Drawdown -- Benchmark Returns -- Volatility --  Returns 1 Month 3 Month 6 Month 12 Month  Alpha 1 Month 3 Month 6 Month 12 Month  Beta 1 Month 3 Month 6 Month 12 Month  Sharpe 1 Month 3 Month 6 Month 12 Month  Sortino 1 Month 3 Month 6 Month 12 Month  Volatility 1 Month 3 Month 6 Month 12 Month  Max Drawdown 1 Month 3 Month 6 Month 12 Month # Backtest ID: 514ad4dbe6a167095d95945d This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes. There was a runtime error. I have seen some commission structures that go down the more trades you make, but this adds another element to the algorithm which must be managed. Perhaps Quantopian can arrange some sort of group commission structuring based on having x number of active trading algos for the whole quantopian community? Not sure if there are security concerns on this or not.... Quantopian must be planning fees consistent with what Interactive Brokers (IB) charges. According to this article they plan to launch live trading with IB. There is more info for "Individual Accounts" for IB here They quote 1 USD minimum for all US trades, flat rate 0.005 USD per share traded, up to a maximum of 0.5% of the trade's value. Let's see... for a 10k account, lets say, you want to buy IBM ($212) and GLD ($156) with 50% in each, so... 5000/212 = 23 shares, trade value of$4876, IB fee = 0.005*23 = $0.115, gets rounded to$1
5000/156 = 32 shares, trade value of $4992, IB fee = 0.005*32 =$0.16, gets rounded to $1 fees total =$2

Doing the same for ONNN ($8) and NVDA ($12),

5000/8 = 625 shares, trade value of $5000, IB fee = 0.005*625 =$3.13
5000/12 = 416 shares, trade value of $4992, IB fee = 0.005*416 =$2.08
fees total = $5.21 So i guess the most cost-efficient stocks would be those you buy 1/0.005 shares of, i.e. 200 shares. For a 10k account with 2 stocks thats around the$25 mark.
For a 10k account with 4 stocks thats around the $12.5 mark.... For the UK its a minimum of 6 GBP for UK stocks, or 5 USD for US stocks, which is well out of reach I think for a 10k account. Using a$1 PerTrade and $10,000 capital 11 Loading... Backtest from to with initial capital Total Returns -- Alpha -- Beta -- Sharpe -- Sortino -- Max Drawdown -- Benchmark Returns -- Volatility --  Returns 1 Month 3 Month 6 Month 12 Month  Alpha 1 Month 3 Month 6 Month 12 Month  Beta 1 Month 3 Month 6 Month 12 Month  Sharpe 1 Month 3 Month 6 Month 12 Month  Sortino 1 Month 3 Month 6 Month 12 Month  Volatility 1 Month 3 Month 6 Month 12 Month  Max Drawdown 1 Month 3 Month 6 Month 12 Month # Backtest ID: 514bd8a88ab26d097588eb95 This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes. There was a runtime error. Thanks James, If you haven't seen it already, there are comments here, including some from the Quantopian guys: https://news.ycombinator.com/item?id=5107045 Lots of skepticism by quant professionals... Grant Thanks for that. "we were sometimes at the mercy of market makers who gave us crap prices on trades or seemingly manipulated prices to hit our stop orders and cause us to exit positions too early" is really true.... the place I worked at was writing algos for their clients that swept the entire order book (at the institutional level) and it looked pretty easy to write add ons that could analyse the order book any which way you wanted. Recently I've been using a historical forex simulator to try and become manually profitable. The package also comes with a way to write algos in C, and disregarding issues like loss of connectivity, exchange problems, power blackouts, etc, the edge cases on watching pending orders get filled/not-filled make up at least 90% of the code and I think there is hidden risk in this edge code. When you start to consider different order types and partial fills, the edge cases just escalate wildly. I gather that one of the concerns is that not all real-life factors are captured by backtesting...so-called "edge cases." It sounds like one of the problems is that there are stochastic processes that get ignored in backtesting. Regarding order fulfillment, vendors like Interactive Brokers must have the data from which one could derive statistics for Monte Carlo simulations (e.g. latency between order submission and order fulfillment, etc.). I wonder if Quantopian could get their hands on such data and share it with the community? Quantopian is an excellent idea, and is very visually pleasing to the eye (unlike most sites these days). I haven't tested the functionality of the backtesting capabilities as equities aren't of interest to me. FX will be a great addition this concept. So .... +1 for Forex, with a start up account of$10k,

and of course eventually forward testing demo capabilities.

+1

+1 for forex

+1 for FOREX

+1 for FOREX Another vote for forex, this market is the fastest growing retail trading arena and apparently >10% of the daily volume in January came from retail platform hedging or ( flow) . This means is growing mkt niche.

+1 for Forex. Is there any update on this?

+1 forex/futures

+1 forex/futures

Any updates on Forex and futures?

+1 forex

+infinity forex!

+1 forex; python > mql5; quantopian > metatrader!

Perhaps someone would explain the intense interest in forex?

forex can generally be traded with much less capital than stocks. Its also 24hrs.

The great thing about Forex is that the commission is just the bid-ask spread, so it's proportional to the money are you trading (not taking different account plans into consideration). Also, it's easier to leverage than stocks, which is also good for small-time traders.

Hello Grant,

I assume Forex has the same attraction as video games, it certainly broadly has the same demographic: load you account, gamble 24/5.5 with 200:1 or 400:1 leverage, blow up, reload. If 1000:1 leverage was available there would be plenty of takers: http://www.forexfactory.com/showthread.php?t=441680

P.

I'm currently developing algorithms for forex. I'm planning to use Oanda's API http://developer.oanda.com/docs/ . I'd like to use quantopian for backtesting but instead I'm having to build my own backtesting module. Wow, it gets complicated very quickly when dealing with pips, leverage and various pairs.

@Peter, the whole reason for backtesting is to get an understanding of how leverage may effect your account. I think those of us seeking to write a trading algorithm are not in the same demographic you describe.

+1 for Forex!

+1 for Forex

Another +1 for Forex,
You need Forex + interest rates to predict index moves and commodities cycle, they are intrinsically connected.
Also need options to mitigate risk, and nice to have cfd for the leverage.

+1 Forex plz.

Any official news on this?

Thank you

+1 Forex, Futures tick data 10ms, 100ms

+1 Forex with real data.

+1 Forex and Futures please... we need leverage :)

Any update on when forex becomes available ?

+1 for forex and interest rates. options would be nice too but can be done later. fx is a must!

+1 forex!!!

+1 Forex!
thanks

+1 for Forex
Thanks

Hmm I looked at quantopian 2 years ago and was gutted to see that FX was missing. I've come back to see how it's progressed and the development env and such have improved dramatically so well done on that....but still no FX? Really guys? Even IB support FX. I guess I will have to keep my algos elsewhere and continue to roll my own engine.
I might have a play else See you in 2 yrs. hopefully FX?

When?

@James... how about.. taxes in Forex compare... to CFDs and Spread Betting are they thesame... no tax in UK..? thanks...

Frankly , I am not sure whether Quantopian Developer heads are in the sand or they don't really realize what they have i.e the Community has given them great attention. Majority of the users on Quantopian are a few quants and retail traders and they are looking for the following multiple assets in priority:

1. Forex ( Top priority)
2. Futures ( 2nd )
3. Equities ( 3rd )
4. Commodities & CFD ( 4th )
5. Options (5th)

As a quant , we say trading moves at the speed of light and if technology does not move you discard it once the shine is over. Quantopian is starting to loose the shine. Zipline and Pyfolio do not work seemlessly offline , which is a big problem for quants . Also a lot of python libraries that are actually used by quants are not supported by quantopian online so we have to use zipline offline to get some work done but it is a nightmare offline.

FX asset class still 2 years and counting ? The shine is wearing off. FX Brokers like IB , OANDA , FXCM, HotSpot & Currenex etc are needed. If not now when ?

+1 for Forex! Forex trading is not necessary more risky than stocks. Pairs like EURUSD represent continents with billions people where stocks can be alot more volatile representing just one company. And I agree with the person above who writes we need more brokers, at least add FXCM, they have an api, shouldnt be that hard: https://www.fxcm.com/services/api-trading/

Also the Metatrader 4 EA's could seriously need some modern competition.

I have known about a dozen traders who traded forex and they all lost, most everything in account. Have you simulated the size of the edge that is required given cost and slippage? It turns out that in time the edge to cover cost is unrealistically large. This is not the case with stocks as the required edge to maintain profit is much smaller.

+1 for Forex. Any chance this could be coming with Quantopian 2?

How about BMFN, they have nice equity and quite good news too. https://bmfn.com

+1 for Forex

+1 Forex

Well, I am here to say +1 Forex as well!

+1 Forex

+1 for Forex. This seems to me to perfectly fit Quantopians mantra of democratising trading - I would love to see this addition.

+1 for Forex

Every person who says that "Forex" is less reliable in comparison to "Equity" should be banned for spreading out wrong information.

I would also like to see a Forex implementation.

Why is the quantopian team not responding ?

IBridgePY also allows the use of Forex directly. Zipline is the only thing, that doesn't support Forex. That means, that you have to create Backtests on your own. Correct me, if I'm wrong.

Seems like Quantopian still does not support Forex. That's a shame, they are holding a leacture here in Sydney in about two weeks, but without Forex support (which is my main market) - I won't be able to join.

I just started studying Python for Finance with Quantopian and stumbled across this limitation. Forex is the only market I am on. So I put this on hold until I am sure that Quantopian will support Forex.

4 years later, still no FOREX

Futures are now supported. Consider FX futures if you're so inclined. All the majors are represented, the data is more consistent and the instruments are traded on an exchange rather than spot.

I've been trading forex for almost a decade now and would also like to see it on Quantopian. That said the addition of futures contracts recently was most appreciated. Until we get real Forex some day in the far future in a galaxy far away, would it be possible to at least get the following CME futures contracts added: 6E, 6J, 6B, 6S, 6C, 6A? Thanks in advance.

Waiting for forex. +1.

forex +1

forex +1

I have been trading forex for seven months with not much success. However, from the experience I get still don't see how is this going to happen with quantopian and algo trading.

Basically forex is up and down with certain amounts for certain periods. If you see historically for example USDCAD it varies between 0.93 and 1.59 for the period after 2013, where the same period AAPL is only rising with small periods where it backs up and go again. I mean every algorithm will be profitable from AAPL, but i doubt it will be like that from USDCAD.

Otherwise I am for adding forex.

forex +1

+1 on Forex

5 years later and still no Fx, very surprising and quite a bottleneck to new active members growth . Sadly I will be joining the other quants into looking elsewhere, do you have a rough timeline as to when this might happen?

@Dan, @Delaney,

ANOTHER vote here for FX, please, although this time from a different perspective
If it is really too difficult to implement FX quickly for trading, then please at least daily quotes for the major FX pairs (as you have for EUR USD).
This is really useful as "alternative" data for equities strategies, especially as part of "Fundamentals" for stocks with significant non-US exposure.

Yes, FX would be peachy. Tony/Olivier - be advised that QT does offer FX futures which is better than nothing.

Forex... Forex... Forex... is it just me or is there an echo in here?!

Please don't let it be an empty cavern of doom x

MORE FOREX pls

You can get a mt4 indicator that will output forex chart data to a csv file. Maybe partnering or getting permission from a provider might be an idea?
Scraping the data without knowledge might be a bit of a grey area..