Getting started with the Zenith WebSockets API client requires nothing more than a modern web-browser and some skill with JavaScript.
First, you will need to get the required credentials from Paritech. These are used to negotiate with our OAuth 2.0 Authorisation Server, which will translate your credentials into a limited-time token for logging in to Paritech services including Zenith.
Once you have a token, you can either use HTTP authorisation to pass it to Zenith, or make an unauthorised connection and call the AuthToken action on the Auth Controller. Zenith will let you know whether your credentials are accepted, either via a HTTP 403 Forbidden reply, or in the response to calling AuthToken.
Be aware that OAuth access tokens can and do expire, so a fully featured client will need to handle this situation and automatically refresh using the OAuth refresh token.
The version of the Zenith protocol you wish to speak can be specified as a version parameter on the initial HTTP request.
One of the first things a client should do is see what they have access to. There are several queries to help with this,including: QueryIdentify, QueryMarkets, QuerySources, and QueryAccounts.
QueryIdentify will tell you whether you’re successfully authorised (assuming you didn’t use HTTP authorisation), and list the Zenith scopes you’ve been authorised for. Most parts of the Zenith WebSockets API will have one or more required scopes before you’ll get any data back.
QueryMarkets, assuming you’re authorised, will give you a list of the markets you can see. Don’t just assume you can always see a particular market. Depending on your login, the live market might be unavailable and you’ll have ASX\[Demo\]
instead. Or you may be able to access both ASX
and ASX\[Demo\]
at the same time.
Alternatively, rather than making a query, you can subscribe to the Markets topic, which will send you updates to market status and downstream connectivity. If the market feed encounters a fault, it’ll let you know.
Following the same pattern, QuerySources returns the list of News Sources you can see, and is paired with the Sources subscription. QueryAccounts returns the list of Trading Accounts you can see, and is paired with the Accounts subscription.
Keeping in mind the access your login has, if you’re authorised you can start making data requests.
The API supports two methods of data access:
We strongly recommend the Subscriptions interface for most tasks, as it provides realtime information with minimal bandwidth usage and processing.
See the Market Controller for retrieving market data. See the News Controller for announcements. See the Trading Controller for holdings, balances and order management.