Install
$ agentstack add skill-weex-labs-weex-trader-skill-weex-monitor-skill ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
WEEX Monitor Skill
Read manifest.json for routing rules. Open file-index.json only when you need file-level guidance.
This skill owns WEEX position-PnL automated monitor orchestration. It converts a constrained PnL monitor intent into a task DSL, renders localized monitor confirmation text with a confirmation token, requires explicit monitor confirmation, stores local task state in SQLite, appends audit events, evaluates local PnL triggers, can activate and start a bounded live PnL loop from one combined user confirmation, can run live PnL checks or a bounded live loop through weex-trader-skill, and reports results to the current thread.
This skill does not own API credentials, profile storage, vault unlock, REST signing, or direct REST submission. Those capabilities stay in weex-trader-skill. Live monitor commands are orchestration wrappers around weex-trader-skill guard flows and require internal live-execution flags. Do not use internal flag names in user-facing wording; tell the user plainly that they are authorizing real account access and, if triggered, a real close order. A single user confirmation may authorize monitor activation and live execution only when the confirmation text includes the matched live position, close action, final task details, and real-account/order authority; PnL live loops must also include a finite live duration. User-facing monitor confirmation must ask for one simple localized reply word: 确认 for Chinese copy or confirm for English copy; do not ask for longer localized phrases such as "confirm start monitoring."
AI natural-language parsing
When the user gives a natural-language monitor request, the AI layer of this skill must convert the user's monitor instruction into the Task DSL before calling the deterministic script. The script intentionally accepts JSON only; do not pass raw chat text to the script and treat a missing DSL field as a clarification need, not as permission to infer a risky value.
Required extraction fields:
- monitor object:
profile,symbol, andposition_side; profile is always required before calling the CLI because the monitor task must bind to a saved WEEX profile name - monitor frequency:
frequency_secondsfor PnL monitors, defaulting to5when omitted - trigger condition: metric must be
unrealized_pnl, with an operator and numeric threshold - execution action: only
market_closetargeting the sameposition_side;action.quantityis optional and, when omitted, live execution uses the matched position size from the fresh account snapshot - live run scope for combined create-and-start PnL flows: finite
duration_secondsor an absolute expiry time that the AI converts toduration_seconds; do not ask users for iteration counts - live position confirmation for combined create-and-start PnL flows: before asking the user to confirm, collect the real account position through
weex-trader-skill, find the exactsymbol+position_sidematch, and show its side, size, current unrealized PnL, and detailed live position snapshot fields such as entry price, current/mark price, leverage, margin mode, closable quantity, liquidation price, position update time, account available balance, and confirmation snapshot time; if a field is not returned, show the missing-value placeholder localized to the confirmation language, such asnot returnedin English - Agent status reporting for live PnL flows: default reporting interval is
60seconds; if the user asks for a different interval, convert it toreporting_interval_secondsas a whole-minute interval no lower than60seconds - callback: only
current_thread
If any required field is absent or ambiguous, ask for the missing field and keep the task as a draft. Do not create a monitor for price-threshold conditions, open, add, reverse, leverage, transfer, arbitrary script, or spot actions. For price-based conditional closes, direct the user to WEEX official conditional orders via weex-trader-skill; do not create a local monitor task. Do not submit orders by bypassing the trader guard; live execution must be delegated to weex-trader-skill and requires explicit user authorization for real account access and real order execution.
Examples:
- User:
Close the BTCUSDT long position automatically when unrealized PnL is above 50; check every 5 seconds. - DSL:
position_pnl_monitor,profile=,symbol=BTCUSDT,position_side=LONG,condition.metric=unrealized_pnl,condition.operator=>,condition.threshold=50,action.target=LONG,frequency_seconds=5. - User:
Create and start a BTCUSDT long-position PnL monitor; close the long position when unrealized PnL is above 50; run for 1 hour. - DSL: same
position_pnl_monitoras above plus live run scopeduration_seconds=3600; first callconfirm-text-liveso the user sees the matched live position, then after the user replies with the localized simple confirmation word from the summary, useconfirm-and-run-loopwith the internal confirmation token and live-execution flag.
Supported Scenarios
position_pnl_monitor: monitor one futures position bysymbolandposition_side, compareunrealized_pnlagainst a threshold, then useweex-trader-skillto preview and confirm a direction-specific market-close order when an authorized live runner is used.
Do not expand this skill to price-threshold monitors, open positions, add margin, change leverage, reverse positions, spot trading, grid trading, trailing stops, multi-account tasks, or arbitrary script execution unless the skill policy and tests are updated first.
Core Entry Point
scripts/weex_monitor_cli.py: normalize PnL monitor tasks, render monitor confirmation text and a confirmation token, render live-position confirmation text withconfirm-text-live, localize confirmation copy and the simple reply word with--language zh|en, require--confirm-monitorplus a matching--confirmation-token, persist draft/active/executing/completed/cancelled/review_required tasks, append events, evaluate PnL snapshots, run dry-run checks and dry-run loops, run live PnL checks and bounded live loops throughweex-trader-skill, activate and run a bounded PnL live loop withconfirm-and-run-loop, returnagent_reportingmetadata for Codex heartbeat, Claude Code/loop, and OpenClaw cron status reporting, list tasks/events, and cancel local tasks.
Safety Policy
- Never send mutating requests directly from this skill's REST code path; live execution must go through
weex-trader-skillguard commands. - Never send mutating requests without explicit user confirmation that they authorize real account access and real order execution.
- Use this skill to create, confirm, store, evaluate, and run monitor tasks; use
weex-trader-skillfor any live REST call, profile lookup, vault operation, signing, or order submission. - Do not import trader internals such as
weex_contract_api,weex_trade_guard, orweex_profile_storeinto this skill's deterministic monitor script. - Do not default to WEEX
closePositions(symbol)for "close long" or "close short"; that endpoint cannot expresspositionSide. - Directional close is mandatory. If a directional close cannot be represented or verified, report the trigger and ask for manual handling instead of submitting a live order.
- The first callback channel is
current_threadonly.
Task DSL
{
"task_type": "position_pnl_monitor",
"profile": "demo",
"market": "futures",
"symbol": "BTCUSDT",
"position_side": "LONG",
"frequency_seconds": 5,
"condition": {
"metric": "unrealized_pnl",
"operator": ">",
"threshold": "50"
},
"action": {
"type": "market_close",
"target": "LONG"
},
"callback": {
"type": "current_thread"
}
}
Operating Rules
- A task starts as
draft;confirm-textrenders localized monitor confirmation text, including the required simple reply word (确认orconfirm), writes the draft locally, and returns aconfirmation_token. - Always pass
--language zhfor Chinese user copy. Always pass--language enfor English user copy when callingconfirm-textorconfirm-text-live; choose from the current user's language context, and do not rely on the script default language for user-facing confirmation copy. - A task becomes
activeonly after the caller passes both--confirm-monitorand the matching--confirmation-token; do not activate a task that has not first gone throughconfirm-text. - PnL monitors default to
5seconds and reject values below3seconds. - Agent status reporting defaults to
60seconds and rejects lower or non-whole-minute intervals. Pass--reporting-interval-secondstoconfirm-text-livewhen the user asks for a different reporting cadence. - Do not create local price-threshold monitors. WEEX official conditional orders should be used for price-based conditional closes.
- One task should trigger at most once. Persist the final task state and report the outcome.
- Treat missing fields, missing positions, zero size, degraded input, or ambiguous direction as non-executable.
- Local task state is stored in
monitor-tasks.sqlite3; legacymonitor-tasks.jsonmay only be read as a fallback. - dry-run commands still write local SQLite task state and events so trigger handling, one-shot behavior, and reporting can be audited.
run-oncerequires--dry-runand must never submit a live order.run-loop --dry-runconsumes caller-supplied position snapshots and must never submit a live order.- Live
run-loopruns a bounded live loop for active PnL monitors. It uses the smallest active taskfrequency_secondsas the default sleep interval unless--sleep-secondsis provided, delegates every live account read and order action toweex-trader-skill, and requires explicit user authorization for real account access and real order execution. - If the user asks to create and start a PnL monitor in one flow, prefer one combined confirmation summary over separate chat confirmations. The summary must include the exact matched live position, detailed live position snapshot fields, task DSL details, finite
duration_secondsor absolute expiry time, real-account/order authority, and one-shot close behavior, and it must ask the user to reply with the localized simple confirmation word (确认for Chinese,confirmfor English). Useconfirm-text-liveto collect the live position and render that summary; after the user replies with that word, callconfirm-and-run-loopwith the internal confirmation token, live-execution flag, and duration. - After starting the live loop and verifying the task is still
activeorexecuting, create a runtime-native status reporting loop from returnedagent_reportingmetadata. In Codex, useagent_reporting.runtimes.codexor the backward-compatiblecodex_reporting/reportingmetadata withautomation_updateto create a thread heartbeat. In Claude Code, useagent_reporting.runtimes.claude_codewith the native/loopscheduled task capability and ask Claude Code what scheduled tasks exist before creating a duplicate. In OpenClaw, useagent_reporting.runtimes.openclawwithopenclaw cron addfor exact interval reporting; useHEARTBEAT.mdonly when its configured heartbeat cadence can satisfy the requested interval. Runtime-native reporting must report task status, condition, latest current value, threshold, trigger state, reason, close order, exchange response, or error. - Do not output HTML entities such as
<,>, or&in runtime-native status reports. Render comparison operators as readable words in the response language, such asless thanfor0, converts duration to internal iterations fromfrequency_seconds, activates the task, then runs only that task through the bounded live loop. - Triggered dry-runs may produce a live delegate plan, but that plan is only a summary for
weex-trader-skilland is not an execution request. run-live-oncerequires internal live-execution authorization; it only runs active PnL tasks that still match a consumed monitor confirmation token, collects live account risk data throughweex-trader-skill, evaluates active PnL monitors, re-collects and revalidates the target position before submission, atomically claims the task asexecuting, then executes the market close throughweex-trader-skill preview-orderandconfirm-order.- Live PnL execution writes
completedand exchange response details only after trader guard returns a successful response; failed delegated commands writereview_requiredplus alive_order_failedevent instead of silently retrying. - Execution claim is local SQLite active-to-executing compare-and-set. If another runner has already claimed the task, report
execution_already_claimedand do not submit a duplicate order.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: weex-labs
- Source: weex-labs/weex-trader-skill
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.