>
COMMANDS Global: GP Symbol: IBM FA
↑↓ Navigate Enter Open Esc Close ` Toggle

Quick Setup Start Here


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:

python --version
pip --version

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 (sets it for your user account; no administrator rights needed): [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
ka quote AAPL
ka help
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 agentic coding tool. It runs in your terminal and can execute shell commands, so once the KlickAnalytics CLI is installed Claude Code can call ka directly — no plugins required.

Install

macOS, Linux or WSL:

curl -fsSL https://claude.ai/install.sh | bash

Windows PowerShell:

irm https://claude.ai/install.ps1 | iex

Then install the KlickAnalytics CLI and set your key as described in Terminal / Command Line:

pip install klickanalytics-cli
Sign in

Run claude and sign in with your Claude account (Pro, Max, Team or Enterprise) or an Anthropic Console account. No Anthropic API key is needed for a subscription sign-in; the only key Claude Code needs from you is KLICKANALYTICS_CLI_API_KEY.

How it works

When you ask a market question, Claude Code runs ka commands with its Bash tool, reads the output and answers. It asks for your permission before running a command it has not been allowed to run yet.

Example prompts (run inside claude)
> 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 technology stocks up more than 5% this month with RSI below 70 > Get quant stats for SPY over the last year and summarise the drawdowns
CLAUDE.md — project 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 market data. Run `ka help` for all commands and `ka help <command>` for one command. ## Common commands - `ka quote -s SYMBOL` Latest quote - `ka prices -s SYMBOL` Historical OHLCV prices - `ka earnings -s SYMBOL` Earnings history, actual vs estimate - `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, e.g. -filter "rsi14 < 30 AND sma50 > sma200" ## Flags - `-sd YYYY-MM-DD` Start date - `-ed YYYY-MM-DD` End date - `-l N` Max rows returned - `-datatype json` JSON output
Tip: claude -p runs a single prompt non-interactively, which is useful in scripts: claude -p "Get the TSLA quote with ka and return just the price". Prefer tools over shell commands? Connect KlickAnalytics as an MCP server instead.

OpenAI Codex CLI Agentic CLI

Codex CLI (codex) is OpenAI's agentic terminal assistant. Like Claude Code it runs shell commands, so it can call ka — once it is allowed to reach the network.

Install
npm install -g @openai/codex

or on macOS: brew install --cask codex. Run codex and choose Sign in with ChatGPT, or sign in with an OpenAI API key.

Allow network access (required)

Codex runs commands in a sandbox that blocks outbound network access by default, and ka needs to reach the KlickAnalytics API. Add this to ~/.codex/config.toml:

[sandbox_workspace_write] network_access = true
Usage
# Interactive session: codex # One-shot, non-interactive (exec is read-only unless you pass --sandbox): codex exec --sandbox workspace-write "Run ka earnings -s TSLA -l 4 and highlight any beats"
AGENTS.md — standing instructions

Codex reads AGENTS.md from your project root, and ~/.codex/AGENTS.md for every project:

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 Latest quote ka earnings -s SYMBOL Earnings history ka ta -s SYMBOL Technical indicators ka quantstats -s SYMBOL Risk & return statistics ka screener -filter "..." Stock screener Run `ka help <command>` to see a command's options. Add `-datatype json` when you need to process the output further.
Alternative: connect KlickAnalytics as an MCP server — MCP tools are not subject to the shell sandbox, so no network setting is needed.

Cursor IDE IDE Integration

Cursor is an AI code editor. Run ka in its integrated terminal alongside your code, or let Cursor's Agent run the commands for you.

Terminal

