Skip to main content

Query parameter combinations

This guide explains the main parameters for CloudQuant Data Liberator queries and the expected results from different combinations.

Core parameters

ParameterDescriptionDefault
nameDataset identifier (required)
symbolsSingle symbol or list, e.g. ['AAPL','GOOG','MSFT']None (all symbols)
back_toQuery start dateNone
as_ofQuery end dateCurrent date/time
fieldsSpecify desired columns to reduce download timeAll columns
statsSet to 'Total' for symbol counts instead of full results
whereCustom SQL predicate appended to the generated filtersNone
sqlFull raw SQL query (replaces name, time range, and other construction params)None
Use liberator.datasets(entitled=True) to list all datasets available to you.
See the Query Parameters Reference for the full parameter list, including superquery, N-Query, and authentication options.

Query examples

All parameters included

df = liberator.get_dataframe(liberator.query(
    name = 'daily_bars',
    as_of = '2024-07-24',
    back_to = '2024-07-16',
    symbols = ['AAPL', 'GOOGL']))
Returns data for specified symbols within the date range.

Without symbols

df = liberator.get_dataframe(liberator.query(
    name = 'daily_bars',
    as_of = '2024-07-24',
    back_to = '2024-07-16'))
Defaults to all available symbols.

Without as_of

df = liberator.get_dataframe(liberator.query(
    name = 'daily_bars',
    back_to = '2024-07-22'))
Defaults as_of to current time, returning data from present back to specified date.

Without back_to

df = liberator.get_dataframe(liberator.query(
    name = 'daily_bars',
    as_of = '2023-12-25'))
Returns the most recent data point per symbol as of the specified date. Look-back distance varies by dataset density.

Minimal query (name only)

df = liberator.get_dataframe(liberator.query(name = 'daily_bars'))
Returns the latest data point for all symbols in the dataset.

Custom where filters

Use where with a standard parameter-based query to append extra SQL predicates on top of the filters CloudQuant Data Liberator generates for time range and symbols. The clause is combined with AND — do not include the WHERE keyword.
df = liberator.get_dataframe(liberator.query(
    name='daily_bars',
    as_of='2024-07-24',
    back_to='2024-07-16',
    symbols=['AAPL', 'GOOGL'],
    where='volume > 1000000'
))
where works with time-range, LKV, and N-Query modes. Column names that match the dataset schema are automatically quoted when needed.

Multi-dataset / concordance-style filters

For datasets keyed by more than symbol (for example concordance tables with a dataset column), use where to narrow the result set:
df = liberator.get_dataframe(liberator.query(
    name='concordance',
    as_of='2025-01-01',
    back_to='2024-01-01',
    where="dataset = 'my_derived_dataset'"
))
where cannot be combined with sql. Use one approach or the other.

Raw sql queries

Pass a complete SQL SELECT statement via sql instead of name, back_to, as_of, and related parameters. When sql is present, parameter-based query construction is skipped.
df = liberator.get_dataframe(liberator.query(
    sql='''
        SELECT *
        FROM "daily_bars"
        WHERE muts >= 1704067200000000
          AND muts < 1704153600000000
          AND symbol = $$AAPL$$
    ''',
    user='my_user',
    system='API'
))

SQL requirements

  • The statement must be a SELECT (including UNION / INTERSECT / EXCEPT branches).
  • Every SELECT arm must include an explicit WHERE clause.
  • By default, the WHERE clause must include a time-range predicate on muts or another configured column (=, >, >=, <, <=, or BETWEEN). Use microsecond timestamps for muts values.
  • Quote dataset names with double quotes when they contain special characters.
  • Use $$symbol$$ dollar-quoting for string literals in filters.

Parameters allowed with sql

When using sql, only connection, auth, and transfer options are permitted alongside the statement — for example user, system, token, compress, json_xfer, and batch_size. Supplying non-empty values for name, back_to, as_of, where, or other construction parameters raises an error.
Raw SQL bypasses the convenience of name / symbols / back_to / as_of. Prefer parameter-based queries unless you need full control over the generated SQL.