StoneX API Architecture
The StoneX API consists of two parts:
- REST API
- Streaming API
REST API
The first part of the StoneX API uses the software architecture style of Representational State Transfer (REST). This is one of the standard web service methods to communicate over the internet with remote servers.
The StoneX API RESTful implementation uses the Secure Hypertext Transfer Protocol (HTTPS) for communication between our back-end and your trading solution (client UI application). Request / response calls initiated by the client UI application must follow a simplified RESTful pattern supporting GET and POST, and encoding data in JavaScript object notation (JSON).
Typically, requests for information such as: available markets, historical prices, and account history are exposed via HTTPS GET requests. Requests that change state such as: placing a trade or logging on are performed using HTTPS POST.
Streaming API
Note: the backend servers are currently still using version 7.4.1 of Lightstreamer. You will need to download and use version 7.4.1 of the Lightstreamer SDK until the servers are upgraded to the latest Lighstreamer version.
The streaming API portion enables you to receive live real-time data streams for things such as market prices, news headlines, and account margin information.
Real-time data is delivered from our servers through the use of long lived polling HTTP subscriptions to specific channels. The streams of real-time data that can be pushed to users are: prices, news headlines, client account margin, orders, and quotes. The streams are exposed using the third party Lightstreamer protocol, and require the use of the latest Lightstreamer client library.
(Documentation, information and Lightstreamer client libraries can be accessed and downloaded from the Lightstreamer website here. A good place to start is General Concepts followed by Network Protocol Tutorial.)
Long lived polling means that the data request rests on the server until an event is triggered, such as the arrival of data or a timeout occurring. Once an event is triggered, the request activates and sends a full response to the client.
Various adapters are provided to enable subscription to the streams. The streams are grouped into adapters as follows:
- STREAMINGALL adapter
- PRICES
- NEWSHEADLINES
- CLIENTACCOUNTMARGIN
- TRADEMARGIN
- ORDERS
- QUOTES
TRADINGACCOUNTMARGIN (this stream is only applicable to the GTS back-end)
- CITYINDEXSTREAMINGDEFAULTPRICES adapter
- DEFAULTPRICES
In the Reference section of this documentation, the Streaming Data topic book provides stream and parameter information for the available channels.
To receive streaming prices from the API, a few pre-requisites must be filled:
- An account on the appropriate environment, whether "Live" or "Pre-Prod".
- A client UI that can perform the login by creating a session (POST a Session) on the trading API address of the appropriate environment for the account.
- The client UI must then subscribe to Lightstreamer so that it can receive the live prices. Note: subscribing to the real-time data streams requires authentication information to subscribe.
The credentials are your account user name and the password is the Session ID received when logging into the REST part of the API.- https://push.cityindex.com/ (Live).
- https://pushpreprod.cityindextest9.co.uk (Pre-Prod).
Important Note: the StoneX API and streaming URLs cannot be mixed between the "Live" and "Pre-Prod" environments. For example, when using a "Pre-Prod" account, then both the StoneX API and streaming URLs must be for "Pre-Prod".
HTTP Connections to Streams
The limit to the number of possible simultaneous connections is not per stream, but per Lightstreamer adapter (referred to as the target). Each adapter requires one HTTP connection, even if more than one stream is subscribed from that adapter. An additional one control connection is always required.
As an example: to subscribe to the Prices, NewsHeadlines and Quotes streams, a total of 1 (adapter) + 1 (control) = 2 HTTP connections are required.
If you are creating a web browser based UI trading application, then the default setting for modern browsers (Internet Explorer 8.x and above, Firefox 3.x and above) allow a maximum of six persistent HTTP connections to a remote server. If required, advanced power users can change the configuration in the browser to allow more than six persistent HTTP connections.
In the case of Windows Phone 7 (WP7) based UI trading applications, the environment imposes a hard concurrent connection limit of six, which is not alterable.
Last updated: 07 November 2025
|
Copyright © 2026 StoneX