Skip to main content

RESTful API Getting Started

The CloudQuant Data Liberator API provides RESTful endpoints for querying financial market data. The primary endpoint is /liberator/query, which accepts JSON payloads and returns data as JSON objects or Apache Arrow batches.

Requirements

  • curl
  • jq
  • base64
  • Python with pyarrow (for Arrow format decoding)
  • pigz (for compressed Arrow format)

Authentication

All requests require a P12 client certificate and user credentials:
URL=https://api.cloudquant.ai
USER=TODO-ADD-YOUR-USERID-HERE
TOKEN=TODO-ADD-YOUR-TOKEN-HERE

Quick Start: JSON Queries

Current Value Query

curl -qs --cert-type P12 --cert liberator.pfx \
  -H "Content-Type: application/json" --noproxy '*' \
  --data '{"json_xfer":true,"symbols":["AAPL","IBM"],"name":"daily_bars","user":"'"$USER"'","token":"'"$TOKEN"'","system":"API","debug_stream":false}' \
  $URL/liberator/query

Time Range Query

curl -qs --cert-type P12 --cert liberator.pfx \
  -H "Content-Type: application/json" --noproxy '*' \
  --data '{"json_xfer":true,"symbols":"AAPL","name":"daily_bars","user":"'"$USER"'","token":"'"$TOKEN"'","system":"API","back_to":"2022-12-01","debug_stream":false}' \
  $URL/liberator/query

Point-in-Time Query

curl -qs --cert-type P12 --cert liberator.pfx \
  -H "Content-Type: application/json" --noproxy '*' \
  --data '{"json_xfer":true,"symbols":"AAPL","name":"daily_bars","user":"'"$USER"'","token":"'"$TOKEN"'","system":"API","as_of":"2022-12-15","debug_stream":false}' \
  $URL/liberator/query

Advanced: Apache Arrow Format

Without Compression

BATCHES=$(curl -qs --cert-type P12 --cert liberator.pfx \
  -H "Content-Type: application/json" --noproxy '*' \
  --data '{"json_xfer":false,"compress":false,"symbols":["AAPL"],"back_to":"2023-01-01","debug_stream":false,"name":"daily_bars","user":"'"$USER"'","token":"'"$TOKEN"'","system":"API"}' \
  $URL/liberator/query | jq -r '.[] | select(type=="object") | .batch')
for BATCH in $BATCHES; do
    echo $BATCH | base64 -d | python -c "import sys; import pyarrow as pa; print(pa.ipc.open_stream(sys.stdin.buffer.read()).read_next_batch().to_pylist())"
done

With Compression

BATCHES=$(curl -qs --cert-type P12 --cert liberator.pfx \
  -H "Content-Type: application/json" --noproxy '*' \
  --data '{"json_xfer":false,"compress":true,"symbols":["AAPL"],"back_to":"2023-01-01","debug_stream":false,"name":"daily_bars","user":"'"$USER"'","token":"'"$TOKEN"'","system":"API"}' \
  $URL/liberator/query | jq -r '.[] | select(type=="object") | .batch')
for BATCH in $BATCHES; do
    echo $BATCH | base64 -d | pigz -dz | python -c "import sys; import pyarrow as pa; print(pa.ipc.open_stream(sys.stdin.buffer.read()).read_next_batch().to_pylist())"
done

Response Format

Standard JSON response includes fields such as: _seq, _dsname, timestamp, symbol, open, high, low, close, volume, vwap, spread, bidvol, askvol, and count.