Skip to main content

Advanced - query data using requests.post RESTful API

As of release version 2.0, the P12 client certificate (liberator.pfx) is no longer required. The cert=cert argument and pfx_to_pem helper shown below are only needed for releases prior to 2.0.

requests.post from Python to access CloudQuant Data Liberator data

requests.post is an HTTP method you can use to send query arguments to the CloudQuant Data Liberator server for processing.

Post arguments

  • {base_url}/liberator/query — The query endpoint. Use the base URL from your Liberator Profile page download.
  • data=json.dumps(...) - This json.dumps section provides the body of the query with these parameters:
    • compress
    • json_xfer
    • user
    • token
    • name
    • as_of
    • back_to
    • symbols
    • system
  • headers={'Content-Type':'application/json'}
  • cert=cert - cert comes from with pfx_to_pem('liberator.pfx','') as cert:

Query the last known value(s)

To get the last known value in any dataset, do not provide the as_of or back_to arguments. This will give you the last known value for the given dataset and symbols.

Query for a time series result

Adding the back_to argument for any query will give you the time series data all the way back to the specified date.
Every dataset has different data frequencies. Use short time frames until you become familiar with the datasets. Some datasets are quite large, and an over-extended request can return an extremely large amount of data.

json.dumps components

Example: calling the CloudQuant Data Liberator REST API with Python