### Get All Instruments Response Example Source: https://public.com/api/docs/resources/instrument-details/get-all-instruments This is an example of a successful response (200 OK) when retrieving instrument data. It includes details about the instrument and its trading capabilities. ```json { "instruments": [ { "instrument": { "symbol": "string", "type": "EQUITY" }, "trading": "BUY_AND_SELL", "fractionalTrading": "BUY_AND_SELL", "optionTrading": "BUY_AND_SELL", "optionSpreadTrading": "BUY_AND_SELL", "instrumentDetails": null, "shortingAvailability": "NOT_SHORTABLE", "hardToBorrowPercentageRate": "string", "optionContractPriceIncrements": { "incrementBelow3": "string", "incrementAbove3": "string" }, "exchange": "string", "exchangeName": "string" } ] } ``` -------------------------------- ### Install the Public CLI using uv Source: https://public.com/api/docs/templates/publicdotcom-cli Alternatively, install the CLI using uv. This is another method for managing tool installations. ```bash uv tool install publicdotcom-cli ``` -------------------------------- ### Make First API Request Source: https://public.com/api/docs/quickstart Example of making an authenticated GET request to retrieve account information. ```curl curl --request GET \ --url https://api.public.com/userapigateway/trading/account \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Install uv on Windows using PowerShell Source: https://public.com/api/docs/templates/claude-desktop-mcp Installs uv, a fast Python package manager, using PowerShell on Windows. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install uv on Windows using winget Source: https://public.com/api/docs/templates/claude-desktop-mcp Installs uv, a fast Python package manager, using winget on Windows. ```powershell winget install --id=astral-sh.uv -e ``` -------------------------------- ### cURL Request Example Source: https://public.com/api/docs/resources/market-data/get-bars-v2-with-aggregation Example of how to make a GET request to the Get Bars V2 endpoint using cURL. Ensure you replace YOUR_API_KEY with your actual API key. ```curl curl --request GET \ --url https://api.public.com/userapigateway/historicdata/{type}/{symbol}/{period}/{aggregation} \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'User-Agent: public-dev-docs' ``` -------------------------------- ### Verify CLI Installation Source: https://public.com/api/docs/templates/publicdotcom-cli Check if the CLI is installed correctly by displaying its help output. This lists all available command groups. ```bash public --help ``` -------------------------------- ### Get Instrument Response Example Source: https://public.com/api/docs/resources/instrument-details/get-instrument This is a sample JSON response for the GET /userapigateway/trading/instruments/{symbol}/{type} endpoint, detailing a financial instrument's properties. ```json { "instrument": { "symbol": "string", "type": "EQUITY" }, "trading": "BUY_AND_SELL", "fractionalTrading": "BUY_AND_SELL", "optionTrading": "BUY_AND_SELL", "optionSpreadTrading": "BUY_AND_SELL", "instrumentDetails": null, "shortingAvailability": "NOT_SHORTABLE", "hardToBorrowPercentageRate": "string", "optionContractPriceIncrements": { "incrementBelow3": "string", "incrementAbove3": "string" }, "exchange": "string", "exchangeName": "string" } ``` -------------------------------- ### Get Option Chain (JavaScript) Source: https://public.com/api/docs/resources/market-data/get-option-chain This JavaScript example shows how to fetch an option chain using the Fetch API. It configures the request with the appropriate method, headers, and JSON body, including the instrument symbol, type, and expiration date. ```javascript const url = `https://api.public.com/userapigateway/marketdata/{accountId}/option-chain`; const headers = { "Authorization": "Bearer YOUR_API_KEY", "User-Agent": "public-dev-docs", "Content-Type": "application/json" }; const payload = { "instrument": { "symbol": "string", "type": "EQUITY" }, "expirationDate": "2023-11-07" }; fetch(url, { method: "POST", headers: headers, body: JSON.stringify(payload) }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error('Error fetching option chain:', error); }); ``` -------------------------------- ### Install OpenClaw Source: https://public.com/api/docs/templates/openclaw-agent-skill Run this command in your terminal to install OpenClaw. This script is for macOS and Linux. ```bash curl -fsSL https://openclaw.ai/install.sh | bash ``` -------------------------------- ### Install uv on macOS using Homebrew Source: https://public.com/api/docs/templates/claude-desktop-mcp Installs uv, a fast Python package manager, using Homebrew on macOS. ```bash brew install uv ``` -------------------------------- ### Install Homebrew on macOS Source: https://public.com/api/docs/templates/claude-desktop-mcp Installs Homebrew, a package manager for macOS, which is a prerequisite for installing uv. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Install the Public CLI using pipx Source: https://public.com/api/docs/templates/publicdotcom-cli Install the CLI using pipx for isolated environments. This ensures the 'public' command is available on your PATH. ```bash pipx install publicdotcom-cli ``` -------------------------------- ### Install Public Agent Skill Source: https://public.com/api/docs/templates/openclaw-agent-skill Prompt OpenClaw with the GitHub URL to install the Public Agent Skill. This allows OpenClaw to interact with your Public brokerage account. ```bash Can you install the agent skill located here: https://github.com/PublicDotCom/claw-skill-public-dot-com? It is a GitHub repo containing the agent skill for interacting with my Public brokerage account ``` -------------------------------- ### Account History Response Example Source: https://public.com/api/docs/resources/account-details/get-history This is an example of a successful 200 OK response when retrieving account history. It includes transaction details, pagination tokens, and query parameters. ```json { "transactions": [ { "timestamp": "2023-11-07T05:31:56Z", "id": "string", "type": "TRADE", "subType": "DEPOSIT", "accountNumber": "string", "symbol": "string", "securityType": "EQUITY", "side": "BUY", "description": "string", "netAmount": "string", "principalAmount": "string", "quantity": "string", "direction": "INCOMING", "fees": "string" } ], "nextToken": "string", "start": "2023-11-07T05:31:56Z", "end": "2023-11-07T05:31:56Z", "pageSize": 123 } ``` -------------------------------- ### Successful Response Example Source: https://public.com/api/docs/resources/authorization/create-personal-access-token This is an example of a successful response when creating a personal access token. The response body contains the generated 'accessToken'. ```json { "accessToken": "string" } ``` -------------------------------- ### Get Strategy Quote Response (JSON) Source: https://public.com/api/docs/resources/option-details/get-strategy-quote This is an example of a successful 200 OK response for a strategy quote request. It includes details about the strategy, its legs, and associated quotes. ```json { "debitCredit": "DEBIT", "strategyLegs": [ { "instrument": { "symbol": "string", "baseSymbol": "string", "type": "CALL", "strikePrice": "string", "expirationDate": "2023-11-07" }, "side": "BUY", "openCloseIndicator": "OPEN", "ratioQuantity": 123, "quote": { "symbol": "string", "last": "string", "bid": "string", "bidSize": "string", "ask": "string", "askSize": "string", "timestamp": "2023-11-07T05:31:56Z", "signature": "string", "collarPercentage": "string", "buyCollar": "string", "sellCollar": "string", "openInterest": 123, "bidCollar": "string", "askCollar": "string", "detail": null, "tradingHalted": true, "uptickRule": "TRIGGERED" } } ], "equityQuote": { "instrument": { "symbol": "string", "baseSymbol": "string", "type": "CALL", "strikePrice": "string", "expirationDate": "2023-11-07" }, "side": "BUY", "openCloseIndicator": "OPEN", "ratioQuantity": 123, "quote": { "symbol": "string", "last": "string", "bid": "string", "bidSize": "string", "ask": "string", "askSize": "string", "timestamp": "2023-11-07T05:31:56Z", "signature": "string", "collarPercentage": "string", "buyCollar": "string", "sellCollar": "string", "openInterest": 123, "bidCollar": "string", "askCollar": "string", "detail": null, "tradingHalted": true, "uptickRule": "TRIGGERED" } }, "price": "string", "bid": "string", "ask": "string", "mark": "string", "strategyName": "string", "expirationDate": "2023-11-07" } ``` -------------------------------- ### Get All Instruments (cURL) Source: https://public.com/api/docs/resources/instrument-details/get-all-instruments Use this cURL command to make a GET request to the instruments endpoint. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```shell curl --request GET \ --url https://api.public.com/userapigateway/trading/instruments \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'User-Agent: public-dev-docs' ``` -------------------------------- ### Create Notional Limit Order for Crypto Source: https://public.com/api/docs/changelog Example of creating a limit order to purchase a specific dollar amount of a cryptocurrency at a given price. ```json { "orderId": "431ddd43-d8ce-4544-b06b-b08e6462139b", "instrument": { "symbol": "BTC", "type": "CRYPTO" }, "orderSide": "BUY", "orderType": "LIMIT", "expiration": { "timeInForce": "DAY" }, "amount": "100", "limitPrice": "87500" } ``` -------------------------------- ### Bond Order Response Example Source: https://public.com/api/docs/templates/place-bond-order This is an example of the JSON response received when checking the status of a bond order. It includes details such as order ID, instrument, status, and filled quantity. ```json { "orderId": "eb11cba2-751b-4a9e-8cb0-82b421f02909", "instrument": { "symbol": "912810TM0", "type": "BOND" }, "createdAt": "2026-04-22T16:22:30.292084Z", "type": "LIMIT", "side": "BUY", "status": "FILLED", "quantity": "1000", "notionalValue": null, "expiration": { "timeInForce": "DAY", "expirationTime": null }, "limitPrice": "0.90", "stopPrice": null, "closedAt": "2026-04-22T16:22:45.118204Z", "openCloseIndicator": "OPEN", "filledQuantity": "1000", "averagePrice": "0.9085", "legs": null, "rejectReason": null } ``` -------------------------------- ### Successful Response for Get Quotes Source: https://public.com/api/docs/resources/market-data/get-quotes This is an example of a successful 200 OK response when retrieving market quotes. It includes detailed information for each instrument, such as last traded price, timestamps, bid/ask details, and volume. ```json { "quotes": [ { "instrument": { "symbol": "string", "type": "EQUITY" }, "outcome": "SUCCESS", "last": "string", "lastTimestamp": "2023-11-07T05:31:56Z", "bid": "string", "bidSize": 123, "bidTimestamp": "2023-11-07T05:31:56Z", "ask": "string", "askSize": 123, "askTimestamp": "2023-11-07T05:31:56Z", "volume": 1234567890, "openInterest": 1234567890, "previousClose": "string", "oneDayChange": { "change": "string", "percentChange": "string" }, "optionDetails": { "greeks": { "delta": "string", "gamma": "string", "theta": "string", "vega": "string", "rho": "string", "impliedVolatility": "string" }, "strikePrice": "string", "midPrice": "string" } } ] } ``` -------------------------------- ### Place a Live Order Source: https://public.com/api/docs/templates/publicdotcom-cli Submit a real trading order to your brokerage account using a JSON order file. Ensure you have reviewed the preflight output carefully. ```bash public order place --file order.json ``` -------------------------------- ### Authenticate with the Public CLI Source: https://public.com/api/docs/templates/publicdotcom-cli Log in to your Public account using the CLI. This opens a browser for authorization and stores credentials locally. ```bash public auth login ``` -------------------------------- ### Get Live Stock Price Source: https://public.com/api/docs/templates/openclaw-agent-skill Use this prompt to get the current price of a stock, such as SPY, to establish a live market data point. ```text What is the current price of SPY? ``` -------------------------------- ### Account Portfolio Response Example Source: https://public.com/api/docs/templates/get-account-balance The response contains comprehensive account details such as buying power, equity distribution, and a list of current investment positions. ```json { "accountId": "YOUR_ACCOUNT_ID", "accountType": "BROKERAGE", "buyingPower": { "cashOnlyBuyingPower": "5000.00", "buyingPower": "10000.00", "optionsBuyingPower": "10000.00" }, "equity": [ { "type": "CASH", "value": "2500.00", "percentageOfPortfolio": "25.00" }, { "type": "STOCK", "value": "7500.00", "percentageOfPortfolio": "75.00" } ], "positions": [ { "instrument": { "symbol": "AAPL", "name": "Apple Inc.", "type": "EQUITY" }, "quantity": "10.0", "currentValue": "1500.00", "percentOfPortfolio": "15.00" } ], "orders": [] } ``` -------------------------------- ### Create Personal Access Token (Python) Source: https://public.com/api/docs/resources/authorization/create-personal-access-token This Python script demonstrates how to create a personal access token. It sends a POST request with the validity in minutes and the secret token. ```python import requests url = "https://api.public.com/userapiauthservice/personal/access-tokens" payload = { "validityInMinutes": 123, "secret": "string" } headers = { 'User-Agent': 'public-dev-docs', 'Content-Type': 'application/json' } response = requests.request("POST", url, json=payload, headers=headers) print(response.text) ``` -------------------------------- ### Get Account ID Source: https://public.com/api/docs/templates/get-account-balance Retrieve your account ID by making a GET request to the accounts endpoint. This ID is necessary for subsequent API calls related to your account. ```curl curl --request GET \ --url https://api.public.com/userapigateway/trading/account \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` -------------------------------- ### Get Option Greeks (cURL) Source: https://public.com/api/docs/resources/option-details/get-option-greeks Use this cURL command to make a GET request to the option greeks endpoint. Replace YOUR_API_KEY with your actual API key. ```curl curl --request GET \ --url https://api.public.com/userapigateway/option-details/{accountId}/greeks \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'User-Agent: public-dev-docs' ``` -------------------------------- ### Complete JSON for Empty Config File Source: https://public.com/api/docs/templates/claude-desktop-mcp If 'claude_desktop_config.json' is empty, wrap the 'mcpServers' configuration in curly braces to create a valid JSON structure. ```json { "mcpServers": { "public-com": { "command": "uvx", "args": [ "publicdotcom-mcp-server" ], "env": { "PUBLIC_COM_SECRET": "YOUR_PUBLIC_COM_SECRET", "PUBLIC_COM_ACCOUNT_ID": "YOUR_ACCOUNT_ID" } } } } ``` -------------------------------- ### Show Portfolio Holdings Source: https://public.com/api/docs/templates/publicdotcom-cli Display your current portfolio and holdings. This command provides an overview of your investments. ```bash public portfolio show ``` -------------------------------- ### Configure Public Brokerage API Key and Account Source: https://public.com/api/docs/templates/perplexity-agent-skill Use this prompt in Perplexity Computer to configure your Public brokerage API key and default account number. Ensure you handle your API key securely. ```plaintext Can you configure my Public brokerage api key and default account number? ``` -------------------------------- ### Get Account Portfolio v2 Response Source: https://public.com/api/docs/resources/account-details/get-account-portfolio-v2 This is a successful response (200 OK) for the Get Account Portfolio v2 endpoint. It includes details about the account, buying power, equity, positions, and orders. ```json { "accountId": "string", "accountType": "BROKERAGE", "buyingPower": { "cashOnlyBuyingPower": "string", "buyingPower": "string", "optionsBuyingPower": "string" }, "equity": [ { "type": "CASH", "value": "string", "percentageOfPortfolio": "string" } ], "positions": [ { "instrument": { "symbol": "string", "name": "string", "type": "EQUITY" }, "quantity": "string", "openedAt": "2023-11-07T05:31:56Z", "currentValue": "string", "percentOfPortfolio": "string", "lastPrice": { "lastPrice": "string", "timestamp": "2023-11-07T05:31:56Z" }, "instrumentGain": { "gainValue": "string", "gainPercentage": "string", "timestamp": "2023-11-07T05:31:56Z" }, "positionDailyGain": { "gainValue": "string", "gainPercentage": "string", "timestamp": "2023-11-07T05:31:56Z" }, "costBasis": { "totalCost": "string", "unitCost": "string", "gainValue": "string", "gainPercentage": "string", "lastUpdate": "2023-11-07T05:31:56Z" }, "strategyIds": [ "string" ] } ], "orders": [ { "orderId": "586589f6-4503-4899-955e-f1a7089a02ec", "instrument": { "symbol": "string", "type": "EQUITY" }, "createdAt": "2023-11-07T05:31:56Z", "type": "MARKET", "side": "BUY", "status": "NEW", "quantity": "string", "notionalValue": "string", "expiration": { "timeInForce": "DAY", "expirationTime": "2023-11-07T05:31:56Z" }, "limitPrice": "string", "stopPrice": "string", "closedAt": "2023-11-07T05:31:56Z", "openCloseIndicator": "OPEN", "filledQuantity": "string", "averagePrice": "string", "legs": [ { "instrument": { "symbol": "string", "type": "EQUITY" }, "side": "BUY", "openCloseIndicator": "OPEN", "ratioQuantity": 123 } ], "rejectReason": "string" } ], "strategies": [ { "strategyId": "string", "displayName": "string", "quantity": "string", "currentValue": "string", "percentOfPortfolio": "string", "lastPrice": { "lastPrice": "string", "timestamp": "2023-11-07T05:31:56Z" }, "positionDailyGain": { "gainValue": "string", "gainPercentage": "string", "timestamp": "2023-11-07T05:31:56Z" }, "costBasis": { "totalCost": "string", "unitCost": "string", "gainValue": "string", "gainPercentage": "string", "lastUpdate": "2023-11-07T05:31:56Z" }, "optionLegs": [ { "symbol": "string", "positionType": "string", "ratioQuantity": "string" } ] } ] } ``` -------------------------------- ### Place Order using cURL Source: https://public.com/api/docs/resources/order-placement/place-order Use this cURL command to submit a new order. Ensure you replace YOUR_API_KEY with your actual API key and fill in the necessary order details. ```curl curl --request POST \ --url https://api.public.com/userapigateway/trading/{accountId}/order \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'User-Agent: public-dev-docs' \ --header 'Content-Type: application/json' \ --data '{ \ "orderId": "eeb46bf2-7373-45f7-bf66-0b89e2a70681", \ "instrument": { \ "symbol": "string", \ "type": "EQUITY" \ }, \ "orderSide": "BUY", \ "orderType": "LIMIT", \ "expiration": { \ "timeInForce": "GTD", \ "expirationTime": "2026-09-18T05:17:45.405Z" \ }, \ "quantity": "string", \ "amount": "string", \ "limitPrice": "string", \ "stopPrice": "string", \ "equityMarketSession": "CORE", \ "openCloseIndicator": "OPEN", \ "useMargin": true \ }' ``` -------------------------------- ### Stock Price Query Source: https://public.com/api/docs/templates/claude-mcpb Get the current trading price of a specific stock. ```text What is the current price of TSLA? ``` -------------------------------- ### Run Multi-Leg Preflight Check Source: https://public.com/api/docs/templates/place-multi-leg-options-order Perform a preflight check for a multi-leg options strategy to estimate costs and validate the strategy before placing the order. This example demonstrates a bull call spread. ```curl curl --request POST \ --url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/preflight/multi-leg \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ \ "orderType": "LIMIT", \ "expiration": { \ "timeInForce": "DAY" \ }, \ "quantity": "1", \ "limitPrice": "5.00", \ "legs": [ \ { \ "instrument": { \ "symbol": "AAPL240216C00140000", \ "type": "OPTION" \ }, \ "side": "BUY", \ "openCloseIndicator": "OPEN", \ "ratioQuantity": 1 \ }, \ { \ "instrument": { \ "symbol": "AAPL240216C00150000", \ "type": "OPTION" \ }, \ "side": "SELL", \ "openCloseIndicator": "OPEN", \ "ratioQuantity": 1 \ } \ ] \ }' ``` ```json { "baseSymbol": "AAPL", "strategyName": "Call Spread", "legs": [ { "instrument": { "symbol": "AAPL240216C00140000", "type": "OPTION" }, "side": "BUY", "openCloseIndicator": "OPEN", "ratioQuantity": 1, "optionDetails": { "baseSymbol": "AAPL", "type": "CALL", "strikePrice": "140.00", "optionExpireDate": "2024-02-16" } }, { "instrument": { "symbol": "AAPL240216C00150000", "type": "OPTION" }, "side": "SELL", "openCloseIndicator": "OPEN", "ratioQuantity": 1, "optionDetails": { "baseSymbol": "AAPL", "type": "CALL", "strikePrice": "150.00", "optionExpireDate": "2024-02-16" } } ], "estimatedCommission": "1.30", "orderValue": "500.00", "estimatedQuantity": "1", "estimatedCost": "501.30", "buyingPowerRequirement": "501.30", "regulatoryFees": { "orfFee": "0.08", "occFee": "0.04" } } ``` -------------------------------- ### Get all instruments Source: https://public.com/api/docs/resources/instrument-details/get-all-instruments Retrieves all available trading instruments with optional filtering capabilities. ```APIDOC ## GET /userapigateway/trading/instruments ### Description Retrieves all available trading instruments with optional filtering capabilities. This endpoint returns a comprehensive list of instruments available for trading, with support for filtering by security type and various trading capabilities. All filter parameters are optional and can be combined to narrow down results. ### Method GET ### Endpoint /userapigateway/trading/instruments ### Parameters #### Query Parameters - **typeFilter** (array) - Optional - set of security types to filter by ([GatewaySecurityType]) - **tradingFilter** (array) - Optional - set of trading statuses to filter by ([ApiInstrumentDto.Trading]) - **fractionalTradingFilter** (array) - Optional - set of fractional trading statuses to filter by ([ApiInstrumentDto.Trading]) - **optionTradingFilter** (array) - Optional - set of option trading statuses to filter by ([ApiInstrumentDto.Trading]) - **optionSpreadTradingFilter** (array) - Optional - set of option spread trading statuses to filter by ([ApiInstrumentDto.Trading]) ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **instruments** (object[]) - Description of instruments array - **instrument** (object) - Details about the instrument - **symbol** (string) - The trading symbol of the instrument. - **type** (string) - The security type of the instrument (e.g., EQUITY, OPTION). - **trading** (string) - The trading status of the instrument (e.g., BUY_AND_SELL, DISABLED). - **fractionalTrading** (string) - Indicates if fractional trading is available. - **optionTrading** (string) - Indicates if option trading is available. - **optionSpreadTrading** (string) - Indicates if option spread trading is available. - **instrumentDetails** (null) - Placeholder for detailed instrument information. - **shortingAvailability** (string) - Availability status for shorting. - **hardToBorrowPercentageRate** (string) - Percentage rate for hard-to-borrow stocks. - **optionContractPriceIncrements** (object) - Details on option contract price increments. - **incrementBelow3** (string) - Increment for prices below 3. - **incrementAbove3** (string) - Increment for prices above 3. - **exchange** (string) - The exchange where the instrument is traded. - **exchangeName** (string) - The name of the exchange. #### Response Example ```json { "instruments": [ { "instrument": { "symbol": "string", "type": "EQUITY" }, "trading": "BUY_AND_SELL", "fractionalTrading": "BUY_AND_SELL", "optionTrading": "BUY_AND_SELL", "optionSpreadTrading": "BUY_AND_SELL", "instrumentDetails": null, "shortingAvailability": "NOT_SHORTABLE", "hardToBorrowPercentageRate": "string", "optionContractPriceIncrements": { "incrementBelow3": "string", "incrementAbove3": "string" }, "exchange": "string", "exchangeName": "string" } ] } ``` ``` -------------------------------- ### Retrieve Stock Price Source: https://public.com/api/docs/templates/perplexity-agent-skill Get the current trading price for a specific stock symbol. ```natural-language Show me the current price of TSLA ``` -------------------------------- ### Get Option Chain (Python) Source: https://public.com/api/docs/resources/market-data/get-option-chain This Python code snippet demonstrates how to request an option chain. It includes the necessary headers and a JSON payload with instrument details and expiration date. Replace placeholders with your actual credentials and data. ```python import requests import json url = "https://api.public.com/userapigateway/marketdata/{accountId}/option-chain" headers = { "Authorization": "Bearer YOUR_API_KEY", "User-Agent": "public-dev-docs", "Content-Type": "application/json" } payload = { "instrument": { "symbol": "string", "type": "EQUITY" }, "expirationDate": "2023-11-07" } response = requests.post(url, headers=headers, data=json.dumps(payload)) print(response.status_code) print(response.json()) ``` -------------------------------- ### Get Instrument Source: https://public.com/api/docs/resources/instrument-details/get-instrument Retrieves detailed information for a specific financial instrument using its symbol and type. ```APIDOC ## GET /userapigateway/trading/instruments/{symbol}/{type} ### Description Retrieves detailed information for a specific financial instrument using its symbol and type. ### Method GET ### Endpoint /userapigateway/trading/instruments/{symbol}/{type} ### Parameters #### Path Parameters - **symbol** (string) - Required - The trading symbol of the instrument. - **type** (string) - Required - The type of the instrument. Available options: EQUITY, OPTION, MULTI_LEG_INSTRUMENT, CRYPTO, ALT, TREASURY_BOND, INDEX. ### Responses #### Success Response (200) - **instrument** (object) - Required - Contains instrument symbol and type. - **symbol** (string) - Required - **type** (string) - Required - **trading** (enum) - Required - Available options: BUY_AND_SELL, LIQUIDATION_ONLY, DISABLED. - **fractionalTrading** (enum) - Required - Available options: BUY_AND_SELL, LIQUIDATION_ONLY, DISABLED. - **optionTrading** (enum) - Required - Available options: BUY_AND_SELL, LIQUIDATION_ONLY, DISABLED. - **optionSpreadTrading** (enum) - Required - Available options: BUY_AND_SELL, LIQUIDATION_ONLY, DISABLED. - **instrumentDetails** (unknown) - Optional - Contains additional instrument details. - **shortingAvailability** (enum) - Optional - The short-selling availability. Available options: NOT_SHORTABLE, EASY_TO_BORROW, HARD_TO_BORROW. - **hardToBorrowPercentageRate** (string) - Optional - The hard to borrow rate as a percentage value. - **optionContractPriceIncrements** (object) - Optional - Record representing price increments below and above $3. - **incrementBelow3** (string) - **incrementAbove3** (string) - **exchange** (string) - The exchange where the instrument is traded. - **exchangeName** (string) - The name of the exchange where the instrument is traded. #### Response Example ```json { "instrument": { "symbol": "string", "type": "EQUITY" }, "trading": "BUY_AND_SELL", "fractionalTrading": "BUY_AND_SELL", "optionTrading": "BUY_AND_SELL", "optionSpreadTrading": "BUY_AND_SELL", "instrumentDetails": null, "shortingAvailability": "NOT_SHORTABLE", "hardToBorrowPercentageRate": "string", "optionContractPriceIncrements": { "incrementBelow3": "string", "incrementAbove3": "string" }, "exchange": "string", "exchangeName": "string" } ``` ``` -------------------------------- ### Place Short Order Source: https://public.com/api/docs/templates/place-short-order This endpoint allows you to place a short order. Ensure you have a margin account, the stock is shortable, and you meet all trading requirements. Use `orderSide: SELL` with `openCloseIndicator: OPEN` to initiate a new short position. Orders must be in whole shares, and market orders are rejected if the uptick rule is active. ```APIDOC ## POST /userapigateway/trading/{YOUR_ACCOUNT_ID}/order ### Description Places a new short order. This requires a margin account, confirmation that the instrument is shortable, and adherence to trading rules like the uptick rule. ### Method POST ### Endpoint /userapigateway/trading/{YOUR_ACCOUNT_ID}/order ### Parameters #### Path Parameters - **YOUR_ACCOUNT_ID** (string) - Required - The ID of your margin brokerage account. #### Request Body - **orderId** (string) - Required - A unique identifier for the order. - **instrument** (object) - Required - Details of the instrument to trade. - **symbol** (string) - Required - The stock symbol. - **type** (string) - Required - The type of instrument (e.g., "EQUITY"). - **orderSide** (string) - Required - The side of the order. Must be "SELL" for short orders. - **orderType** (string) - Required - The type of order (e.g., "LIMIT"). Market orders are rejected if the uptick rule is active. - **limitPrice** (string) - Required if orderType is LIMIT - The price at which to execute the order. - **expiration** (object) - Required - Order expiration details. - **timeInForce** (string) - Required - The time in force for the order (e.g., "DAY"). - **quantity** (string) - Required - The number of shares to trade. Must be whole shares. - **openCloseIndicator** (string) - Required - Indicates the intent of the order. Must be "OPEN" to initiate a short position. ### Request Example ```json { "orderId": "a3f9b2c1-4d8e-4f7a-9b3c-1e2d3f4a5b6c", "instrument": { "symbol": "AAPL", "type": "EQUITY" }, "orderSide": "SELL", "orderType": "LIMIT", "limitPrice": "150.20", "expiration": { "timeInForce": "DAY" }, "quantity": "10", "openCloseIndicator": "OPEN" } ``` ### Response #### Success Response (200) - **orderId** (string) - The ID of the submitted order. #### Response Example ```json { "orderId": "a3f9b2c1-4d8e-4f7a-9b3c-1e2d3f4a5b6c" } ``` ``` -------------------------------- ### Get Option Greeks Source: https://public.com/api/docs/templates/place-options-order Retrieves the Greek risk metrics for a specific option position, useful for risk analysis. ```APIDOC ## GET /userapigateway/option-details/{symbol}/greeks ### Description Retrieves the Greeks (risk metrics) for an option position for analysis purposes. ### Method GET ### Endpoint https://api.public.com/userapigateway/option-details/{symbol}/greeks ### Parameters #### Path Parameters - **symbol** (string) - Required - The symbol of the option for which to retrieve Greeks. #### Headers - **Authorization** (string) - Required - Bearer token for authentication. ### Response #### Success Response (200) - **delta** (string) - The option's delta. - **gamma** (string) - The option's gamma. - **theta** (string) - The option's theta. - **vega** (string) - The option's vega. - **rho** (string) - The option's rho. - **impliedVolatility** (string) - The option's implied volatility. #### Response Example ```json { "delta": "0.65", "gamma": "0.02", "theta": "-0.15", "vega": "0.85", "rho": "0.45", "impliedVolatility": "0.25" } ``` ``` -------------------------------- ### Run a Preflight Order Check Source: https://public.com/api/docs/templates/publicdotcom-cli Validate an order defined in a JSON file before placing it. This command shows an estimated cost breakdown without submitting a live order. ```bash public order preflight-single --file order.json ``` -------------------------------- ### Get Account ID Source: https://public.com/api/docs/templates/place-bond-order Retrieve your account ID using the accounts endpoint. This is necessary for subsequent trading operations. ```shell curl --request GET \ --url https://api.public.com/userapigateway/trading/account \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```json { "accounts": [ { "accountId": "YOUR_ACCOUNT_ID", "accountType": "BOND_ACCOUNT", "optionsLevel": "NONE", "brokerageAccountType": "CASH", "tradePermissions": "BUY_AND_SELL" } ] } ``` -------------------------------- ### List All Linked Accounts Source: https://public.com/api/docs/templates/publicdotcom-cli Display a list of all brokerage accounts linked to your login. This is necessary to find account IDs for other commands. ```bash public accounts list ``` -------------------------------- ### Account ID Response Example Source: https://public.com/api/docs/templates/get-account-balance The response to the accounts endpoint provides a list of your available accounts, each with a unique account ID. ```json { "accounts": [ { "accountId": "YOUR_ACCOUNT_ID", "accountType": "BROKERAGE", "optionsLevel": "LEVEL_2", "brokerageAccountType": "MARGIN" } ] } ```