Quick Setup Start Here
Setup at local machine
Step 1 - Get API Key
Create your account and generate your CLI API key in seconds.
Step 2 - Install CLI
Install the KlickAnalytics CLI package locally on your machine.
pip install klickanalytics-cli
Step 3 - Set API Key
Connect your terminal to your KlickAnalytics account.
export KLICKANALYTICS_CLI_API_KEY=your_api_key_here
Step 4 - Run Command
Go to your terminal or command window on your local machine, and type the below command to get the latest quote of AMZN.
Terminal / Command Line CLI
The simplest way to use KlickAnalytics. Install once, run from any shell — bash, zsh, PowerShell, or Windows CMD.
Step 1 — Check if Python & pip are installed
Open your terminal (macOS/Linux) or Command Prompt / PowerShell (Windows) and run:
If either command is not found, install Python first:
- macOS: Install via Homebrew —
brew install python3
- Windows: Download the installer from python.org/downloads — check "Add python.exe to PATH" during install
- Linux (Ubuntu/Debian):
sudo apt update && sudo apt install python3 python3-pip
- Linux (RHEL/CentOS):
sudo yum install python3 python3-pip
Windows note: After installing Python, restart your Command Prompt so PATH changes take effect. You may need to use python3 and pip3 instead of python / pip on some systems.
Step 2 — Install KlickAnalytics CLI
pip install klickanalytics-cli
To upgrade an existing installation:
pip install --upgrade klickanalytics-cli
Step 3 — Set your API Key (safely)
There are several ways to store your API key. Choose the method that matches your setup:
── Method 1: Shell profile (macOS/Linux) — Recommended ──────────
# For bash users:
echo 'export KLICKANALYTICS_CLI_API_KEY=your_key_here' >> ~/.bashrc
source ~/.bashrc
# For zsh users (macOS default):
echo 'export KLICKANALYTICS_CLI_API_KEY=your_key_here' >> ~/.zshrc
source ~/.zshrc
── Method 2: Windows — Permanent system variable ─────────────────
# PowerShell (run as Administrator):
[System.Environment]::SetEnvironmentVariable("KLICKANALYTICS_CLI_API_KEY","your_key_here","User")
# Or via GUI: Start → Search "Environment Variables" → Edit for your account
── Method 3: .env file (good for projects/scripts) ───────────────
# Create a .env file in your project root:
KLICKANALYTICS_CLI_API_KEY=your_key_here
# Load it in Python:
pip install python-dotenv
from dotenv import load_dotenv
load_dotenv() # reads .env automatically
import subprocess
result = subprocess.run(["ka", "quote", "AAPL"], capture_output=True, text=True)
print(result.stdout)
# ⚠ Always add .env to your .gitignore — never commit it:
echo ".env" >> .gitignore
── Method 4: macOS Keychain (most secure) ────────────────────────
# Store securely in macOS Keychain:
security add-generic-password -a "$USER" -s "KLICKANALYTICS_CLI_API_KEY" -w "your_key_here"
# Retrieve and export in your shell profile:
export KLICKANALYTICS_CLI_API_KEY=$(security find-generic-password -a "$USER" -s "KLICKANALYTICS_CLI_API_KEY" -w)
Security rules:
- Never paste your API key directly into code files or notebooks that you share
- Never commit your key to git — add
.env and any config files to .gitignore
- Use separate keys for development and production if possible
- Rotate your key from the API Keys page if you suspect it was exposed
Step 4 — Verify & Explore
Tip: Add -datatype json to any command for machine-readable JSON output — great for piping into scripts or other tools. Example: ka prices TSLA -datatype json
Claude Code Agentic CLI
Claude Code is Anthropic's official agentic CLI. It runs in your terminal and can execute shell commands, read files, and reason over code. Because KlickAnalytics CLI is a shell command, Claude Code can call it natively — no plugins or setup required beyond having both installed.
Prerequisites
npm install -g @anthropic-ai/claude-code
pip install klickanalytics-cli
Set API Keys in your shell profile
# ~/.zshrc or ~/.bashrc
export ANTHROPIC_API_KEY=your_anthropic_key_here
export KLICKANALYTICS_CLI_API_KEY=your_ka_key_here
How it works
Claude Code has a built-in Bash tool. When you ask it a financial question, it will automatically invoke ka commands to get live data, reason over the output, and return an answer — all in one turn.
Example prompts (run inside claude)
# Start Claude Code in your terminal:
claude
# Then type natural-language prompts:
> Fetch the last 6 TSLA earnings and tell me whether beats or misses dominate
> Run technical analysis on NVDA and flag any bearish divergences
> Compare 30-day volatility for AAPL, MSFT and GOOGL and rank them
> Screen for NASDAQ tech stocks up more than 15% this year with RSI below 65
> Get the quantstats report for SPY for 2024 and summarise the drawdown periods
CLAUDE.md — Project-level context
Add a CLAUDE.md file to your project root so Claude Code always knows about KlickAnalytics:
# Financial Data — KlickAnalytics CLI
`ka` commands are available in this environment. Use them to fetch live market data.
## Common commands
- `ka quote -s SYMBOL` Real-time quote
- `ka prices -s SYMBOL` Historical OHLCV prices
- `ka earnings -s SYMBOL` Earnings history with beat/miss
- `ka ta -s SYMBOL` Full technical analysis
- `ka quantstats -s SYMBOL` Risk & return statistics
- `ka volatility -s SYMBOL` Volatility metrics
- `ka peers -s SYMBOL` Comparable companies
- `ka screener -filter "..."` Stock screener with filters
## Flags
- `-sd YYYY-MM-DD` Start date
- `-ed YYYY-MM-DD` End date
- `-limit N` Max rows returned
- `-datatype json` Machine-readable JSON output
Tip: Claude Code's --print flag lets you run one-shot queries non-interactively, great for scripts: claude --print "Get TSLA quote via ka and return just the price"
OpenAI Codex CLI Agentic CLI
OpenAI Codex CLI (codex) is OpenAI's agentic terminal assistant. Like Claude Code, it can execute shell commands — so ka commands are available to it out of the box.
Install
npm install -g @openai/codex
Set API Keys
# ~/.zshrc or ~/.bashrc
export OPENAI_API_KEY=your_openai_key_here
export KLICKANALYTICS_CLI_API_KEY=your_ka_key_here
Usage
# Interactive session:
codex
# One-shot query (non-interactive):
codex "Fetch the current AAPL quote using ka and summarise it"
# With full auto-approve (for scripting):
codex --approval-mode full-auto "Run ka earnings -s TSLA -limit 4 and highlight any beats"
System prompt file — ~/.codex/instructions.md
Add KlickAnalytics context so Codex always knows the available commands:
You have access to the KlickAnalytics CLI via the `ka` command.
KLICKANALYTICS_CLI_API_KEY is already set in the environment.
Use `ka` commands to answer financial data questions:
ka quote -s SYMBOL Real-time price & stats
ka earnings -s SYMBOL Earnings history
ka ta -s SYMBOL Technical indicators
ka quantstats -s SYMBOL Portfolio statistics
ka screener -filter "..." Stock screener
Always prefer JSON output (`-datatype json`) when piping data into further analysis.
Approval modes: suggest (default, asks before each command), auto-edit (runs shell commands freely), full-auto (fully autonomous — use in sandboxed environments only).
Cursor IDE IDE Integration
Cursor is an AI-powered code editor. Use KlickAnalytics CLI directly in Cursor's integrated terminal, or let Cursor's AI run commands for you during research and development.
Terminal Integration
Open the built-in terminal (Ctrl+`) and run any ka command directly alongside your code:
ka quantstats TSLA -sd 2024-01-01 -ed 2024-12-31
ka ta NVDA
ka screener -sector technology -limit 20
Cursor AI Chat / Composer
Open Composer with Ctrl+I and give Cursor this system context:
I have klickanalytics-cli installed with KLICKANALYTICS_CLI_API_KEY set.
When I ask financial questions, run ka commands in the terminal.
Available commands:
ka quote [symbol] ka profile [symbol]
ka prices [symbol] ka earnings [symbol]
ka dividends [symbol] ka ta [symbol]
ka quantstats [symbol] ka volatility [symbol]
ka peers [symbol] ka screener [filters]
.cursorrules — Project-Level Config
Create a .cursorrules file in your project root to make financial data always available:
# Financial Data via KlickAnalytics CLI
# API key is set via KLICKANALYTICS_CLI_API_KEY environment variable
## Common Commands
- ka quote [symbol] # Real-time quote
- ka prices [symbol] -limit 100 # Historical OHLCV
- ka earnings [symbol] # Earnings history with surprises
- ka ta [symbol] # Technical indicators
- ka quantstats [symbol] # Risk & return stats
- ka volatility [symbol] # Volatility metrics
- ka peers [symbol] # Comparable companies
## Flags
-sd YYYY-MM-DD Start date
-ed YYYY-MM-DD End date
-limit N Max rows
-datatype json JSON output (pipe-friendly)
MCP — Model Context Protocol New
MCP is an open standard created by Anthropic that lets AI models connect to external tools and data sources. Use KlickAnalytics as an MCP server to give any MCP-compatible AI client direct access to real-time financial data — no code required.
Install MCP Server
pip install klickanalytics-mcp
Configure in Claude Desktop
Edit the Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"klickanalytics": {
"command": "klickanalytics-mcp",
"env": {
"KLICKANALYTICS_CLI_API_KEY": "your_api_key_here"
}
}
}
}
Configure in Cursor
Add the same block to Cursor's MCP settings under Settings → MCP.
What You Can Do via MCP
- Ask Claude: "What were TSLA's last 8 earnings beats/misses?"
- Ask: "Run technical analysis on NVDA and summarise the signals"
- Ask: "Compare the 30-day volatility of AAPL, MSFT, and GOOGL"
- Ask: "Fetch quantstats for SPY for 2024 and highlight drawdowns"
- Ask: "Screen for technology stocks with high volume and positive momentum"
Note: MCP works with Claude Desktop, Cursor, and any other MCP-compatible client. Restart the client after updating the config file.
Claude by Anthropic AI Agent
Use KlickAnalytics CLI as a tool within Claude conversations. Claude can execute ka commands to fetch real-time market data and answer your financial questions intelligently.
Method 1 — Claude.ai with Computer Use
If you have Claude Pro or Teams with Computer Use enabled, Claude can run terminal commands directly. Give it this context:
I have klickanalytics-cli installed and KLICKANALYTICS_CLI_API_KEY is set.
Use 'ka' commands to fetch live financial data when I ask.
Examples:
ka quote AAPL # Real-time quote
ka earnings TSLA -limit 8 # Last 8 earnings
ka ta NVDA # Technical analysis
ka quantstats SPY # Portfolio statistics
Method 2 — Claude API + Tool Use (Python)
Use the Anthropic SDK to give Claude programmatic access to financial data via tool calling:
pip install anthropic
import anthropic
import subprocess
client = anthropic.Anthropic() # uses ANTHROPIC_API_KEY env var
tools = [{
"name": "run_ka_command",
"description": "Run a KlickAnalytics CLI command to fetch live financial data",
"input_schema": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The full ka command, e.g. 'ka quote AAPL' or 'ka earnings TSLA -limit 4'"
}
},
"required": ["command"]
}
}]
def run_ka(command):
result = subprocess.run(command.split(), capture_output=True, text=True, timeout=30)
return result.stdout or result.stderr
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=2048,
tools=tools,
messages=[{
"role": "user",
"content": "What is the current price of NVDA and how did it perform on its last 4 earnings?"
}]
)
# Handle tool use in the response
for block in response.content:
if block.type == "tool_use" and block.name == "run_ka_command":
output = run_ka(block.input["command"])
print(f"Command: {block.input['command']}")
print(f"Output: {output}")
MCP Alternative: See the MCP section above for a zero-code way to connect Claude Desktop to KlickAnalytics.
OpenAI / ChatGPT AI Agent
Connect KlickAnalytics to GPT-4o and other OpenAI models using Function Calling for automated financial data retrieval.
Method 1 — ChatGPT Custom GPT
- Go to chat.openai.com → Explore GPTs → Create
- In Instructions, add: "When the user asks about stocks or financial data, instruct them to run the appropriate
ka command in their terminal. Provide the exact command."
- You can extend with an Action pointing to the KlickAnalytics REST API for server-side data fetching
Method 2 — OpenAI API Function Calling (Python)
pip install openai
from openai import OpenAI
import subprocess, json
client = OpenAI() # uses OPENAI_API_KEY env var
tools = [{
"type": "function",
"function": {
"name": "run_ka_command",
"description": "Fetch real-time financial data using KlickAnalytics CLI",
"parameters": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The ka command to run, e.g. 'ka quote TSLA' or 'ka prices AAPL -sd 2025-01-01'"
}
},
"required": ["command"]
}
}
}]
def run_ka(command):
result = subprocess.run(command.split(), capture_output=True, text=True, timeout=30)
return result.stdout or result.stderr
messages = [{"role": "user", "content": "Get me AAPL earnings history and current volatility"}]
response = client.chat.completions.create(
model="gpt-4o",
messages=messages,
tools=tools,
tool_choice="auto"
)
# Process tool calls
msg = response.choices[0].message
if msg.tool_calls:
for call in msg.tool_calls:
args = json.loads(call.function.arguments)
output = run_ka(args["command"])
print(f"Ran: {args['command']}")
print(output)
Bash & Shell Script Agents Scripting
The simplest possible agent: a bash script that calls ka, captures the output, and pipes it into an LLM API call via curl. No frameworks, no dependencies beyond the CLI and jq.
Single-command query with curl + OpenAI
#!/bin/bash
# Fetch live data then ask GPT-4o to analyse it
SYMBOL=${1:-AAPL}
DATA=$(ka quote -s "$SYMBOL" -datatype json 2>/dev/null)
PROMPT="Here is the latest quote for $SYMBOL: $DATA
Please give a brief one-paragraph market commentary."
curl -s https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"gpt-4o\",
\"messages\": [{\"role\": \"user\", \"content\": $(echo \"$PROMPT\" | jq -Rs .)}]
}" | jq -r '.choices[0].message.content'
Multi-step pipeline script
#!/bin/bash
# morning_briefing.sh — daily market summary
set -euo pipefail
SYMBOLS=("AAPL" "MSFT" "NVDA" "TSLA" "SPY")
REPORT=""
for SYM in "${SYMBOLS[@]}"; do
DATA=$(ka quote -s "$SYM" -datatype json 2>/dev/null)
REPORT+="$SYM: $DATA\n"
done
# Pipe combined data into Claude via API
curl -s https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"claude-opus-4-6\",
\"max_tokens\": 1024,
\"messages\": [{
\"role\": \"user\",
\"content\": \"Morning briefing data:\n$REPORT\n\nSummarise the market in 3 bullet points.\"
}]
}" | jq -r '.content[0].text'
Cron-scheduled daily briefing
# Add to crontab (crontab -e) — runs at 7:30am weekdays:
30 7 * * 1-5 /path/to/morning_briefing.sh >> /var/log/ka_briefing.log 2>&1
Pipe ka output into Python for analysis
ka earnings -s TSLA -datatype json | python3 -c "
import sys, json
data = json.load(sys.stdin)
beats = sum(1 for r in data if r.get('surprise_pct', 0) > 0)
print(f'Beats: {beats}/{len(data)} quarters')
"
Tip: Always use -datatype json when scripting — it gives you clean, parseable output. Use 2>/dev/null to suppress progress bars in non-interactive scripts.
HTTP-Based Agents REST / API
For server-side agents, cloud functions, or any environment where you cannot install a local CLI, call the KlickAnalytics REST API directly over HTTP. All ka commands have equivalent REST endpoints.
Base URL & Authentication
Base URL: https://api.klickanalytics.com/v1
Auth: X-API-Key: your_ka_api_key_here (header)
Example — Fetch a quote via curl
curl -s -H "X-API-Key: $KLICKANALYTICS_CLI_API_KEY" "https://api.klickanalytics.com/v1/quote?symbol=AAPL"
Python — requests agent
import os, requests
KA_KEY = os.environ["KLICKANALYTICS_CLI_API_KEY"]
BASE = "https://api.klickanalytics.com/v1"
HEADERS = {"X-API-Key": KA_KEY}
def ka_get(endpoint, params=None):
r = requests.get(f"{BASE}/{endpoint}", headers=HEADERS, params=params, timeout=15)
r.raise_for_status()
return r.json()
# Examples
quote = ka_get("quote", {"symbol": "AAPL"})
earnings = ka_get("earnings", {"symbol": "TSLA", "limit": 8})
ta = ka_get("ta", {"symbol": "NVDA"})
screener = ka_get("screener", {"filter": "rsi14 < 35 AND return_1m < -10"})
Node.js / TypeScript agent
const KA_KEY = process.env.KLICKANALYTICS_CLI_API_KEY;
const BASE = "https://api.klickanalytics.com/v1";
async function ka(endpoint: string, params: Record<string, string> = {}) {
const url = new URL(`${BASE}/${endpoint}`);
Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
const res = await fetch(url.toString(), {
headers: { "X-API-Key": KA_KEY! }
});
if (!res.ok) throw new Error(`KA API error: ${res.status}`);
return res.json();
}
// Examples
const quote = await ka("quote", { symbol: "AAPL" });
const earnings = await ka("earnings", { symbol: "TSLA", limit: "8" });
const screener = await ka("screener", { filter: "adx14 > 25 AND rsi14 < 65" });
OpenAI function calling via HTTP (no CLI needed)
import os, requests
from openai import OpenAI
client = OpenAI()
KA_KEY = os.environ["KLICKANALYTICS_CLI_API_KEY"]
KA_BASE = "https://api.klickanalytics.com/v1"
def ka_http(endpoint, **params):
r = requests.get(f"{KA_BASE}/{endpoint}",
headers={"X-API-Key": KA_KEY}, params=params, timeout=15)
return r.json()
tools = [{
"type": "function",
"function": {
"name": "fetch_market_data",
"description": "Fetch financial data from KlickAnalytics REST API",
"parameters": {
"type": "object",
"properties": {
"endpoint": {"type": "string",
"description": "API endpoint: quote, earnings, ta, volatility, quantstats, screener"},
"symbol": {"type": "string", "description": "Stock ticker e.g. AAPL"},
"limit": {"type": "integer","description": "Max rows to return"}
},
"required": ["endpoint"]
}
}
}]
messages = [{"role": "user", "content": "Compare volatility of AAPL and NVDA"}]
response = client.chat.completions.create(model="gpt-4o", messages=messages,
tools=tools, tool_choice="auto")
msg = response.choices[0].message
if msg.tool_calls:
for call in msg.tool_calls:
import json
args = json.loads(call.function.arguments)
data = ka_http(args["endpoint"], **{k: v for k, v in args.items() if k != "endpoint"})
print(data)
Webhook / Cloud Function pattern
# AWS Lambda / Google Cloud Function handler example
import os, requests, json
def handler(event, context):
symbol = event.get("symbol", "SPY")
endpoint = event.get("endpoint", "quote")
r = requests.get(
f"https://api.klickanalytics.com/v1/{endpoint}",
headers={"X-API-Key": os.environ["KLICKANALYTICS_CLI_API_KEY"]},
params={"symbol": symbol},
timeout=15
)
return {"statusCode": 200, "body": json.dumps(r.json())}
Serverless tip: Store your KLICKANALYTICS_CLI_API_KEY in AWS Secrets Manager, GCP Secret Manager, or Vercel environment variables — never hardcode it in your function source.
OpenClaw & ClawHub Skill
ClawHub is a marketplace for AI agent skills. Install the KlickAnalytics skill in seconds — no code, no config — and use it with any OpenClaw-compatible agent.
Quick Setup (3 steps)
Using in OpenClaw
Once installed, your OpenClaw agent has access to all ka commands. Example prompts:
- "Fetch AAPL earnings for the last 4 quarters and identify the trend"
- "Run technical analysis on NVDA and tell me if it's overbought"
- "Get volatility metrics for SPY, QQQ, and IWM side by side"
- "Screen for S&P 500 stocks with positive earnings surprises"
OpenClaw Skill Config (JSON)
{
"skill": "klickanalytics-cli",
"version": "latest",
"config": {
"api_key": "your_api_key_here"
}
}
NemoClaw Agent
NemoClaw is an autonomous agent framework for building financial research pipelines. Connect KlickAnalytics to give your NemoClaw agents access to real-time data for trading research, automated reporting, and multi-step analysis workflows.
Install
pip install nemoclaw klickanalytics-cli
Register as Agent Tool
import subprocess
from nemoclaw import Agent
agent = Agent(name="FinanceAgent")
@agent.tool(description="Fetch real-time financial data from KlickAnalytics CLI")
def fetch_financial_data(command: str) -> str:
"""
Run a ka command and return output.
Examples:
fetch_financial_data('ka quote AAPL')
fetch_financial_data('ka earnings TSLA -limit 8')
fetch_financial_data('ka volatility SPY -datatype json')
"""
result = subprocess.run(
command.split(),
capture_output=True,
text=True,
timeout=30
)
return result.stdout or result.stderr
# Run a multi-step analysis
agent.run("""
Analyse TSLA comprehensively:
1. Get current quote and profile
2. Fetch last 4 earnings with beat/miss
3. Get 30-day volatility and compare to SPY
4. Run technical analysis and summarise signals
Provide a brief investment thesis based on the data.
""")
Automated Pipeline Example
from nemoclaw import Agent, Schedule
agent = Agent(name="DailyBriefing")
@agent.tool(description="Fetch KlickAnalytics data")
def ka(command: str) -> str:
import subprocess
return subprocess.run(command.split(), capture_output=True, text=True).stdout
# Schedule a daily market briefing at 7am
@Schedule.daily(at="07:00")
def morning_briefing():
agent.run("""
Generate a morning market briefing:
- Get quotes for AAPL, MSFT, NVDA, TSLA, SPY
- Identify biggest movers
- Flag any earnings announcements today
- Summarise overnight sentiment
""")
Use Cases
- Automated daily earnings report pipeline
- Morning market briefing agent (scheduled)
- Portfolio risk monitoring & alerts
- Sector rotation screener with weekly reports
- Back-test signal generation with historical price data
- Peer comparison & relative strength ranking
Pro tip: NemoClaw agents can chain multiple ka commands together across a single conversation turn — ideal for complex multi-step research workflows that would otherwise require manual copy-paste between tools.