SG Analytics Data API gives access to quotes and descriptions of more than 500k intruments covering a wide cross-asset scope: Equity, Bonds, Credit, Forex, Commodities.
Data comes from either SG research and SG trading desks or external sources such as ICAP or Markit.
The Market Data Analytics API provides endpoints to retrieve:
For more informations check out the API descrition (swagger)
This repo is meant to help clients (and employees) to tap SG Research APIs.
This is a work in a progress and subject to change. All the major endpoints are covered and more notebooks are in coming soon.
The usual way to expose an API is to make a swagger available and also a GUI, typically a web page.
These have the following drawbacks:
A swagger is as precise as it is dull. Unless clients are (working with) IT savvy people they will have a hard time taking advantage of it. In short it is not enough. A GUI is easy to use but often as much a help as a hindrance: They are very slow/costly to build/adapt, are seldom as flexible as the underlying API, and are no help for industrial use of the API.
To fill the gap, we introduce the Jupyter notebook as an API consumption tool (It as many other uses). The associated Python package used here has a very simple interface, but can be arbitrarily modified for (and by) an advanced user. It has the same display capabilities as a web page (being one itself). Most importantly is is written in Python so can be evolved by a business user (as opposed to a web frontend which is invariably delegated to specialist developpers).
This repo contains:
The demo Jupyter notebook is a convenient and versatile interface to:
# download and install package from pypi.org pip install sgmarkets_api_analytics_data #launch notebook jupyter notebook
Create a notebook or run the demo notebook and modify it to your own use case.
To use this library, authentication is required.
Read the demo notebook for a hands-on introduction.
The key steps are the following.
The package contains the corresponding API swagger url and contact info:
import sgmarkets_api_analytics_data as SGMD # info about SGMD SGMD.info()
See the user guide in the sgmarkets-api-auth repo.
Select it from the list of those available in the package.
import sgmarkets_api_analytics_data as SG # Examples ep = SGMD.endpoint.v2_quotas ep = SGMD.endpoint.v2_quotes ep = SGMD.endpoint.v2_product
Each end point comes with a Request object.
# For all endpoints rq = ep.request()
And fill the object with the necessary data. This part is specific to the endpoint selected. See the demo notebook for examples.
Then explore your Request object to make sure it is properly set.
# For all endpoints # display the structure of the object rq.info()
You can call the API directly from the Request object.
# For all endpoints # a is an Api object (see 4.2) res = rq.call_api(a)
The returned object is a Response object associated to this endpoint. You can explore it starting with
# For all endpoints # display the structure of the object res.info()