GraphQL API
The ALOR Broker trading system provides an opportunity to receive data via GraphQL API. Compared to other methods of data retrieval, using GraphQL queries allows you to freely select the content of responses from the server and receive only the information you need to solve the task.
GraphQL API provides a flexible way to get extended information about financial instruments aggregated from different sources.
For example, you can get extended information about the company, dividend payments on shares, coupons on bonds and so on. Both historical and real-time data are available.
To get the most out of this interface, it is recommended to read the GraphQL specification, official documentation, and answers to frequently asked questions prepared by the creators of this technology. This guide prioritizes the demonstration of GraphQL capabilities and its application using practical examples.
General information
As a query language, GraphQL has the following features and advantages:
- Single interaction point: All queries are being forwarded to a single endpoint, reducing the possibility of missing one of the path parameters or mistaking their order.
- Query Flexibility: The user is free to independently form a query to receive only the data he needs to solve the task. This allows optimizing the parsing of the received responses, reducing the load on the network and hardware, and reducing the number of requests required to obtain all the information to one.
- Multitasking Requests: Multiple messages can be sent within a single request, which the server will successfully process, even if they are unrelated.
- ** API Transparency**: The GraphQL schema is always available for the user to view in its entirety, allowing the user to more accurately specify the parameters corresponding to the desired data.
- Parameter Typing: All query and response parameters are strictly typed, reducing query errors and making it easier to automate queries that are sent.
GraphQL should be seen as a convenient way to get only the data you need for a task right now without having to process redundant data or run several different queries and consolidate their results to get the desired result.
Access to schema
To access the schema, go to the URL of the interface in a browser or set it as an endpoint in the plug-in libraries and testing tools.
https://api.alor.ru/hyperion
https://apidev.alor.ru/hyperion
- Postman
- Sandbox
Example with Postman
Example with sandbox web interface
Request authorization
Authorization of requests to GraphQL API can be done in the same way and with the same resources as for HTTP API — by passing an Access token in the Authorization
header parameter.
This token should be passed as a Bearer token, therefore the header should contain the prefix Bearer
before the value to be passed. Filling the header in different variations looks like this:
- Header
- Postman
- Sandbox
Example of header
Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJzdWIiOiJMb2dpblNhbXBsZSIsImVudCI6ImNsaWVudCIsImVpbiI6IjAxMjM0IiwiY2xpZW50aWQiOiIwMTIzNDU2IiwiYXpwIjoiMDEyMzQ1Njc4OWFiY2RlZjAxMjMiLCJhZ3JlZW1lbnRzIjoiQWdyZWVtZW50U2FtcGxlMSBBZ3JlZW1lbnRTYW1wbGUyIEFncmVlbWVudFNhbXBsZTMiLCJwb3J0Zm9saW9zIjoiUG9ydGZvbGlvU2FtcGxlMSBQb3J0Zm9saW9TYW1wbGUyIFBvcnRmb2xpb1NhbXBsZTMiLCJzY29wZSI6Ik9yZGVyc1JlYWQgT3JkZXJzQ3JlYXRlIFRyYWRlcyBQZXJzb25hbCBTdGF0cyIsImV4cCI6Mjg3MTc2MzE5OSwiaWF0IjowLCJpc3MiOiJBbG9yLklkZW50aXR5IiwiYXVkIjoiQ2xpZW50IFdBUlAgV2FycEFUQ29ubmVjdG9yIHN1YnNjcmlwdGlvbnNBcGkgQ29tbWFuZEFwaSBJbnN0cnVtZW50QXBpIFRyYWRpbmdWaWV3UGxhdGZvcm0ifQ.QOQVMIAoZ6SnF5urnIzJ0EvtQd9P5Sx355069kXoID207wHOTW0wkKNMcrIKXmENEQQ_0yDjqH_kjeqWLBJuqA
Example in Postman
Example in web interface
What's next?
Additionally, we recommend reading the following related articles:
- Basic GraphQL syntax
- Sandbox for Production environment
- Sandbox for Test environment
- Guide to HTTP API
- Guide to WebSocket API