openbroker 1.0.59 → 1.0.60

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/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.59", "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)"}]}}
7
+ metadata: {"author": "monemetrics", "version": "1.0.60", "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_fills ob_orders ob_order_status ob_fees ob_candles ob_funding_history ob_trades ob_rate_limit ob_funding_scan 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
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openbroker",
3
3
  "name": "OpenBroker — Hyperliquid Trading",
4
- "version": "1.0.59",
4
+ "version": "1.0.60",
5
5
  "description": "Trade on Hyperliquid DEX with background position monitoring",
6
6
  "configSchema": {
7
7
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openbroker",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "Hyperliquid trading CLI - execute orders, manage positions, and run trading strategies",
5
5
  "type": "module",
6
6
  "bin": {
@@ -284,6 +284,35 @@ export class PositionWatcher implements PluginService {
284
284
  return events;
285
285
  }
286
286
 
287
+ private buildHookMessage(event: PositionEvent): string {
288
+ const lines: string[] = [
289
+ `[OpenBroker Alert] ${this.formatEventHeadline(event)}`,
290
+ '',
291
+ 'Details:',
292
+ ...Object.entries(event.details ?? {}).map(([k, v]) => ` ${k}: ${v}`),
293
+ '',
294
+ `Notify the user of this trading alert via their preferred channel.`,
295
+ ];
296
+ return lines.join('\n');
297
+ }
298
+
299
+ private formatEventHeadline(event: PositionEvent): string {
300
+ switch (event.type) {
301
+ case 'position_opened':
302
+ return `New ${event.details?.side ?? ''} position opened on ${event.coin}: ${Math.abs(parseFloat(String(event.details?.size ?? '0')))} ${event.coin} at $${event.details?.entryPrice}`;
303
+ case 'position_closed':
304
+ return `Position on ${event.coin} has been closed (was ${event.details?.previousSize} at $${event.details?.entryPrice}, last unrealized PnL: $${event.details?.lastPnl})`;
305
+ case 'position_size_changed':
306
+ return `Position on ${event.coin} size changed from ${event.details?.previousSize} to ${event.details?.newSize}`;
307
+ case 'pnl_threshold':
308
+ return `Significant PnL movement on ${event.coin}: $${Number(event.details?.previousPnl ?? 0).toFixed(2)} → $${Number(event.details?.currentPnl ?? 0).toFixed(2)} (${Number(event.details?.changePct ?? 0).toFixed(1)}% of position value)`;
309
+ case 'margin_warning':
310
+ return `Margin usage at ${Number(event.details?.marginUsedPct ?? 0).toFixed(1)}% — approaching risk threshold (equity: $${event.details?.equity}, margin used: $${event.details?.marginUsed})`;
311
+ default:
312
+ return event.message;
313
+ }
314
+ }
315
+
287
316
  private async sendHook(event: PositionEvent): Promise<void> {
288
317
  const port = this.gatewayPort || 18789;
289
318
 
@@ -302,7 +331,7 @@ export class PositionWatcher implements PluginService {
302
331
  'Authorization': `Bearer ${this.hooksToken}`,
303
332
  },
304
333
  body: JSON.stringify({
305
- message: event.message,
334
+ message: this.buildHookMessage(event),
306
335
  name: `ob-${event.type}`,
307
336
  wakeMode: 'now',
308
337
  }),