{
  "schemaVersion": "1.0",
  "item": {
    "slug": "vincent-trading-engine",
    "name": "Vincent - Trading Engine",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/glitch003/vincent-trading-engine",
    "canonicalUrl": "https://clawhub.ai/glitch003/vincent-trading-engine",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/vincent-trading-engine",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=vincent-trading-engine",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/vincent-trading-engine"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/vincent-trading-engine",
    "agentPageUrl": "https://openagent3.xyz/skills/vincent-trading-engine/agent",
    "manifestUrl": "https://openagent3.xyz/skills/vincent-trading-engine/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/vincent-trading-engine/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Vincent Trading Engine - Strategy-Driven Automated Trading",
        "body": "Use this skill to create and manage automated trading strategies for Polymarket prediction markets and HyperLiquid perpetuals/spot. The Trading Engine combines driver-based monitoring (web search, Twitter, newswire, price feeds) with a signal pipeline and LLM-powered decision-making to automatically trade based on your thesis. It also includes standalone stop-loss, take-profit, and trailing stop rules that work without the LLM.\n\nAll commands use the @vincentai/cli package."
      },
      {
        "title": "How It Works",
        "body": "The Trading Engine is a unified system with two modes:\n\nLLM-Powered Strategies — Create a versioned strategy with a structured thesis, weighted drivers (web search keywords, Twitter accounts, newswire topics, price triggers), and an escalation policy. When drivers detect new information, signals are scored and batched. When the escalation threshold is met, an LLM (Claude via OpenRouter) evaluates the signals against your thesis and decides whether to trade, update the thesis, set protective orders, or alert you.\nStandalone Trade Rules — Set stop-loss, take-profit, and trailing stop rules on positions. These execute automatically when price conditions are met — no LLM involved.\n\nArchitecture:\n\nIntegrated into the Vincent backend (no separate service to run)\nStrategy endpoints under /api/skills/polymarket/strategies/...\nTrade rule endpoints under /api/skills/polymarket/rules/...\nHyperLiquid rules use venue: \"hyperliquid\" and route through the HL adapter\nUses the same API key as the Polymarket or HyperLiquid skill (depending on venue)\nAll trades go through Vincent's policy-enforced pipeline\nLLM costs are metered and deducted from the user's credit balance\nEvery LLM invocation is recorded with full audit trail (tokens, cost, actions, duration)"
      },
      {
        "title": "Security Model",
        "body": "LLM cannot bypass policies — all trades go through the venue's policy-enforced skill (polymarketSkill.placeBet() or hyperliquidSkill.trade()) which enforces spending limits, approval thresholds, and allowlists\nBackend-side LLM key — the OpenRouter API key never leaves the server. Agents and users cannot invoke the LLM directly\nCredit gating — no LLM invocation without sufficient credit balance\nTool constraints — the LLM's available tools are controlled by the strategy's config.tools settings. If canTrade: false, the trade tool is not provided\nRate limiting — max concurrent LLM invocations is capped to prevent runaway costs\nAudit trail — every invocation is recorded with full prompt, response, actions, cost, and duration\nNo private keys — the Trading Engine uses the Vincent API for all trades. Private keys stay on Vincent's servers"
      },
      {
        "title": "Core Concepts",
        "body": "Instrument: A tradeable asset on a venue. Defined by id, type (stock, perp, swap, binary, option), venue, and optional constraints (leverage, margin, liquidity, fees).\nThesis: Your directional view — estimate (target price/value), direction (long/short/neutral), confidence (0–1), and reasoning.\nDriver: A named information source that feeds the signal pipeline. Each driver has a weight, direction (bullish/bearish/contextual), and monitoring config (entities, keywords, embedding anchor, sources, polling interval).\nEscalation Policy: Controls when the LLM is woken up. signalScoreThreshold (minimum score to batch), highConfidenceThreshold (score that triggers immediate wake), maxWakeFrequency (e.g. \"1 per 15m\"), batchWindow (e.g. \"5m\").\nTrade Rules: Entry rules (min edge, order type), exit rules (thesis invalidation triggers), auto-actions (stop-loss, take-profit, trailing stop, price delta triggers), and sizing rules (method, max position, portfolio %, max trades/day)."
      },
      {
        "title": "Signal Pipeline",
        "body": "Strategies process information through a 6-layer pipeline:\n\nIngest — Raw data from driver sources (web search, Twitter, newswire, price feeds, RSS, Reddit, on-chain, filings, options flow)\nFilter — Deduplication and relevance filtering. Drops signals already seen or below quality threshold\nScore — Each signal is scored (0–1) based on driver weight, embedding similarity to the anchor, and entity/keyword matches\nEscalate — Scored signals are batched according to the escalation policy. Low-score signals accumulate in a batch window; high-confidence signals trigger immediate LLM wake\nLLM — The LLM evaluates batched signals against the current thesis. It can update the thesis, issue trade decisions, update driver states, or take no action\nExecute — Trade decisions pass through policy enforcement and are routed to the appropriate venue adapter for execution"
      },
      {
        "title": "Strategy Lifecycle",
        "body": "Strategies follow a versioned lifecycle: DRAFT → ACTIVE → PAUSED → ARCHIVED\n\nDRAFT: Can be edited. Not yet monitoring or invoking the LLM.\nACTIVE: Drivers are running. New signals trigger the pipeline.\nPAUSED: Monitoring is stopped. Can be resumed.\nARCHIVED: Permanently stopped. Cannot be reactivated.\n\nTo iterate on a strategy, duplicate it as a new version (creates a new DRAFT with incremented version number and the same config)."
      },
      {
        "title": "Create a Strategy",
        "body": "npx @vincentai/cli@latest trading-engine create-strategy \\\n  --key-id <KEY_ID> \\\n  --name \"BTC Momentum\" \\\n  --config '{\n    \"instruments\": [\n      { \"id\": \"btc-usd-perp\", \"type\": \"perp\", \"venue\": \"polymarket\" },\n      { \"id\": \"BTC\", \"type\": \"perp\", \"venue\": \"hyperliquid\" }\n    ],\n    \"thesis\": {\n      \"estimate\": 105000,\n      \"direction\": \"long\",\n      \"confidence\": 0.7,\n      \"reasoning\": \"ETF inflows accelerating, halving supply shock imminent\"\n    },\n    \"drivers\": [\n      {\n        \"name\": \"ETF Flow Monitor\",\n        \"weight\": 2.0,\n        \"direction\": \"bullish\",\n        \"monitoring\": {\n          \"entities\": [\"BlackRock\", \"Fidelity\"],\n          \"keywords\": [\"bitcoin ETF\", \"BTC inflow\"],\n          \"embeddingAnchor\": \"Bitcoin ETF institutional inflows\",\n          \"sources\": [\"web_search\", \"newswire\"]\n        }\n      },\n      {\n        \"name\": \"Crypto Twitter\",\n        \"weight\": 1.0,\n        \"direction\": \"contextual\",\n        \"monitoring\": {\n          \"entities\": [\"@BitcoinMagazine\", \"@saborskycnbc\"],\n          \"keywords\": [\"bitcoin\", \"BTC\"],\n          \"sources\": [\"twitter\"]\n        }\n      }\n    ],\n    \"escalation\": {\n      \"signalScoreThreshold\": 0.3,\n      \"highConfidenceThreshold\": 0.8,\n      \"maxWakeFrequency\": \"1 per 15m\",\n      \"batchWindow\": \"5m\"\n    },\n    \"tradeRules\": {\n      \"entry\": { \"minEdge\": 0.05, \"orderType\": \"limit\", \"limitOffset\": 0.01 },\n      \"autoActions\": { \"stopLoss\": -0.10, \"takeProfit\": 0.25, \"trailingStop\": -0.05 },\n      \"exit\": { \"thesisInvalidation\": [\"ETF outflows exceed $500M/week\"] },\n      \"sizing\": {\n        \"method\": \"edgeScaled\",\n        \"maxPosition\": 500,\n        \"maxPortfolioPct\": 20,\n        \"maxTradesPerDay\": 5,\n        \"minTimeBetweenTrades\": \"30m\"\n      }\n    },\n    \"notifications\": {\n      \"onTrade\": true,\n      \"onThesisChange\": true,\n      \"channel\": \"none\"\n    }\n  }'\n\nParameters:\n\n--name: Strategy name\n--config: Full strategy config JSON (see Core Concepts above for structure)\n--data-source-secret-id: Optional DATA_SOURCES secret ID for driver monitoring API calls\n--poll-interval: Polling interval in minutes for driver monitoring (default: 15)"
      },
      {
        "title": "List Strategies",
        "body": "npx @vincentai/cli@latest trading-engine list-strategies --key-id <KEY_ID>"
      },
      {
        "title": "Get Strategy Details",
        "body": "npx @vincentai/cli@latest trading-engine get-strategy --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Update a Strategy",
        "body": "Update a DRAFT strategy. Pass only the fields you want to change — config is a partial object.\n\nnpx @vincentai/cli@latest trading-engine update-strategy --key-id <KEY_ID> --strategy-id <STRATEGY_ID> \\\n  --name \"Updated Name\" --config '{ \"thesis\": { \"confidence\": 0.8, \"reasoning\": \"Updated reasoning\" } }'\n\nParameters:\n\n--strategy-id: Strategy ID (required)\n--name: New strategy name\n--config: Partial strategy config JSON — only include fields to update\n--data-source-secret-id: DATA_SOURCES secret ID\n--poll-interval: New polling interval in minutes"
      },
      {
        "title": "Activate a Strategy",
        "body": "Starts driver monitoring and signal pipeline processing. Strategy must be in DRAFT status.\n\nnpx @vincentai/cli@latest trading-engine activate --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Pause a Strategy",
        "body": "Stops monitoring. Strategy must be ACTIVE.\n\nnpx @vincentai/cli@latest trading-engine pause --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Resume a Strategy",
        "body": "Resumes monitoring. Strategy must be PAUSED.\n\nnpx @vincentai/cli@latest trading-engine resume --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Archive a Strategy",
        "body": "Permanently stops a strategy. Cannot be undone.\n\nnpx @vincentai/cli@latest trading-engine archive --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Duplicate a Strategy (New Version)",
        "body": "Creates a new DRAFT with the same config, incremented version number, and a link to the parent version.\n\nnpx @vincentai/cli@latest trading-engine duplicate-strategy --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "View Version History",
        "body": "See all versions of a strategy lineage.\n\nnpx @vincentai/cli@latest trading-engine versions --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "View LLM Invocation History",
        "body": "See the LLM decision log for a strategy — what data triggered it, what the LLM decided, what actions were taken, and the cost.\n\nnpx @vincentai/cli@latest trading-engine invocations --key-id <KEY_ID> --strategy-id <STRATEGY_ID> --limit 20"
      },
      {
        "title": "View Cost Summary",
        "body": "See aggregate LLM costs for all strategies under a secret.\n\nnpx @vincentai/cli@latest trading-engine costs --key-id <KEY_ID>"
      },
      {
        "title": "View Performance Metrics",
        "body": "See performance metrics for a strategy: P&L, win rate, trade count, and per-instrument breakdown.\n\nnpx @vincentai/cli@latest trading-engine performance --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Driver Configuration",
        "body": "Web Search Drivers\n\nAdd a driver with \"sources\": [\"web_search\"]. The engine periodically searches Brave for the driver's keywords and triggers the signal pipeline when new results appear.\n\n{\n  \"name\": \"AI News Monitor\",\n  \"weight\": 1.5,\n  \"direction\": \"bullish\",\n  \"monitoring\": {\n    \"keywords\": [\"AI tokens\", \"GPU shortage\", \"prediction market regulation\"],\n    \"embeddingAnchor\": \"AI technology investment trends\",\n    \"sources\": [\"web_search\"]\n  }\n}\n\nEach keyword is searched independently. Results are deduplicated — the same URLs won't trigger the pipeline twice.\n\nTwitter Drivers\n\nAdd a driver with \"sources\": [\"twitter\"]. The engine periodically checks the specified entities for new tweets.\n\n{\n  \"name\": \"Crypto Twitter\",\n  \"weight\": 1.0,\n  \"direction\": \"contextual\",\n  \"monitoring\": {\n    \"entities\": [\"@DeepSeek\", \"@nvidia\", \"@OpenAI\"],\n    \"keywords\": [\"AI\", \"GPU\"],\n    \"sources\": [\"twitter\"]\n  }\n}\n\nTweets are deduplicated by tweet ID — only genuinely new tweets trigger the pipeline.\n\nNewswire Drivers (Finnhub)\n\nAdd a driver with \"sources\": [\"newswire\"]. The engine periodically polls Finnhub's market news API and triggers the pipeline when new headlines matching your keywords appear.\n\n{\n  \"name\": \"Market News\",\n  \"weight\": 1.5,\n  \"direction\": \"contextual\",\n  \"monitoring\": {\n    \"keywords\": [\"artificial intelligence\", \"GPU shortage\", \"semiconductor\"],\n    \"sources\": [\"newswire\"]\n  }\n}\n\nHeadlines and summaries are matched case-insensitively. Articles are deduplicated by headline hash with a sliding window.\n\nNote: Requires a FINNHUB_API_KEY env var on the server. Finnhub's free tier allows 60 API calls/min. No per-call credit deduction.\n\nPrice Triggers\n\nPrice triggers are evaluated in real-time via the Polymarket WebSocket feed. When a price condition is met, the signal pipeline is invoked with the price data.\n\nTrigger types:\n\nABOVE — triggers when price exceeds a threshold\nBELOW — triggers when price drops below a threshold\nCHANGE_PCT — triggers on a percentage change from reference price\n\nPrice triggers are one-shot: once fired, they're marked as consumed. The LLM can create new triggers if needed."
      },
      {
        "title": "Thesis Best Practices",
        "body": "The thesis is your structured directional view. Good theses include:\n\nA clear estimate: Target price or value the market should reach\nA confidence level: Start at 0.5–0.7 and let the LLM adjust as new data arrives\nSpecific reasoning: \"ETF inflows accelerating, halving supply shock imminent\" is better than \"BTC will go up\"\nExplicit invalidation conditions: Use tradeRules.exit.thesisInvalidation to define what would break your thesis"
      },
      {
        "title": "LLM Available Tools",
        "body": "When the LLM is invoked, it can use these tools (depending on strategy config):\n\nToolDescriptionRequiresplace_tradeBuy or sell a positioncanTrade: true in trade rulesset_stop_lossSet a stop-loss rule on a positioncanSetRules: true in trade rulesset_take_profitSet a take-profit rulecanSetRules: true in trade rulesset_trailing_stopSet a trailing stopcanSetRules: true in trade rulesalert_userSend an alert without tradingAlways availableno_actionDo nothing (with reasoning)Always available"
      },
      {
        "title": "Cost Tracking",
        "body": "Every LLM invocation is metered:\n\nToken costs: Input and output tokens are priced per the model's rate\nDeducted from credit balance: Same pool as data source credits (dataSourceCreditUsd)\nPre-flight check: If insufficient credit, the invocation is skipped and logged\nData source costs: Brave Search ($0.005/call) and Twitter ($0.005-$0.01/call) are also metered. Finnhub newswire calls are free (no credit deduction)\n\nTypical LLM invocation cost: $0.05–$0.30 depending on context size."
      },
      {
        "title": "Part 2: Standalone Trade Rules",
        "body": "Trade rules execute automatically when price conditions are met — no LLM involved. These are stop-loss, take-profit, and trailing stop rules that protect your positions."
      },
      {
        "title": "Check Worker Status",
        "body": "npx @vincentai/cli@latest trading-engine status --key-id <KEY_ID>\n# Returns: worker status, active rules count, last sync time, circuit breaker state"
      },
      {
        "title": "Create a Stop-Loss Rule",
        "body": "Automatically sell a position if price drops below a threshold:\n\n# Polymarket — triggerPrice is 0–1 (outcome token price)\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0x123... --token-id 456789 \\\n  --rule-type STOP_LOSS --trigger-price 0.40\n\n# HyperLiquid — triggerPrice is absolute USD price, marketId and tokenId are the coin name\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id BTC --token-id BTC \\\n  --rule-type STOP_LOSS --trigger-price 95000\n\nParameters:\n\n--venue: polymarket (default) or hyperliquid\n--market-id: Polymarket condition ID, or coin name for HyperLiquid (e.g. BTC, ETH)\n--token-id: Polymarket outcome token ID, or coin name for HyperLiquid\n--rule-type: STOP_LOSS (sells if price <= trigger), TAKE_PROFIT (sells if price >= trigger), or TRAILING_STOP\n--trigger-price: Price threshold — 0 to 1 for Polymarket, absolute USD price for HyperLiquid"
      },
      {
        "title": "Create a Take-Profit Rule",
        "body": "Automatically sell a position if price rises above a threshold:\n\n# Polymarket\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0x123... --token-id 456789 \\\n  --rule-type TAKE_PROFIT --trigger-price 0.75\n\n# HyperLiquid\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id ETH --token-id ETH \\\n  --rule-type TAKE_PROFIT --trigger-price 4500"
      },
      {
        "title": "Create a Trailing Stop Rule",
        "body": "A trailing stop moves the stop price up as the price rises:\n\n# Polymarket\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0x123... --token-id 456789 \\\n  --rule-type TRAILING_STOP --trigger-price 0.45 --trailing-percent 5\n\n# HyperLiquid\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id SOL --token-id SOL \\\n  --rule-type TRAILING_STOP --trigger-price 170 --trailing-percent 5\n\nTrailing stop behavior:\n\n--trailing-percent is percent points (e.g. 5 = 5%)\nComputes candidateStop = currentPrice * (1 - trailingPercent/100)\nIf candidateStop > current triggerPrice, updates triggerPrice\ntriggerPrice never moves down\nRule triggers when currentPrice <= triggerPrice"
      },
      {
        "title": "List Rules",
        "body": "# All rules\nnpx @vincentai/cli@latest trading-engine list-rules --key-id <KEY_ID>\n\n# Filter by status\nnpx @vincentai/cli@latest trading-engine list-rules --key-id <KEY_ID> --status ACTIVE"
      },
      {
        "title": "Update a Rule",
        "body": "npx @vincentai/cli@latest trading-engine update-rule --key-id <KEY_ID> --rule-id <RULE_ID> --trigger-price 0.45"
      },
      {
        "title": "Cancel a Rule",
        "body": "npx @vincentai/cli@latest trading-engine delete-rule --key-id <KEY_ID> --rule-id <RULE_ID>"
      },
      {
        "title": "View Monitored Positions",
        "body": "npx @vincentai/cli@latest trading-engine positions --key-id <KEY_ID>"
      },
      {
        "title": "View Event Log",
        "body": "# All events\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID>\n\n# Events for specific rule\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID> --rule-id <RULE_ID>\n\n# Paginated\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID> --limit 50 --offset 100\n\nEvent types:\n\nRULE_CREATED — Rule was created\nRULE_TRAILING_UPDATED — Trailing stop moved triggerPrice upward\nRULE_EVALUATED — Worker checked the rule against current price\nRULE_TRIGGERED — Trigger condition was met\nACTION_PENDING_APPROVAL — Trade requires human approval, rule paused\nACTION_EXECUTED — Trade executed successfully\nACTION_FAILED — Trade execution failed\nRULE_CANCELED — Rule was manually canceled"
      },
      {
        "title": "Rule Statuses",
        "body": "ACTIVE — Rule is live and being monitored\nTRIGGERED — Condition was met, trade executed\nPENDING_APPROVAL — Trade requires human approval; rule paused\nCANCELED — Manually canceled before triggering\nFAILED — Triggered but trade execution failed"
      },
      {
        "title": "Step 1: Place a bet with the Polymarket skill",
        "body": "npx @vincentai/cli@latest polymarket bet --key-id <KEY_ID> --token-id 123456789 --side BUY --amount 10 --price 0.55"
      },
      {
        "title": "Step 2: Create a strategy to monitor the thesis",
        "body": "npx @vincentai/cli@latest trading-engine create-strategy --key-id <KEY_ID> \\\n  --name \"Bitcoin Bull Thesis\" \\\n  --config '{\n    \"instruments\": [\n      { \"id\": \"123456789\", \"type\": \"binary\", \"venue\": \"polymarket\" }\n    ],\n    \"thesis\": {\n      \"estimate\": 0.85,\n      \"direction\": \"long\",\n      \"confidence\": 0.7,\n      \"reasoning\": \"Bitcoin is likely to break $100k on ETF inflows\"\n    },\n    \"drivers\": [\n      {\n        \"name\": \"ETF News\",\n        \"weight\": 2.0,\n        \"direction\": \"bullish\",\n        \"monitoring\": {\n          \"keywords\": [\"bitcoin ETF inflows\", \"bitcoin institutional\"],\n          \"sources\": [\"web_search\", \"newswire\"]\n        }\n      },\n      {\n        \"name\": \"Crypto Twitter\",\n        \"weight\": 1.0,\n        \"direction\": \"contextual\",\n        \"monitoring\": {\n          \"entities\": [\"@BitcoinMagazine\", \"@saborskycnbc\"],\n          \"sources\": [\"twitter\"]\n        }\n      }\n    ],\n    \"escalation\": {\n      \"signalScoreThreshold\": 0.3,\n      \"highConfidenceThreshold\": 0.8,\n      \"maxWakeFrequency\": \"1 per 15m\",\n      \"batchWindow\": \"5m\"\n    },\n    \"tradeRules\": {\n      \"entry\": { \"minEdge\": 0.05 },\n      \"autoActions\": { \"stopLoss\": -0.15, \"takeProfit\": 0.30, \"trailingStop\": -0.05 },\n      \"exit\": { \"thesisInvalidation\": [\"ETF outflows accelerate above $500M/week\"] },\n      \"sizing\": { \"method\": \"edgeScaled\", \"maxPosition\": 100, \"maxPortfolioPct\": 20, \"maxTradesPerDay\": 5 }\n    }\n  }' \\\n  --poll-interval 10"
      },
      {
        "title": "Step 3: Set a standalone stop-loss as immediate protection",
        "body": "npx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0xabc... --token-id 123456789 \\\n  --rule-type STOP_LOSS --trigger-price 0.40"
      },
      {
        "title": "Step 4: Activate the strategy",
        "body": "npx @vincentai/cli@latest trading-engine activate --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Step 5: Monitor activity",
        "body": "# Check strategy invocations\nnpx @vincentai/cli@latest trading-engine invocations --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\n# Check trade rule events\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID>\n\n# Check costs\nnpx @vincentai/cli@latest trading-engine costs --key-id <KEY_ID>\n\n# Check performance\nnpx @vincentai/cli@latest trading-engine performance --key-id <KEY_ID> --strategy-id <STRATEGY_ID>"
      },
      {
        "title": "Step 1: Open a perp position with the HyperLiquid skill",
        "body": "npx @vincentai/cli@latest hyperliquid trade --key-id <KEY_ID> \\\n  --coin BTC --is-buy true --sz 0.001 --limit-px 106000 --order-type market"
      },
      {
        "title": "Step 2: Set a stop-loss rule for the position",
        "body": "npx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id BTC --token-id BTC \\\n  --rule-type STOP_LOSS --trigger-price 95000"
      },
      {
        "title": "Step 3: Set a take-profit rule",
        "body": "npx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id BTC --token-id BTC \\\n  --rule-type TAKE_PROFIT --trigger-price 115000"
      },
      {
        "title": "Step 4: Create a strategy to monitor your thesis",
        "body": "npx @vincentai/cli@latest trading-engine create-strategy --key-id <KEY_ID> \\\n  --name \"BTC Perp Momentum\" \\\n  --config '{\n    \"instruments\": [\n      { \"id\": \"BTC\", \"type\": \"perp\", \"venue\": \"hyperliquid\" }\n    ],\n    \"thesis\": {\n      \"estimate\": 115000,\n      \"direction\": \"long\",\n      \"confidence\": 0.7,\n      \"reasoning\": \"ETF inflows accelerating, halving supply shock imminent\"\n    },\n    \"drivers\": [\n      {\n        \"name\": \"ETF News\",\n        \"weight\": 2.0,\n        \"direction\": \"bullish\",\n        \"monitoring\": {\n          \"keywords\": [\"bitcoin ETF inflows\", \"bitcoin institutional\"],\n          \"sources\": [\"web_search\", \"newswire\"]\n        }\n      }\n    ],\n    \"escalation\": {\n      \"signalScoreThreshold\": 0.3,\n      \"highConfidenceThreshold\": 0.8,\n      \"maxWakeFrequency\": \"1 per 15m\",\n      \"batchWindow\": \"5m\"\n    },\n    \"tradeRules\": {\n      \"entry\": { \"minEdge\": 0.05 },\n      \"autoActions\": { \"stopLoss\": -0.10, \"takeProfit\": 0.25, \"trailingStop\": -0.05 },\n      \"sizing\": { \"method\": \"edgeScaled\", \"maxPosition\": 500, \"maxPortfolioPct\": 20, \"maxTradesPerDay\": 5 }\n    }\n  }' \\\n  --poll-interval 10"
      },
      {
        "title": "Step 5: Activate and monitor",
        "body": "npx @vincentai/cli@latest trading-engine activate --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID>"
      },
      {
        "title": "Background Workers",
        "body": "The Trading Engine runs two independent background workers:\n\nStrategy Engine Worker — Ticks every 30s, checks which strategy drivers are due, fetches new data, scores signals, and invokes the LLM when the escalation threshold is met. Hooks into venue WebSocket feeds (Polymarket and HyperLiquid) for real-time price trigger evaluation.\nTrade Rule Worker — Monitors prices in real-time via WebSocket (with polling fallback), evaluates stop-loss/take-profit/trailing stop rules, executes trades when conditions are met. Supports both Polymarket and HyperLiquid venues.\n\nCircuit Breaker: Both workers use a circuit breaker pattern. If a venue API fails 5+ consecutive times, the worker pauses and resumes after a cooldown. Check status with:\n\nnpx @vincentai/cli@latest trading-engine status --key-id <KEY_ID>"
      },
      {
        "title": "Best Practices",
        "body": "Start with confidence: 0.5 and let the LLM adjust — avoid overconfidence in the initial thesis\nWeight drivers by importance — a driver with weight: 3.0 has 3x the signal score contribution of weight: 1.0\nUse edgeScaled sizing for adaptive position sizes based on thesis confidence and edge\nSet maxPortfolioPct to limit exposure — even high-confidence strategies shouldn't risk the entire portfolio\nSet both stop-loss and take-profit on positions for protection (via autoActions in the config or standalone rules)\nUse thesisInvalidation exit rules to define explicit conditions that should trigger position exits\nMonitor invocation costs — check the costs command regularly\nIterate with versions — duplicate a strategy to tweak the config without losing the original\nDon't set triggers too close to current price — market noise can trigger prematurely"
      },
      {
        "title": "Example User Prompts",
        "body": "When a user says:\n\n\"Create a strategy to monitor AI tokens\" → Create strategy with web search + Twitter drivers\n\"Set a stop-loss at 40 cents\" → Create STOP_LOSS rule\n\"What has my strategy been doing?\" → Show invocations for the strategy\n\"How is my strategy performing?\" → Show performance metrics\n\"How much has the trading engine cost me?\" → Show cost summary\n\"Pause my strategy\" → Pause the strategy\n\"Make a new version with a different thesis\" → Duplicate, then update the draft\n\"Set a 5% trailing stop\" → Create TRAILING_STOP rule"
      },
      {
        "title": "Output Format",
        "body": "Strategy creation:\n\n{\n  \"strategyId\": \"strat-123\",\n  \"name\": \"BTC Momentum\",\n  \"status\": \"DRAFT\",\n  \"version\": 1\n}\n\nRule creation:\n\n{\n  \"ruleId\": \"rule-456\",\n  \"ruleType\": \"STOP_LOSS\",\n  \"triggerPrice\": 0.4,\n  \"status\": \"ACTIVE\"\n}\n\nLLM invocation log entries:\n\n{\n  \"invocationId\": \"inv-789\",\n  \"strategyId\": \"strat-123\",\n  \"trigger\": \"web_search\",\n  \"actions\": [\"place_trade\"],\n  \"costUsd\": 0.12,\n  \"createdAt\": \"2026-02-26T12:00:00.000Z\"\n}"
      },
      {
        "title": "Error Handling",
        "body": "ErrorCauseResolution401 UnauthorizedInvalid or missing API keyCheck that the key-id is correct; re-link if needed403 Policy ViolationTrade blocked by server-side policyUser must adjust policies at heyvincent.ai402 Insufficient CreditNot enough credit for LLM invocationUser must add credit at heyvincent.aiINVALID_STATUS_TRANSITIONStrategy can't transition to requested stateCheck current status (e.g., only DRAFT can activate)CIRCUIT_BREAKER_OPENPolymarket API failures triggered circuit breakerWait for cooldown; check status command429 Rate LimitedToo many requests or concurrent LLM invocationsWait and retry with backoffKey not foundAPI key was revoked or never createdRe-link with a new token from the wallet owner"
      },
      {
        "title": "Important Notes",
        "body": "Authorization: All endpoints require the API key for the relevant venue (Polymarket or HyperLiquid wallet key)\nLocal only: The API listens on localhost:19000 — only accessible from the same VPS\nNo private keys: All trades use the Vincent API — your private key stays secure on Vincent's servers\nPolicy enforcement: All trades (both LLM and standalone rules) go through Vincent's policy checks\nIdempotency: Rules only trigger once. LLM invocations are deduplicated by driver state."
      }
    ],
    "body": "Vincent Trading Engine - Strategy-Driven Automated Trading\n\nUse this skill to create and manage automated trading strategies for Polymarket prediction markets and HyperLiquid perpetuals/spot. The Trading Engine combines driver-based monitoring (web search, Twitter, newswire, price feeds) with a signal pipeline and LLM-powered decision-making to automatically trade based on your thesis. It also includes standalone stop-loss, take-profit, and trailing stop rules that work without the LLM.\n\nAll commands use the @vincentai/cli package.\n\nHow It Works\n\nThe Trading Engine is a unified system with two modes:\n\nLLM-Powered Strategies — Create a versioned strategy with a structured thesis, weighted drivers (web search keywords, Twitter accounts, newswire topics, price triggers), and an escalation policy. When drivers detect new information, signals are scored and batched. When the escalation threshold is met, an LLM (Claude via OpenRouter) evaluates the signals against your thesis and decides whether to trade, update the thesis, set protective orders, or alert you.\nStandalone Trade Rules — Set stop-loss, take-profit, and trailing stop rules on positions. These execute automatically when price conditions are met — no LLM involved.\n\nArchitecture:\n\nIntegrated into the Vincent backend (no separate service to run)\nStrategy endpoints under /api/skills/polymarket/strategies/...\nTrade rule endpoints under /api/skills/polymarket/rules/...\nHyperLiquid rules use venue: \"hyperliquid\" and route through the HL adapter\nUses the same API key as the Polymarket or HyperLiquid skill (depending on venue)\nAll trades go through Vincent's policy-enforced pipeline\nLLM costs are metered and deducted from the user's credit balance\nEvery LLM invocation is recorded with full audit trail (tokens, cost, actions, duration)\nSecurity Model\nLLM cannot bypass policies — all trades go through the venue's policy-enforced skill (polymarketSkill.placeBet() or hyperliquidSkill.trade()) which enforces spending limits, approval thresholds, and allowlists\nBackend-side LLM key — the OpenRouter API key never leaves the server. Agents and users cannot invoke the LLM directly\nCredit gating — no LLM invocation without sufficient credit balance\nTool constraints — the LLM's available tools are controlled by the strategy's config.tools settings. If canTrade: false, the trade tool is not provided\nRate limiting — max concurrent LLM invocations is capped to prevent runaway costs\nAudit trail — every invocation is recorded with full prompt, response, actions, cost, and duration\nNo private keys — the Trading Engine uses the Vincent API for all trades. Private keys stay on Vincent's servers\nPart 1: LLM-Powered Strategies\nCore Concepts\nInstrument: A tradeable asset on a venue. Defined by id, type (stock, perp, swap, binary, option), venue, and optional constraints (leverage, margin, liquidity, fees).\nThesis: Your directional view — estimate (target price/value), direction (long/short/neutral), confidence (0–1), and reasoning.\nDriver: A named information source that feeds the signal pipeline. Each driver has a weight, direction (bullish/bearish/contextual), and monitoring config (entities, keywords, embedding anchor, sources, polling interval).\nEscalation Policy: Controls when the LLM is woken up. signalScoreThreshold (minimum score to batch), highConfidenceThreshold (score that triggers immediate wake), maxWakeFrequency (e.g. \"1 per 15m\"), batchWindow (e.g. \"5m\").\nTrade Rules: Entry rules (min edge, order type), exit rules (thesis invalidation triggers), auto-actions (stop-loss, take-profit, trailing stop, price delta triggers), and sizing rules (method, max position, portfolio %, max trades/day).\nSignal Pipeline\n\nStrategies process information through a 6-layer pipeline:\n\nIngest — Raw data from driver sources (web search, Twitter, newswire, price feeds, RSS, Reddit, on-chain, filings, options flow)\nFilter — Deduplication and relevance filtering. Drops signals already seen or below quality threshold\nScore — Each signal is scored (0–1) based on driver weight, embedding similarity to the anchor, and entity/keyword matches\nEscalate — Scored signals are batched according to the escalation policy. Low-score signals accumulate in a batch window; high-confidence signals trigger immediate LLM wake\nLLM — The LLM evaluates batched signals against the current thesis. It can update the thesis, issue trade decisions, update driver states, or take no action\nExecute — Trade decisions pass through policy enforcement and are routed to the appropriate venue adapter for execution\nStrategy Lifecycle\n\nStrategies follow a versioned lifecycle: DRAFT → ACTIVE → PAUSED → ARCHIVED\n\nDRAFT: Can be edited. Not yet monitoring or invoking the LLM.\nACTIVE: Drivers are running. New signals trigger the pipeline.\nPAUSED: Monitoring is stopped. Can be resumed.\nARCHIVED: Permanently stopped. Cannot be reactivated.\n\nTo iterate on a strategy, duplicate it as a new version (creates a new DRAFT with incremented version number and the same config).\n\nCreate a Strategy\nnpx @vincentai/cli@latest trading-engine create-strategy \\\n  --key-id <KEY_ID> \\\n  --name \"BTC Momentum\" \\\n  --config '{\n    \"instruments\": [\n      { \"id\": \"btc-usd-perp\", \"type\": \"perp\", \"venue\": \"polymarket\" },\n      { \"id\": \"BTC\", \"type\": \"perp\", \"venue\": \"hyperliquid\" }\n    ],\n    \"thesis\": {\n      \"estimate\": 105000,\n      \"direction\": \"long\",\n      \"confidence\": 0.7,\n      \"reasoning\": \"ETF inflows accelerating, halving supply shock imminent\"\n    },\n    \"drivers\": [\n      {\n        \"name\": \"ETF Flow Monitor\",\n        \"weight\": 2.0,\n        \"direction\": \"bullish\",\n        \"monitoring\": {\n          \"entities\": [\"BlackRock\", \"Fidelity\"],\n          \"keywords\": [\"bitcoin ETF\", \"BTC inflow\"],\n          \"embeddingAnchor\": \"Bitcoin ETF institutional inflows\",\n          \"sources\": [\"web_search\", \"newswire\"]\n        }\n      },\n      {\n        \"name\": \"Crypto Twitter\",\n        \"weight\": 1.0,\n        \"direction\": \"contextual\",\n        \"monitoring\": {\n          \"entities\": [\"@BitcoinMagazine\", \"@saborskycnbc\"],\n          \"keywords\": [\"bitcoin\", \"BTC\"],\n          \"sources\": [\"twitter\"]\n        }\n      }\n    ],\n    \"escalation\": {\n      \"signalScoreThreshold\": 0.3,\n      \"highConfidenceThreshold\": 0.8,\n      \"maxWakeFrequency\": \"1 per 15m\",\n      \"batchWindow\": \"5m\"\n    },\n    \"tradeRules\": {\n      \"entry\": { \"minEdge\": 0.05, \"orderType\": \"limit\", \"limitOffset\": 0.01 },\n      \"autoActions\": { \"stopLoss\": -0.10, \"takeProfit\": 0.25, \"trailingStop\": -0.05 },\n      \"exit\": { \"thesisInvalidation\": [\"ETF outflows exceed $500M/week\"] },\n      \"sizing\": {\n        \"method\": \"edgeScaled\",\n        \"maxPosition\": 500,\n        \"maxPortfolioPct\": 20,\n        \"maxTradesPerDay\": 5,\n        \"minTimeBetweenTrades\": \"30m\"\n      }\n    },\n    \"notifications\": {\n      \"onTrade\": true,\n      \"onThesisChange\": true,\n      \"channel\": \"none\"\n    }\n  }'\n\n\nParameters:\n\n--name: Strategy name\n--config: Full strategy config JSON (see Core Concepts above for structure)\n--data-source-secret-id: Optional DATA_SOURCES secret ID for driver monitoring API calls\n--poll-interval: Polling interval in minutes for driver monitoring (default: 15)\nList Strategies\nnpx @vincentai/cli@latest trading-engine list-strategies --key-id <KEY_ID>\n\nGet Strategy Details\nnpx @vincentai/cli@latest trading-engine get-strategy --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nUpdate a Strategy\n\nUpdate a DRAFT strategy. Pass only the fields you want to change — config is a partial object.\n\nnpx @vincentai/cli@latest trading-engine update-strategy --key-id <KEY_ID> --strategy-id <STRATEGY_ID> \\\n  --name \"Updated Name\" --config '{ \"thesis\": { \"confidence\": 0.8, \"reasoning\": \"Updated reasoning\" } }'\n\n\nParameters:\n\n--strategy-id: Strategy ID (required)\n--name: New strategy name\n--config: Partial strategy config JSON — only include fields to update\n--data-source-secret-id: DATA_SOURCES secret ID\n--poll-interval: New polling interval in minutes\nActivate a Strategy\n\nStarts driver monitoring and signal pipeline processing. Strategy must be in DRAFT status.\n\nnpx @vincentai/cli@latest trading-engine activate --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nPause a Strategy\n\nStops monitoring. Strategy must be ACTIVE.\n\nnpx @vincentai/cli@latest trading-engine pause --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nResume a Strategy\n\nResumes monitoring. Strategy must be PAUSED.\n\nnpx @vincentai/cli@latest trading-engine resume --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nArchive a Strategy\n\nPermanently stops a strategy. Cannot be undone.\n\nnpx @vincentai/cli@latest trading-engine archive --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nDuplicate a Strategy (New Version)\n\nCreates a new DRAFT with the same config, incremented version number, and a link to the parent version.\n\nnpx @vincentai/cli@latest trading-engine duplicate-strategy --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nView Version History\n\nSee all versions of a strategy lineage.\n\nnpx @vincentai/cli@latest trading-engine versions --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nView LLM Invocation History\n\nSee the LLM decision log for a strategy — what data triggered it, what the LLM decided, what actions were taken, and the cost.\n\nnpx @vincentai/cli@latest trading-engine invocations --key-id <KEY_ID> --strategy-id <STRATEGY_ID> --limit 20\n\nView Cost Summary\n\nSee aggregate LLM costs for all strategies under a secret.\n\nnpx @vincentai/cli@latest trading-engine costs --key-id <KEY_ID>\n\nView Performance Metrics\n\nSee performance metrics for a strategy: P&L, win rate, trade count, and per-instrument breakdown.\n\nnpx @vincentai/cli@latest trading-engine performance --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nDriver Configuration\nWeb Search Drivers\n\nAdd a driver with \"sources\": [\"web_search\"]. The engine periodically searches Brave for the driver's keywords and triggers the signal pipeline when new results appear.\n\n{\n  \"name\": \"AI News Monitor\",\n  \"weight\": 1.5,\n  \"direction\": \"bullish\",\n  \"monitoring\": {\n    \"keywords\": [\"AI tokens\", \"GPU shortage\", \"prediction market regulation\"],\n    \"embeddingAnchor\": \"AI technology investment trends\",\n    \"sources\": [\"web_search\"]\n  }\n}\n\n\nEach keyword is searched independently. Results are deduplicated — the same URLs won't trigger the pipeline twice.\n\nTwitter Drivers\n\nAdd a driver with \"sources\": [\"twitter\"]. The engine periodically checks the specified entities for new tweets.\n\n{\n  \"name\": \"Crypto Twitter\",\n  \"weight\": 1.0,\n  \"direction\": \"contextual\",\n  \"monitoring\": {\n    \"entities\": [\"@DeepSeek\", \"@nvidia\", \"@OpenAI\"],\n    \"keywords\": [\"AI\", \"GPU\"],\n    \"sources\": [\"twitter\"]\n  }\n}\n\n\nTweets are deduplicated by tweet ID — only genuinely new tweets trigger the pipeline.\n\nNewswire Drivers (Finnhub)\n\nAdd a driver with \"sources\": [\"newswire\"]. The engine periodically polls Finnhub's market news API and triggers the pipeline when new headlines matching your keywords appear.\n\n{\n  \"name\": \"Market News\",\n  \"weight\": 1.5,\n  \"direction\": \"contextual\",\n  \"monitoring\": {\n    \"keywords\": [\"artificial intelligence\", \"GPU shortage\", \"semiconductor\"],\n    \"sources\": [\"newswire\"]\n  }\n}\n\n\nHeadlines and summaries are matched case-insensitively. Articles are deduplicated by headline hash with a sliding window.\n\nNote: Requires a FINNHUB_API_KEY env var on the server. Finnhub's free tier allows 60 API calls/min. No per-call credit deduction.\n\nPrice Triggers\n\nPrice triggers are evaluated in real-time via the Polymarket WebSocket feed. When a price condition is met, the signal pipeline is invoked with the price data.\n\nTrigger types:\n\nABOVE — triggers when price exceeds a threshold\nBELOW — triggers when price drops below a threshold\nCHANGE_PCT — triggers on a percentage change from reference price\n\nPrice triggers are one-shot: once fired, they're marked as consumed. The LLM can create new triggers if needed.\n\nThesis Best Practices\n\nThe thesis is your structured directional view. Good theses include:\n\nA clear estimate: Target price or value the market should reach\nA confidence level: Start at 0.5–0.7 and let the LLM adjust as new data arrives\nSpecific reasoning: \"ETF inflows accelerating, halving supply shock imminent\" is better than \"BTC will go up\"\nExplicit invalidation conditions: Use tradeRules.exit.thesisInvalidation to define what would break your thesis\nLLM Available Tools\n\nWhen the LLM is invoked, it can use these tools (depending on strategy config):\n\nTool\tDescription\tRequires\nplace_trade\tBuy or sell a position\tcanTrade: true in trade rules\nset_stop_loss\tSet a stop-loss rule on a position\tcanSetRules: true in trade rules\nset_take_profit\tSet a take-profit rule\tcanSetRules: true in trade rules\nset_trailing_stop\tSet a trailing stop\tcanSetRules: true in trade rules\nalert_user\tSend an alert without trading\tAlways available\nno_action\tDo nothing (with reasoning)\tAlways available\nCost Tracking\n\nEvery LLM invocation is metered:\n\nToken costs: Input and output tokens are priced per the model's rate\nDeducted from credit balance: Same pool as data source credits (dataSourceCreditUsd)\nPre-flight check: If insufficient credit, the invocation is skipped and logged\nData source costs: Brave Search ($0.005/call) and Twitter ($0.005-$0.01/call) are also metered. Finnhub newswire calls are free (no credit deduction)\n\nTypical LLM invocation cost: $0.05–$0.30 depending on context size.\n\nPart 2: Standalone Trade Rules\n\nTrade rules execute automatically when price conditions are met — no LLM involved. These are stop-loss, take-profit, and trailing stop rules that protect your positions.\n\nCheck Worker Status\nnpx @vincentai/cli@latest trading-engine status --key-id <KEY_ID>\n# Returns: worker status, active rules count, last sync time, circuit breaker state\n\nCreate a Stop-Loss Rule\n\nAutomatically sell a position if price drops below a threshold:\n\n# Polymarket — triggerPrice is 0–1 (outcome token price)\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0x123... --token-id 456789 \\\n  --rule-type STOP_LOSS --trigger-price 0.40\n\n# HyperLiquid — triggerPrice is absolute USD price, marketId and tokenId are the coin name\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id BTC --token-id BTC \\\n  --rule-type STOP_LOSS --trigger-price 95000\n\n\nParameters:\n\n--venue: polymarket (default) or hyperliquid\n--market-id: Polymarket condition ID, or coin name for HyperLiquid (e.g. BTC, ETH)\n--token-id: Polymarket outcome token ID, or coin name for HyperLiquid\n--rule-type: STOP_LOSS (sells if price <= trigger), TAKE_PROFIT (sells if price >= trigger), or TRAILING_STOP\n--trigger-price: Price threshold — 0 to 1 for Polymarket, absolute USD price for HyperLiquid\nCreate a Take-Profit Rule\n\nAutomatically sell a position if price rises above a threshold:\n\n# Polymarket\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0x123... --token-id 456789 \\\n  --rule-type TAKE_PROFIT --trigger-price 0.75\n\n# HyperLiquid\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id ETH --token-id ETH \\\n  --rule-type TAKE_PROFIT --trigger-price 4500\n\nCreate a Trailing Stop Rule\n\nA trailing stop moves the stop price up as the price rises:\n\n# Polymarket\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0x123... --token-id 456789 \\\n  --rule-type TRAILING_STOP --trigger-price 0.45 --trailing-percent 5\n\n# HyperLiquid\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id SOL --token-id SOL \\\n  --rule-type TRAILING_STOP --trigger-price 170 --trailing-percent 5\n\n\nTrailing stop behavior:\n\n--trailing-percent is percent points (e.g. 5 = 5%)\nComputes candidateStop = currentPrice * (1 - trailingPercent/100)\nIf candidateStop > current triggerPrice, updates triggerPrice\ntriggerPrice never moves down\nRule triggers when currentPrice <= triggerPrice\nList Rules\n# All rules\nnpx @vincentai/cli@latest trading-engine list-rules --key-id <KEY_ID>\n\n# Filter by status\nnpx @vincentai/cli@latest trading-engine list-rules --key-id <KEY_ID> --status ACTIVE\n\nUpdate a Rule\nnpx @vincentai/cli@latest trading-engine update-rule --key-id <KEY_ID> --rule-id <RULE_ID> --trigger-price 0.45\n\nCancel a Rule\nnpx @vincentai/cli@latest trading-engine delete-rule --key-id <KEY_ID> --rule-id <RULE_ID>\n\nView Monitored Positions\nnpx @vincentai/cli@latest trading-engine positions --key-id <KEY_ID>\n\nView Event Log\n# All events\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID>\n\n# Events for specific rule\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID> --rule-id <RULE_ID>\n\n# Paginated\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID> --limit 50 --offset 100\n\n\nEvent types:\n\nRULE_CREATED — Rule was created\nRULE_TRAILING_UPDATED — Trailing stop moved triggerPrice upward\nRULE_EVALUATED — Worker checked the rule against current price\nRULE_TRIGGERED — Trigger condition was met\nACTION_PENDING_APPROVAL — Trade requires human approval, rule paused\nACTION_EXECUTED — Trade executed successfully\nACTION_FAILED — Trade execution failed\nRULE_CANCELED — Rule was manually canceled\nRule Statuses\nACTIVE — Rule is live and being monitored\nTRIGGERED — Condition was met, trade executed\nPENDING_APPROVAL — Trade requires human approval; rule paused\nCANCELED — Manually canceled before triggering\nFAILED — Triggered but trade execution failed\nComplete Workflow: Strategy + Trade Rules\nPolymarket Workflow\nStep 1: Place a bet with the Polymarket skill\nnpx @vincentai/cli@latest polymarket bet --key-id <KEY_ID> --token-id 123456789 --side BUY --amount 10 --price 0.55\n\nStep 2: Create a strategy to monitor the thesis\nnpx @vincentai/cli@latest trading-engine create-strategy --key-id <KEY_ID> \\\n  --name \"Bitcoin Bull Thesis\" \\\n  --config '{\n    \"instruments\": [\n      { \"id\": \"123456789\", \"type\": \"binary\", \"venue\": \"polymarket\" }\n    ],\n    \"thesis\": {\n      \"estimate\": 0.85,\n      \"direction\": \"long\",\n      \"confidence\": 0.7,\n      \"reasoning\": \"Bitcoin is likely to break $100k on ETF inflows\"\n    },\n    \"drivers\": [\n      {\n        \"name\": \"ETF News\",\n        \"weight\": 2.0,\n        \"direction\": \"bullish\",\n        \"monitoring\": {\n          \"keywords\": [\"bitcoin ETF inflows\", \"bitcoin institutional\"],\n          \"sources\": [\"web_search\", \"newswire\"]\n        }\n      },\n      {\n        \"name\": \"Crypto Twitter\",\n        \"weight\": 1.0,\n        \"direction\": \"contextual\",\n        \"monitoring\": {\n          \"entities\": [\"@BitcoinMagazine\", \"@saborskycnbc\"],\n          \"sources\": [\"twitter\"]\n        }\n      }\n    ],\n    \"escalation\": {\n      \"signalScoreThreshold\": 0.3,\n      \"highConfidenceThreshold\": 0.8,\n      \"maxWakeFrequency\": \"1 per 15m\",\n      \"batchWindow\": \"5m\"\n    },\n    \"tradeRules\": {\n      \"entry\": { \"minEdge\": 0.05 },\n      \"autoActions\": { \"stopLoss\": -0.15, \"takeProfit\": 0.30, \"trailingStop\": -0.05 },\n      \"exit\": { \"thesisInvalidation\": [\"ETF outflows accelerate above $500M/week\"] },\n      \"sizing\": { \"method\": \"edgeScaled\", \"maxPosition\": 100, \"maxPortfolioPct\": 20, \"maxTradesPerDay\": 5 }\n    }\n  }' \\\n  --poll-interval 10\n\nStep 3: Set a standalone stop-loss as immediate protection\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --market-id 0xabc... --token-id 123456789 \\\n  --rule-type STOP_LOSS --trigger-price 0.40\n\nStep 4: Activate the strategy\nnpx @vincentai/cli@latest trading-engine activate --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nStep 5: Monitor activity\n# Check strategy invocations\nnpx @vincentai/cli@latest trading-engine invocations --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\n# Check trade rule events\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID>\n\n# Check costs\nnpx @vincentai/cli@latest trading-engine costs --key-id <KEY_ID>\n\n# Check performance\nnpx @vincentai/cli@latest trading-engine performance --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\n\nHyperLiquid Workflow\nStep 1: Open a perp position with the HyperLiquid skill\nnpx @vincentai/cli@latest hyperliquid trade --key-id <KEY_ID> \\\n  --coin BTC --is-buy true --sz 0.001 --limit-px 106000 --order-type market\n\nStep 2: Set a stop-loss rule for the position\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id BTC --token-id BTC \\\n  --rule-type STOP_LOSS --trigger-price 95000\n\nStep 3: Set a take-profit rule\nnpx @vincentai/cli@latest trading-engine create-rule --key-id <KEY_ID> \\\n  --venue hyperliquid --market-id BTC --token-id BTC \\\n  --rule-type TAKE_PROFIT --trigger-price 115000\n\nStep 4: Create a strategy to monitor your thesis\nnpx @vincentai/cli@latest trading-engine create-strategy --key-id <KEY_ID> \\\n  --name \"BTC Perp Momentum\" \\\n  --config '{\n    \"instruments\": [\n      { \"id\": \"BTC\", \"type\": \"perp\", \"venue\": \"hyperliquid\" }\n    ],\n    \"thesis\": {\n      \"estimate\": 115000,\n      \"direction\": \"long\",\n      \"confidence\": 0.7,\n      \"reasoning\": \"ETF inflows accelerating, halving supply shock imminent\"\n    },\n    \"drivers\": [\n      {\n        \"name\": \"ETF News\",\n        \"weight\": 2.0,\n        \"direction\": \"bullish\",\n        \"monitoring\": {\n          \"keywords\": [\"bitcoin ETF inflows\", \"bitcoin institutional\"],\n          \"sources\": [\"web_search\", \"newswire\"]\n        }\n      }\n    ],\n    \"escalation\": {\n      \"signalScoreThreshold\": 0.3,\n      \"highConfidenceThreshold\": 0.8,\n      \"maxWakeFrequency\": \"1 per 15m\",\n      \"batchWindow\": \"5m\"\n    },\n    \"tradeRules\": {\n      \"entry\": { \"minEdge\": 0.05 },\n      \"autoActions\": { \"stopLoss\": -0.10, \"takeProfit\": 0.25, \"trailingStop\": -0.05 },\n      \"sizing\": { \"method\": \"edgeScaled\", \"maxPosition\": 500, \"maxPortfolioPct\": 20, \"maxTradesPerDay\": 5 }\n    }\n  }' \\\n  --poll-interval 10\n\nStep 5: Activate and monitor\nnpx @vincentai/cli@latest trading-engine activate --key-id <KEY_ID> --strategy-id <STRATEGY_ID>\nnpx @vincentai/cli@latest trading-engine events --key-id <KEY_ID>\n\nBackground Workers\n\nThe Trading Engine runs two independent background workers:\n\nStrategy Engine Worker — Ticks every 30s, checks which strategy drivers are due, fetches new data, scores signals, and invokes the LLM when the escalation threshold is met. Hooks into venue WebSocket feeds (Polymarket and HyperLiquid) for real-time price trigger evaluation.\nTrade Rule Worker — Monitors prices in real-time via WebSocket (with polling fallback), evaluates stop-loss/take-profit/trailing stop rules, executes trades when conditions are met. Supports both Polymarket and HyperLiquid venues.\n\nCircuit Breaker: Both workers use a circuit breaker pattern. If a venue API fails 5+ consecutive times, the worker pauses and resumes after a cooldown. Check status with:\n\nnpx @vincentai/cli@latest trading-engine status --key-id <KEY_ID>\n\nBest Practices\nStart with confidence: 0.5 and let the LLM adjust — avoid overconfidence in the initial thesis\nWeight drivers by importance — a driver with weight: 3.0 has 3x the signal score contribution of weight: 1.0\nUse edgeScaled sizing for adaptive position sizes based on thesis confidence and edge\nSet maxPortfolioPct to limit exposure — even high-confidence strategies shouldn't risk the entire portfolio\nSet both stop-loss and take-profit on positions for protection (via autoActions in the config or standalone rules)\nUse thesisInvalidation exit rules to define explicit conditions that should trigger position exits\nMonitor invocation costs — check the costs command regularly\nIterate with versions — duplicate a strategy to tweak the config without losing the original\nDon't set triggers too close to current price — market noise can trigger prematurely\nExample User Prompts\n\nWhen a user says:\n\n\"Create a strategy to monitor AI tokens\" → Create strategy with web search + Twitter drivers\n\"Set a stop-loss at 40 cents\" → Create STOP_LOSS rule\n\"What has my strategy been doing?\" → Show invocations for the strategy\n\"How is my strategy performing?\" → Show performance metrics\n\"How much has the trading engine cost me?\" → Show cost summary\n\"Pause my strategy\" → Pause the strategy\n\"Make a new version with a different thesis\" → Duplicate, then update the draft\n\"Set a 5% trailing stop\" → Create TRAILING_STOP rule\nOutput Format\n\nStrategy creation:\n\n{\n  \"strategyId\": \"strat-123\",\n  \"name\": \"BTC Momentum\",\n  \"status\": \"DRAFT\",\n  \"version\": 1\n}\n\n\nRule creation:\n\n{\n  \"ruleId\": \"rule-456\",\n  \"ruleType\": \"STOP_LOSS\",\n  \"triggerPrice\": 0.4,\n  \"status\": \"ACTIVE\"\n}\n\n\nLLM invocation log entries:\n\n{\n  \"invocationId\": \"inv-789\",\n  \"strategyId\": \"strat-123\",\n  \"trigger\": \"web_search\",\n  \"actions\": [\"place_trade\"],\n  \"costUsd\": 0.12,\n  \"createdAt\": \"2026-02-26T12:00:00.000Z\"\n}\n\nError Handling\nError\tCause\tResolution\n401 Unauthorized\tInvalid or missing API key\tCheck that the key-id is correct; re-link if needed\n403 Policy Violation\tTrade blocked by server-side policy\tUser must adjust policies at heyvincent.ai\n402 Insufficient Credit\tNot enough credit for LLM invocation\tUser must add credit at heyvincent.ai\nINVALID_STATUS_TRANSITION\tStrategy can't transition to requested state\tCheck current status (e.g., only DRAFT can activate)\nCIRCUIT_BREAKER_OPEN\tPolymarket API failures triggered circuit breaker\tWait for cooldown; check status command\n429 Rate Limited\tToo many requests or concurrent LLM invocations\tWait and retry with backoff\nKey not found\tAPI key was revoked or never created\tRe-link with a new token from the wallet owner\nImportant Notes\nAuthorization: All endpoints require the API key for the relevant venue (Polymarket or HyperLiquid wallet key)\nLocal only: The API listens on localhost:19000 — only accessible from the same VPS\nNo private keys: All trades use the Vincent API — your private key stays secure on Vincent's servers\nPolicy enforcement: All trades (both LLM and standalone rules) go through Vincent's policy checks\nIdempotency: Rules only trigger once. LLM invocations are deduplicated by driver state."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/glitch003/vincent-trading-engine",
    "publisherUrl": "https://clawhub.ai/glitch003/vincent-trading-engine",
    "owner": "glitch003",
    "version": "1.0.69",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/vincent-trading-engine",
    "downloadUrl": "https://openagent3.xyz/downloads/vincent-trading-engine",
    "agentUrl": "https://openagent3.xyz/skills/vincent-trading-engine/agent",
    "manifestUrl": "https://openagent3.xyz/skills/vincent-trading-engine/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/vincent-trading-engine/agent.md"
  }
}