openbroker 1.0.68 → 1.0.69
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 +78 -7
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Hyperliquid trading plugin with background position monitoring and
|
|
|
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.69", "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 ob_auto_run ob_auto_stop ob_auto_list Bash(openbroker:*)
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -732,15 +732,86 @@ api.on('margin_warning', async ({ marginUsedPct, equity }) => {
|
|
|
732
732
|
|
|
733
733
|
### Client Methods Available
|
|
734
734
|
|
|
735
|
-
The `api.client` object exposes the full
|
|
735
|
+
The `api.client` object exposes the full `HyperliquidClient`. All `coin` params accept HIP-3 prefixed tickers (e.g. `xyz:CL`). Optional `user` params default to the configured wallet address.
|
|
736
|
+
|
|
737
|
+
#### Trading
|
|
738
|
+
|
|
739
|
+
| Method | Description |
|
|
740
|
+
|--------|-------------|
|
|
741
|
+
| `marketOrder(coin, isBuy, size, slippageBps?, leverage?)` | Market order via IOC limit at mid ± slippage. Returns `OrderResponse` |
|
|
742
|
+
| `limitOrder(coin, isBuy, size, price, tif?, reduceOnly?, leverage?)` | Limit order. `tif`: `'Gtc'` (default), `'Ioc'`, `'Alo'`. Returns `OrderResponse` |
|
|
743
|
+
| `triggerOrder(coin, isBuy, size, triggerPrice, limitPrice, tpsl, reduceOnly?, leverage?)` | Trigger (conditional) order. `tpsl`: `'tp'` or `'sl'`. Activates when price hits `triggerPrice`, then fills as limit at `limitPrice`. Returns `OrderResponse` |
|
|
744
|
+
| `stopLoss(coin, isBuy, size, triggerPrice, slippageBps?)` | Stop loss shortcut. Sets limit price with slippage buffer (default 100 bps / 1%) to ensure fill. `reduceOnly` is always true. Returns `OrderResponse` |
|
|
745
|
+
| `takeProfit(coin, isBuy, size, triggerPrice)` | Take profit shortcut. Limit price = trigger price (favorable direction). `reduceOnly` is always true. Returns `OrderResponse` |
|
|
746
|
+
| `cancel(coin, oid)` | Cancel a single order by numeric OID. Returns `CancelResponse` |
|
|
747
|
+
| `cancelAll(coin?)` | Cancel all open orders. If `coin` is provided, only cancels orders for that asset. Returns `CancelResponse[]` |
|
|
748
|
+
| `order(coin, isBuy, size, price, orderType, reduceOnly?, includeBuilder?, leverage?)` | Low-level order placement. `orderType`: `{ limit: { tif: 'Gtc' | 'Ioc' | 'Alo' } }`. Automatically injects builder fee, rounds price/size, and handles HIP-3 margin setup. Returns `OrderResponse` |
|
|
749
|
+
|
|
750
|
+
#### Market Data
|
|
751
|
+
|
|
752
|
+
| Method | Returns |
|
|
753
|
+
|--------|---------|
|
|
754
|
+
| `getAllMids()` | `Record<string, string>` — mid prices for all assets (main + HIP-3). Key = coin name, value = price string |
|
|
755
|
+
| `getMetaAndAssetCtxs()` | `MetaAndAssetCtxs` — market metadata (universe of assets with `szDecimals`, `maxLeverage`) and asset contexts (funding, open interest, volume, mark/oracle prices) |
|
|
756
|
+
| `getL2Book(coin)` | `{ bids, asks, bestBid, bestAsk, midPrice, spread, spreadBps }` — L2 order book with computed spread |
|
|
757
|
+
| `getRecentTrades(coin)` | `Array<{ coin, side, px, sz, time, hash, tid }>` — recent trade tape. `side`: `'B'` (buy) or `'A'` (sell) |
|
|
758
|
+
| `getCandleSnapshot(coin, interval, startTime, endTime?)` | `Array<{ t, T, s, i, o, c, h, l, v, n }>` — OHLCV candles. `interval`: `'1m'`, `'5m'`, `'15m'`, `'1h'`, `'4h'`, `'1d'`. Times are Unix ms |
|
|
759
|
+
| `getFundingHistory(coin, startTime, endTime?)` | `Array<{ coin, fundingRate, premium, time }>` — historical hourly funding rates |
|
|
760
|
+
| `getPredictedFundings()` | `Array<[coin, Array<[venue, { fundingRate, nextFundingTime }]>]>` — predicted funding rates across all venues |
|
|
761
|
+
| `getPerpDexs()` | `Array<{ name, fullName, deployer } | null>` — list of perp DEXs. Index 0 is `null` (main), rest are HIP-3 |
|
|
762
|
+
| `getAllPerpMetas()` | `Array<{ dexName, meta, assetCtxs }>` — metadata + contexts for every perp DEX (main + all HIP-3) |
|
|
763
|
+
| `getSpotMeta()` | `{ tokens, universe }` — spot market metadata (token info, trading pairs) |
|
|
764
|
+
| `getSpotMetaAndAssetCtxs()` | `{ meta, assetCtxs }` — spot metadata + price/volume contexts |
|
|
765
|
+
| `getTokenDetails(tokenId)` | Token details: supply, deployer, prices. Returns `null` if not found |
|
|
766
|
+
|
|
767
|
+
#### Account
|
|
768
|
+
|
|
769
|
+
| Method | Returns |
|
|
770
|
+
|--------|---------|
|
|
771
|
+
| `getUserStateAll(user?)` | `ClearinghouseState` — full account state across all dexes: `marginSummary` (accountValue, totalMarginUsed, withdrawable), `crossMarginSummary`, and `assetPositions[]` (each with `position.coin`, `.szi`, `.entryPx`, `.unrealizedPnl`, `.positionValue`, `.leverage`, `.marginUsed`, `.liquidationPx`) |
|
|
772
|
+
| `getUserState(user?, dex?)` | `ClearinghouseState` — account state for a single dex (omit `dex` for main perps) |
|
|
773
|
+
| `getOpenOrders(user?)` | `OpenOrder[]` — all open orders across all dexes. Each: `{ coin, side, limitPx, sz, oid, timestamp, orderType }` |
|
|
774
|
+
| `getUserFills(user?, aggregateByTime?)` | `Array<{ coin, px, sz, side, time, closedPnl, fee, oid, tid, crossed, builderFee }>` — trade fill history. `side`: `'B'` (buy) or `'A'` (sell) |
|
|
775
|
+
| `getHistoricalOrders(user?)` | `Array<{ order: { coin, side, limitPx, sz, origSz, oid, timestamp, orderType, tif, triggerCondition, triggerPx, isTrigger, isPositionTpsl, reduceOnly }, status, statusTimestamp }>` — all orders (filled, cancelled, etc.) |
|
|
776
|
+
| `getOrderStatus(oid, user?)` | `{ status, order? }` — status of a specific order by numeric OID or string CLOID |
|
|
777
|
+
| `getUserFunding(user?, startTime?, endTime?)` | `Array<{ time, hash, delta: { coin, usdc, szi, fundingRate } }>` — funding payments received/paid |
|
|
778
|
+
| `getUserFees(user?)` | `{ dailyUserVlm, feeSchedule, userCrossRate, userAddRate, activeReferralDiscount, activeStakingDiscount }` — fee tier, rates, and volume |
|
|
779
|
+
| `getUserRateLimit(user?)` | `{ cumVlm, nRequestsUsed, nRequestsCap, nRequestsSurplus }` — API rate limit status |
|
|
780
|
+
| `getSpotBalances(user?)` | `{ balances: Array<{ coin, token, hold, total, entryNtl }> }` — spot token balances |
|
|
781
|
+
| `getSubAccounts(user?)` | `Array<{ subAccountUser, name }>` — sub-accounts for a master wallet |
|
|
782
|
+
| `getAccountMode(user?)` | `string` — account abstraction mode: `'standard'`, `'unified'`, `'portfolio'`, or `'dexAbstraction'` |
|
|
783
|
+
| `isUnifiedAccount(user?)` | `boolean` — `true` if unified or portfolio margin (shared USDC across dexes) |
|
|
784
|
+
|
|
785
|
+
#### Leverage & Config
|
|
786
|
+
|
|
787
|
+
| Method | Description |
|
|
788
|
+
|--------|-------------|
|
|
789
|
+
| `updateLeverage(coin, leverage, isCross?)` | Set leverage. `isCross` defaults to `true` (cross margin). HIP-3 assets are forced to isolated and clamped to their max leverage |
|
|
790
|
+
| `approveBuilderFee(maxFeeRate?, builder?)` | Approve builder fee (must be called from main wallet, not API wallet). Default rate: `'0.1%'` |
|
|
791
|
+
| `getMaxBuilderFee(user?, builder?)` | Check approved builder fee. Returns fee string (e.g. `'0.01%'`) or `null` if not approved |
|
|
792
|
+
|
|
793
|
+
#### Utility Properties
|
|
736
794
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
795
|
+
| Property / Method | Description |
|
|
796
|
+
|-------------------|-------------|
|
|
797
|
+
| `getAssetIndex(coin)` | Get numeric asset index for a coin (used internally for order wire) |
|
|
798
|
+
| `getSzDecimals(coin)` | Get size decimal precision for a coin |
|
|
799
|
+
| `isHip3(coin)` | Check if a coin is a HIP-3 asset |
|
|
800
|
+
| `getCoinDex(coin)` | Get dex name for a coin (`null` for main perps) |
|
|
801
|
+
| `getAllAssetNames()` | Get all known asset names (main + HIP-3) |
|
|
802
|
+
| `getHip3AssetNames()` | Get only HIP-3 asset names |
|
|
803
|
+
| `invalidateMetaCache()` | Force refresh of market metadata on next call |
|
|
740
804
|
|
|
741
|
-
|
|
805
|
+
#### Utility Functions (`api.utils`)
|
|
742
806
|
|
|
743
|
-
|
|
807
|
+
| Function | Description |
|
|
808
|
+
|----------|-------------|
|
|
809
|
+
| `roundPrice(price, szDecimals, isSpot?)` | Round price to 5 significant figures (max 6 decimals perp, 8 spot) |
|
|
810
|
+
| `roundSize(size, szDecimals)` | Round size to asset-specific decimal precision |
|
|
811
|
+
| `sleep(ms)` | Promise-based delay |
|
|
812
|
+
| `normalizeCoin(coin)` | Normalize coin name (uppercase, trim whitespace) |
|
|
813
|
+
| `formatUsd(amount)` | Format number as USD string (e.g. `$1,234.56`) |
|
|
814
|
+
| `annualizeFundingRate(hourlyRate)` | Convert hourly funding rate to annualized percentage |
|
|
744
815
|
|
|
745
816
|
### Example: Price Breakout
|
|
746
817
|
|
package/openclaw.plugin.json
CHANGED