Matic Trades
This skill tells you how to call Matic Trades from OpenClaw using the bundled script. Keep instructions short: run the script, pass the user’s words as --prompt, return a clear summary (and image URLs when present).
How OpenClaw uses this
- - Skills are markdown + optional files; the model follows this file when the task matches the description.
- Prefer
python3 "{baseDir}/scripts/matic.py" … so requests stay consistent with the real API (no hand-rolled JSON in chat). - After the script prints JSON, summarize for the user; don’t dump raw JSON unless they ask.
Docs: OpenClaw — Creating skills, Skills loading.
Config
| Variable | Required | Purpose |
|---|
| INLINECODE2 | Yes | Bearer token (same as dashboard API key). Alias: MATIC_TRADES_API_KEY. |
| INLINECODE4 |
No | Default
https://api.matictrades.com/api/v1 (no trailing slash). Override if your deployment uses another host. |
Never print or log the API key.
1) Toolbox — AI_PICK (default for “use Matic tools”)
What the API does: POST /toolbox/execute with mode: AI_PICK. The server uses the prompt alone to decide which tools to run (e.g. chart_analysis, market_news, social_search), then executes them. context is not required and is not what drives tool selection in normal use—put everything important in the prompt (tickers, timeframe, what they want).
Minimal request body (this is correct):
CODEBLOCK0
Run:
CODEBLOCK1
Examples (prompt-only):
- - INLINECODE13
- INLINECODE14
- INLINECODE15
Do not require or invent a context object for AI_PICK unless you are implementing a documented advanced API feature (e.g. custom_handlers from Matic’s API docs). For ClawHub users, prompt-only is the supported path.
2) Data — SMART_SEARCH (Twelve Data via natural language)
What the API does: POST /data/execute with mode: SMART_SEARCH. The server maps the prompt to an allowed Twelve Data endpoint and parameters.
Run:
CODEBLOCK2
Optional hints only if the user gave them: --symbol AAPL, --interval 1day. The API still centers on prompt for SMART_SEARCH.
3) Agent charting — autonomous charts + analysis
What the API does: POST /agent/chart/autonomous — multi-step chart agent; can return image URLs or base64 in snapshots.
Run:
CODEBLOCK3
Use --images url when the client can open links; b64 or both if the UI supports inline images.
Optional: --max-actions N, --model MODEL (see references/api.md).
Which command when?
| User goal | Command |
|---|
| Broad research, multiple possible tools, news/social/chart mix | toolbox (AIPICK, prompt only) |
| “Get RSI / price / indicator / series for …” in plain English |
data (SMARTSEARCH) |
| “Walk through charts”, “show me the chart”, visual narrative |
chart |
Chaining: Only if it clearly helps—e.g. data for numbers, then toolbox for synthesis, or chart for visuals. Avoid redundant double calls.
Response handling
- - Parse JSON stdout; explain tool_runs / analysis / data in plain language.
- If
snapshots.pre_url, snapshots.post_url, or URLs appear in outputs, give the user those links.
Errors
- - 401 — Missing/wrong
MATIC_API_KEY. - 429 — Rate limit; slow down or check plan.
- Quota / billing messages — Point to Matic dashboard.
Files
- -
references/api.md — request/response shapes. - INLINECODE42 — install, ClawHub upload, env setup.
Scope
Only call matic.py with user-supplied prompt text (sanitized for shell if needed). HTTP targets only MATIC_TRADES_API_BASE paths used by this script. No arbitrary curl to other hosts with user data.
Matic Trades
此技能说明如何通过捆绑脚本从OpenClaw调用 Matic Trades。请保持指令简短:运行脚本,将用户输入作为 --prompt 参数传递,返回清晰摘要(如有图片URL也一并返回)。
OpenClaw 使用方式
- - 技能为 markdown + 可选文件;当任务匹配描述时,模型遵循此文件。
- 优先使用 python3 {baseDir}/scripts/matic.py … 以确保请求与真实API一致(避免在聊天中手动构造JSON)。
- 脚本输出JSON后,为用户总结;除非用户要求,否则不要直接输出原始JSON。
文档:OpenClaw — 创建技能,技能加载。
配置
| 变量 | 必需 | 用途 |
|---|
| MATICAPIKEY | 是 | Bearer令牌(与仪表盘API密钥相同)。别名:MATICTRADESAPIKEY。 |
| MATICTRADESAPIBASE |
否 | 默认 https://api.matictrades.com/api/v1(无尾部斜杠)。若部署使用其他主机可覆盖。 |
切勿打印或记录API密钥。
1) 工具箱 — AI_PICK(使用Matic工具的默认模式)
API功能: POST /toolbox/execute,模式为 AIPICK。服务器仅根据提示决定运行哪些工具(例如 chartanalysis、marketnews、socialsearch),然后执行。context 非必需,在正常使用中不驱动工具选择——所有重要信息(股票代码、时间范围、用户需求)都应放在提示中。
最小请求体(正确格式):
json
{ mode: AI_PICK, prompt: 用户完整请求(自然语言) }
运行命令:
bash
python3 {baseDir}/scripts/matic.py toolbox --prompt 用户文本
示例(仅提示):
- - toolbox --prompt 今日异常期权活动及相关新闻
- toolbox --prompt NVDA图表和情绪分析——关注近期水平
- toolbox --prompt 加密货币大户动向及社交媒体讨论
除非你正在实现文档中说明的高级API功能(例如Matic API文档中的 customhandlers),否则不要为AIPICK要求或虚构 context 对象。对于ClawHub用户,仅提示是支持的路径。
2) 数据 — SMART_SEARCH(通过自然语言查询Twelve Data)
API功能: POST /data/execute,模式为 SMART_SEARCH。服务器将提示映射到允许的Twelve Data端点和参数。
运行命令:
bash
python3 {baseDir}/scripts/matic.py data --prompt 用户文本
仅当用户提供了可选提示时使用:--symbol AAPL、--interval 1day。对于SMART_SEARCH,API仍以prompt为核心。
3) 智能图表 — 自主图表与分析
API功能: POST /agent/chart/autonomous — 多步骤图表代理;可在 snapshots 中返回图片URL或base64。
运行命令:
bash
python3 {baseDir}/scripts/matic.py chart --prompt 用户文本 --images url
当客户端可打开链接时使用 --images url;若UI支持内嵌图片则使用 b64 或 both。
可选参数:--max-actions N、--model MODEL(参见 references/api.md)。
何时使用哪个命令?
| 用户目标 | 命令 |
|---|
| 广泛研究、多种可能工具、新闻/社交/图表混合 | toolbox(AIPICK,仅提示) |
| 用自然语言查询获取RSI/价格/指标/序列... |
data(SMARTSEARCH) |
| 逐步查看图表、展示图表、可视化叙述 |
chart |
链式调用: 仅当明确有帮助时使用——例如先用 data 获取数据,再用 toolbox 进行综合分析,或使用 chart 获取可视化。避免冗余的双重调用。
响应处理
- - 解析JSON标准输出;用通俗语言解释 toolruns / analysis / data。
- 如果输出中包含 snapshots.preurl、snapshots.post_url 或URL,向用户提供这些链接。
错误处理
- - 401 — 缺少或错误的 MATICAPIKEY。
- 429 — 速率限制;降低频率或检查套餐。
- 配额/计费消息 — 指向Matic仪表盘。
文件
- - references/api.md — 请求/响应格式。
- README.md — 安装、ClawHub上传、环境配置。
范围
仅使用用户提供的提示文本调用 matic.py(必要时进行shell转义)。HTTP目标仅限此脚本使用的 MATICTRADESAPI_BASE 路径。禁止使用用户数据向其他主机发起任意 curl 请求。