Using General-Purpose Python Backtesters and FX Data for Forex Strategies
Summary
The document answers whether Python trading libraries can support forex strategies. It describes three routes: combine plotting tools with a broker's REST API, use a backtesting framework that accepts OHLC data regardless of instrument, or run Zipline outside its original hosted environment with forex price feeds supplied by the user.
The main practical point is that support depends partly on data access and format, not only on a library's built-in instrument list. The suggestions are brief and identify possible tools rather than giving implementation steps, execution details, or a tested comparison. OHLC-based backtesting also does not by itself establish that a strategy models broker costs, financing, liquidity, or live order behavior accurately.
Key ideas
- A general-purpose backtesting framework can handle forex when supplied with suitable OHLC data.
- A broker API can provide forex data and connectivity independently of the library used for calculations.
- Zipline may be used with forex price feeds outside its original hosted environment.
- Check whether a backtest models the costs and trading conditions relevant to live FX trading.
Tags
Full text
# Are there Python algorithmic trading libraries supporting forex? # Are there Python algorithmic trading libraries supporting forex? I know about zipline and ultrafinance, but as far as I know, they don't support fx trading. Which libraries do? ## Answer by icehac (score 2) https://quant.stackexchange.com/a/10896 I currently use a combination of matplotlib and Oanda's FX API. Their API is REST based, and would essentially allow for any type of library to handle calculations. A python wrapper for the Oanda API is on github ## Answer by K3---rnc (score 0) https://quant.stackexchange.com/a/43571 Backtesting.py framework is completely agnostic with regards to the type of data you feed it, as long as it's OHLC data. ## Answer by Jamie (score 0) https://quant.stackexchange.com/a/49390 Zipline can support any instrument type when used outside of Quantopian. You will need to pass in some price feeds for the Forex pairs that you are backtesting then run your tests.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.