Simple Data Access
Download historical market data with just a few lines of code.
The Quantdle Python Client is a user-friendly library that simplifies downloading financial market data from Quantdle. This client handles all the complexity of data downloading, extraction, and processing, giving you clean, ready-to-use pandas or polars DataFrames.
Simple Data Access
Download historical market data with just a few lines of code.
High Performance
Parallel downloads and smart chunking for faster data retrieval.
Multiple Formats
Support for both pandas and polars DataFrames.
Zero Configuration
Works out of the box with minimal setup.
Install the Quantdle Python client using pip:
pip install quantdle
pip install quantdle[polars]
Before using the Python client, you’ll need to obtain your API credentials from the Quantdle dashboard.
Here’s how to get started with the Quantdle Python client in just a few lines of code:
import quantdle as qdl
# Initialize the client with your API credentialsclient = qdl.Client( api_key="your-api-key", api_key_id="your-api-key-id")
# Download data for EURUSDdf = client.download_data( symbol="EURUSD", timeframe="H1", start_date="2023-01-01", end_date="2023-12-31")
# Display the first few rowsprint(df.head())
import quantdle as qdl
# Initialize client onceclient = qdl.Client( api_key="your-api-key", api_key_id="your-api-key-id")
# Download different symbols and timeframesxau_data = client.download_data("XAUUSD", "D1", "2023-01-01", "2023-12-31")eur_data = client.download_data("EURUSD", "H1", "2023-01-01", "2023-01-31")
For large datasets, polars DataFrames offer better performance and memory efficiency:
import quantdle as qdl
client = qdl.Client( api_key="your-api-key", api_key_id="your-api-key-id")
# Get data as a polars DataFramedf = client.download_data( symbol="XAUUSD", timeframe="D1", start_date="2023-01-01", end_date="2023-12-31", output_format="polars")
print(f"Data shape: {df.shape}")print(df.head())
Before downloading data, you can check which symbols are available for your account:
import quantdle as qdl
client = qdl.Client( api_key="your-api-key", api_key_id="your-api-key-id")
# Get all available symbols for your accountsymbols = client.get_available_symbols()print(f"Available symbols: {symbols}")
# Get information about a specific symbolinfo = client.get_symbol_info("EURUSD")print(f"EURUSD available from {info['available_from']} to {info['available_to']}")
The client automatically handles large date ranges by splitting them into smaller chunks to avoid timeouts:
import quantdle as qdl
client = qdl.Client( api_key="your-api-key", api_key_id="your-api-key-id")
# Download 10 years of data - will be automatically chunkeddf = client.download_data( symbol="EURUSD", timeframe="H1", start_date="2014-01-01", end_date="2023-12-31", chunk_size_years=5 # Download in 5-year chunks)
Customize download behavior for optimal performance:
import quantdle as qdl
client = qdl.Client( api_key="your-api-key", api_key_id="your-api-key-id")
# Customize download behaviordf = client.download_data( symbol="EURUSD", timeframe="M5", start_date="2023-01-01", end_date="2023-12-31", max_workers=8, # Increase parallel downloads show_progress=True, # Show progress bars chunk_size_years=3 # Smaller chunks for more frequent updates)
The Quantdle API supports the following timeframes:
Timeframe | Description |
---|---|
M1 | 1 minute |
M5 | 5 minutes |
M15 | 15 minutes |
M30 | 30 minutes |
H1 | 1 hour |
H4 | 4 hours |
D1 | 1 day |
The returned DataFrame contains the following columns:
Column | Type | Description |
---|---|---|
timestamp | datetime | Bar timestamp |
open | float | Opening price |
high | float | Highest price |
low | float | Lowest price |
close | float | Closing price |
tickvol | int | Tick volume (number of new ticks) |
volume | int | Trading volume |
spread | int | Average spread of the bar |
spreadmax | int | Maximum spread of the bar |
spread_open | int | Opening spread of the bar |
# Sample output structure timestamp open high low close tickvol volume spread spreadmax spreadopen0 2023-06-30 15:34:00 1.08840 1.08867 1.08829 1.08861 389 369332000 4 7 21 2023-06-30 15:35:00 1.08862 1.08874 1.08849 1.08854 302 318511000 4 7 42 2023-06-30 15:36:00 1.08859 1.08880 1.08844 1.08851 281 339198000 3 7 13 2023-06-30 15:37:00 1.08851 1.08898 1.08849 1.08881 253 328819000 3 6 3...
The client includes robust error handling for common scenarios:
import quantdle as qdl
client = qdl.Client( api_key="your-api-key", api_key_id="your-api-key-id")
try: df = client.download_data( symbol="INVALID_SYMBOL", timeframe="H1", start_date="2023-01-01", end_date="2023-12-31" )except ValueError as e: print(f"Invalid parameter: {e}")except ConnectionError as e: print(f"Network error: {e}")except Exception as e: print(f"Unexpected error: {e}")
Create the client once and reuse it for multiple downloads:
# Good: Create client onceclient = qdl.Client(api_key="...", api_key_id="...")
# Download multiple datasetseurusd = client.download_data("EURUSD", "H1", "2023-01-01", "2023-12-31")gbpusd = client.download_data("GBPUSD", "H1", "2023-01-01", "2023-12-31")
# Bad: Creating new client for each download# This is inefficient and may hit rate limits
Save large datasets locally to avoid re-downloading:
import quantdle as qdlimport pandas as pd
client = qdl.Client(api_key="...", api_key_id="...")
# Download and save to filedf = client.download_data("EURUSD", "H1", "2023-01-01", "2023-12-31")df.to_parquet("eurusd_h1_2023.parquet") # Efficient binary format
# Later, load from file instead of re-downloadingdf = pd.read_parquet("eurusd_h1_2023.parquet")
Be mindful of the data range you’re requesting:
# Good: Reasonable date rangedf = client.download_data("EURUSD", "H1", "2023-01-01", "2023-12-31")
# Consider carefully: Very large rangedf = client.download_data("EURUSD", "M1", "2020-01-01", "2023-12-31") # 4 years of minute data!
Authentication Errors
Download Timeouts
chunk_size_years
parameterMemory Issues with Large Datasets
output_format="polars"
for better memory efficiencySymbol Not Found
get_available_symbols()
to check available symbolsIf you encounter issues with the Python client:
Now that you know how to use the Python client, explore these related topics:
Symbol Reference
MetaTrader Integration