{"id":"34bc28cc-f074-4eb9-9923-d822e1207194","entityType":"agent","slug":"clawhub-ssj124-aionmarket-sdk-divergence-trader","name":"Aionmarket Sdk Divergence Trader","canonicalUrl":"https://www.xpersona.co/agent/clawhub-ssj124-aionmarket-sdk-divergence-trader","canonicalPath":"/agent/clawhub-ssj124-aionmarket-sdk-divergence-trader","generatedAt":"2026-10-09T23:01:42.940Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-09T14:05:40.968Z","emptyReason":null},"description":"Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional li... Skill: Aionmarket Sdk Divergence Trader Owner: ssj124 Summary: Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional li... Tags: latest:1.0.0 Version history: v1.0.0 | 2026-04-25T07:44:00.764Z | auto AION Market Divergence Trader 1.0.0 — Initial Release - Provides a template for disciplined probability-based trading o","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 2.5K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s174p432zdjmq0szb7x7pvv8zx84s03q:aionmarket-sdk-divergence-trader","sourceUrl":"https://clawhub.ai/ssj124/aionmarket-sdk-divergence-trader","homepage":"https://clawhub.ai/ssj124/skills/aionmarket-sdk-divergence-trader","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/ssj124/aionmarket-sdk-divergence-trader","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/ssj124/skills/aionmarket-sdk-divergence-trader","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":68,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional li..."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T14:05:40.968Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T14:05:40.968Z","emptyReason":null},"stars":null,"forks":null,"downloads":2512,"packageName":null,"latestVersion":"1.0.0","tractionLabel":"2.5K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T14:05:40.967Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T14:05:40.968Z","lastCrawledAt":"2026-10-09T14:05:40.967Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T14:05:40.967Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.0","createdAt":"2026-04-25T07:44:00.764Z","changelog":"AION Market Divergence Trader 1.0.0 — Initial Release - Provides a template for disciplined probability-based trading on AION Market venues (default: Polymarket), with probability divergence as the core signal. - Includes dry-run mode by default, with safe execution controls; live trading requires explicit activation. - Fetches and checks live market context (prices, warnings) before any trade; skips trades with alerts or insufficient edge. - Takes user/model probability input and only executes trades meeting a configurable minimum edge threshold. - Supports reasoning and tagging for auditability; prints operator-style summaries after each decision. - Easily remixable for different models, venues, and risk management workflows.","fileCount":5,"zipByteSize":11197}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s174p432zdjmq0szb7x7pvv8zx84s03q:aionmarket-sdk-divergence-trader","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-09T23:01:42.939Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ssj124-aionmarket-sdk-divergence-trader/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-09T14:05:40.968Z","emptyReason":null},"readme":"Skill: Aionmarket Sdk Divergence Trader\n\nOwner: ssj124\n\nSummary: Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional li...\n\nTags: latest:1.0.0\n\nVersion history:\n\nv1.0.0 | 2026-04-25T07:44:00.764Z | auto\n\nAION Market Divergence Trader 1.0.0 — Initial Release\n\n- Provides a template for disciplined probability-based trading on AION Market venues (default: Polymarket), with probability divergence as the core signal.\n- Includes dry-run mode by default, with safe execution controls; live trading requires explicit activation.\n- Fetches and checks live market context (prices, warnings) before any trade; skips trades with alerts or insufficient edge.\n- Takes user/model probability input and only executes trades meeting a configurable minimum edge threshold.\n- Supports reasoning and tagging for auditability; prints operator-style summaries after each decision.\n- Easily remixable for different models, venues, and risk management workflows.\n\nArchive index:\n\nArchive v1.0.0: 5 files, 11197 bytes\n\nFiles: clawhub.json (994b), divergence_trader.py (6926b), skill-card.md (2081b), SKILL.md (17585b), _meta.json (151b)\n\nFile v1.0.0:SKILL.md\n\n---\nname: aionmarket-trading\ndescription: Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional live execution through AION.\nmetadata:\n    author: \"Saul Su\"\n    version: \"1.0.0\"\n    displayName: \"AION Market Divergence Trader\"\n    difficulty: \"intermediate\"\n---\n\n# AION Market Divergence Trader\n\nThis skill is a publishable trading template for AION Market. It compares your probability estimate with the live market price, checks market context, and only places a trade when the edge clears a configurable threshold. aionmarket-sdk\n\n> **This is a template.** The default signal is probability divergence: if your model thinks the event is more likely than the market implies, the skill buys YES; if less likely, it buys NO. Remix the signal source with your own model, API, or research process. The skill handles trade discipline, operator output, and AION trade tagging.\n\n## When To Use\n\nUse this skill when an agent already has a probability estimate for a specific market and needs a safe execution wrapper around that signal.\n\n## Skill Folder\n\nThis skill ships with three files:\n\n- SKILL.md\n- clawhub.json\n- divergence_trader.py\n\n## Defaults\n\n- Venue: polymarket\n- Trade size: 5.0\n- Minimum edge: 0.05\n- Execution mode: dry-run unless `--live` is passed\n- Trade source: `sdk:aionmarket-trading`\n- Skill slug: `aionmarket-trading`\n\n## Required Inputs\n\nThe skill expects:\n\n- `AION_API_KEY` or `AIONMARKET_API_KEY`\n- `MARKET_ID` for the target market\n- `MY_PROBABILITY` as a decimal between `0` and `1`\n\nOptional inputs:\n\n- `VENUE` such as `polymarket` or `kalshi`\n- `TRADE_SIZE`\n- `MIN_EDGE`\n- `REASONING_PREFIX`\n\n## Safety Rules\n\n1. Always fetch market context before deciding.\n2. Always default to dry-run. Live trading requires explicit `--live`.\n3. Always attach `source`, `skill_slug`, and human-readable `reasoning`.\n4. Skip trading when context reports warnings or flip-flop risk.\n5. Return `HOLD` when the edge is smaller than the configured threshold.\n\n## Decision Logic\n\n1. Read the live market probability from market context.\n2. Compute `edge = my_probability - market_probability`.\n3. If `edge >= min_edge`, buy YES.\n4. If `edge <= -min_edge`, buy NO.\n5. Otherwise hold.\n\n## Example Commands\n\nDry-run:\n\n```bash\npython divergence_trader.py --market-id 12345 --my-probability 0.62\n```\n\nLive trade:\n\n```bash\npython divergence_trader.py --market-id 12345 --my-probability 0.62 --amount 5 --live\n```\n\n## Expected Operator Output\n\nThe script prints an operator-style summary:\n\n```text\nSkill: aionmarket-trading\nVenue: polymarket\nRisk alerts:\n- none\n\nDecision:\n- MARKET_ID: TRADE YES size=5.0 reason=edge +7.0%\n```\n\n## Remix Ideas\n\n- Replace `MY_PROBABILITY` with a forecast model output.\n- Drive `MARKET_ID` from a market scanner.\n- Add portfolio-aware sizing before the trade call.\n- Extend the loop to poll with jitter and auto-redeem resolved positions.\n    key=private_key,\n    chain_id=137,\n)\ncreds = polymarket.create_or_derive_api_creds()\nwallet = polymarket.get_address()\n\nprint(f\"Wallet: {wallet}\")\nprint(f\"CLOB API Key: {creds.api_key}\")\n\n# 2. Register with AION Market\ncheck = client.check_wallet_credentials(wallet)\nif not check[\"hasCredentials\"]:\n    client.register_wallet_credentials(\n        wallet_address=wallet,\n        api_key=creds.api_key,\n        api_secret=creds.api_secret,\n        api_passphrase=creds.api_passphrase,\n    )\n    print(f\"Wallet credentials registered for {wallet}\")\nelse:\n    print(f\"Wallet {wallet} already configured.\")\n```\n\n### Step 4 — Configure Risk Limits\n\n```python\nclient.update_settings(\n    max_trades_per_day=50,\n    max_trade_amount=100.0,\n    trading_paused=False,\n    auto_redeem_enabled=True,\n)\nsettings = client.get_settings()\nprint(settings)\n```\n\n### Step 5 — Kalshi Prerequisites (Optional, for Kalshi venue)\n\n- Ensure Solana wallet is available (`SOLANA_PRIVATE_KEY` / `userPublicKey`)\n- Use `kalshi_quote()` to request unsigned tx, locally sign, then call `kalshi_submit()`\n- For BUY flows, provide `userPublicKey` so KYC/geo checks can be evaluated upstream\n\n---\n\n## Workflow: Market Search & Context\n\n### Understanding Market Data Structure\n\n> **Critical:** `get_markets()` returns **events**, each containing a nested `markets[]`\n> array of **sub-markets**. Trading fields like `conditionId`, `clobTokenIds`,\n> `outcomePrices`, `negRisk`, and `orderPriceMinTickSize` live on the **sub-market**, NOT the event.\n\n```python\nimport ast\n\n# Search returns events\nevents = client.get_markets(q=\"bitcoin\", limit=10)\n\nfor event in events:\n    print(f\"Event: {event['title']}\")\n    for sub in event.get(\"markets\", []):\n        # Parse JSON strings\n        prices = ast.literal_eval(sub.get(\"outcomePrices\", '[\"0.5\",\"0.5\"]'))\n        token_ids = ast.literal_eval(sub.get(\"clobTokenIds\", '[]'))\n        print(f\"  Sub-market: {sub['question']}\")\n        print(f\"    conditionId: {sub['conditionId']}\")\n        print(f\"    YES price: {prices[0]}, NO price: {prices[1]}\")\n        print(f\"    YES token: {token_ids[0] if token_ids else 'N/A'}\")\n        print(f\"    negRisk: {sub.get('negRisk', False)}\")\n        print(f\"    tickSize: {sub.get('orderPriceMinTickSize', 0.01)}\")\n        print(f\"    minSize: {sub.get('orderMinSize', 5)}\")\n```\n\n### Get Market Context (REQUIRED before trading)\n\n```python\ncontext = client.get_market_context(\"CONDITION_ID\", user=wallet)\n\nprint(f\"Name:       {context.get('name')}\")\nprint(f\"Position:   {context.get('myPosition')}\")\nprint(f\"Risk limit: {context.get('riskLimit')}\")\nprint(f\"Warnings:   {context.get('warnings')}\")\n\nif context.get(\"warnings\"):\n    print(\"⚠️  Review warnings before proceeding!\")\n```\n\n### Automatic Pre-Trade Readiness Checks\n\nBefore signing or submitting any order, the agent should automatically verify:\n\n- wallet credentials are already registered, otherwise register them\n- collateral balance is sufficient for the intended spend\n- Polygon gas balance is sufficient if an onchain approval may be needed\n- the required spender allowance already exists for the intended order\n\nIf allowance is insufficient and gas is available, the agent should send the approval transaction automatically instead of asking the user to do it manually.\n\n---\n\n## Workflow: Trade Execution\n\n### Building a Signed Order (REQUIRED)\n\nThe `trade()` endpoint requires a **complete EIP712-signed order** from `py-clob-client`.\nPassing `\"order\": {}` will cause a credential lookup failure — the server reads\n`order.signatureType` to find your wallet credentials.\n\n```python\nimport ast\nfrom py_clob_client.client import ClobClient\nfrom py_clob_client.clob_types import ApiCreds, CreateOrderOptions, OrderArgs\n\n# 1. Initialize CLOB client with creds (derived earlier in bootstrap)\nclob = ClobClient(\n    \"https://clob.polymarket.com\",\n    key=private_key,     # WALLET_PRIVATE_KEY\n    chain_id=137,\n    creds=ApiCreds(\n        api_key=creds.api_key,\n        api_secret=creds.api_secret,\n        api_passphrase=creds.api_passphrase,\n    ),\n)\n\n# 2. Extract trading params from sub-market (NOT event)\nsub_market = event[\"markets\"][0]  # pick the sub-market you want to trade\ncondition_id = sub_market[\"conditionId\"]\ntoken_ids = ast.literal_eval(sub_market[\"clobTokenIds\"])\nyes_token_id = token_ids[0]   # index 0 = YES, index 1 = NO\nno_token_id = token_ids[1]\nneg_risk = sub_market.get(\"negRisk\", False)\ntick_size = str(sub_market.get(\"orderPriceMinTickSize\", \"0.01\"))\nmin_size = sub_market.get(\"orderMinSize\", 5)\n\n# 3. Build signed order — MUST use CreateOrderOptions for proper signing\nsigned_order = clob.create_order(\n    OrderArgs(\n        token_id=yes_token_id,   # or no_token_id for NO side\n        price=0.55,\n        size=min_size,           # must >= orderMinSize\n        side=\"BUY\",\n    ),\n    options=CreateOrderOptions(\n        tick_size=tick_size,     # from sub-market.orderPriceMinTickSize\n        neg_risk=neg_risk,       # CRITICAL for neg-risk markets!\n    ),\n)\n\n# 4. Convert dataclass to dict for JSON serialization\norder_dict = signed_order.dict()\n```\n\n### Place a Trade\n\n```python\nresult = client.trade({\n    \"marketConditionId\": condition_id,          # hex conditionId from sub-market\n    \"marketQuestion\": sub_market[\"question\"],   # question text\n    \"outcome\": \"YES\",                           # YES or NO\n    \"orderSize\": min_size,                      # number of contracts\n    \"price\": 0.55,                              # price per contract (0-1)\n    \"isLimitOrder\": True,                       # True=limit, False=market\n    \"order\": order_dict,                        # ← FULL signed order (never {})\n    \"walletAddress\": wallet,                    # ← REQUIRED\n    \"reasoning\": \"Strategy edge explanation\",\n})\nprint(f\"Order ID: {result.get('orderId')}\")\nprint(f\"Status:   {result.get('status')}\")\n```\n\n### Default Execution Policy\n\nFor general-purpose execution, use this default policy unless the user overrides it:\n\n1. prefer `market` mode\n2. use `2` USDC as default buy size\n3. derive a marketable cap from current prices or order book when using market-order helpers\n4. ask for a price only when the user explicitly requested a limit order and did not provide one\n5. report the market snapshot and final order parameters without blocking on extra confirmation\n\n> **Common pitfalls:**\n>\n> - `\"order\": {}` → server cannot find `signatureType`, returns credential error\n> - Using event numeric ID as `marketConditionId` → use sub-market hex `conditionId`\n> - Missing `walletAddress` → \"walletAddress 不能为空\" error\n> - Not setting `neg_risk=True` for neg-risk markets → invalid signature, Polymarket rejects\n> - `orderSize` below `orderMinSize` → order rejected\n> - Insufficient USDC balance → server returns generic `INTERNAL_ERROR`\n> - Insufficient allowance → downstream exchange cannot spend collateral\n> - SDK result is empty or generic → verify recent trades and orders before reporting failure\n\n**Order types:** `GTC` (default), `FOK`, `GTD`, `FAK`\n**Sides:** `BUY`, `SELL`\n**Outcomes:** `YES`, `NO`\n\n---\n\n## Workflow: Kalshi Quote -> Sign -> Submit\n\nUse this flow for Kalshi venue execution.\n\n```python\nquote = client.kalshi_quote(\n    market_ticker=\"KX...\",\n    side=\"YES\",\n    action=\"BUY\",\n    amount=10,\n    user_public_key=\"<solana-wallet>\",\n)\n\n# Sign quote[\"unsignedTransaction\"] locally (wallet implementation specific)\nsigned_tx = \"<base64-signed-tx>\"\n\nsubmit = client.kalshi_submit(\n    market_ticker=\"KX...\",\n    side=\"YES\",\n    action=\"BUY\",\n    amount=10,\n    quote_id=quote[\"quoteId\"],\n    signed_transaction=signed_tx,\n    user_public_key=\"<solana-wallet>\",\n    in_amount=quote.get(\"inAmount\"),\n    out_amount=quote.get(\"outAmount\"),\n    min_out_amount=quote.get(\"minOutAmount\"),\n)\nprint(submit)\n\n# Unified positions endpoint for Kalshi (venue = kalshi)\nkalshi_positions = client.get_current_positions(\n    user=\"<solana-wallet>\",\n    venue=\"kalshi\",\n)\nprint(kalshi_positions)\n```\n\nKalshi currently does not expose a dedicated cancel API in this SDK. Use a SELL flow (`kalshi_quote` -> sign -> `kalshi_submit`) to reduce/exit exposure.\n\n## Workflow: Order Management\n\n```python\n# List open orders\nopen_orders = client.get_open_orders()\n\n# Order history (with optional filters)\nhistory = client.get_order_history(limit=20, order_status=2)\n\n# Single order detail\ndetail = client.get_order_detail(\"ORDER_ID\")\n\n# Cancel one order\nclient.cancel_order(\"ORDER_ID\")\n\n# Cancel ALL orders (use with care)\nclient.cancel_all_orders()\n```\n\n---\n\n## Workflow: Heartbeat / Briefing\n\nCall periodically (every 30s–15min depending on strategy frequency).\n\n```python\n# wallet can be Polygon or Solana based on venue flow\nbriefing = client.get_briefing(user=wallet)\n\n# 1. Handle risk alerts first\nfor alert in briefing.get(\"riskAlerts\", []):\n    print(f\"⚠️  {alert}\")\n\n# 2. Review open orders\nopen_orders = client.get_open_orders()\nprint(f\"Open orders: {len(open_orders)}\")\n\n# 3. Scan opportunity markets\nfor opp in briefing.get(\"opportunityMarkets\", [])[:5]:\n    print(f\"Opportunity: {opp.get('id')} — {opp.get('question')}\")\n```\n\n---\n\n## Workflow: Redemption\n\nWhen a market settles, redeem winning positions:\n\n```python\nclient.redeem(market_id=\"MARKET_ID\", side=\"YES\")\n```\n\n---\n\n## Error Handling\n\n```python\nfrom aionmarket_sdk import AionMarketClient, ApiError\n\nclient = AionMarketClient()\n\ntry:\n    result = client.get_me()\nexcept ApiError as e:\n    if e.status_code == 401:\n        print(\"❌ Invalid or missing API key\")\n    elif e.status_code == 403:\n        print(\"❌ Agent not authorized — check claim status or wallet credentials\")\n    elif e.status_code == 429:\n        print(\"⏳ Rate limited — back off and retry\")\n    else:\n        print(f\"API Error {e.code}: {e.message}\")\n```\n\nWhen trading, an `ApiError` from AION Market may still hide a successful downstream venue execution. If the response is ambiguous, query venue-specific follow-up endpoints before concluding failure (Polymarket orders/trades, or Kalshi submit/positions state).\n\n---\n\n## SDK Method Reference\n\n### Agent Management\n\n| Method                                | Description                                       |\n| ------------------------------------- | ------------------------------------------------- |\n| `register_agent(name)`                | Create agent, returns API key + claim code        |\n| `claim_preview(claim_code)`           | Preview agent info via claim code                 |\n| `get_me()`                            | Current agent profile and balances                |\n| `get_settings()`                      | Read risk control settings                        |\n| `update_settings(...)`                | Update max trades, max amount, pause, auto-redeem |\n| `get_skills(category, limit, offset)` | List available strategy skills                    |\n\n### Market Operations\n\n| Method                                                       | Description                                         |\n| ------------------------------------------------------------ | --------------------------------------------------- |\n| `get_markets(q, limit, page, venue, events_status)`          | Search markets by keyword                           |\n| `get_market(market_id, venue)`                               | Single market details                               |\n| `check_market_exists(market_id, venue)`                      | Existence check                                     |\n| `get_prices_history(token_id, ...)`                          | Historical prices for a token                       |\n| `get_briefing(venue, since, user, include_markets)`          | Heartbeat: alerts + opportunities                   |\n| `get_market_context(market_id, venue, user, my_probability)` | Pre-trade context & risk                            |\n| `get_current_positions(user, venue, ...)`                    | Unified current positions (`polymarket` / `kalshi`) |\n\n### Wallet Management\n\n| Method                                                                             | Description                      |\n| ---------------------------------------------------------------------------------- | -------------------------------- |\n| `check_wallet_credentials(wallet_address)`                                         | Check if CLOB credentials exist  |\n| `register_wallet_credentials(wallet_address, api_key, api_secret, api_passphrase)` | Store encrypted CLOB credentials |\n\n### Trading Operations\n\n| Method                                               | Description                           |\n| ---------------------------------------------------- | ------------------------------------- |\n| `trade(payload)`                                     | Place a Polymarket market/limit order |\n| `get_open_orders(venue, market_condition_id, limit)` | List unfilled orders                  |\n| `get_order_history(venue, ..., limit, offset)`       | Historical orders with filters        |\n| `get_order_detail(order_id, venue, wallet_address)`  | Single order detail                   |\n| `cancel_order(order_id, venue, wallet_address)`      | Cancel one order                      |\n| `cancel_all_orders(venue, wallet_address)`           | Cancel all open orders                |\n| `redeem(market_id, side, venue, wallet_address)`     | Redeem settled position               |\n| `kalshi_quote(...)`                                  | Build unsigned Kalshi quote tx        |\n| `kalshi_submit(...)`                                 | Submit locally signed Kalshi tx       |\n\n---\n\n## Checklist: Ready to Trade\n\n- [ ] `pip install aionmarket-sdk py-clob-client python-dotenv` installed\n- [ ] `.env` file created with `AIONMARKET_API_KEY` and `WALLET_PRIVATE_KEY` (plus `SOLANA_PRIVATE_KEY` if using Kalshi)\n- [ ] `.env` added to `.gitignore`\n- [ ] `get_me()` returns valid agent info\n- [ ] Polymarket CLOB credentials derived from private key and registered via `register_wallet_credentials()`\n- [ ] automatic balance, gas/fees, and allowance checks are part of the trading flow\n- [ ] missing allowance is auto-approved when technically possible\n- [ ] Risk limits configured via `update_settings()`\n- [ ] Heartbeat loop (`get_briefing()`) running or planned\n- [ ] Error handling wraps every SDK call with `ApiError`\n- [ ] For Kalshi: quote -> sign -> submit flow validated with `kalshi_quote()` / `kalshi_submit()`\n- [ ] ambiguous trade responses are verified against venue-specific state endpoints\n\n> Once all boxes are checked, the agent is ready for strategy skills to drive\n> market discovery and automated trade execution.\n\nFile v1.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn75fv5d7z6aj8q78vn72zsbnn84rb61\",\n  \"slug\": \"aionmarket-sdk-divergence-trader\",\n  \"version\": \"1.0.0\",\n  \"publishedAt\": 1777103040764\n}\n\nFile v1.0.0:skill-card.md\n\n## Description:\n\nTrades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional live execution through AION.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[ssj124](https://clawhub.ai/user/ssj124)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and trading operators use this skill when an agent already has a probability estimate for a specific prediction market and needs a disciplined wrapper for checking live market context, calculating edge, and optionally executing an AION trade.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can perform sensitive live-trading actions and may involve wallet approvals or credential custody.\n\nMitigation: Keep dry-run mode enabled by default, require explicit confirmation before live trading or wallet-affecting actions, and use only test funds or a tightly limited account.\n\nRisk: Trading SDK dependencies are not pinned to exact versions.\n\nMitigation: Pin and review dependency versions before using the skill with real credentials or funds.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/ssj124/skills/aionmarket-sdk-divergence-trader)\n- [Polymarket CLOB API endpoint](https://clob.polymarket.com)\n\n## Skill Output:\n\n**Output Type(s):** [Guidance, Shell commands, Code, Configuration, Text]\n\n**Output Format:** [Markdown guidance with bash and Python examples; the script prints text summaries and JSON trade results.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Requires AION API credentials and market inputs; live execution occurs only when the --live flag is used.]\n\n## Skill Version(s):\n\n1.0.0 (source: server release metadata and skill metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.0:clawhub.json\n\n{\n  \"emoji\": \"chart_with_upwards_trend\",\n  \"primaryEnv\": \"AION_API_KEY\",\n  \"requires\": {\n    \"pip\": [\"aion-sdk\", \"python-dotenv\"],\n    \"env\": [\"AION_API_KEY\"]\n  },\n  \"envVars\": [\n    {\n      \"name\": \"AION_API_KEY\",\n      \"required\": true,\n      \"description\": \"Main AION API key used by the skill.\"\n    },\n    {\n      \"name\": \"AIONMARKET_API_KEY\",\n      \"required\": false,\n      \"description\": \"Legacy alias supported by the script when AION_API_KEY is not set.\"\n    },\n    {\n      \"name\": \"MARKET_ID\",\n      \"required\": false,\n      \"description\": \"Target market id for automated runs.\"\n    },\n    {\n      \"name\": \"MY_PROBABILITY\",\n      \"required\": false,\n      \"description\": \"Your probability estimate between 0 and 1.\"\n    },\n    {\n      \"name\": \"VENUE\",\n      \"required\": false,\n      \"description\": \"Venue filter for reads and trades, such as polymarket or kalshi.\"\n    }\n  ],\n  \"cron\": \"*/15 * * * *\",\n  \"automaton\": {\n    \"managed\": true,\n    \"entrypoint\": \"divergence_trader.py\"\n  }\n}","readmeExcerpt":"Skill: Aionmarket Sdk Divergence Trader Owner: ssj124 Summary: Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional li... Tags: latest:1.0.0 Version history: v1.0.0 | 2026-04-25T07:44:00.764Z | auto AION Market Divergence Trader 1.0.0 — Initial Release - Provides a template for disciplined probability-based trading o","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python divergence_trader.py --market-id 12345 --my-probability 0.62"},{"language":"bash","snippet":"python divergence_trader.py --market-id 12345 --my-probability 0.62 --amount 5 --live"},{"language":"text","snippet":"Skill: aionmarket-trading\nVenue: polymarket\nRisk alerts:\n- none\n\nDecision:\n- MARKET_ID: TRADE YES size=5.0 reason=edge +7.0%"},{"language":"text","snippet":"### Step 4 — Configure Risk Limits"},{"language":"text","snippet":"### Step 5 — Kalshi Prerequisites (Optional, for Kalshi venue)\n\n- Ensure Solana wallet is available (`SOLANA_PRIVATE_KEY` / `userPublicKey`)\n- Use `kalshi_quote()` to request unsigned tx, locally sign, then call `kalshi_submit()`\n- For BUY flows, provide `userPublicKey` so KYC/geo checks can be evaluated upstream\n\n---\n\n## Workflow: Market Search & Context\n\n### Understanding Market Data Structure\n\n> **Critical:** `get_markets()` returns **events**, each containing a nested `markets[]`\n> array of **sub-markets**. Trading fields like `conditionId`, `clobTokenIds`,\n> `outcomePrices`, `negRisk`, and `orderPriceMinTickSize` live on the **sub-market**, NOT the event."},{"language":"text","snippet":"### Get Market Context (REQUIRED before trading)"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: aionmarket-trading\ndescription: Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional live execution through AION.\nmetadata:\n    author: \"Saul Su\"\n    version: \"1.0.0\"\n    displayName: \"AION Market Divergence Trader\"\n    difficulty: \"intermediate\"\n---\n\n# AION Market Divergence Trader\n\nThis skill is a publishable trading template for AION Market. It compares your probability estimate with the live market price, checks market context, and only places a trade when the edge clears a configurable threshold. aionmarket-sdk\n\n> **This is a template.** The default signal is probability divergence: if your model thinks the event is more likely than the market implies, the skill buys YES; if less likely, it buys NO. Remix the signal source with your own model, API, or research process. The skill handles trade discipline, operator output, and AION trade tagging.\n\n## When To Use\n\nUse this skill when an agent already has a probability estimate for a specific market and needs a safe execution wrapper around that signal.\n\n## Skill Folder\n\nThis skill ships with three files:\n\n- SKILL.md\n- clawhub.json\n- divergence_trader.py\n\n## Defaults\n\n- Venue: polymarket\n- Trade size: 5.0\n- Minimum edge: 0.05\n- Execution mode: dry-run unless `--live` is passed\n- Trade source: `sdk:aionmarket-trading`\n- Skill slug: `aionmarket-trading`\n\n## Required Inputs\n\nThe skill expects:\n\n- `AION_API_KEY` or `AIONMARKET_API_KEY`\n- `MARKET_ID` for the target market\n- `MY_PROBABILITY` as a decimal between `0` and `1`\n\nOptional inputs:\n\n- `VENUE` such as `polymarket` or `kalshi`\n- `TRADE_SIZE`\n- `MIN_EDGE`\n- `REASONING_PREFIX`\n\n## Safety Rules\n\n1. Always fetch market context before deciding.\n2. Always default to dry-run. Live trading requires explicit `--live`.\n3. Always attach `source`, `skill_slug`, and human-readable `reasoning`.\n4. Skip trading when context reports warnings or flip-flop risk.\n5. Return `HOLD` when the edge is smaller than the configured threshold.\n\n## Decision Logic\n\n1. Read the live market probability from market context.\n2. Compute `edge = my_probability - market_probability`.\n3. If `edge >= min_edge`, buy YES.\n4. If `edge <= -min_edge`, buy NO.\n5. Otherwise hold.\n\n## Example Commands\n\nDry-run:\n\n```bash\npython divergence_trader.py --market-id 12345 --my-probability 0.62\n```\n\nLive trade:\n\n```bash\npython divergence_trader.py --market-id 12345 --my-probability 0.62 --amount 5 --live\n```\n\n## Expected Operator Output\n\nThe script prints an operator-style summary:\n\n```text\nSkill: aionmarket-trading\nVenue: polymarket\nRisk alerts:\n- none\n\nDecision:\n- MARKET_ID: TRADE YES size=5.0 reason=edge +7.0%\n```\n\n## Remix Ideas\n\n- Replace `MY_PROBABILITY` with a forecast model output.\n- Drive `MARKET_ID` from a market scanner.\n- Add portfolio-aware sizing before the trade call.\n- Extend the loop to poll with jitter and auto-redeem resolved positions.\n    key=private_key,\n    chain_i"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn75fv5d7z6aj8q78vn72zsbnn84rb61\",\n  \"slug\": \"aionmarket-sdk-divergence-trader\",\n  \"version\": \"1.0.0\",\n  \"publishedAt\": 1777103040764\n}"},{"path":"skill-card.md","content":"## Description:\n\nTrades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional live execution through AION.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[ssj124](https://clawhub.ai/user/ssj124)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and trading operators use this skill when an agent already has a probability estimate for a specific prediction market and needs a disciplined wrapper for checking live market context, calculating edge, and optionally executing an AION trade.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can perform sensitive live-trading actions and may involve wallet approvals or credential custody.\n\nMitigation: Keep dry-run mode enabled by default, require explicit confirmation before live trading or wallet-affecting actions, and use only test funds or a tightly limited account.\n\nRisk: Trading SDK dependencies are not pinned to exact versions.\n\nMitigation: Pin and review dependency versions before using the skill with real credentials or funds.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/ssj124/skills/aionmarket-sdk-divergence-trader)\n- [Polymarket CLOB API endpoint](https://clob.polymarket.com)\n\n## Skill Output:\n\n**Output Type(s):** [Guidance, Shell commands, Code, Configuration, Text]\n\n**Output Format:** [Markdown guidance with bash and Python examples; the script prints text summaries and JSON trade results.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Requires AION API credentials and market inputs; live execution occurs only when the --live flag is used.]\n\n## Skill Version(s):\n\n1.0.0 (source: server release metadata and skill metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."},{"path":"clawhub.json","content":"{\n  \"emoji\": \"chart_with_upwards_trend\",\n  \"primaryEnv\": \"AION_API_KEY\",\n  \"requires\": {\n    \"pip\": [\"aion-sdk\", \"python-dotenv\"],\n    \"env\": [\"AION_API_KEY\"]\n  },\n  \"envVars\": [\n    {\n      \"name\": \"AION_API_KEY\",\n      \"required\": true,\n      \"description\": \"Main AION API key used by the skill.\"\n    },\n    {\n      \"name\": \"AIONMARKET_API_KEY\",\n      \"required\": false,\n      \"description\": \"Legacy alias supported by the script when AION_API_KEY is not set.\"\n    },\n    {\n      \"name\": \"MARKET_ID\",\n      \"required\": false,\n      \"description\": \"Target market id for automated runs.\"\n    },\n    {\n      \"name\": \"MY_PROBABILITY\",\n      \"required\": false,\n      \"description\": \"Your probability estimate between 0 and 1.\"\n    },\n    {\n      \"name\": \"VENUE\",\n      \"required\": false,\n      \"description\": \"Venue filter for reads and trades, such as polymarket or kalshi.\"\n    }\n  ],\n  \"cron\": \"*/15 * * * *\",\n  \"automaton\": {\n    \"managed\": true,\n    \"entrypoint\": \"divergence_trader.py\"\n  }\n}"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional li... Skill: Aionmarket Sdk Divergence Trader Owner: ssj124 Summary: Trades a market when your estimated probability diverges from the live market price, with dry-run by default, context checks, reasoning tags, and optional li... Tags: latest:1.0.0 Version history: v1.0.0 | 2026-04-25T07:44:00.764Z | auto AION Market Divergence Trader 1.0.0 — Initial Release - Provides a template for disciplined probability-based trading o","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1250,"uniquenessScore":46,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T14:05:40.968Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-09T14:05:40.968Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-09T23:01:42.940Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}