Algorithmic trading has permeated the financial world and continues to gain popularity as alternative data becomes more accessible and new markets are developing. Traders can now register with a brokerage and create a program to trade according to predetermined parameters from their living room—no expensive cables, data subscription or traditional trading floor required. Algorithmic trading is quickly outpacing traditional discretionary investing in financial markets from equities to futures to FX.
FX, also known as Forex which stands for foreign exchange, is a highly liquid market—about $5.1 trillion is exchanged per day—which means getting in and out of trades is easy. Retail FX trades 24 hours per day from 5pm EST Sunday until 5pm EST Friday, allowing for ultimate market access. Additionally, unlike other markets there are no limitations on short selling currencies, making it simple to create strategies that place long or short trades. FX traders use technical and fundamental strategies to analyze charts and find a trading opportunity. Given FX traders’ affinity for technical strategies, algorithmic trading is becoming increasingly popular in the FX landscape.
Similar to the way technical analysts may use price action to locate price patterns, quantitative traders may analyze price data to identify patterns in the behavior of the market. FX price data can range from tick data, which includes multiple prices per second, to daily or even monthly data. Depending on the granularity of the dataset, an algorithm or program is often used to identify these patterns. By using an API, a trader can stream live or historical data to their platform of choice to perform analysis and interpret results. Once a pattern has been identified, a trader may form a strategy based on the pattern observed.
An algo strategy based on technical analysis can be coded quite easily with the appropriate data and platform. For example, let’s assume an investor wants to buy (sell) the USD/JPY when the 100 day moving average crosses below (above) the 20 day moving average. He’ll need a connection to a data feed with historical data in order to backtest this strategy and execute trades in a live environment. One way to achieve this is to connect to a platform, but for the trader looking for a more customizable solution, faster execution, and custom programming, an API is the answer.
Why do FX traders use APIs?
APIs provide traders flexibility that may not be available on many proprietary platforms. Through an API the trader connects directly to the price and execution engines without the use of the broker’s proprietary platform which, regardless of the advanced features a platform may or may not have, allows for complete customization. By using their language of choice the trader has increased flexibility which provides the potential for more sophisticated analysis. Traders can combine multiple data sources, utilize specialized tools for backtesting and analysis, and can combine otherwise incompatible and separate systems to find an edge. Additionally, API trading enhances efficiency as traders can streamline their code to be as efficient as possible, saving time on analysis and execution, which can be especially useful for High Frequency Trading (HFT) systems.
About FXCM’s REST API
The FXCM REST API is a web-based API using a WebSocket connection and was developed with algorithmic trading in mind.
Developers and investors can create custom trading applications, integrate into the FXCM platform, back test strategies and build robotic trading systems. Calls can be made in any language that supports standard HTTP.
FXCM’s REST API utilizes the OAuth 2.0 specification for authentication via token. This allows for more secure authorization when accessing your application and can easily be integrated with web applications, mobile devices, and desktop platforms.