CLI Tool
Use the official Hedge Layer command-line tool for terminal research, feed screens, scripting, and allocator recommendations.
Install
npm install -g @hedge-layer/cliThe CLI requires Node.js 22 or later.
Quick Start
Create an API token in Settings, authenticate locally, then run Market Briefs or research sessions from your terminal.
# 1. Create an API token at https://hedgelayer.ai/account/settings
# 2. Authenticate the CLI
hl auth login
# 3. Generate a Market Brief
hl brief "US China trade war tariffs"
# 4. Or start an interactive research session
hl researchAuthentication
The CLI uses Hedge Layer API tokens. Tokens are stored locally in ~/.hedgelayer/config.json.
hl auth login # Paste your API token
hl auth status # Check current authentication
hl auth logout # Remove the stored tokenYou can also pass a token inline for CI jobs or scripts:
hl --token hl_abc123... research listBrief
Generate a Market Brief directly from a topic. The AI researches current events, discovers relevant prediction markets, and synthesizes a structured brief with causal reasoning and coverage gaps.
# Generate a brief
hl brief "US China trade war tariffs"
hl brief "hurricane season impact on Florida" --location "US Southeast" --time-horizon "6 months"
# Pipe the brief as JSON
hl --json brief "crypto regulation 2026" | jq '.markets'
# Filter by tags and volume
hl brief "energy policy" --tags "geopolitics,energy" --min-volume 10000| Option | Description |
|---|---|
-l, --location <loc> | Geographic context, such as "Middle East" or "US". |
-t, --time-horizon <h> | Time frame, such as "3 months" or "2026". |
--tags <tags> | Comma-separated focus tags, such as "geopolitics,energy". |
--min-volume <n> | Minimum market volume in USD. |
--max-yes-price <n> | Maximum YES price from 0 to 1. |
Research
Run AI-powered research sessions. Describe a topic or thesis, and the AI researches current events, discovers relevant markets, and turns the result into a Market Brief.
# Start an interactive research session
hl research
# Run a non-interactive JSON brief
hl research run "US election forecasting"
# List past sessions
hl research list
hl research list --status completed
# View or delete a session
hl research show <id>
hl research delete <id>For non-interactive JSON output, use hl research run or hl brief. Both use the same POST /api/brief endpoint.
Feed
Run deterministic screens over active Polymarket markets. This is the same engine used by the in-app feed tool and GET /api/feed.
# LP-style screen: thinner books with meaningful daily rewards
hl feed lp-opportunity
hl --json feed lp-opportunity | jq '.markets[:5]'
# Deep books that are new or long-dated
hl feed liquid-new-or-long
# Custom crypto screen sorted by movement
hl feed --tag crypto --sort-by movement --limit 25
# Candidate screen tuned for allocator recommendations
hl feed liquidity-provider
# Daily discovery: run several feed lenses, de-dupe by slug, and write candidates JSON
hl feed ensemble --limit 25 --output candidates.json
hl --json lp allocator --markets candidates.json | jq '.result.summary'Curated defaults live in the API for lp-opportunity, liquidity-provider, and liquid-new-or-long. CLI flags override those defaults. Use hl feed ensemble for daily discovery across liquid-core, active-volume, movers, new-markets, uncertainty, and LP-quality lenses; it writes a de-duplicated candidate file ready for hl lp allocator --markets.
Allocator
Use hl feed to create a candidate market file, then pass it to hl lp allocator --markets. The allocator returns target capital, quote regimes, failed checks, and split economics. Execution stays outside Hedge Layer.
# Step 1: get candidate markets
hl --json feed liquidity-provider --limit 15 | jq '{ markets: .markets }' > markets.json
# Step 2: ask the allocator for target allocations and quote regimes
hl lp allocator --markets markets.json
hl --json lp allocator --markets markets.json | jq '.result.summary'
# Step 3: execute separately with your own trading workflowKey allocator options include --markets, --allocations, --pnl, --total-holdings, --capital-limit-pct, --per-market-limit-pct, --capital-limit, --per-market-limit, --min-expected-return-daily-pct, --max-inventory-imbalance, --volatility-fill-spike-threshold, --event-no-quote-minutes-before, --event-no-quote-minutes-after, --allocator-min-liquidity, --max-spread, --allocator-min-days-to-end, --max-markets, --paused.
Signal
Use hl signal analyze after a search or Market Brief to ask the signal agent for a true YES probability estimate, the gap versus market pricing, confidence, and key factors. The command calls POST /api/signal/analyze and never places trades.
# Analyze a Polymarket market or event URL
hl signal analyze "https://polymarket.com/event/example-market"
# Include search notes from your own research workflow
hl signal analyze "https://polymarket.com/event/example-market" --context "Recent sources point to a late catalyst."
# Pipe machine-readable output into jq
hl --json signal analyze "https://polymarket.com/event/example-market" | jq '.result.analysis'
# Analyze inline market JSON from a file or stdin
hl signal analyze --market ./market.json
cat market.json | hl signal analyze --market -Wallet
Inspect the MetaMask owner wallet and Polymarket deposit wallet, read available funds, and print deposit instructions from the terminal. Withdrawals are initiated by the CLI, authorized in the browser with the MetaMask owner wallet, relayed from the deposit wallet, then polled by the CLI until the transfer reaches a terminal state.
# Inspect the owner wallet, Polymarket wallet, and available LP funds
hl wallet status
hl wallet balances
hl wallet funds
# Show Polygon deposit instructions
hl wallet deposit
hl wallet deposit --bridge
# Create a browser-signed withdrawal intent
hl wallet withdraw --asset pUSD --amount 10 --to 0x...
hl wallet withdraw --amount 10 --to 0x... --no-open --no-waitWithdrawals currently send pUSD from the Polymarket deposit wallet on Polygon through the configured builder relayer.
Profile
hl profileGlobal Options
| Flag | Description |
|---|---|
--json | Machine-readable JSON output. |
--api-url <url> | Override the API base URL. Defaults to https://hedgelayer.ai. |
--token <token> | Override the locally stored API token. |
--verbose | Show HTTP request and response details. |
--no-color | Disable colored output. |
JSON Output
Every command supports --json for pipe-friendly output.
hl --json research list | jq '.[0].id'