Open the integrated terminal (Ctrl+`) and run any ka command:

ka quantstats -s TSLA -l 252 ka ta -s NVDA ka screener -filter "return_1m > 5 AND rsi14 < 70 AND sector = Technology"
Agent

Open Agent (Cmd+I on macOS, Ctrl+I on Windows/Linux) and ask a market question. The Agent can run ka in the terminal and reason over the output.

Project rules

Cursor reads AGENTS.md in your project root, or a rule in .cursor/rules/. Create .cursor/rules/klickanalytics.mdc so every Agent session knows the commands:

--- description: Financial data via the KlickAnalytics CLI alwaysApply: true --- The KlickAnalytics CLI is installed and KLICKANALYTICS_CLI_API_KEY is set. When I ask financial questions, run `ka` commands in the terminal. - ka quote -s SYMBOL Latest quote - ka prices -s SYMBOL -l 100 Historical OHLCV - ka earnings -s SYMBOL Earnings history with surprises - ka ta -s SYMBOL Technical indicators - ka quantstats -s SYMBOL Risk & return stats - ka volatility -s SYMBOL Volatility metrics - ka peers -s SYMBOL Comparable companies Flags: -sd YYYY-MM-DD (start), -ed YYYY-MM-DD (end), -l N (rows), -datatype json Run `ka help <command>` for a command's options.
Note: the older .cursorrules file is legacy — use .cursor/rules or AGENTS.md for new projects.

MCP — Model Context Protocol New

MCP is the open standard AI apps use to connect to outside tools. KlickAnalytics runs a hosted MCP server, so any MCP client can search, read and run the same 160+ commands as the CLI — nothing to install on the KlickAnalytics side.

Server details
Server URL: https://api.klickanalytics.com/mcp Transport: Streamable HTTP Auth: Authorization: Bearer your_api_key_here
  • Use your CLI API key from the API Keys page — it is the same key.
  • MCP access is included with paid plans. A key from a free account is refused with an upgrade message.
  • Send the key in the header. Do not put it in the URL, where it ends up in logs and history.
Tools the server exposes
  • search_endpoints — find the right command for a question
  • describe_endpoint — read how a command is used, with examples
  • call_endpoint — run it and return the result (commands that change your account, such as watchlist edits, require confirm)
Claude Code
claude mcp add --transport http --scope user klickanalytics https://api.klickanalytics.com/mcp --header "Authorization: Bearer $KLICKANALYTICS_CLI_API_KEY"

Check the connection with claude mcp list, or /mcp inside Claude Code.

Claude Desktop

Claude Desktop reaches remote servers through the mcp-remote helper, which needs Node.js. Open Settings → Developer → Edit Config and add:

{ "mcpServers": { "klickanalytics": { "command": "npx", "args": [ "mcp-remote", "https://api.klickanalytics.com/mcp", "--header", "Authorization:${AUTH_HEADER}" ], "env": { "AUTH_HEADER": "Bearer your_api_key_here" } } } }
Windows: keep Authorization:${AUTH_HEADER} with no space after the colon. Quit and reopen Claude Desktop after saving.
OpenAI Codex CLI
codex mcp add klickanalytics --url https://api.klickanalytics.com/mcp --bearer-token-env-var KLICKANALYTICS_CLI_API_KEY

Or add it to ~/.codex/config.toml:

[mcp_servers.klickanalytics] url = "https://api.klickanalytics.com/mcp" bearer_token_env_var = "KLICKANALYTICS_CLI_API_KEY"
Claude API and OpenAI API

Both APIs can connect to the server on your app's behalf:

  • Claude API — MCP connector: server URL above, API key in authorization_token.
  • OpenAI Responses API — mcp tool: server URL above, key in headers as Authorization: Bearer …, sent with every request.
What You Can Do via MCP
  • Ask: "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: "Build a correlation matrix for SPY, QQQ, TLT and GLD"
  • Ask: "How risky is SPY? Give me volatility, max drawdown and value at risk"
ChatGPT: developer mode currently connects only to servers that use OAuth or no sign-in, so it cannot send a KlickAnalytics API key. Use Codex or the OpenAI API instead.

Claude by Anthropic AI Agent

There are three ways to give Claude KlickAnalytics data, depending on where you use Claude:

  • In your terminal — Claude Code runs ka commands directly.
  • In the Claude Desktop app — connect the MCP server.
  • In your own application — use the Claude API, either with the MCP connector (see MCP) or with tool use, below.

Claude on claude.ai in the browser cannot run commands on your computer.

Claude API + tool use (Python)

Give Claude a tool that runs ka on your machine. The SDK's tool runner calls the tool whenever Claude asks and feeds the output back until Claude has an answer.

pip install anthropic klickanalytics-cli
import shlex import subprocess import anthropic from anthropic import beta_tool client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY @beta_tool def run_ka(args: str) -> str: """Run a KlickAnalytics CLI command and return its output. Args: args: Everything after "ka", e.g. "quote -s NVDA" or "earnings -s NVDA -l 4". """ # Runs only the ka program, never a shell. result = subprocess.run(["ka", *shlex.split(args)], capture_output=True, text=True, timeout=60) return result.stdout or result.stderr runner = client.beta.messages.tool_runner( model="claude-opus-5", max_tokens=16000, tools=[run_ka], messages=[{ "role": "user", "content": "What is NVDA trading at, and how did it do on its last 4 earnings?", }], ) for message in runner: for block in message.content: if block.type == "text": print(block.text)

OpenAI AI Agent

In the terminal, use Codex CLI. In your own application, use the OpenAI Responses API — either with the KlickAnalytics MCP server or with function calling.

pip install openai klickanalytics-cli
Method 1 — Responses API + MCP server

OpenAI connects to the KlickAnalytics MCP server for you (paid KlickAnalytics plans). OpenAI does not store the key, so send the tool with every request.

import os from openai import OpenAI client = OpenAI() # reads OPENAI_API_KEY response = client.responses.create( model="gpt-6-astra", tools=[{ "type": "mcp", "server_label": "klickanalytics", "server_url": "https://api.klickanalytics.com/mcp", "headers": {"Authorization": "Bearer " + os.environ["KLICKANALYTICS_CLI_API_KEY"]}, "require_approval": "never", }], input="Compare AAPL, MSFT and GOOGL on valuation and one-year return.", ) print(response.output_text)
Method 2 — Responses API + function calling (Python)

Define a function that runs ka locally, then loop until the model stops asking for it:

import json import shlex import subprocess from openai import OpenAI client = OpenAI() # reads OPENAI_API_KEY tools = [{ "type": "function", "name": "run_ka", "description": "Run a KlickAnalytics CLI command and return its output.", "parameters": { "type": "object", "properties": { "args": { "type": "string", "description": 'Everything after "ka", e.g. "quote -s AAPL" or "volatility -s AAPL"', }, }, "required": ["args"], "additionalProperties": False, }, "strict": True, }] def run_ka(args): # Runs only the ka program, never a shell. result = subprocess.run(["ka", *shlex.split(args)], capture_output=True, text=True, timeout=60) return result.stdout or result.stderr response = client.responses.create( model="gpt-6-astra", tools=tools, input="Get AAPL's earnings history and its current volatility.", ) while True: calls = [item for item in response.output if item.type == "function_call"] if not calls: break outputs = [{ "type": "function_call_output", "call_id": call.call_id, "output": run_ka(json.loads(call.arguments)["args"]), } for call in calls] response = client.responses.create( model="gpt-6-astra", tools=tools, previous_response_id=response.id, input=outputs, ) print(response.output_text)

Bash & Shell Script Agents Scripting

The simplest possible agent: a bash script that calls ka, captures the output, and sends it to an LLM API with curl. No frameworks — just the CLI, curl and jq (which builds the JSON safely, whatever the output contains).

One symbol, one commentary (OpenAI)
#!/bin/bash # quote_commentary.sh SYMBOL — fetch a quote, ask for a one-paragraph commentary set -euo pipefail SYMBOL=${1:-AAPL} DATA=$(ka quote -s "$SYMBOL") jq -n --arg sym "$SYMBOL" --arg data "$DATA" '{ model: "gpt-6-astra", input: ("Latest quote for " + $sym + ":\n" + $data + "\n\nWrite a one-paragraph market commentary.") }' | curl -s https://api.openai.com/v1/responses \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d @- \ | jq -r '.output[] | select(.type == "message") | .content[] | select(.type == "output_text") | .text'
Morning briefing (Claude)
#!/bin/bash # morning_briefing.sh — quotes for a watchlist, summarised in three bullets set -euo pipefail REPORT="" for SYM in AAPL MSFT NVDA TSLA SPY; do REPORT+="== $SYM =="$'\n'"$(ka quote -s "$SYM")"$'\n\n' done jq -n --arg report "$REPORT" '{ model: "claude-opus-5", max_tokens: 16000, messages: [{ role: "user", content: ("Morning briefing data:\n\n" + $report + "\nSummarise the market in 3 bullet points.") }] }' | 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 @- \ | jq -r '.content[] | select(.type == "text") | .text'
Schedule it with cron

cron does not load your shell profile, so set the keys at the top of the crontab (crontab -e):

KLICKANALYTICS_CLI_API_KEY=your_ka_key_here ANTHROPIC_API_KEY=your_anthropic_key_here # 7:30am on weekdays: 30 7 * * 1-5 /path/to/morning_briefing.sh >> /var/log/ka_briefing.log 2>&1
JSON output for scripts

Add -datatype json to a command and pipe it into jq or Python:

ka quote -s AAPL -datatype json | jq . ka prices -s TSLA -l 30 -datatype json | python3 -m json.tool
Tip: when a command fails, ka writes the error to stderr and exits with a non-zero code — so set -e stops a script at the first failed command instead of sending an error message to the model.

HTTP-Based Agents REST / API

Where you cannot install the CLI — serverless functions, cloud workers, other languages — call the same API the CLI uses. Every ka command works: send the command text, get its output back.

Endpoint & authentication
Endpoint: POST https://api.klickanalytics.com/cli Header: KLICKANALYTICS-CLI-API-KEY: your_ka_api_key_here Body: {"raw": "quote -s AAPL"} # any ka command, without the leading "ka" Response: {"ok": true, "stdout": "...", "stderr": "", "exit_code": 0, "data": ...}

The command's output is in stdout. On an error — missing or invalid key, unknown command, bad arguments — ok is false and stderr says why.

Example — curl
curl -s -X POST https://api.klickanalytics.com/cli -H "KLICKANALYTICS-CLI-API-KEY: $KLICKANALYTICS_CLI_API_KEY" -H "Content-Type: application/json" -d "{\"raw\": \"quote -s AAPL\"}"
Python — requests
import os import requests KA_URL = "https://api.klickanalytics.com/cli" KA_KEY = os.environ["KLICKANALYTICS_CLI_API_KEY"] def ka(command): r = requests.post(KA_URL, headers={"KLICKANALYTICS-CLI-API-KEY": KA_KEY}, json={"raw": command}, timeout=60) body = r.json() if r.status_code != 200 or body.get("ok") is False: raise RuntimeError(body.get("stderr") or f"HTTP {r.status_code}") return body print(ka("quote -s AAPL")["stdout"]) print(ka("earnings -s TSLA -l 8")["stdout"]) print(ka('screener -filter "rsi14 < 30 AND sma50 > sma200"')["stdout"])
Node.js (18+)
const KA_URL = "https://api.klickanalytics.com/cli"; async function ka(command) { const res = await fetch(KA_URL, { method: "POST", headers: { "Content-Type": "application/json", "KLICKANALYTICS-CLI-API-KEY": process.env.KLICKANALYTICS_CLI_API_KEY, }, body: JSON.stringify({ raw: command }), }); const body = await res.json(); if (!res.ok || body.ok === false) { throw new Error(body.stderr || `HTTP ${res.status}`); } return body; } const quote = await ka("quote -s AAPL"); console.log(quote.stdout);
AWS Lambda / cloud function
import json import os import urllib.request def handler(event, context): command = event.get("command", "quote -s SPY") req = urllib.request.Request( "https://api.klickanalytics.com/cli", data=json.dumps({"raw": command}).encode(), headers={ "Content-Type": "application/json", "KLICKANALYTICS-CLI-API-KEY": os.environ["KLICKANALYTICS_CLI_API_KEY"], }, method="POST", ) with urllib.request.urlopen(req, timeout=60) as resp: return {"statusCode": 200, "body": resp.read().decode()}
Keys: store KLICKANALYTICS_CLI_API_KEY in your platform's secret store (AWS Secrets Manager, GCP Secret Manager, Vercel environment variables) — never in function source or in a browser app, where anyone could read it.

OpenClaw & ClawHub Skill

OpenClaw is an open-source AI agent, and ClawHub is its skill registry. The KlickAnalytics skill teaches an OpenClaw agent the ka commands: klickanalytics-cli on ClawHub.

Step 1 — Install the CLI on the machine running OpenClaw
pip install klickanalytics-cli
Step 2 — Install the skill
openclaw skills install @klickanalytics/klickanalytics-cli

Add --global to make it available to all your agents.

Step 3 — Add your API key

In ~/.openclaw/openclaw.json, add the key under the skill's entry (merge it into your existing skills section if you have one):

{ "skills": { "entries": { "klickanalytics-cli": { "enabled": true, "env": { "KLICKANALYTICS_CLI_API_KEY": "your_api_key_here" } } } } }
Using it

Your OpenClaw agent can now run 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"
  • "Build a correlation matrix for SPY, TLT and GLD"

NemoClaw Agent

NemoClaw is NVIDIA's open-source stack for running OpenClaw agents inside secure OpenShell sandboxes, with policies for network, filesystem and process access. The KlickAnalytics skill works the same way as in OpenClaw, with one extra step: the sandbox must be allowed to reach the KlickAnalytics API.

Step 1 — Install NemoClaw and create an agent
curl -fsSL https://www.nvidia.com/nemoclaw.sh | bash

Then run nemoclaw onboard and follow the prompts.

Step 2 — Install the KlickAnalytics skill in the sandbox

Download the skill from ClawHub, then install that folder into your agent's sandbox:

npm install -g clawhub clawhub install @klickanalytics/klickanalytics-cli nemoclaw <agent-name> skill install ./skills/klickanalytics-cli
Step 3 — Allow network access to KlickAnalytics

Sandboxes block outbound connections by default. Allow api.klickanalytics.com on port 443 with a custom policy preset (nemoclaw <agent-name> policy add --from-file <preset>.yaml), or approve the blocked request in the OpenShell terminal UI when the agent first runs ka. See NVIDIA's guide to network policies for the preset format.

Step 4 — Provide your API key

The ka command inside the sandbox reads KLICKANALYTICS_CLI_API_KEY. Supply it through NemoClaw's credential settings rather than writing it into the skill folder.

Use cases
  • Morning market briefing on a schedule
  • Earnings season monitoring for a watchlist
  • Portfolio risk checks with alerts
  • Peer comparison & relative strength ranking

Market News ×
Loading news…