Skip to main content

CLI

Use fcontext from your terminal to query Financial Context market data, inspect authentication, and produce JSON output for scripts or agents. The CLI talks to Financial Context by default:
https://fcontext.com
Commands call read-only market-data endpoints under /api/market-data/*. The current CLI focuses on US stock data: symbols must use the CODE.US format, and market filters must be US.

Install

Install from the latest GitHub release:
curl -fsSL https://raw.githubusercontent.com/aitaport/fcontext-terminal/main/install | sh
The installer downloads the matching release archive, verifies the .sha256 checksum, and places fcontext in /usr/local/bin.
If a release installer cannot find a published release yet, use the source build flow.

Authenticate

Create an API key in Financial Context account settings, then export it:
export FCONTEXT_API_KEY="YOUR_FINANCIAL_CONTEXT_API_KEY"
Approved OAuth clients can use an access token instead:
export FCONTEXT_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"
For staging or local testing, override the base URL:
export FCONTEXT_BASE_URL="https://staging.fcontext.com"
Check your configuration:
fcontext auth status
fcontext check

First Commands

# Realtime quotes
fcontext quote AAPL.US MSFT.US

# JSON output for scripts and agents
fcontext quote AAPL.US MSFT.US --format json

# Static instrument information
fcontext static AAPL.US MSFT.US

# Daily candles
fcontext kline AAPL.US --period day --count 100

# Historical candles by date range
fcontext kline history AAPL.US --start 2024-01-01 --end 2024-12-31

Market Data

fcontext market-status
fcontext top-movers --market US --sort hot --count 20
fcontext market-temp US
fcontext market-temp US --history --start 2024-01-01 --end 2024-12-31
fcontext trading session
fcontext trading days US --start 2026-01-01 --end 2026-01-31
fcontext security-list US
The fear-greed command fetches CNN’s public Fear & Greed Index data directly and does not require Financial Context credentials:
fcontext fear-greed
fcontext fear-greed --history-count 90 --indicator-history-count 10 --format json

Company Data

fcontext company AAPL.US
fcontext fundamental-compare AAPL.US
fcontext compare AAPL.US MSFT.US NVDA.US --currency USD
fcontext consensus AAPL.US
fcontext dividend AAPL.US
fcontext forecast-eps AAPL.US
fcontext insider-trades AAPL.US --count 20
fcontext institution-rating AAPL.US
fcontext institution-rating detail AAPL.US
fcontext operating AAPL.US
fcontext shareholder AAPL.US
fcontext shareholder AAPL.US --top --periods 4
fcontext valuation AAPL.US
fcontext valuation AAPL.US --history

News And Events

fcontext news AAPL.US
fcontext filing AAPL.US
fcontext topic AAPL.US
fcontext finance-calendar report --market US
fcontext finance-calendar dividend --market US

Trading Activity

fcontext trades AAPL.US --count 50
fcontext trade-stats AAPL.US
fcontext short-positions AAPL.US
fcontext short-trades AAPL.US

Screeners

fcontext screener strategies --market US
fcontext screener mine --market US
fcontext screener strategy 19
fcontext screener run 19 --count 20
fcontext screener filter pettm:10:50 roe:5: --market US
fcontext screener indicators

Direct Endpoint Access

Use api get when you need a supported read-only endpoint before a dedicated command exists:
fcontext api get /api/market-data/market/status --format json
The CLI rejects absolute URLs, streaming endpoints, non-US market filters, and unsupported account or trading paths before sending a request.

Output For Agents

Every command supports JSON output:
fcontext company AAPL.US --format json
Use --schema to print a machine-readable response schema without authenticating:
fcontext company --schema
fcontext quote --schema
Generate shell completions:
fcontext completion zsh > ~/.zfunc/_fcontext
fcontext completion bash > ~/.local/share/bash-completion/completions/fcontext
fcontext completion fish > ~/.config/fish/completions/fcontext.fish

Troubleshooting

ProblemWhat to check
Missing fcontext credentialsSet FCONTEXT_API_KEY or FCONTEXT_ACCESS_TOKEN.
fcontext API error (401)Confirm the key or token is active and was copied without extra whitespace.
Non-US symbol rejectedUse symbols such as AAPL.US; non-US markets are intentionally not exposed by the CLI.
Need stagingSet FCONTEXT_BASE_URL=https://staging.fcontext.com.
Need request detailsAdd --verbose to print the request URL and elapsed time to stderr.