### Verify Installation with Health Check Source: https://github.com/elliottech/lighter-agent-kit/blob/main/README.md Runs the health check script from the installation directory to confirm the setup is functioning correctly. ```bash python3 scripts/health.py ``` -------------------------------- ### init / reset response JSON example Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/schemas-paper.md Response for init and reset commands. reset with no flags reuses the previous collateral and tier. ```json { "status": "ok", "collateral": 10000, "tier": "premium", "taker_fee_bps": 2.8, "maker_fee_bps": 0.4, "state_path": "/Users/you/.lighter/lighter-agent-kit/paper-state.json" } ``` -------------------------------- ### Perform Manual Installation Source: https://github.com/elliottech/lighter-agent-kit/blob/main/README.md Clones the repository manually and creates a symbolic link for Claude Code integration. ```bash git clone https://github.com/elliottech/lighter-agent-kit ~/.agents/skills/lighter-agent-kit ln -s ~/.agents/skills/lighter-agent-kit ~/.claude/skills/lighter-agent-kit # for Claude Code ``` -------------------------------- ### Install Lighter Agent Kit via CLI Source: https://github.com/elliottech/lighter-agent-kit/blob/main/README.md Use this command to install the Lighter Agent Kit into your compatible AI agent environment. ```bash curl -fsSL https://github.com/elliottech/lighter-agent-kit/releases/latest/download/install.sh | bash ``` -------------------------------- ### Run Lighter Agent Kit scripts Source: https://github.com/elliottech/lighter-agent-kit/blob/main/README.md Example commands for executing the query, trade, and paper simulation scripts from the agent skill directory. ```bash cd ~/.agents/skills/lighter-agent-kit python3 scripts/query.py market book BTC --limit 10 python3 scripts/trade.py order limit BTC --side long --amount 0.01 --price 60000 python3 scripts/paper.py init python3 scripts/paper.py order market BTC --side long --amount 0.1 ``` -------------------------------- ### market list output format Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/query.md Example of the JSON response structure returned by the market list command. ```json {"code": 200, "markets": [{"symbol": "ETH", "market_index": 0, "market_type": "perp"}]} ``` -------------------------------- ### AssetRegistry.configure_signer Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/assets.md Installs this deployment's scales on one SignerClient instance by setting ASSET_TO_TICKER_SCALE. ```APIDOC ## AssetRegistry.configure_signer ### Description Installs this deployment's scales on one SignerClient instance by setting ASSET_TO_TICKER_SCALE. ### Method Instance method ### Signature `configure_signer(client)` ### Parameters - **client** (lighter.SignerClient) - Required - The signer to configure ### Returns None ``` -------------------------------- ### Usage example — importing and using path functions Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/paths.md Shows how to import and use the path functions. Prints the credentials path, paper state path (with optional `LIGHTER_PAPER_STATE_PATH` override), and a hashed, normalized symbol cache path for a given host. ```python import sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from _paths import credentials_path, paper_state_path, symbol_cache_path print(credentials_path()) # ~/.lighter/lighter-agent-kit/credentials print(paper_state_path()) # ~/.lighter/lighter-agent-kit/paper-state.json (or $LIGHTER_PAPER_STATE_PATH) print(symbol_cache_path("HTTPS://MAINNET.ZKLIGHTER.ELLIOT.AI/")) # hashed, normalized ``` -------------------------------- ### Set API Credentials via Environment Variables Source: https://github.com/elliottech/lighter-agent-kit/blob/main/README.md Exports credentials directly for CI or manual setup. Environment variables take precedence over the credentials file. ```bash export LIGHTER_API_PRIVATE_KEY= export LIGHTER_ACCOUNT_INDEX= export LIGHTER_API_KEY_INDEX= ``` -------------------------------- ### Authenticated open orders query Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/query.md Retrieves open orders for ETH using environment variables for authentication. Includes an example of a failed request due to missing required arguments. ```bash export LIGHTER_API_PRIVATE_KEY=... LIGHTER_ACCOUNT_INDEX=41 LIGHTER_API_KEY_INDEX=5 python3 scripts/query.py orders open --symbol ETH # {"code": 200, "orders": [{"client_order_index": 79084886055, ...}]} python3 scripts/query.py orders open # no filter # {"error": "orders open requires --symbol or --market_index"} ``` -------------------------------- ### Usage example: using JsonArgumentParser and output() Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/cli.md Demonstrates importing the helpers, building a parser, and handling an argument error. The comment shows the JSON error envelope output for a missing argument value. ```python import sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from _cli import JsonArgumentParser, error, output parser = JsonArgumentParser(prog="demo") parser.add_argument("--limit", type=int, default=20) args = parser.parse_args(["--limit"]) # {"error": "argument --limit: expected one argument"} (exit 1) output({"status": "ok", "limit": args.limit}) ``` -------------------------------- ### market info response schema Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/schemas-read.md Example response for the `market info` command. Lists every market on the exchange. Note that `supported_size_decimals` and `supported_price_decimals` are used internally by `trade.py` to scale human prices/amounts into integer ticks/lots. The raw API uses `market_id` here, while the compact `market list` projection re-keys it as `market_index` to match the CLI flag. ```json { "code": 200, "order_books": [ { "symbol": "ETH", "market_id": 0, "market_type": "perp", // "perp" or "spot" "base_asset_id": 1, "quote_asset_id": 3, "status": "active", "taker_fee": "0.00045", "maker_fee": "0.00010", "liquidation_fee": "0.00500", "min_base_amount": "0.0001", "min_quote_amount": "10", "order_quote_limit": "1000000", "supported_size_decimals": 4, // amount precision "supported_price_decimals": 2, // price precision "supported_quote_decimals": 6 } ] } ``` -------------------------------- ### Run interactive configuration utility Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/diagnostics.md Launches the interactive configuration tool which writes credentials to ~/.lighter/lighter-agent-kit/credentials with 0600 permissions. ```bash ./lighter-config # interactive; writes ~/.lighter/lighter-agent-kit/credentials at mode 0600 ``` -------------------------------- ### ensure_lighter function implementation Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/sdk.md Bootstraps the lighter environment by ensuring dependencies are installed and available in the path. It includes a Python version guard, dependency installation via pip, and error handling that outputs JSON envelopes. ```python def ensure_lighter(): """Make `import lighter` work, pip-installing from requirements.lock on first run if needed. Everything lands in .vendor/pyX.Y/. On failure, prints a JSON error envelope to stdout and exits 1 so callers never see a Python traceback leak into the agent's context. """ if sys.version_info < MIN_PYTHON: ... sys.exit(1) _stub_eth_account() _prepend_vendor() try: import lighter return except ImportError: pass try: _install_deps() except subprocess.CalledProcessError as e: ... sys.exit(1) except PermissionError as e: ... sys.exit(1) _prepend_vendor() try: import lighter except ImportError as e: ... sys.exit(1) ``` -------------------------------- ### Configure credentials file Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/env-vars.md Define your credentials in the ~/.lighter/lighter-agent-kit/credentials file. Environment variables will override these values if both are set. ```text LIGHTER_API_PRIVATE_KEY=... LIGHTER_ACCOUNT_INDEX=... LIGHTER_API_KEY_INDEX=... LIGHTER_HOST=https://testnet.zklighter.elliot.ai ``` -------------------------------- ### Configure API Credentials via Helper Source: https://github.com/elliottech/lighter-agent-kit/blob/main/README.md Runs the configuration helper to securely store API keys and deployment settings in the credentials file. ```bash ./lighter-config ``` -------------------------------- ### Error response JSON example Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/schemas-write.md Example of the JSON error envelope returned on failure. The error message is the cleaned-up 'message' field from the API response. Errors always exit with code 1 and no Python traceback is emitted. ```json {"error": "order limit failed: not enough margin to create the order"} ``` -------------------------------- ### Resolve asset details with SignerClient Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/assets.md Demonstrates how to initialize a SignerClient and use resolve_asset to fetch asset information. Includes error handling for unknown assets. ```python import asyncio import lighter from _assets import resolve_asset async def main(): signer = lighter.SignerClient( url="https://mainnet.zklighter.elliot.ai", account_index=41, api_private_keys={5: "..."}, ) asset = await resolve_asset(signer, "collateral") # aliases USDC on Lighter print(asset.asset_id, asset.symbol, asset.decimals, asset.min_withdrawal_amount) try: await resolve_asset(signer, "XUSD") except ValueError as e: print({"error": str(e)}) # {"error": "unknown asset 'XUSD'; available assets: COLLATERAL, ..."} finally: await signer.api_client.close() asyncio.run(main()) ``` -------------------------------- ### Catching errors in shell workflows Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/errors.md Example of executing a script and parsing the error message from stdout if the command fails. ```bash out=$(python3 scripts/trade.py order market BTC --side long --amount 0.1 2>/dev/null) if ! echo "$out" | grep -q '"status"'; then echo "FAILED: $(echo "$out" | python3 -c 'import sys,json;print(json.load(sys.stdin)["error"])')" fi ``` -------------------------------- ### Run SDK bootstrap script Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/diagnostics.md Executes the bootstrap script to initialize the SDK and vendor directory. ```bash python3 scripts/bootstrap.py # {"status": "ok", "sdk_version": "1.x.y", "vendor_dir": "/home/user/.agents/skills/lighter-agent-kit/.vendor/py3.11"} ``` -------------------------------- ### set_tier response JSON example Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/schemas-paper.md Response for the set_tier command, showing updated tier and fee basis points. ```json { "status": "ok", "tier": "premium_3", "taker_fee_bps": 2.52, "maker_fee_bps": 0.36 } ``` -------------------------------- ### GET /api/v1/funding-rates Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/endpoints.md Fetches funding rates for markets. The rate is an 8-hour-equivalent funding rate normalized for cross-venue comparison. ```APIDOC ## GET /api/v1/funding-rates ### Description Fetches funding rates for markets. The rate is an 8-hour-equivalent funding rate normalized for cross-venue comparison. ### Method GET ### Endpoint /api/v1/funding-rates ### Parameters None ### Response #### Success Response (200) - **code** (int) - Response code. - **funding_rates** (array) - List of funding rate objects. #### Funding Rate Fields - **market_id** (int) - Market index. - **exchange** (str) - Exchange identifier. - **symbol** (str) - Market symbol. - **rate** (float) - 8-hour-equivalent funding rate. ### Response Example { "code": 200, "funding_rates": [ { "market_id": 1, "exchange": "lighter", "symbol": "ETH/USDC", "rate": 0.0001 } ] } ### Error Handling Non-200 status codes are surfaced as "API error {status}: {detail}". ``` -------------------------------- ### main() entry point Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/query.md Parses command-line arguments and routes requests. It special-cases the 'auth status' command for local execution and uses asyncio to run the main dispatcher for other commands. ```python def main(): args = build_parser().parse_args() if args.group == "auth" and args.action == "status": cmd_auth_status() return asyncio.run(run(args)) ``` -------------------------------- ### Initialize Paper Trading Environment Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/paper.md Initializes the paper trading session with specified collateral and tier settings. ```bash python3 scripts/paper.py init --collateral 5000 --tier premium_2 # {"status": "ok", "collateral": 5000.0, "tier": "premium_2", "taker_fee_bps": 2.66, ...} ``` -------------------------------- ### Handle margin position errors Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/trade.md Example of an error response when attempting to add margin to a position, returned as a JSON envelope. ```bash python3 scripts/trade.py position margin ETH --amount 100 --direction add # {"error": "position margin failed: invalid margin mode"} # cross-margin position ``` -------------------------------- ### fetch_market_decimals(client, market_index) - Get market decimals Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/trade.md Returns (size_decimals, price_decimals) from OrderApi.order_books(). Raises a JSON error when the market_index is not found. ```python async def fetch_market_decimals(client, market_index): """Return (size_decimals, price_decimals) for the given market.""" result = await client.order_api.order_books() for ob in result.order_books: if ob.market_id == market_index: return ob.supported_size_decimals, ob.supported_price_decimals error(f"market_index {market_index} not found") ``` -------------------------------- ### init Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/paper.md Creates a new paper trading account with specified collateral and fee tier. Fails if an account already exists. ```APIDOC ## init ### Description Creates a paper account via `new_paper_account(collateral)` and persists state. Fails with `paper account already exists; use paper.py reset to reinitialize` if state exists. ### Method CLI Command ### Endpoint `init` ### Parameters #### Arguments - `--collateral` (float) - Optional - Default: `10000` - Starting collateral - `--tier` (str) - Optional - Default: `"premium"` - Fee tier (`standard`…`premium_7`) ### Response #### Success Response - `status` (string) - Always "ok" - `collateral` (number) - Starting collateral - `tier` (string) - Fee tier - `taker_fee_bps` (number) - Taker fee in basis points - `maker_fee_bps` (number) - Maker fee in basis points - `state_path` (string) - Path to persisted state #### Response Example ```json {"status": "ok", "collateral": 10000, "tier": "premium", "taker_fee_bps": 2, "maker_fee_bps": 1, "state_path": "/path/to/state"} ``` ``` -------------------------------- ### AssetRegistry.__init__ Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/assets.md Initializes an AssetRegistry instance with an asset catalog and alias map. Validates that the catalog is not empty and that all aliases point to known assets. ```APIDOC ## AssetRegistry.__init__ ### Description Initializes an AssetRegistry instance with an asset catalog and alias map. Validates that the catalog is not empty and that all aliases point to known assets. ### Method Constructor ### Signature `__init__(assets, aliases)` ### Parameters - **assets** (list[AssetMetadata]) - Required - Deployment asset catalog - **aliases** (dict[str, int]) - Required - Uppercase alias → `asset_id` (from spot pairs and `COLLATERAL`) ### Raises - `ValueError("asset catalog is empty")` when no assets - `ValueError("asset alias points to an unknown asset")` when an alias references a missing asset ### Returns None ``` -------------------------------- ### GET /api/v1/orderBooks Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/endpoints.md Fetches the order book catalog or market list. Used for asset discovery and market information. No authentication required. ```APIDOC ## GET /api/v1/orderBooks ### Description Fetches the order book catalog or market list. Used for asset discovery and market information. ### Method GET ### Endpoint /api/v1/orderBooks ### Parameters #### Query Parameters - **filter** (str) - Optional - Filter to only spot books (e.g., "spot"). ### Response #### Success Response (200) - **code** (int) - Response code. - **order_books** (array) - List of order book objects. #### Order Book Fields - **symbol** (str) - Market symbol (e.g., "ETH" for perp, "ETH/USDC" for spot). - **market_id** (int) - Market index. - **market_type** (str) - "perp" or "spot". - **base_asset_id** (int) - Base asset reference. - **quote_asset_id** (int) - Quote asset reference. - **status** (str) - Market status (e.g., "active"). - **taker_fee** (str) - Taker fee rate. - **maker_fee** (str) - Maker fee rate. - **liquidation_fee** (str) - Liquidation fee rate. - **min_base_amount** (str) - Minimum base amount. - **min_quote_amount** (str) - Minimum quote amount. - **order_quote_limit** (str) - Order quote limit. - **supported_size_decimals** (int) - Size tick precision. - **supported_price_decimals** (int) - Price tick precision. - **supported_quote_decimals** (int) - Quote tick precision. ### Response Example { "code": 200, "order_books": [ { "symbol": "ETH/USDC", "market_id": 1, "market_type": "spot", "base_asset_id": 1, "quote_asset_id": 2, "status": "active", "taker_fee": "0.001", "maker_fee": "0.0005", "liquidation_fee": "0.01", "min_base_amount": "0.001", "min_quote_amount": "1", "order_quote_limit": "10000", "supported_size_decimals": 6, "supported_price_decimals": 2, "supported_quote_decimals": 6 } ] } ### Error Handling Non-200 status codes are surfaced as "API error {status}: {detail}". ``` -------------------------------- ### Run bootstrap.py SDK diagnostic Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/diagnostics.md Verifies the Lighter SDK loads and performs self-installation of dependencies if necessary. Outputs a JSON status object on success or an error envelope on failure. ```python #!/usr/bin/env python3 """Diagnostic: verify the lighter SDK loads, self-installing if needed. ... Exit 0 on success with {"status": "ok", "sdk_version": "1.x.y", "vendor_dir": "..."} Exit 1 on failure with the JSON error envelope from _sdk.ensure_lighter(). """ import json import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from _sdk import ensure_lighter, VENDOR_DIR # noqa: E402 ensure_lighter() import lighter # noqa: E402 def main(): print( json.dumps( { "status": "ok", "sdk_version": getattr(lighter, "__version__", "unknown"), "vendor_dir": VENDOR_DIR, } ) ) ``` -------------------------------- ### GET /api/v1/account-info Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/schemas-read.md Retrieves account information including balances, positions, and assets. Supports lookup by l1_address and optional inclusion of zero positions. ```APIDOC ## GET /api/v1/account-info ### Description Retrieves account information including balances, positions, and assets. Supports lookup by l1_address and optional inclusion of zero positions. ### Method GET ### Endpoint /api/v1/account-info ### Parameters #### Query Parameters - **l1_address** (string) - Optional - The L1 address to look up. If provided, returns the same shape but may include multiple accounts (master + sub-accounts). - **include_zero_positions** (boolean) - Optional - If true, returns all positions including zero-size ones. Default is false, which filters to currently-open positions. ### Response #### Success Response (200) - **code** (integer) - HTTP status code. - **total** (integer) - Total number of accounts returned. - **accounts** (array) - List of account objects. - **index** (integer) - Account index. - **l1_address** (string) - L1 address of the account. - **account_type** (integer) - Type of account. - **account_trading_mode** (integer) - Trading mode: 0 = Classic, 1 = Unified. - **status** (integer) - Account status. - **collateral** (string) - Collateral amount. - **available_balance** (string) - Available balance. - **total_order_count** (integer) - Total number of orders. - **pending_order_count** (integer) - Number of pending orders. - **positions** (array) - List of positions. By default, only open positions (non-zero size) are included. - **market_id** (integer) - Market identifier. - **symbol** (string) - Trading symbol. - **sign** (integer) - Position direction: 1 = long, -1 = short. - **position** (string) - Position size. - **avg_entry_price** (string) - Average entry price. - **position_value** (string) - Position value. - **unrealized_pnl** (string) - Unrealized profit and loss. - **realized_pnl** (string) - Realized profit and loss. - **liquidation_price** (string) - Liquidation price. - **margin_mode** (integer) - Margin mode: 0 = cross, 1 = isolated. - **allocated_margin** (string) - Allocated margin. - **initial_margin_fraction** (string) - Initial margin fraction. - **assets** (array) - List of assets. - **symbol** (string) - Asset symbol. - **asset_id** (integer) - Asset identifier. - **balance** (string) - Asset balance. - **locked_balance** (string) - Locked balance. - **margin_balance** (string) - Margin balance. - **margin_mode** (string) - Whether the asset is enabled as collateral (e.g., "enabled"). #### Response Example { "code": 200, "total": 1, "accounts": [ { "index": 41, "l1_address": "0x...", "account_type": 0, "account_trading_mode": 1, "status": 0, "collateral": "0.000000", "available_balance": "0.000000", "total_order_count": 0, "pending_order_count": 0, "positions": [ { "market_id": 0, "symbol": "ETH", "sign": 1, "position": "0.0000", "avg_entry_price": "0.00", "position_value": "0.000000", "unrealized_pnl": "0.000000", "realized_pnl": "0.000000", "liquidation_price": "0", "margin_mode": 0, "allocated_margin": "0.000000", "initial_margin_fraction": "5.00" } ], "assets": [ { "symbol": "SPY", "asset_id": 20, "balance": "3.000000", "locked_balance": "0.000000", "margin_balance": "1.500000", "margin_mode": "enabled" } ] } ] } ``` -------------------------------- ### reset Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/paper.md Wipes existing paper account state and starts fresh with optional new collateral and tier. Falls back to previous values or defaults if not provided. ```APIDOC ## reset ### Description Wipes state and starts fresh. With no state present, falls back to `10000` / `premium`. Response identical to `init`. ### Method CLI Command ### Endpoint `reset` ### Parameters #### Arguments - `--collateral` (float) - Optional - Default: `None` - New starting collateral; no-args form reuses previous - `--tier` (str) - Optional - Default: `None` - New fee tier; no-args form reuses previous ### Response #### Success Response - `status` (string) - Always "ok" - `collateral` (number) - Starting collateral - `tier` (string) - Fee tier - `taker_fee_bps` (number) - Taker fee in basis points - `maker_fee_bps` (number) - Maker fee in basis points - `state_path` (string) - Path to persisted state #### Response Example ```json {"status": "ok", "collateral": 10000, "tier": "premium", "taker_fee_bps": 2, "maker_fee_bps": 1, "state_path": "/path/to/state"} ``` ``` -------------------------------- ### build_signer_client() - Build and validate SignerClient Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/trade.md Resolves all three credentials (each individually validated — missing → JSON error, non-integer → JSON error), constructs lighter.SignerClient(url=host, account_index=…, api_private_keys={api_key_index: api_private_key.expose()}), runs client.check_client(), and returns the client. On failure the API client is closed before the error envelope. host comes from LIGHTER_HOST or DEFAULT_HOST. ```python async def build_signer_client(): """Build and validate a SignerClient from configured credentials.""" api_private_key = get_config_value("LIGHTER_API_PRIVATE_KEY") if not api_private_key: error( "missing LIGHTER_API_PRIVATE_KEY; set it as an env var or in your " "lighter-agent-kit credentials file" ) ... client = lighter.SignerClient( url=host, account_index=account_index, api_private_keys={api_key_index: api_private_key.expose()}, ) ... err = client.check_client() if err is not None: await client.api_client.close() error(f"client check failed: {err}") return client ``` -------------------------------- ### Fetch registry with _fetch_registry Source: https://github.com/elliottech/lighter-agent-kit/blob/main/_autodocs/api-reference/assets.md Constructs an AssetRegistry by gathering asset details and spot order books. It maps symbols and spot pair names to asset IDs, dropping ambiguous aliases. ```python async def _fetch_registry(api_client): import lighter order_api = lighter.OrderApi(api_client) details, books = await asyncio.gather( order_api.asset_details(), order_api.order_books(filter="spot"), ) assets = [AssetMetadata.from_api(asset) for asset in details.asset_details] asset_ids = {asset.asset_id for asset in assets} aliases = {} ambiguous = set() for asset in assets: _add_alias(aliases, ambiguous, asset.symbol, asset.asset_id) quote_asset_ids = set() for book in books.order_books: if book.market_type != "spot": continue pair = book.symbol.split("/", 1) if len(pair) != 2: continue if book.base_asset_id in asset_ids: _add_alias(aliases, ambiguous, pair[0], book.base_asset_id) if book.quote_asset_id in asset_ids: _add_alias(aliases, ambiguous, pair[1], book.quote_asset_id) quote_asset_ids.add(book.quote_asset_id) if len(quote_asset_ids) == 1: aliases["COLLATERAL"] = next(iter(quote_asset_ids)) return AssetRegistry(assets, aliases) ``` -------------------------------- ### status response JSON example Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/schemas-paper.md Response for the status command. total_pnl = (collateral - initial_collateral) + unrealized_pnl. Auto-refreshes mark prices; pass --no-refresh to use cached values. ```json { "status": "ok", "collateral": 9950.12, "initial_collateral": 10000, "tier": "premium", "taker_fee_bps": 2.8, "maker_fee_bps": 0.4, "unrealized_pnl": 25.0, "total_pnl": -24.88, "positions_count": 1, "trades_count": 2, "state_path": "/Users/you/.lighter/lighter-agent-kit/paper-state.json" } ``` -------------------------------- ### Account limits response Source: https://github.com/elliottech/lighter-agent-kit/blob/main/references/schemas-read.md Example response for the account limits endpoint. Shows the user tier, current fee ticks, and LLP-related fields. Note that `can_create_public_pool` is false for a standard tier. ```json { "code": 200, "user_tier": "standard", "user_tier_name": "standard", "current_maker_fee_tick": 0, "current_taker_fee_tick": 0, "max_llp_percentage": 100, "max_llp_amount": "0.000000", "leased_lit": "0.00000000", "effective_lit_stakes": "0.00000000", "can_create_public_pool": false } ```