Openfish CLI
Install
Section titled “Install”Homebrew (macOS / Linux)
Section titled “Homebrew (macOS / Linux)”brew tap Openfish/openfish-cli https://github.com/Openfish/openfish-clibrew install openfishShell script (one-liner)
Section titled “Shell script (one-liner)”curl -sSL https://raw.githubusercontent.com/Openfish/openfish-cli/main/install.sh | shBuild from source
Section titled “Build from source”Requires Rust 1.88+.
git clone https://github.com/Openfish/openfish-clicd openfish-clicargo install --path .Update
Section titled “Update”openfish upgrade# orbrew upgrade openfishVerify installation
Section titled “Verify installation”openfish --version # prints versionopenfish status # checks API connectivityFirst-Time Setup
Section titled “First-Time Setup”The guided setup wizard handles wallet creation and contract approvals in one step:
openfish setupOr do it manually:
# 1. Create or import a walletopenfish wallet create# oropenfish wallet import 0xYOUR_PRIVATE_KEY
# 2. Approve Openfish contracts (needs MATIC for gas)openfish approve set
# 3. Check your balanceopenfish clob balance --asset-type collateralConfiguration
Section titled “Configuration”Private Key
Section titled “Private Key”The CLI looks for your private key in this order:
--private-key 0x...flagOPENFISH_PRIVATE_KEYenvironment variable- Config file at
~/.config/openfish/config.json
Config file format:
{ "private_key": "0x...", "chain_id": 137, "signature_type": "proxy"}Security: Never commit your private key to source control. Use environment variables or the config file. The config file is created with
600permissions.
Signature Types
Section titled “Signature Types”| Type | Description | Gas |
|---|---|---|
proxy (default) | Openfish proxy wallet | Gasless (relayer pays) |
eoa | Direct wallet signing | You pay gas in MATIC |
gnosis-safe | Gnosis Safe multisig | Gasless (relayer pays) |
Override per-command: --signature-type eoa or OPENFISH_SIGNATURE_TYPE=eoa.
What Needs a Wallet
Section titled “What Needs a Wallet”Most read operations work without a wallet:
| No wallet needed | Wallet required |
|---|---|
| Browse markets | Place/cancel orders |
| View order books | Check your balances |
| Check prices | On-chain operations (approve, split, merge, redeem) |
| View leaderboards | API key management |
| Search events | Bridge operations |
Output Formats
Section titled “Output Formats”Every command supports two output modes:
# Human-readable table (default)openfish markets list --limit 3
# Machine-readable JSON (for scripts and integrations)openfish -o json markets list --limit 3Short form: -o json or --output json.
Errors follow the same pattern: table mode prints Error: ... to stderr, JSON mode prints {"error": "..."} to stdout. Non-zero exit code in both cases.
Browsing Markets
Section titled “Browsing Markets”List and search
Section titled “List and search”# Browse active marketsopenfish markets list --limit 10openfish markets list --active true --order volume_num
# Search by keywordopenfish markets search "bitcoin" --limit 5
# Get market detailsopenfish markets get will-trump-win-the-2024-electionopenfish markets get 12345Events
Section titled “Events”Events group related markets (e.g., “2024 Election” contains multiple yes/no markets).
openfish events list --limit 10openfish events list --tag politics --active trueopenfish events get 500Tags and series
Section titled “Tags and series”openfish tags listopenfish tags get politicsopenfish series list --limit 10Order Book & Prices
Section titled “Order Book & Prices”All read-only, no wallet needed.
# Single tokenopenfish clob price <token_id> --side buyopenfish clob midpoint <token_id>openfish clob spread <token_id>openfish clob book <token_id>
# Batch (comma-separated)openfish clob batch-prices "TOKEN1,TOKEN2" --side buyopenfish clob midpoints "TOKEN1,TOKEN2"openfish clob books "TOKEN1,TOKEN2"
# Price historyopenfish clob price-history <token_id> --interval 1d --fidelity 30Intervals: 1m, 1h, 6h, 1d, 1w, max
Trading
Section titled “Trading”Requires a configured wallet.
Place orders
Section titled “Place orders”# Limit order: buy 10 shares at $0.50openfish clob create-order \ --token <token_id> \ --side buy --price 0.50 --size 10
# Market order: buy $5 worthopenfish clob market-order \ --token <token_id> \ --side buy --amount 5
# Batch ordersopenfish clob post-orders \ --tokens "TOKEN1,TOKEN2" \ --side buy \ --prices "0.40,0.60" \ --sizes "10,10"Order types: GTC (default, Good Till Cancelled), FOK (Fill Or Kill), GTD (Good Till Date), FAK (Fill And Kill). Add --post-only for limit orders that should only add liquidity.
Cancel orders
Section titled “Cancel orders”openfish clob cancel <order_id>openfish clob cancel-orders "ORDER1,ORDER2"openfish clob cancel-market --market <condition_id>openfish clob cancel-allView your activity
Section titled “View your activity”openfish clob ordersopenfish clob orders --market <condition_id>openfish clob order <order_id>openfish clob tradesCheck balances
Section titled “Check balances”openfish clob balance --asset-type collateralopenfish clob balance --asset-type conditional --token <token_id>CTF Operations
Section titled “CTF Operations”Split, merge, and redeem conditional tokens on-chain. Requires MATIC for gas.
# Split $10 USDC into YES + NO tokensopenfish ctf split --condition <condition_id> --amount 10
# Merge YES + NO tokens back to USDCopenfish ctf merge --condition <condition_id> --amount 10
# Redeem winning tokens after market resolutionopenfish ctf redeem --condition <condition_id>--amount is in USDC (e.g., 10 = $10.00).
Contract Approvals
Section titled “Contract Approvals”Before trading, Openfish contracts need ERC-20 (USDC) and ERC-1155 (CTF) token approvals.
# Check current approval statusopenfish approve check
# Approve all contracts (sends 6 on-chain transactions)openfish approve setPortfolio & On-Chain Data
Section titled “Portfolio & On-Chain Data”Public data, no wallet needed.
# Your positionsopenfish data positions <wallet_address>openfish data closed-positions <wallet_address>openfish data value <wallet_address>
# Trade historyopenfish data trades <wallet_address> --limit 50
# Market analyticsopenfish data holders <condition_id>openfish data open-interest <condition_id>
# Leaderboardsopenfish data leaderboard --period month --order-by pnl --limit 10API Key Management
Section titled “API Key Management”openfish clob api-keys # List your API keysopenfish clob create-api-key # Generate a new keyopenfish clob delete-api-key # Revoke an existing keyBridge
Section titled “Bridge”Move assets between Openfish and other chains.
openfish bridge deposit <wallet_address> # Get deposit addressesopenfish bridge supported-assets # List supported chains/tokensopenfish bridge status <deposit_address> # Check deposit statusWallet Management
Section titled “Wallet Management”openfish wallet create # Generate new walletopenfish wallet import <key> # Import existing private keyopenfish wallet address # Print wallet addressopenfish wallet show # Full wallet infoopenfish wallet reset # Delete config (prompts confirmation)Interactive Shell
Section titled “Interactive Shell”Launch a REPL for quick exploration:
openfish shellopenfish> markets list --limit 3openfish> clob book <token_id>openfish> exitAll commands work the same as the CLI, just without the openfish prefix. Supports command history.
Scripting Examples
Section titled “Scripting Examples”Fetch market prices as JSON
Section titled “Fetch market prices as JSON”openfish -o json markets list --limit 100 | jq '.[].question'Check a price programmatically
Section titled “Check a price programmatically”openfish -o json clob midpoint <token_id> | jq '.mid'Error handling in scripts
Section titled “Error handling in scripts”if ! result=$(openfish -o json clob balance --asset-type collateral 2>/dev/null); then echo "Failed to fetch balance" exit 1fiecho "Balance: $(echo $result | jq '.balance')"Monitor and trade loop
Section titled “Monitor and trade loop”while true; do price=$(openfish -o json clob midpoint $TOKEN | jq -r '.mid') if (( $(echo "$price < 0.30" | bc -l) )); then openfish clob market-order --token $TOKEN --side buy --amount 10 echo "Bought at $price" fi sleep 60doneCommon Workflows
Section titled “Common Workflows”Research a market
Section titled “Research a market”openfish markets search "bitcoin" --limit 5openfish markets get bitcoin-above-100kopenfish clob book <token_id>openfish clob price-history <token_id> --interval 1dNew wallet to first trade
Section titled “New wallet to first trade”openfish wallet createopenfish approve set # needs MATIC for gasopenfish clob balance --asset-type collateralopenfish clob market-order --token <token_id> --side buy --amount 5Monitor portfolio
Section titled “Monitor portfolio”openfish data positions <your_address>openfish data value <your_address>openfish clob ordersopenfish clob tradesTroubleshooting
Section titled “Troubleshooting”| Problem | Solution |
|---|---|
Error: no private key configured | Run openfish wallet create or set OPENFISH_PRIVATE_KEY |
Error: insufficient allowance | Run openfish approve set |
Error: insufficient balance | Deposit USDC.e to your Polygon wallet |
Error: connection refused | Check openfish status, API may be down |
Error: insufficient gas | Send MATIC to your wallet for on-chain operations |
| Command not found | Verify installation with which openfish |