# TradeHub > Perpetual futures trading for AI agents on the user's own exchange accounts, behind one risk gate with limits a person sets. Environment: sandbox. Exchanges: hyperliquid (testnet / demo), bybit (testnet / demo), binance (testnet / demo), okx (testnet / demo), sandbox (built-in play money at real prices). Symbols: BTC, ETH, SOL. Use TradeHub when an agent should place, size, check or close perpetual futures positions for a person, or compare prices and funding across exchanges. Every order needs a stop-loss, is previewed against the agent's permissions and the person's risk limits, and executes on the person's own exchange account. ## Connect - MCP (OAuth or API key): https://tradehub.tichat.net/mcp - MCP without an account (public market data, 60/min): https://tradehub.tichat.net/mcp/public - REST: https://tradehub.tichat.net/v1 (OpenAPI: https://tradehub.tichat.net/openapi.json) - Try trading now, no sign-up: POST https://tradehub.tichat.net/v1/trial returns a sandbox API key for 24 hours (10,000 USDC of play money); send it as Authorization: Bearer to the REST API or /mcp - Sign up (free sandbox, keys that last): https://tradehub.tichat.net/account/signup - Service description (JSON): https://tradehub.tichat.net/.well-known/tradehub.json - Tool reference, one page per tool: https://tradehub.tichat.net/docs - Agent skill (how to connect and trade safely; SKILL.md + references + a Python client): https://tradehub.tichat.net/skills/tradehub-trading.zip (files: https://tradehub.tichat.net/skills/index.json) ## Typical flow get_my_trading_permissions → size_position_by_risk → preview_perp_order (stop-loss required) → execute_previewed_order (with your client_order_id) → close_perp_position_reduce_only. A rejection carries error.suggested_args when a fix is certain, and error.human_action_url when only the person can act. Every executed open, close, cancel and stop returns a signed receipt (JWS, EdDSA) with the checks, preview price, fill, slippage, order ids and who the agent acts for; verify it with https://tradehub.tichat.net/.well-known/tradehub-receipts.jwks. ## Tools - get_my_trading_permissions: What this agent may do right now on TradeHub: autonomy level (read, propose = every order needs a person's approval, preauth = executes within limits), allowed venues, symbols and actions, per-trade and daily limits, today's usage, connected venues and whether trading is halted. Use first in every session and after any rejection that mentions your mandate. Not for account balances (use get_my_account_balances). No inputs. Limits are fractions of equity or USD. Only a person can widen them, on the Web, and widening waits 24 hours. Next: size_position_by_risk or get_my_open_positions. - get_my_account_balances: Equity, free margin, used margin and open profit or loss on every exchange account the user connected (Hyperliquid, Bybit, Binance, OKX, sandbox), and the total. Use to report balances or to compare free margin across exchanges. Not needed before opening: size_position_by_risk reads equity itself. Not for positions (use get_my_open_positions). No inputs. Amounts in USD (USDC / USDT count as USD). Next: get_my_open_positions. - get_my_open_positions: Every open perpetual futures position on every connected exchange account: side, size, entry, mark, open profit or loss, leverage, and the liquidation price with how far away it is. Use before closing, adjusting a stop or reporting exposure. Not for resting orders or stops (use get_my_open_orders). No inputs. Sizes in the base coin, prices in USD. Next: close_perp_position_reduce_only or get_my_open_orders. - get_my_open_orders: Resting orders on the user's exchange accounts, including protective stop-loss and take-profit orders (is_trigger = true), and trigger entries TradeHub holds (type TRIGGER_ENTRY, order_id req_…). Use to find an order_id to cancel or to confirm a stop is in place. Not for filled trades (use get_my_trade_history). Inputs: optional venue and symbol filters. Sizes in the base coin, prices in USD. Next: cancel_open_order(order_id). - get_my_risk_limits_usage: The person's global risk limits (per-trade risk, daily / weekly / monthly loss, drawdown, leverage, open positions) and how much of each is used, across all exchanges, plus limit increases waiting to take effect. Use when a trade was rejected by a user-level limit or before planning several trades. Not for this agent's own permissions (use get_my_trading_permissions). No inputs. Fractions of equity and USD; real money and the sandbox are counted separately. Next: size_position_by_risk. - get_my_trade_history: Recent trades opened through TradeHub with entry, stop, take-profit, leverage and realised profit or loss. Third-party apps see only the trades they opened; the user's own keys see all. Use for reviews and reports. Not for live positions (use get_my_open_positions). Input: limit (1-200). Sizes in the base coin, money in USD. Next: get_my_open_positions. - get_my_agent_performance: How this agent has done: trades opened and closed, wins, realised profit or loss in USD, and its most common refusals with what to do differently, over the last N days. Use at the start of a session or after a run of rejections, to avoid repeating mistakes. Not for the trades themselves (use get_my_trade_history). Input: days (1-90). Only this agent's own record; a person sees all agents together. Next: get_my_trading_permissions. - get_order_request_status: The current state of an order request made with execute_previewed_order: pending_approval, executed, rejected, failed, expired or declined, with fill price and stop order id once executed. Use to follow an order that was waiting for a person's approval. Not for listing orders (use get_my_open_orders). Input: request_id. Next: get_my_open_positions once executed. - get_perp_contract_rules (public): Rules and current funding for one perpetual futures contract on one exchange: mark price, size step, minimum size, price tick, maximum leverage, funding rate per interval and annualised. Use when a limit price or leverage must fit the venue; not needed for market orders (sizing and preview round for you). Not for comparing exchanges (use compare_perp_quotes_across_venues or compare_funding_rates_across_venues). Inputs: symbol (base coin, e.g. BTC), venue (without an account: hyperliquid only). Prices in USD per coin, sizes in the base coin, rates as fractions. Next: size_position_by_risk. - get_order_book (public): Order book levels for one perpetual futures contract on one exchange, best first, as [price, size]. Use to judge liquidity before a large market order. Not for the best price across exchanges (use compare_perp_quotes_across_venues). Inputs: symbol, venue (without an account: hyperliquid only), depth (1-50 levels). Prices in USD per coin, sizes in the base coin. Next: preview_perp_order. - compare_perp_quotes_across_venues (public): Use to choose where to trade one perpetual futures coin: bid, ask, spread, trading fee (your account's rate if the exchange reports it, else the published one) and measured execution over 7 days, per exchange (with an account, also the sandbox). With side (and size_base or notional_usd): ranked by price plus taker fee plus a cost for poor execution; hold_hours adds funding, exit fee. With an account it shows which venues you may use and can afford; best_venue is the cheapest. Not for one venue's depth (use get_order_book). No rebates. Next: preview_perp_order with that venue, or venue "best". - compare_funding_rates_across_venues (public): Current perpetual futures funding rate for one coin on every exchange TradeHub supports, per interval and annualised, with the age of each reading. Use when choosing where to hold a long or a short, or to check a funding spread. Not a forecast: rates change every interval. Input: symbol (base coin). Rates are fractions; positive means longs pay shorts. Sorted by annualised rate, highest first; TradeHub takes no rebates from any exchange. Next: get_perp_contract_rules(venue, symbol) or size_position_by_risk. - get_venue_health (public): Whether each exchange is reachable right now: TradeHub's public price feed per exchange, and, with an account, each connected exchange account's latency, last error and rate-limit headroom. Use after a VENUE_UNAVAILABLE error or before trading on an exchange that misbehaved. Not for prices (use compare_perp_quotes_across_venues). No inputs. Next: retry the failed call, or use another venue. - get_technical_indicators_15m (public): RSI, MACD, Bollinger %B, ATR, EMA trend and volume rank on Hyperliquid's 15-minute candles for one coin, plus the current funding rate. Use as inputs to your own decision; it is not a trading recommendation. ATR is useful for placing a stop. Not for live quotes (use compare_perp_quotes_across_venues). Input: symbol (base coin). Prices in USD per coin. Next: size_position_by_risk. - get_price_candles (public): Price history for one coin as candles: open, high, low, close and volume per interval (1m, 5m, 15m, 1h, 4h, 1d), up to 500, oldest first, from Hyperliquid's public market, the same prices the sandbox trades at. Use to look back at price action, find recent highs and lows for a stop, or judge the trend. Not for the live best price (use compare_perp_quotes_across_venues) or ready-made indicators (use get_technical_indicators_15m). Inputs: symbol (base coin), interval (default 1h), limit (default 100). Prices in USD per coin, volume in the base coin, times UTC. Next: size_position_by_risk. - size_position_by_risk: Turns "risk 1% of equity, stop 2% below" into a size in the base coin, rounded down to the venue step and capped by every limit (this agent's, the person's and TradeHub's). Reads equity, mark and contract rules itself: no need for get_my_account_balances or get_perp_contract_rules first. Use before every preview_perp_order. Not an order: nothing is sent. Inputs: symbol, stop_loss (USD) or stop_pct with side, risk_pct or risk_usd (default: the most allowed), venue, entry_price (default: mark), leverage. Next: preview_perp_order with the returned size_base, stop_loss and leverage. - preview_perp_order: Check a perpetual futures order with its stop-loss (optional take-profit) against this agent's permissions, the person's limits and the price band, sending nothing. Use before every new position, also one that waits for a price (trigger_price). Not for closing (use close_perp_position_reduce_only). size_base (base coin): from size_position_by_risk; the stop: stop_loss (USD) or stop_pct. Returns preview_id (valid 30 s), notional, risk, margin, likely fill and every check; a rejection names the failing check and, when a fix is certain, suggested_args. Next: execute_previewed_order(preview_id). - execute_previewed_order: Execute a preview from preview_perp_order: re-checked at a fresh price, then sent to the exchange with its stop-loss placed there. Use only after a successful preview. Not for new or changed orders (preview again). If a person must approve (propose level, or no trade:execute scope) it waits; wait_seconds (0-30) holds the call open for the decision. Inputs: preview_id, client_order_id (idempotency key: repeating it returns the first result). A fill cannot be undone; the remedy is close_perp_position_reduce_only. Next: get_order_request_status(request_id) while pending. - cancel_open_order: Cancel one resting order on an exchange. Use to withdraw an unfilled limit order or a take-profit. A held position's stop-loss cannot be cancelled (move it with a new stop or close the position): this keeps every position protected. Not for closing positions (use close_perp_position_reduce_only). Inputs: order_id (from get_my_open_orders), symbol, venue. Works while trading is halted. Next: get_my_open_orders. - tighten_stop_loss: Move a held position's stop-loss closer to the current price, e.g. to breakeven or to lock in profit: the new stop is placed first, then the old one is cancelled, so the position is never unprotected. Use when the user asks to raise a long's stop or lower a short's. Not for widening a stop (never allowed while the position is open) or for closing (use close_perp_position_reduce_only). Inputs: symbol, stop_loss (USD per coin), venue. Works while trading is halted. Next: get_my_open_orders to see the new stop. - set_take_profit_levels: Replace a held position's take-profits: one level or several (e.g. 50% at 98000, the rest at 101000), each a reduce-only trigger on the exchange, so it can only shrink the position. Use after entry, or to move or remove them ([] removes all). Not for the stop-loss (use tighten_stop_loss) or for closing now (use close_perp_position_reduce_only). Inputs: symbol, levels [{price, close_pct}], venue. New orders are placed before the old ones go. Works while trading is halted. Next: get_my_open_orders. - set_stop_loss_rule: Make a held position's stop-loss move by itself, only ever toward the price: trailing (it follows the best price at trail_pct behind it) or breakeven (it moves to the entry once the price reaches activate_at). TradeHub checks about every 5 seconds; each move follows tighten_stop_loss's rules and is audited. Use to lock in profit on a winning position. One rule per position: a new one replaces it, kind=none removes it, it ends when the position closes. Not for a one-off move (use tighten_stop_loss). Next: get_my_open_positions shows the rule. - close_perp_position_reduce_only: Close all or part of a perpetual futures position with a reduce-only market order, so it can never open or flip a position. Use to take profit, cut a loss or reduce exposure; it is also the only way to undo a filled order. Third-party apps can close only positions they opened. Not for cancelling resting orders (use cancel_open_order). Inputs: symbol, venue, close_pct (1-100, default 100). Works while trading is halted. Next: get_my_open_positions. - stop_all_trading_now: Emergency stop for the whole account: cancel every resting order, close every position on every exchange with reduce-only orders, and block new positions. Use only when the person asks to stop everything or something is clearly wrong. Only a person can resume, on the Web with a verification code; third-party apps never get this permission. Not for closing one position (use close_perp_position_reduce_only). Input: reason. Next: get_my_open_positions to confirm nothing is left. ## Limits - 20,000 requests a day per account; closing, cancelling and the emergency stop are never limited. - Default per-trade risk 1% of equity; platform caps: leverage 50x, risk 2% per trade. - Only the person can widen limits, on the Web; widening waits 24 hours. ## Pricing - Sandbox and market data: free. Live: monthly subscription or per traded notional, the user's choice (prices not published yet). ## Neutrality - TradeHub takes no rebates or referral fees from any venue; order and defaults follow only the stated ranking_basis. ## TradeHub does not - hold customer funds or keys that can withdraw (exchange keys with withdrawal rights are refused) - give trading advice (indicators are inputs, not recommendations) - undo a filled order (the remedy is a reduce-only close) - let an agent widen its own limits (only the person, on the Web, and widening waits 24 hours) - take rebates or referral fees from any exchange