Use Your Own AI with Financial Data
Three ways to use your existing AI subscription with Trading Studio: generate SQL queries, fetch data via API, or run and customize 85+ backtesting strategies.
If you have a ChatGPT, Claude, or Gemini subscription, you can use it to work with financial data on Trading Studio. This overview explains the available approaches and which one fits your use case.
What Trading Studio provides
- Managed data warehouse with FMP financial data (stock prices, fundamentals, analyst estimates, insider trading, ETFs, economic calendars)
- DuckDB query engine for fast analytical queries
- API access for programmatic data retrieval
- Cloud compute for running backtests
- 85+ open-source backtesting strategies
You can access all of this using your own AI tools instead of (or in addition to) the platform's built-in AI.
Three approaches
Guide 1: Generate SQL with AI (no API key)
Best for: Quick queries, learning SQL, users who prefer web interfaces
How it works:
- Copy a compact schema from the Data Explorer
- Paste it into ChatGPT/Claude/Gemini
- Ask questions in plain English
- AI generates DuckDB SQL
- Paste the SQL back into the Data Explorer
- Run and see results
Setup: None. Just your existing AI subscription.
Use case: "Show me technology stocks with P/E under 15 and ROE over 20%"
Guide 2: Query via API (API key required)
Best for: Scripting, automation, repeated queries, Python users
How it works:
- Set your API key as an environment variable
- Give your AI the endpoint documentation
- Ask questions
- AI generates and runs Python code that submits queries and fetches results
Setup: API key + Python with requests.
Use case: Building a data analysis script where the AI pulls data programmatically.
Guide 3: Backtesting with AI (API key + backtests repo)
Best for: Strategy research, signal testing, parameter optimization
How it works:
- Clone the open-source backtests framework (85+ strategies)
- Run existing strategies or tell your AI to customize them
- AI modifies signal logic, filters, parameters
- Run locally or on cloud compute via the Projects API
Setup: API key + Python + backtests repo.
Use case: Testing a custom value strategy on Indian stocks with transaction costs, or running a parameter sweep across 20 configurations on cloud compute.
Which guide should you use?
If you're just getting started: Use Guide 1 (SQL generation). No setup, no cost, works with any AI chatbot.
If you're writing a Python script or notebook: Use Guide 2 (API queries). Your AI can generate data-fetching code that you integrate into your analysis.
If you want to test trading strategies: Use Guide 3 (backtesting). Run 85+ strategies as-is, customize with AI, or build new ones from scratch.
You can mix approaches. Many users start with Guide 1 for exploration, then use Guide 2 for scripting once they know which data they need, and Guide 3 when they're ready to test strategies.
API key setup
Guides 2 and 3 require an API key.
Get your key:
- Sign in to tradingstudio.finance
- Go to Settings, API Keys
- Click "Create New Key"
- Copy the key (format:
ts_xxxxxxxxxxxx)
Set it as an environment variable:
export TS_API_KEY="ts_your_key_here"
Add to ~/.zshrc or ~/.bashrc so it persists across sessions. Then tell your AI: "Use the TS_API_KEY environment variable for authentication."
Resources
- Backtests framework: github.com/ceta-research/backtests
- Methodology: github.com/ceta-research/backtests/blob/main/METHODOLOGY.md
Start with Guide 1: Use AI to Query Financial Data