### Run Polymarket CLI Setup Wizard Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Launches an interactive wizard for first-time setup. Guides users through wallet creation/import, contract approval checks, and setting up necessary approvals. ```bash polymarket setup ``` -------------------------------- ### Example Shell Commands Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/modules-core.md Demonstrates how to use the interactive shell to list markets, get CLOB prices, and exit. ```bash polymarket shell # polymarket> markets list --limit 5 # polymarket> clob price TOKEN_ID --side buy # polymarket> exit ``` -------------------------------- ### Set up Wallet for Trading Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Initiate wallet setup for trading, either through the interactive 'setup' command or by manually creating/importing a wallet. ```bash polymarket setup # Or manually: polymarket wallet create polymarket approve set ``` -------------------------------- ### Install Polymarket CLI via Shell Script Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Download and execute the installation script from GitHub to install the CLI. ```bash curl -sSL https://raw.githubusercontent.com/Polymarket/polymarket-cli/main/install.sh | sh ``` -------------------------------- ### Install Polymarket CLI via Homebrew Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Use Homebrew to tap the Polymarket repository and install the CLI on macOS or Linux. ```bash brew tap Polymarket/polymarket-cli https://github.com/Polymarket/polymarket-cli brew install polymarket ``` -------------------------------- ### Split Arguments Example Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/modules-core.md Shows an example of using the `split_args` function to parse a command with a quoted argument. ```rust let args = split_args("markets get \"will trump win\""); // ["markets", "get", "will trump win"] ``` -------------------------------- ### Build Polymarket CLI from Source Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Clone the repository, navigate to the directory, and install the CLI using Cargo. ```bash git clone https://github.com/Polymarket/polymarket-cli cd polymarket-cli cargo install --path . ``` -------------------------------- ### Market Tags Response Example Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-markets.md Example of the JSON response when fetching tags for a market. Each tag includes an ID, label, and slug. ```json [ { "id": "123", "label": "Politics", "slug": "politics" } ] ``` -------------------------------- ### Get Config File Path Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/modules-core.md Returns the standard path for the Polymarket configuration file. ```rust pub fn config_path() -> Result ``` -------------------------------- ### Hash Parsing Example Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/types-and-errors.md Condition IDs and hashes can be provided with or without the '0x' prefix. ```bash polymarket ctf split --condition 0xABC123... polymarket ctf split --condition ABC123... ``` -------------------------------- ### Address Parsing Example Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/types-and-errors.md The CLI accepts Ethereum addresses with or without the '0x' prefix and is case-insensitive. Addresses are internally normalized. ```bash polymarket data positions 0xf5E6d3D1f5b5c6f7e8f9a0b1c2d3e4f5a6b7c8d9 polymarket data positions f5E6d3D1f5b5c6f7e8f9a0b1c2d3e4f5a6b7c8d9 ``` -------------------------------- ### Get Market Details Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Retrieve detailed information for a specific market using its ID. Use this command to get single market details. ```bash polymarket markets get ``` -------------------------------- ### Utility Commands Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Provides utility commands for checking API status, running the setup wizard, updating the CLI, and accessing version or help information. ```bash polymarket status # API health check polymarket setup # Guided first-time setup wizard polymarket upgrade # Update to the latest version polymarket --version polymarket --help ``` -------------------------------- ### Polymarket CLI Global Flag Examples Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/configuration.md Demonstrates how to use global flags for output format, private key, and signature type with various Polymarket CLI commands. ```bash polymarket -o json markets list --limit 5 ``` ```bash polymarket --private-key 0x123abc... clob balance --asset-type collateral ``` ```bash polymarket --signature-type eoa approve set ``` ```bash polymarket -o json --private-key 0x123abc... --signature-type gnosis-safe clob create-order ... ``` -------------------------------- ### Start Interactive Shell Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/modules-core.md Initiates the interactive shell loop for the Polymarket CLI. Reads commands from stdin and executes them. ```rust pub async fn run_shell() -> anyhow::Result<()> ``` -------------------------------- ### Get a Specific Tag Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve details for a specific tag. ```bash polymarket tags get politics ``` -------------------------------- ### Get JSON Output for Scripts Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Use the '-o json' flag to get market data in JSON format, suitable for scripting and automation. ```bash polymarket -o json markets list --limit 3 ``` -------------------------------- ### Complete Trading Workflow with Polymarket CLI Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md This workflow demonstrates a full trading cycle using the Polymarket CLI. It covers wallet setup, balance checks, market discovery, price viewing, order book inspection, order placement, and reviewing orders, trades, and positions. Ensure your wallet is set up and approved before proceeding. ```bash # 1. Set up wallet (first time only) polymarket wallet create polymarket approve set ``` ```bash # 2. Check your balance polymarket clob balance --asset-type collateral ``` ```bash # 3. Find a market polymarket markets search "bitcoin" --limit 5 ``` ```bash # 4. Check current price polymarket clob price 48331043336612883 --side buy ``` ```bash # 5. View order book polymarket clob book 48331043336612883 ``` ```bash # 6. Place a limit order polymarket clob create-order \ --token 48331043336612883 \ --side buy \ --price 0.50 \ --size 10 ``` ```bash # 7. Check your orders polymarket clob orders ``` ```bash # 8. Check trades polymarket clob trades ``` ```bash # 9. View positions polymarket data positions 0x ``` -------------------------------- ### Polymarket CLI Configuration File Example Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/overview.md This JSON structure represents the configuration file for the Polymarket CLI, specifying private key, chain ID, and signature type. ```json { "private_key": "0x...", "chain_id": 137, "signature_type": "proxy" } ``` -------------------------------- ### Amount Conversion Example Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/types-and-errors.md Amounts are specified in pUSD (USD value) and are internally scaled by the token's decimals. For example, $10 is converted to 10,000,000 for on-chain operations if the token has 6 decimals. ```bash # User specifies $10 polymarket ctf split --amount 10 # Converted to 10 * 10^6 = 10,000,000 for on-chain operation ``` -------------------------------- ### Get Builder Leaderboard Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Fetches the leaderboard for market builders. Supports filtering by 'day', 'week', or 'month' periods and limiting results. ```bash polymarket data builder-leaderboard --period week ``` -------------------------------- ### Trade Object Structure Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-trading.md Example structure of a Trade object returned by the trades command. ```json [ { "tradeId": "TRADE123", "orderId": "ORDER123", "tokenId": "48331043336612883", "side": "buy", "price": "0.50", "size": "10.00", "feeAmount": "0.05", "timestamp": "2024-01-15T10:30:00Z" } ] ``` -------------------------------- ### Get CLOB Prices Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Query the CLOB for the price of a token for a specific side (buy or sell). ```bash polymarket clob price 48331043336612883... --side buy ``` -------------------------------- ### Place Market Order Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Place a market order to buy or sell a token at the current market price, specifying the amount. Requires wallet setup and contract approval. ```bash polymarket clob market-order --token --side buy --amount 5 ``` -------------------------------- ### JSON Output for Market Data Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-markets.md To get machine-readable JSON output, use the `-o json` flag with the `markets list` command. This is useful for scripting and further processing, for example, extracting specific fields like the market question using `jq`. ```bash polymarket -o json markets list --limit 5 | jq '.[].question' ``` -------------------------------- ### Set Up Wallet and Initiate Trading Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Commands for creating a new wallet, approving token spending (requires MATIC for gas), and checking collateral balance before placing orders. ```bash polymarket wallet create ``` ```bash polymarket approve set # needs MATIC for gas ``` ```bash polymarket clob balance --asset-type collateral ``` ```bash polymarket clob market-order --token TOKEN_ID --side buy --amount 5 ``` -------------------------------- ### Get Open Interest for a Market Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Fetches the open interest data for a specified market condition ID. Supports pagination. ```bash polymarket data open-interest [OPTIONS] ``` ```bash polymarket data open-interest 0xABC123... ``` -------------------------------- ### Place Limit Order Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Place a limit order to buy or sell a token at a specified price and size. Requires wallet setup and contract approval. ```bash polymarket clob create-order --token --side buy --price 0.50 --size 10 ``` -------------------------------- ### Get Total USD Value of Positions Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Calculates and returns the total USD value of all positions held by a wallet address. ```bash polymarket data value
``` ```bash polymarket data value 0xf5E6... ``` -------------------------------- ### Get Open Positions for a Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves a list of open positions for a specified wallet address. Supports pagination with limit and offset parameters. ```bash polymarket data positions
[OPTIONS] ``` ```bash polymarket data positions 0xf5E6... ``` ```bash polymarket data positions 0xf5E6... --limit 50 ``` -------------------------------- ### Get Currently Active Reward Programs Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md List all reward programs that are currently active. Provides details such as program name, status, and eligibility criteria. ```bash polymarket clob current-rewards ``` -------------------------------- ### Get Builder Volume Data Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves market volume data for builders. Allows filtering by 'day', 'week', or 'month' and setting a maximum number of results. ```bash polymarket data builder-volume --period month ``` -------------------------------- ### Fetch and Parse CLOB Order Book Data Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-clob.md Example of fetching a token's order book and using `jq` to extract specific information, such as the first bid entry. This is useful for scripting and automation. ```bash polymarket clob book 48331043336612883 polymarket -o json clob book 48331043336612883 | jq '.bids[0]' ``` -------------------------------- ### Get Clob Price Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Get the current price for a token ID, specifying the side (buy or sell). Use this command to check market prices. ```bash polymarket clob price --side buy ``` -------------------------------- ### Place a Market Order Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-trading.md Use this command to place a market order, buying or selling a token at the current market price. Ensure you provide the token ID, side (buy/sell), and amount. Market orders execute at the best available price and may fill partially or fail if liquidity is insufficient. ```bash polymarket clob market-order --token --side --amount ``` ```bash polymarket clob market-order --token 48331043336612883 --side buy --amount 5 ``` ```bash polymarket clob market-order --token 48331043336612883 --side sell --amount 100 ``` -------------------------------- ### Import an Existing Wallet Key Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Import a pre-existing private key into the CLI's configuration. Replace '0xabc123...' with your actual key. ```bash polymarket wallet import 0xabc123... ``` -------------------------------- ### Get Batch Token Prices Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-clob.md Query prices for multiple tokens simultaneously using a comma-separated list of token IDs. Specify the desired side for the price query. ```bash polymarket clob batch-prices "TOKEN1,TOKEN2,TOKEN3" --side buy ``` -------------------------------- ### Get Current Reward Rates Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieve the current reward rates or percentages. These rates can vary based on market, liquidity tier, and other factors. ```bash polymarket clob reward-percentages ``` -------------------------------- ### Get Last Trade Prices for Multiple Tokens Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-clob.md Fetch the last trade prices for a comma-separated list of token IDs. Use this to efficiently get recent trade data for several assets simultaneously. ```bash polymarket clob last-trades "TOKEN1,TOKEN2,TOKEN3" ``` -------------------------------- ### List Markets with Filters Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Demonstrates various ways to filter and sort market listings using flags like `--active`, `--closed`, `--limit`, and `--order`. ```bash polymarket markets list --limit 10 ``` ```bash polymarket markets list --active true --order volume_num ``` ```bash polymarket markets list --closed false --limit 50 --offset 25 ``` -------------------------------- ### Get CLOB Order Books for Multiple Tokens Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-clob.md Use this command to fetch the order books for multiple tokens simultaneously by providing a comma-separated list of token IDs. This is efficient for batch processing. ```bash polymarket clob books "TOKEN1,TOKEN2" ``` -------------------------------- ### Get a Single Series Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve details for a specific series by its ID. ```bash polymarket series get 42 ``` -------------------------------- ### Get User Profile Command Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Fetches a user's public profile information, including display name, avatar, and bio. Requires the user's address as a parameter. ```bash polymarket profiles get
``` ```bash polymarket profiles get 0xf5E6... ``` -------------------------------- ### Get Related Tags Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Find tags that are related to a given tag. ```bash polymarket tags related politics ``` ```bash polymarket tags related-tags politics ``` -------------------------------- ### Scripting with JSON Output and Error Handling Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Utilize the '-o json' flag to pipe command output to tools like 'jq' for programmatic analysis. Includes an example of checking command success in scripts. ```bash # Pipe market data to jq polymarket -o json markets list --limit 100 | jq '.[].question' ``` ```bash # Check prices programmatically polymarket -o json clob midpoint TOKEN_ID | jq '.mid' ``` ```bash # Error handling in scripts if ! result=$(polymarket -o json clob balance --asset-type collateral 2>/dev/null); then echo "Failed to fetch balance" fi ``` -------------------------------- ### Load Configuration Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/modules-core.md Loads the configuration from the default path. Returns `Ok(None)` if the file does not exist, or `Err` if parsing fails. ```rust pub fn load_config() -> Result> ``` ```rust let config = load_config()?; if let Some(cfg) = config { println!("Key: {}", cfg.private_key); } ``` -------------------------------- ### Get a Single Event Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve details for a specific event by its ID. ```bash polymarket events get 500 ``` -------------------------------- ### Series Get Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves a single series template by its unique ID. ```APIDOC ## Series Get ### Description Get a single series by ID. ### Method GET (implied) ### Endpoint /series/get/{id} ### Parameters #### Path Parameters - **id** (string) - Required - Series ID ### Returns Single Series object. ### Examples ```bash polymarket series get 42 ``` ``` -------------------------------- ### load_config() Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/modules-core.md Loads configuration from `~/.config/polymarket/config.json`. Returns `Ok(None)` if the file does not exist, and `Err` if the file exists but cannot be parsed. ```APIDOC ## load_config() ### Description Loads configuration from `~/.config/polymarket/config.json`. Returns `Ok(None)` if the file does not exist, and `Err` if the file exists but cannot be parsed. ### Returns - `Result>`: An optional `Config` object if the file exists and is valid, otherwise `None` or an error. ### Example ```rust let config = load_config()?; if let Some(cfg) = config { println!("Key: {}", cfg.private_key); } ``` ``` -------------------------------- ### Get Order Details Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-trading.md Retrieve detailed information for a specific order using its ID. Optional parameters allow overriding the private key and signature type. ```bash polymarket clob order ``` ```bash polymarket clob order ORDER123 ``` -------------------------------- ### Browse Markets with Polymarket CLI Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Quickly list, search, and view market details without needing a wallet. Useful for immediate exploration. ```bash # No wallet needed — browse markets immediately polymarket markets list --limit 5 polymarket markets search "election" polymarket events list --tag politics # Check a specific market polymarket markets get will-trump-win-the-2024-election ``` -------------------------------- ### Get Reward Percentages Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieves the current reward rates or percentages. ```APIDOC ## GET /clob/reward-percentages ### Description Get current reward rates/percentages. ### Method GET ### Endpoint /clob/reward-percentages ### Response #### Success Response (200) - **reward_rates** (array) - Array of reward rates (e.g., "0.02" for 2%). ``` -------------------------------- ### Get Public Profile Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve a public profile associated with a given address. ```bash polymarket profiles get 0xf5E6... ``` -------------------------------- ### Create CLOB Order with Decimal Price and Size Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Place a CLOB order specifying a decimal price and size. ```bash polymarket clob create-order ... --price 0.50 --size 10.5 ``` -------------------------------- ### Launch Polymarket CLI Interactive Shell Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Starts an interactive Read-Eval-Print Loop (REPL) for executing Polymarket commands without the 'polymarket' prefix. Supports command history and provides an 'exit' or 'help' command. ```bash polymarket shell ``` ```bash # polymarket> markets list --limit 5 # polymarket> clob midpoint TOKEN_ID # polymarket> exit ``` -------------------------------- ### List Markets with Filtering and Pagination Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-markets.md Use the `markets list` command to retrieve market data. Options include filtering by active or closed status, setting a limit for results, specifying a pagination offset, and ordering by fields like volume or liquidity. ```bash polymarket markets list [OPTIONS] ``` ```bash polymarket markets list --limit 10 --active true ``` ```bash polymarket markets list --closed true --limit 50 --offset 50 ``` ```bash polymarket markets list --order volume_num --limit 20 ``` -------------------------------- ### Get Event Tags Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve tags associated with a specific event by its ID. ```bash polymarket events tags 500 ``` -------------------------------- ### View Open Positions Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md View your open positions on the blockchain by providing a wallet address. Use this command to track your investments. ```bash polymarket data positions 0x... ``` -------------------------------- ### Get Market Tags Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve tags associated with a specific market by its ID. ```bash polymarket markets tags 12345 ``` -------------------------------- ### Create Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Generate a new wallet for use with the Polymarket CLI. This is a prerequisite for trading. ```bash polymarket wallet create ``` -------------------------------- ### List All CLOB Markets with Pagination Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-clob.md List all available markets in the CLOB, supporting pagination via a cursor. Use this to browse markets and retrieve them in manageable chunks. ```bash polymarket clob markets ``` ```bash polymarket clob markets --cursor ABC123 ``` -------------------------------- ### Get CLOB Spread Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve the bid-ask spread for a given token ID from the CLOB. ```bash polymarket clob spread 48331043336612883... ``` -------------------------------- ### Import Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Import an existing private key to use with the Polymarket CLI. Ensure the key is kept secure. ```bash polymarket wallet import 0x... ``` -------------------------------- ### Get CLOB Midpoint Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve the midpoint price for a given token ID from the CLOB. ```bash polymarket clob midpoint 48331043336612883... ``` -------------------------------- ### List API Keys Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md List all API keys associated with your account. This command retrieves key IDs, creation dates, last usage, and status. ```bash polymarket clob api-keys ``` -------------------------------- ### Get Comments by User Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve comments made by a specific user, identified by their address. ```bash polymarket comments by-user 0xf5E6... ``` -------------------------------- ### Get Earnings by Date Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieves the net Profit and Loss (PnL) for a specific date. ```APIDOC ## GET /clob/earnings ### Description Get earnings (net PnL) for a specific date. ### Method GET ### Endpoint /clob/earnings ### Parameters #### Query Parameters - **--date** (string) - Optional - Date to query (YYYY-MM-DD). - **--private-key** (string) - Optional - Override private key. - **--signature-type** (string) - Optional - Override signature type. ### Request Example ```bash polymarket clob earnings --date 2024-06-15 ``` ### Response #### Success Response (200) - **net_pnl** (string) - Net earnings/PnL for the date. ``` -------------------------------- ### Get Last Trade Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve information about the last trade executed for a given token ID. ```bash polymarket clob last-trade 48331043336612883... ``` -------------------------------- ### Place Batch Orders Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-trading.md Use this command to place multiple orders simultaneously. All orders must share the same side. Ensure the counts of tokens, prices, and sizes match exactly, as mismatches will result in an error. Supported order types include GTC, FOK, GTD, and FAK. ```bash polymarket clob post-orders --tokens --side --prices --sizes ``` ```bash polymarket clob post-orders \ --tokens "TOKEN1,TOKEN2,TOKEN3" \ --side buy \ --prices "0.40,0.50,0.60" \ --sizes "100,50,25" ``` -------------------------------- ### Create RPC Provider with Wallet Signing Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/modules-core.md Creates an RPC provider capable of wallet signing, intended for on-chain transactions like approvals, splits, merges, and redemptions. It can resolve the wallet from an optional private key. ```rust pub async fn create_provider(private_key: Option<&str>) -> Result ``` ```rust let provider = create_provider(None).await?; // Use for sending transactions ``` -------------------------------- ### Get CLOB Price by Token ID Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Retrieve the price for a specific token ID from the CLOB. ```bash polymarket clob price 48331043336612883 --side buy ``` -------------------------------- ### Get Market Reward Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieves specific reward details for a given market condition ID. ```APIDOC ## GET /clob/market-reward/{condition_id} ### Description Get reward for a specific market. ### Method GET ### Endpoint /clob/market-reward/{condition_id} ### Parameters #### Path Parameters - **condition_id** (string) - Required - Market condition ID (0x...). #### Query Parameters - **--private-key** (string) - Optional - Override private key. - **--signature-type** (string) - Optional - Override signature type. ### Response #### Success Response (200) - **reward_details** (object) - Reward details for the market. ``` -------------------------------- ### List Markets in Table Format Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Use the `polymarket markets list` command with the `--limit` flag to display market data in a human-readable table format. This is the default output. ```bash polymarket markets list --limit 2 ``` -------------------------------- ### View Portfolio Value Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Calculate and display the total value of your portfolio based on your wallet address. Use this command for a summary of your assets. ```bash polymarket data value 0x... ``` -------------------------------- ### Get Earnings Markets by Date Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieves a list of markets in which you traded during a specified earning period. ```APIDOC ## GET /clob/earnings-markets ### Description Get markets you traded in during a earning period. ### Method GET ### Endpoint /clob/earnings-markets ### Parameters #### Query Parameters - **--date** (string) - Optional - Date (YYYY-MM-DD). - **--private-key** (string) - Optional - Override private key. - **--signature-type** (string) - Optional - Override signature type. ### Request Example ```bash polymarket clob earnings-markets --date 2024-06-15 ``` ### Response #### Success Response (200) - **markets** (array) - Array of markets with trading activity. ``` -------------------------------- ### Get Rewards for a Specific Date Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Query rewards for a particular date using the YYYY-MM-DD format. ```bash polymarket clob rewards --date 2024-06-15 ``` -------------------------------- ### Check Balances Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Query your account balances for collateral or specific conditional tokens. Requires a configured wallet. ```bash polymarket clob balance --asset-type collateral ``` ```bash polymarket clob balance --asset-type conditional --token 48331043336612883... ``` -------------------------------- ### Set Output Format via CLI Flags Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/types-and-errors.md Shows how to set the output format to JSON or Table using the -o or --output flags in the CLI. ```bash polymarket -o json markets list polymarket --output table clob price TOKEN_ID --side buy ``` -------------------------------- ### Get Count of Unique Markets Traded Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Returns the number of distinct markets a wallet address has traded on. ```bash polymarket data traded
``` ```bash polymarket data traded 0xf5E6... ``` -------------------------------- ### List Sports Metadata Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve a list of supported sports. ```bash polymarket sports list ``` -------------------------------- ### Events Get Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves a single event by its ID or slug, providing full details for the specified event. ```APIDOC ## Events Get ### Description Retrieves a single event by its ID or slug, providing full details for the specified event. ### Command ``` polymarket events get ``` ### Parameters #### Path Parameters - **id** (string) - Required - Event ID (numeric) or slug ### Returns Single Event object with full details. ### Examples ```bash polymarket events get 500 polymarket events get 2024-election ``` ``` -------------------------------- ### Query Positions by Address Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Fetch data positions using an Ethereum-style address. ```bash polymarket data positions 0xf5E6d3D1f5b5c6f7e8f9a0b1c2d3e4f5a6b7c8d9 ``` -------------------------------- ### Get Current Rewards Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieves a list of currently active reward programs, including their status and details. ```APIDOC ## GET /clob/current-rewards ### Description Get currently active reward programs. ### Method GET ### Endpoint /clob/current-rewards ### Response #### Success Response (200) - **active_rewards** (array) - Array of active reward programs with details (program name, status, eligibility criteria, reward rate). ``` -------------------------------- ### Import Existing Private Key to Polymarket Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-wallet-onchain.md Imports an existing private key into the Polymarket CLI configuration. The key can be provided with or without a '0x' prefix. Use --force to overwrite an existing wallet or --signature-type to specify the signature mode. ```bash polymarket wallet import 0x1234567890abcdef... ``` ```bash polymarket wallet import 0xabcd... --force ``` ```bash polymarket wallet import 0x1234... --signature-type gnosis-safe ``` -------------------------------- ### Get Rewards by Date Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieves the rewards earned on a specific date. If no date is provided, it defaults to the current date. ```APIDOC ## GET /clob/rewards ### Description Get rewards earned on a specific date. ### Method GET ### Endpoint /clob/rewards ### Parameters #### Query Parameters - **--date** (string) - Optional - Date to query (YYYY-MM-DD). Defaults to today. - **--private-key** (string) - Optional - Override private key. - **--signature-type** (string) - Optional - Override signature type. ### Request Example ```bash polymarket clob rewards --date 2024-06-15 ``` ### Response #### Success Response (200) - **reward_amount** (string) - Reward amount for the date. ``` -------------------------------- ### Missing Wallet Error Message Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/types-and-errors.md Displayed when a command requires a private key but none is configured. Use `polymarket wallet create` or `polymarket wallet import ` to resolve. ```text Error: No wallet configured. Run `polymarket wallet create` or `polymarket wallet import ` ``` -------------------------------- ### Place a Market Order Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Submit a market order to the CLOB, specifying the token, side, and the total amount to buy or sell. Requires a configured wallet. ```bash polymarket clob market-order \ --token 48331043336612883... \ --side buy --amount 5 ``` -------------------------------- ### Manage Positions with Polymarket CLI Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md This workflow covers managing positions using the Polymarket CLI. It includes viewing open positions, splitting collateral into tokens, merging tokens back, and redeeming winning tokens. Ensure you have the correct condition IDs for these operations. ```bash # View open positions polymarket data positions 0xf5E6... ``` ```bash # Split collateral into tokens polymarket ctf split --condition 0xABC... --amount 10 ``` ```bash # Merge tokens back polymarket ctf merge --condition 0xABC... --amount 10 ``` ```bash # Redeem winning tokens polymarket ctf redeem --condition 0xABC... ``` -------------------------------- ### Set Config File Permissions Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/configuration.md Ensures the configuration file has owner read/write permissions only to protect the private key. ```bash chmod 600 ~/.config/polymarket/config.json ``` -------------------------------- ### Get CLOB Order Book Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md View the order book for a specific token ID, showing buy and sell orders. ```bash polymarket clob book 48331043336612883... ``` -------------------------------- ### List All Tags Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Lists all available tags. Supports limiting results and pagination. Use to view all categories. ```bash polymarket tags list [OPTIONS] ``` ```bash polymarket tags list --limit 50 ``` -------------------------------- ### Show Full Polymarket Wallet Information Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-wallet-onchain.md Displays comprehensive details about the configured Polymarket wallet, including its address, config file path, and the source of the private key (flag, environment variable, or config file). The --private-key option can be used to specify a different key. ```bash polymarket wallet show ``` -------------------------------- ### Get CLOB Tick Size Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-clob.md Retrieves the minimum price increment (tick size) for a given token ID from the CLOB. ```bash polymarket clob tick-size 48331043336612883 ``` -------------------------------- ### Environment Variables for Configuration Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/configuration.md Lists environment variables that can override configuration file settings for private key, signature type, RPC URL, and CLOB host. ```text POLYMARKET_PRIVATE_KEY POLYMARKET_SIGNATURE_TYPE POLYMARKET_RPC_URL POLYMARKET_CLOB_HOST ``` -------------------------------- ### Get Clob Midpoint Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Retrieve the midpoint price for a given token ID. Use this command for quick price checks. ```bash polymarket clob midpoint ``` -------------------------------- ### Monitor Rewards with Polymarket CLI Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md This workflow shows how to monitor rewards using the Polymarket CLI. It includes commands to check current reward programs, assess order eligibility, retrieve rewards for a specific date, and view earnings. ```bash # Check current reward programs polymarket clob current-rewards ``` ```bash # Check if your orders qualify polymarket clob orders-scoring "ORDER1,ORDER2" ``` ```bash # Get rewards for a date polymarket clob rewards --date 2024-06-15 ``` ```bash # Get earnings polymarket clob earnings --date 2024-06-15 ``` -------------------------------- ### Get Notifications Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieves a list of account notifications, including their ID, type, message, creation date, and read status. ```APIDOC ## Get Notifications ### Description Get account notifications. ### Command ``` polymarket clob notifications ``` ### Returns Array of notification objects: - ID - Type - Message - Created date - Read status ### Parameters #### Query Parameters - **--private-key** (string) - Optional - Override private key - **--signature-type** (string) - Optional - Override signature type ### Examples ```bash polymarket clob notifications ``` ``` -------------------------------- ### Define Ethereum Address Type Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/types-and-errors.md Demonstrates how to define and parse an Ethereum-style address using the SDK's Address type. ```rust use polymarket_client_sdk_v2::types::Address; let addr: Address = "0xf5E6d3D1f5b5c6f7e8f9a0b1c2d3e4f5a6b7c8d9".parse()?; ``` -------------------------------- ### Get Earnings for a Specific Date Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieve net Profit and Loss (PnL) for a specified date. The date should be in YYYY-MM-DD format. ```bash polymarket clob earnings --date 2024-06-15 ``` -------------------------------- ### Get Rewards for a Specific Date Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieve earned rewards for a given date. Defaults to the current date if no date is specified. ```bash polymarket clob rewards --date ``` -------------------------------- ### Check Collateral Balance Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Use this command to view your current collateral balance. Ensure you are authenticated with the CLI. ```bash # 1. Check current collateral balance polymarket clob balance --asset-type collateral ``` -------------------------------- ### Search Markets Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/README.md Search for markets using a query string. Use this command to find markets by keywords. ```bash polymarket markets search "" ``` -------------------------------- ### List All CLOB Markets Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve a list of all markets available in the CLOB. ```bash polymarket clob markets ``` -------------------------------- ### Get Trader Leaderboard Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves the trader leaderboard data. Allows filtering by period and sorting by PNL or volume, with a configurable limit. ```bash polymarket data leaderboard [OPTIONS] ``` -------------------------------- ### Create New Polymarket Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/configuration.md Creates a new wallet for use with the Polymarket CLI. The output includes the wallet's address, proxy address, and the configuration file path. The default signature type is 'proxy'. ```bash polymarket wallet create # Outputs: address, proxy address, config path # Signature type defaults to "proxy" ``` ```bash polymarket wallet create --signature-type eoa ``` ```bash polymarket wallet create --force ``` -------------------------------- ### Get On-Chain Activity for a Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Fetches a record of on-chain activities for a wallet address, such as CTF operations and approvals. Supports pagination. ```bash polymarket data activity
[OPTIONS] ``` ```bash polymarket data activity 0xf5E6... ``` -------------------------------- ### Get Trade History for a Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves the trade history for a specified wallet address, including execution details. Supports pagination. ```bash polymarket data trades
[OPTIONS] ``` ```bash polymarket data trades 0xf5E6... --limit 100 ``` -------------------------------- ### Get Related Tag Objects Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves actual tag objects that are related to a specified tag. Can be used to filter out empty relationships. ```bash polymarket tags related-tags [--omit-empty] ``` ```bash polymarket tags related-tags politics ``` -------------------------------- ### List Series Templates Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Lists available series templates. Supports pagination with --limit and --offset parameters. Default limit is 25. ```bash polymarket series list --limit 50 ``` -------------------------------- ### List API Keys Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md If you are using programmatic access to Polymarket, this command lists your active API keys. Ensure you handle this information securely. ```bash # 8. List API keys (if using programmatic access) polymarket clob api-keys ``` -------------------------------- ### Get Account Notifications Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Retrieve a list of account notifications, including their ID, type, message, creation date, and read status. ```bash polymarket clob notifications ``` -------------------------------- ### Manage API Keys Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Commands for managing API keys, including listing existing keys, creating new ones, and deleting them. These operations require authentication. ```bash # API key management polymarket clob api-keys polymarket clob create-api-key polymarket clob delete-api-key ``` -------------------------------- ### Get JSON Output for Balance Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/balance-and-rewards.md Fetches the pUSD collateral balance and pipes the JSON output to jq to extract the 'amount' field. ```bash polymarket -o json clob balance --asset-type collateral | jq '.amount' ``` -------------------------------- ### Get Comments by User Address Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Fetch all comments made by a specific user, identified by their address. Options for limiting results and pagination are available. ```bash polymarket comments by-user
[OPTIONS] ``` ```bash polymarket comments by-user 0xf5E6... ``` -------------------------------- ### List Tags Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Retrieve a list of available tags. ```bash polymarket tags list ``` -------------------------------- ### Get a Single Comment by ID Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieve a specific comment using its unique ID. This command is useful for fetching details of a single comment. ```bash polymarket comments get ``` ```bash polymarket comments get abc123 ``` -------------------------------- ### Get Top Token Holders for a Market Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Retrieves a list of top token holders for a given market condition ID. Supports pagination. ```bash polymarket data holders [OPTIONS] ``` ```bash polymarket data holders 0xABC123... ``` -------------------------------- ### Markets List Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-markets.md Lists markets with optional filtering and pagination. This command does not require a wallet. ```APIDOC ## Markets List ### Description Lists markets with optional filtering and pagination. This command does not require a wallet. ### Command `polymarket markets list [OPTIONS]` ### Parameters #### Options - `--active` (bool) - Optional - Filter by active status (mutually exclusive with --closed) - `--closed` (bool) - Optional - Filter by closed status (mutually exclusive with --active) - `--limit` (i32) - Optional - Maximum results to return (default: 25) - `--offset` (i32) - Optional - Pagination offset - `--order` (string) - Optional - Sort field (e.g., "volume_num", "liquidity_num", "created_at") - `--ascending` (flag) - Optional - Sort ascending instead of descending (default: false) ### Returns Array of Market objects in table format (default) or JSON. ### Response Example (JSON) ```json [ { "id": "12345", "question": "Will Trump win the 2024 election?", "slug": "will-trump-win-the-2024-election", "outcomeNames": ["No", "Yes"], "outcomePrices": ["0.48", "0.52"], "volume": "145200000", "volumeNum": 145200000, "liquidity": "1200000", "liquidityNum": 1200000, "createdAt": "2024-01-01T00:00:00Z", "closed": false, "active": true } ] ``` ### Examples List 10 most active markets: ```bash polymarket markets list --limit 10 --active true ``` List all closed markets with pagination: ```bash polymarket markets list --closed true --limit 50 --offset 50 ``` List by volume (highest to lowest): ```bash polymarket markets list --order volume_num --limit 20 ``` Machine-readable JSON output: ```bash polymarket -o json markets list --limit 5 | jq '.[].question' ``` ``` -------------------------------- ### Recovery Commands for Missing Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/types-and-errors.md Commands to resolve the 'Missing Wallet Error'. Create a new wallet or import an existing private key. ```bash polymarket wallet create # or polymarket wallet import 0x... ``` -------------------------------- ### Get Closed Positions for a Wallet Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Fetches resolved (closed) positions for a given wallet address. Pagination is available via limit and offset. ```bash polymarket data closed-positions
[OPTIONS] ``` ```bash polymarket data closed-positions 0xf5E6... ``` -------------------------------- ### Place a Limit Order Source: https://github.com/polymarket/polymarket-cli/blob/main/README.md Submit a limit order to the CLOB, specifying the token, side (buy/sell), price, and size. Requires a configured wallet. ```bash polymarket clob create-order \ --token 48331043336612883... \ --side buy --price 0.50 --size 10 ``` -------------------------------- ### Get Tag Relationship Data Source: https://github.com/polymarket/polymarket-cli/blob/main/_autodocs/commands-events-data.md Fetches relationship data for a given tag, such as parent or child tags. Optionally omits tags with no relationships. ```bash polymarket tags related [--omit-empty] ``` ```bash polymarket tags related politics ``` ```bash polymarket tags related crypto --omit-empty true ```