Using darwintIQ data in Python, TradingView, or Excel
This guide shows how to consume darwintIQ API data in external tools such as Python scripts, spreadsheets, dashboards, and custom charting workflows.
What This Integration Is For
This type of integration is useful when you want to:
- pull darwintIQ data into your own analytics pipeline
- monitor models and signals outside the darwintIQ dashboard
- build automations, alerts, or reports
- combine darwintIQ output with your own market data or risk models
Minimum Setup
- Generate or obtain a valid API token.
- Choose the endpoint you want to consume, such as
/v1/models,/v1/supres, or/v1/trendmatrix. - Send an authenticated HTTPS request with
Authorization: Bearer YOUR_TOKEN. - Parse the JSON response in your target tool.
- Add validation and error handling before using the data in production.
Common Integration Patterns
Python
Python is the most direct option for scripting, automation, research, and backend integrations.
Typical uses:
- scheduled data pulls
- signal filtering
- exporting data to databases
- building custom alerts or internal dashboards
Example:
import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN"
}
res = requests.get(
"https://api.darwintiq.com/v1/models?symbol=XAUUSD",
headers=headers,
timeout=10,
)
res.raise_for_status()
data = res.json()
for trading_model in data.get("trading_models", []):
print(trading_model.get("id"), trading_model.get("fitness"))
TradingView
TradingView cannot call authenticated REST endpoints directly from Pine Script in the same way a backend script can, so the usual approach is to use an intermediate service.
Typical uses:
- fetch darwintIQ data on your backend
- convert it into a simplified feed
- pass key values into TradingView-compatible workflows, overlays, or alerts
In practice, this usually means:
- Your server calls the darwintIQ API.
- Your server transforms the response.
- Your TradingView workflow consumes the transformed data indirectly.
Excel or Google Sheets
Spreadsheet tools are useful for lightweight analysis, ranking, and reporting.
Typical uses:
- compare model metrics across symbols
- track fitness values over time
- build simple internal review sheets
In practice, spreadsheet integrations usually work best when you:
- fetch API data through a script or connector
- normalize the JSON into rows and columns
- refresh the sheet on a schedule
How the Integration Works
At a high level, the workflow is the same across tools:
- Call the darwintIQ API endpoint you need.
- Authenticate with a bearer token.
- Parse the JSON response.
- Extract only the fields relevant to your workflow.
- Store, display, alert on, or further process the data.
Troubleshooting
If your integration does not work as expected, check the following first:
-
HTTP
401or authorization errors Your token is missing, invalid, or expired. -
Empty or incomplete results The selected symbol may not have current data, or your request parameters may be too narrow.
-
Parsing failures Your code may assume a response shape that does not match the current API payload.
-
Timeouts or connection issues Add retry logic, timeouts, and backoff handling in your client.
-
Spreadsheet import issues Nested JSON often needs to be flattened before it can be used effectively in rows and columns.
Production Guidance
Before relying on these integrations in production:
- validate response fields before using them
- handle rate limits and retries explicitly
- log failed requests and malformed payloads
- avoid hardcoding assumptions about optional fields
- cache or batch requests where appropriate
Example Request
GET https://api.darwintiq.com/v1/models?symbol=XAUUSD
Authorization: Bearer YOUR_TOKEN
Related Endpoints
Useful starting points include:
/v1/models/v1/supres/v1/trendmatrix
Repository
Public example code is available here:
https://github.com/darwintIQ/API