Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Trading Markets using APIs

By Milind Paradkar

Algorithmic trading has become the buzz word in recent years. Growing markets, regulatory approval, increasing number of Algorithmic platform providers, all have led to a surge in the number of trading firms and retail traders switching to the new way of trading. Algorithmic platform providers have played a key role, along with the brokers, in making algorithmic trading accessible to retails traders and firms.

An algorithmic platform allows for execution of various types of trading strategies across asset classes like equities, derivatives, currencies etc. It also provides for backtesting, paper trading and live trading with order management and risk management systems in place. Check our article on Top Algo Trading Platforms in India to know more about them.

A trading firm or a retail trader can start algo trading by opening a trading account with a broker who provides such an algo trading platform. Apart from this, there are other requirements that need to be fulfilled for algo trading. Check our article on the requirements for Setting-up an Algo Trading Desk.

There are different ways in which one can perform trading using these platforms. One method is using the trading Apis provided by the platform developers. That brings me to the topic of the day, i.e. “Trading markets using APIs”. This post will provide a brief overview of API, its types and examples of some platform providers offering such APIs for trading.

Application Programming Interface (API)

Application Programming Interface, commonly referred as API, consists of a set of rules describing how one application can interact with another application.

When trading one needs access to different market quotes, orders are required to be sent based on the buy/sell signals generated by the applied strategy, and the open trading positions need to be continuously monitored till squared off.

A trading API allows a trader to connect his trading application to the algorithmic execution platform situated at the brokers end and in effect connect with the exchange. Thus, a trading API facilitates the interaction between these two softwares and allows for the exchange of data and requests.

An API developer (i.e. the algorithmic trading platform provider) may offer different types of trading APIs in different programming languages for the convenience of its users. Let us take an example of the Presto API solutions offered by Symphony Fintech for Indian markets. Symphony Fintech offers APIs in Java, C#, .NET, HTML which can be used to develop custom algo strategies. A trader can connect across the internet via web-service or use LAN option for low latency (for overview of all Presto APIs). Similarly, other algorithmic platform providers offer different APIs for algo trading.

Types of APIs

Now let us take a look at the different API types. I found this chart which gives a good break-up of the API types. We will cover some of the APIs that find usage in trading.

REST APIs

REST or REpresentational State Transfer is used for creating API’s for applications in a standardized way. It involves using HTTP for making requests. It is used in applications wherein some information needs to be transferred based on user action. For real time transfer or streaming of data, REST is not the best protocol and WebSockets can be used instead. We have covered WebSockets in the next part.

Example:

Zerodha’s Kite Connect offers a set of REST-like APIs that can be used to build a complete trading and investment platform.  All requests happen over HTTPs. Inputs are form-encoded parameters and responses from the API server are in JSON. You can read the other details about it here.

WebSocket APIs

WebSocket is a protocol that allows for transferring data to and from the servers. The socket that is connected to the server stays open for communication. Thus, data can be pushed or requested in real-time on demand.

Example:

Zerodha’s Kite Connect Trading APIs use the WebSocket API for streaming quotes across instruments and markets during live market hours. To connect to the Kite WebSocket API, you will need a WebSocket client library in your choice of programming language (Python, php). Quotes are delivered via the API and are used in the implementation of custom trading strategies. You can read in detail about the streaming websocket APIs here.

Library-based APIs

To use this type of API, we need to import a library of code and use the functions provided in that library to extract market information and send requests.

Example:

The IBrokers API allows one to trade on Interactive Brokers (IB) using R programming. One needs to install the IBrokers library which has various functions to pull market quotes, send/modify orders, extract historical data, contract information, account information etc. We also have the IBridgePy library-based API developed by Dr. Hui Liu which is a wrapper for Interactive Brokers’ C++ API.

Using IBrokers package to implement R in Interactive Brokers API

Using IBridgePy to implement Python in Interactive Brokers API

Class-based APIs (object oriented) – a special type of library-based API

These are a special type of library-based APIs which use the Object Oriented Programming (OOP) model. The model revolves around objects which are used to construct programs. The objects consist of attributes (data fields) and methods (actions).

Example:

The Presto Fuse XL offered by Symphony Fintech is an EXCEL based API which allows for automated trading. Excel traders can develop custom strategies by writing formulas/macros via VB scripting. Check here to read more about Presto Fuse XL.

Next Step

These were some of the API types that we explored in this article. We hope that it gave you a good introduction to APIs used for trading markets. Considering the wide usage of APIs by traders, we have included dedicated API knowledge sessions in our Executive Programme in Algorithmic Trading (EPAT™) curriculum.

If you want to learn various aspects of Algorithmic trading then do check out our EPAT™ program. It covers training modules like Algorithmic & Quantitative Trading, Financial Computing, Technology, Statistics and Econometrics. EPAT™ equips you with the required skill sets to be a successful trader. Enroll now!

The post Trading Markets using APIs appeared first on .



This post first appeared on Best Algo Trading Platforms Used In Indian Market, please read the originial post: here

Share the post

Trading Markets using APIs

×

Subscribe to Best Algo Trading Platforms Used In Indian Market

Get updates delivered right to your inbox!

Thank you for your subscription

×