Skip to main content
Version: Upcoming

Snowflake API

If interested, we provide clients with Snowflake reader accounts to our historical data. The reader accounts allow you to query the datasets that you are subscribed to via the Snowflake SQL interface.

Performance considerations

  • Partitioning - We store the data partitioned by date under a partitioning key of date_p. When querying the data, query performance will be poor if no partitioning key is included in the query. We always recommend including date_p in your filters.
  • Selecting only the columns required - We recommend selecting only the columns that you are actually interested in for your queries. SELECT * should only be used if necessary.
  • Using detailed WHERE clauses - The more detailed you are with the WHERE clauses in your query, the faster the data retrieval will be.

Python

There are multiple ways to connect to Snowflake from Python. We found Polars to be the most efficient way to retrieve data from Snowflake.

In the following example code, you will need to replace the placeholders with the credentials provided to you.

Polars

The Snowflake ADBC driver package provides efficient data transfer between Python and Snowflake. For optimal performance, use the ADBC engine.

pip install polars adbc-driver-snowflake
import polars as pl

connection_string = 'snowflake://<user>:<password>@<account_identifier>/<database>/<schema>'
query="""SELECT
okey_tk,
okey_dt,
okey_xx,
okey_cp,
date,
srprc
FROM
OPTIONINTRADAYHIST_EQT
WHERE
date_p = '2026-02-05'
AND okey_tk = 'AAPL'
"""

df=pl.read_database_uri(query=query,uri=connection_string,engine='adbc')

Note that numeric values will be returned as decimal types and you will need to cast them to the desired datatype.

Pandas

pip install pandas snowflake-sqlalchemy[pandas]
import pandas as pd

connection_string = 'snowflake://<user>:<password>@<account_identifier>/<database>/<schema>'
query="""SELECT
okey_tk,
okey_dt,
okey_xx,
okey_cp,
date,
srprc
FROM
OPTIONINTRADAYHIST_EQT
WHERE
date_p = '2026-02-05'
AND okey_tk = 'AAPL'
"""

df=pd.read_sql(sql=query,con=connection_string)

C#

For information on how to connect and query our historical data using C#, please visit our GitHub repo with an example.