openbroker 1.0.42 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -0
- package/SKILL.md +48 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -559,6 +559,105 @@ openbroker approve-builder --max-fee "0.05%" # Custom max fee
|
|
|
559
559
|
| `--builder` | Custom builder address (advanced) | Open Broker |
|
|
560
560
|
| `--verbose` | Show debug output | — |
|
|
561
561
|
|
|
562
|
+
## OpenClaw Plugin
|
|
563
|
+
|
|
564
|
+
OpenBroker ships as an [OpenClaw](https://openclaw.ai) plugin. When installed via OpenClaw, it registers structured agent tools and a background position watcher — no Bash wrappers needed.
|
|
565
|
+
|
|
566
|
+
### Install via OpenClaw
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
openclaw plugins install openbroker
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
Or install from a local checkout during development:
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
openclaw plugins install -l ./open-broker-mvp
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
After installation, run `openbroker setup` to configure your wallet (same onboarding as the standalone CLI).
|
|
579
|
+
|
|
580
|
+
### Plugin Tools
|
|
581
|
+
|
|
582
|
+
When loaded, the plugin registers these agent tools:
|
|
583
|
+
|
|
584
|
+
| Category | Tool | Description |
|
|
585
|
+
|----------|------|-------------|
|
|
586
|
+
| Info | `ob_account` | Account balance, equity, margin, open orders |
|
|
587
|
+
| Info | `ob_positions` | Open positions with PnL, leverage, liquidation price |
|
|
588
|
+
| Info | `ob_funding` | Funding rates sorted by annualized rate |
|
|
589
|
+
| Info | `ob_markets` | Market data (price, volume, OI) |
|
|
590
|
+
| Info | `ob_search` | Search assets across perps, HIP-3, and spot |
|
|
591
|
+
| Info | `ob_spot` | Spot markets and token balances |
|
|
592
|
+
| Trading | `ob_buy` | Market buy |
|
|
593
|
+
| Trading | `ob_sell` | Market sell |
|
|
594
|
+
| Trading | `ob_limit` | Limit order (GTC, IOC, ALO) |
|
|
595
|
+
| Trading | `ob_trigger` | Trigger order (TP/SL) |
|
|
596
|
+
| Trading | `ob_tpsl` | Set TP/SL on existing position |
|
|
597
|
+
| Trading | `ob_cancel` | Cancel orders |
|
|
598
|
+
| Advanced | `ob_twap` | TWAP execution |
|
|
599
|
+
| Advanced | `ob_bracket` | Entry + TP + SL |
|
|
600
|
+
| Advanced | `ob_chase` | Chase price with ALO orders |
|
|
601
|
+
| Monitoring | `ob_watcher_status` | Background watcher state |
|
|
602
|
+
|
|
603
|
+
### Background Position Watcher
|
|
604
|
+
|
|
605
|
+
The plugin runs a background service that polls your Hyperliquid account every 30 seconds and sends webhook notifications when:
|
|
606
|
+
|
|
607
|
+
- **Position opened** — new position detected
|
|
608
|
+
- **Position closed** — position removed
|
|
609
|
+
- **Size changed** — position increased or decreased
|
|
610
|
+
- **PnL threshold** — unrealized PnL changed by more than the configured % (default: 5%)
|
|
611
|
+
- **Margin warning** — margin usage exceeds threshold (default: 80%)
|
|
612
|
+
|
|
613
|
+
### Plugin Configuration
|
|
614
|
+
|
|
615
|
+
Configure in your OpenClaw settings under `plugins.entries.openbroker.config`:
|
|
616
|
+
|
|
617
|
+
```json
|
|
618
|
+
{
|
|
619
|
+
"privateKey": "0x...",
|
|
620
|
+
"accountAddress": "0x...",
|
|
621
|
+
"network": "mainnet",
|
|
622
|
+
"hooksToken": "your-hooks-secret",
|
|
623
|
+
"watcher": {
|
|
624
|
+
"enabled": true,
|
|
625
|
+
"pollIntervalMs": 30000,
|
|
626
|
+
"pnlChangeThresholdPct": 5,
|
|
627
|
+
"marginUsageWarningPct": 80,
|
|
628
|
+
"notifyOnPositionChange": true,
|
|
629
|
+
"notifyOnFunding": true
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
All fields are optional — the plugin falls back to `~/.openbroker/.env` and environment variables.
|
|
635
|
+
|
|
636
|
+
### OpenClaw Webhook Setup
|
|
637
|
+
|
|
638
|
+
For the position watcher to notify your agent, you need webhooks enabled in your OpenClaw gateway config:
|
|
639
|
+
|
|
640
|
+
```yaml
|
|
641
|
+
hooks:
|
|
642
|
+
enabled: true
|
|
643
|
+
token: "your-hooks-secret" # Must match hooksToken in plugin config
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
The watcher sends alerts to `POST /hooks/agent` with `wakeMode: "now"`, which triggers an immediate agent turn. The agent receives a message like:
|
|
647
|
+
|
|
648
|
+
```
|
|
649
|
+
Position alert: ETH unrealized PnL changed from +$500 to -$200 (-140%).
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
### CLI Commands
|
|
653
|
+
|
|
654
|
+
The plugin also registers CLI commands accessible via the OpenClaw CLI:
|
|
655
|
+
|
|
656
|
+
```bash
|
|
657
|
+
openclaw ob status # Show watcher state and current positions
|
|
658
|
+
openclaw ob watch # Run watcher in foreground (debugging)
|
|
659
|
+
```
|
|
660
|
+
|
|
562
661
|
## Development
|
|
563
662
|
|
|
564
663
|
For local development without global install:
|
package/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Hyperliquid trading plugin with background position monitoring. Exe
|
|
|
4
4
|
license: MIT
|
|
5
5
|
compatibility: Requires Node.js 22+, network access to api.hyperliquid.xyz
|
|
6
6
|
homepage: https://www.npmjs.com/package/openbroker
|
|
7
|
-
metadata: {"author": "monemetrics", "version": "1.0.
|
|
7
|
+
metadata: {"author": "monemetrics", "version": "1.0.43", "openclaw": {"requires": {"bins": ["openbroker"], "env": ["HYPERLIQUID_PRIVATE_KEY"]}, "primaryEnv": "HYPERLIQUID_PRIVATE_KEY", "install": [{"id": "node", "kind": "node", "package": "openbroker", "bins": ["openbroker"], "label": "Install openbroker (npm)"}]}}
|
|
8
8
|
allowed-tools: ob_account ob_positions ob_funding ob_markets ob_search ob_spot ob_buy ob_sell ob_limit ob_trigger ob_tpsl ob_cancel ob_twap ob_bracket ob_chase ob_watcher_status Bash(openbroker:*)
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -321,6 +321,53 @@ Run `openbroker setup` to create the global config interactively.
|
|
|
321
321
|
|
|
322
322
|
The builder fee (1 bps / 0.01%) is hardcoded and not configurable.
|
|
323
323
|
|
|
324
|
+
## OpenClaw Plugin (Optional)
|
|
325
|
+
|
|
326
|
+
This skill works standalone via Bash — every command above runs through the `openbroker` CLI. For enhanced features, the same `openbroker` npm package also ships as an **OpenClaw plugin** that you can enable alongside this skill.
|
|
327
|
+
|
|
328
|
+
### What the plugin adds
|
|
329
|
+
|
|
330
|
+
- **Structured agent tools** (`ob_account`, `ob_buy`, `ob_limit`, etc.) — typed tool calls with proper input schemas instead of Bash strings. The agent gets structured JSON responses.
|
|
331
|
+
- **Background position watcher** — polls your Hyperliquid account every 30s and sends webhook alerts when positions open/close, PnL moves significantly, or margin usage gets dangerous.
|
|
332
|
+
- **CLI commands** — `openclaw ob status` and `openclaw ob watch` for inspecting the watcher.
|
|
333
|
+
|
|
334
|
+
### Enable the plugin
|
|
335
|
+
|
|
336
|
+
The plugin is bundled in the same `openbroker` npm package. To enable it in your OpenClaw config:
|
|
337
|
+
|
|
338
|
+
```yaml
|
|
339
|
+
plugins:
|
|
340
|
+
entries:
|
|
341
|
+
openbroker:
|
|
342
|
+
enabled: true
|
|
343
|
+
config:
|
|
344
|
+
hooksToken: "your-hooks-secret" # Required for watcher alerts
|
|
345
|
+
watcher:
|
|
346
|
+
enabled: true
|
|
347
|
+
pollIntervalMs: 30000
|
|
348
|
+
pnlChangeThresholdPct: 5
|
|
349
|
+
marginUsageWarningPct: 80
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
The plugin reads wallet credentials from `~/.openbroker/.env` (set up by `openbroker setup`), so you don't need to duplicate `privateKey` in the plugin config unless you want to override.
|
|
353
|
+
|
|
354
|
+
### Webhook setup for watcher alerts
|
|
355
|
+
|
|
356
|
+
For position alerts to reach the agent, enable hooks in your gateway config:
|
|
357
|
+
|
|
358
|
+
```yaml
|
|
359
|
+
hooks:
|
|
360
|
+
enabled: true
|
|
361
|
+
token: "your-hooks-secret" # Must match hooksToken above
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Without hooks, the watcher still runs and tracks state (accessible via `ob_watcher_status`), but it can't wake the agent.
|
|
365
|
+
|
|
366
|
+
### Using with or without the plugin
|
|
367
|
+
|
|
368
|
+
- **Skill only (no plugin):** Use Bash commands (`openbroker buy --coin ETH --size 0.1`). No background monitoring.
|
|
369
|
+
- **Skill + plugin:** The agent prefers the `ob_*` tools when available (structured data), falls back to Bash for commands not covered by tools (strategies, scale). Background watcher sends alerts automatically.
|
|
370
|
+
|
|
324
371
|
## Risk Warning
|
|
325
372
|
|
|
326
373
|
- Always use `--dry` first to preview orders
|
package/openclaw.plugin.json
CHANGED