Skip to content

Commit 3d7dced

Browse files
Michael YuanMichael Yuan
authored andcommitted
Add OpenClaw skill definition
- skills/SKILL.md: workflows for spot, perp, options, predictions, portfolio - skills/scripts/fintool: wrapper script to find binary - Mandatory setup check for OpenAI key and exchange credentials - Error handling guidance for exchange routing
1 parent 83d1b8b commit 3d7dced

2 files changed

Lines changed: 250 additions & 0 deletions

File tree

skills/SKILL.md

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# fintool — Financial Trading Skill
2+
3+
A CLI tool for market intelligence and trading across multiple exchanges.
4+
5+
## Tool
6+
7+
- **Binary**: `{baseDir}/scripts/fintool`
8+
- **Config**: `~/.fintool/config.toml`
9+
- **Output**: JSON by default, `--human` for colored terminal output
10+
11+
## Setup Check (MANDATORY — do this FIRST)
12+
13+
Before running any command, verify the user's configuration:
14+
15+
```bash
16+
cat ~/.fintool/config.toml 2>/dev/null
17+
```
18+
19+
**If the file doesn't exist**, run:
20+
```bash
21+
{baseDir}/scripts/fintool init
22+
```
23+
24+
**Check for these requirements:**
25+
26+
1. **OpenAI API key** — Required for enriched quotes (trend/momentum analysis).
27+
- Look for: `openai_api_key = "sk-..."` (uncommented) in `[api_keys]`
28+
- If missing: Ask the user for their OpenAI API key, or tell them to add it to `~/.fintool/config.toml` under `[api_keys]`
29+
30+
2. **At least one exchange** — Required for trading commands.
31+
- **Hyperliquid**: `private_key = "0x..."` in `[wallet]` (spot + perps)
32+
- **Binance**: `binance_api_key` + `binance_api_secret` in `[api_keys]` (spot + perps + options)
33+
- **Coinbase**: `coinbase_api_key` + `coinbase_api_secret` in `[api_keys]` (spot only)
34+
- If none configured: Ask the user which exchange they want to use and request the credentials.
35+
36+
**If the user provides credentials**, edit `~/.fintool/config.toml` directly to add them.
37+
38+
## Exchange Capabilities
39+
40+
| Feature | Hyperliquid | Binance | Coinbase |
41+
|---------|-------------|---------|----------|
42+
| Spot orders ||||
43+
| Perp orders ||||
44+
| Options ||||
45+
| Balance ||||
46+
| Open orders ||||
47+
| Cancel ||||
48+
| Positions ||||
49+
50+
**Auto exchange priority**: Hyperliquid > Coinbase > Binance for spot/perp. Binance-only for options.
51+
52+
Use `--exchange hyperliquid|binance|coinbase` to force a specific exchange.
53+
54+
## Error Handling
55+
56+
- If a command returns an **exchange error**, suggest the user try a different exchange with `--exchange <name>`.
57+
- If the selected exchange is **not configured**, tell the user which credentials are needed and offer to add them to config.
58+
- If a trading command fails with **insufficient balance** or **invalid symbol**, relay the error clearly.
59+
60+
## Workflows
61+
62+
### Workflow 1: Spot Trading
63+
64+
**Goal**: Research a symbol and place a spot trade.
65+
66+
**Step 1 — Quote price with analysis:**
67+
```bash
68+
{baseDir}/scripts/fintool quote <SYMBOL>
69+
```
70+
Returns: price, 24h/7d/30d changes, trend (bullish/bearish/neutral), momentum, volume analysis, summary. Uses data from Hyperliquid + Yahoo Finance + CoinGecko, merged by OpenAI.
71+
72+
**Step 2 — Check recent news:**
73+
```bash
74+
{baseDir}/scripts/fintool news <SYMBOL>
75+
```
76+
Returns: up to 10 recent headlines from Google News RSS.
77+
78+
**Step 3 — Check SEC filings (for stocks):**
79+
```bash
80+
{baseDir}/scripts/fintool report list <SYMBOL>
81+
{baseDir}/scripts/fintool report annual <SYMBOL>
82+
```
83+
84+
**Step 4 — Place the trade:**
85+
```bash
86+
# Buy: spend $<AMOUNT> at max price $<PRICE>
87+
{baseDir}/scripts/fintool order buy <SYMBOL> <AMOUNT_USDC> <MAX_PRICE>
88+
89+
# Sell: sell <AMOUNT> units at min price $<PRICE>
90+
{baseDir}/scripts/fintool order sell <SYMBOL> <AMOUNT> <MIN_PRICE>
91+
92+
# Force a specific exchange:
93+
{baseDir}/scripts/fintool order buy <SYMBOL> <AMOUNT> <PRICE> --exchange binance
94+
```
95+
96+
**Step 5 — Verify:**
97+
```bash
98+
{baseDir}/scripts/fintool orders
99+
{baseDir}/scripts/fintool balance
100+
```
101+
102+
### Workflow 2: Perpetual Futures Trading
103+
104+
**Goal**: Research and take a leveraged position via perpetual futures.
105+
106+
**Step 1 — Get perp quote with funding/OI:**
107+
```bash
108+
{baseDir}/scripts/fintool perp quote <SYMBOL>
109+
```
110+
Returns: mark price, oracle price, funding rate, open interest, premium, max leverage.
111+
112+
**Step 2 — Check spot price for context:**
113+
```bash
114+
{baseDir}/scripts/fintool quote <SYMBOL>
115+
```
116+
117+
**Step 3 — Check news:**
118+
```bash
119+
{baseDir}/scripts/fintool news <SYMBOL>
120+
```
121+
122+
**Step 4 — Place the trade:**
123+
```bash
124+
# Long: spend $<AMOUNT> at limit price $<PRICE>
125+
{baseDir}/scripts/fintool perp buy <SYMBOL> <AMOUNT_USDC> <PRICE>
126+
127+
# Short: sell <SIZE> units at limit price $<PRICE>
128+
{baseDir}/scripts/fintool perp sell <SYMBOL> <SIZE> <PRICE>
129+
```
130+
131+
**Step 5 — Monitor:**
132+
```bash
133+
{baseDir}/scripts/fintool positions
134+
{baseDir}/scripts/fintool orders
135+
```
136+
137+
**Note**: Perps only available on Hyperliquid and Binance. If the user only has Coinbase configured, tell them perps are not supported on Coinbase.
138+
139+
### Workflow 3: Options Trading
140+
141+
**Goal**: Buy or sell options contracts.
142+
143+
**IMPORTANT**: Options only work on Binance. If user tries with Hyperliquid or Coinbase, explain this and ask them to configure Binance credentials.
144+
145+
**Step 1 — Research the underlying:**
146+
```bash
147+
{baseDir}/scripts/fintool quote <SYMBOL>
148+
{baseDir}/scripts/fintool news <SYMBOL>
149+
```
150+
151+
**Step 2 — Place options trade:**
152+
```bash
153+
# Buy a call option
154+
{baseDir}/scripts/fintool options buy <SYMBOL> call <STRIKE> <EXPIRY> <SIZE>
155+
156+
# Buy a put option
157+
{baseDir}/scripts/fintool options buy <SYMBOL> put <STRIKE> <EXPIRY> <SIZE>
158+
159+
# Sell a call option
160+
{baseDir}/scripts/fintool options sell <SYMBOL> call <STRIKE> <EXPIRY> <SIZE>
161+
```
162+
163+
- `EXPIRY` format: `YYYY-MM-DD` (e.g., `2026-03-28`)
164+
- Binance converts to: `BTC-260328-80000-C` internally
165+
166+
### Workflow 4: Prediction Markets
167+
168+
**Goal**: Browse and trade on prediction markets (Polymarket + Kalshi).
169+
170+
**Step 1 — Browse markets:**
171+
```bash
172+
{baseDir}/scripts/fintool predict list
173+
{baseDir}/scripts/fintool predict search "election"
174+
{baseDir}/scripts/fintool predict search "BTC" --platform kalshi
175+
```
176+
177+
**Step 2 — Get detailed quote:**
178+
```bash
179+
{baseDir}/scripts/fintool predict quote kalshi:TICKER
180+
{baseDir}/scripts/fintool predict quote polymarket:slug
181+
```
182+
183+
**Step 3 — Trade (stub — requires platform-specific auth):**
184+
```bash
185+
{baseDir}/scripts/fintool predict buy kalshi:TICKER yes 10
186+
```
187+
188+
### Workflow 5: Portfolio Overview
189+
190+
**Goal**: Check current positions and balances across exchanges.
191+
192+
```bash
193+
# Account balance
194+
{baseDir}/scripts/fintool balance
195+
{baseDir}/scripts/fintool balance --exchange binance
196+
197+
# Open positions (perps)
198+
{baseDir}/scripts/fintool positions
199+
200+
# Open orders
201+
{baseDir}/scripts/fintool orders
202+
{baseDir}/scripts/fintool orders BTC
203+
204+
# Cancel an order
205+
{baseDir}/scripts/fintool cancel BTC:91490942 # Hyperliquid
206+
{baseDir}/scripts/fintool cancel binance_spot:BTCUSDT:123 # Binance spot
207+
{baseDir}/scripts/fintool cancel binance_futures:BTCUSDT:456 # Binance futures
208+
{baseDir}/scripts/fintool cancel coinbase:uuid-here # Coinbase
209+
```
210+
211+
## Symbol Aliases
212+
213+
Common indices and commodities have convenient aliases:
214+
215+
| Alias | Description |
216+
|-------|-------------|
217+
| `SP500`, `SPX` | S&P 500 |
218+
| `NASDAQ`, `NDX` | Nasdaq |
219+
| `DOW`, `DJI` | Dow Jones |
220+
| `VIX` | Volatility Index |
221+
| `GOLD` | Gold Futures |
222+
| `SILVER` | Silver Futures |
223+
| `OIL`, `CRUDE` | Crude Oil |
224+
| `10Y`, `30Y` | Treasury Yields |
225+
| `NIKKEI`, `FTSE`, `DAX`, `HSI` | International indices |
226+
227+
## Tips
228+
229+
- **Always quote before trading** — The enriched quote gives trend/momentum context that helps with timing.
230+
- **Check news before large trades** — Headlines can explain sudden price moves.
231+
- **Use `--exchange` when ambiguous** — If the user has multiple exchanges, explicitly select one to avoid confusion.
232+
- **JSON output is default** — Parse it programmatically. Use `--human` only when showing to the user in terminal.
233+
- **For stocks, check SEC filings**`report annual` and `report quarterly` give fundamental context.

skills/scripts/fintool

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Wrapper: find fintool binary from release build or PATH
3+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
4+
REPO_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
5+
6+
# Try release binary from repo build first
7+
if [ -x "$REPO_DIR/target/release/fintool" ]; then
8+
exec "$REPO_DIR/target/release/fintool" "$@"
9+
fi
10+
11+
# Try PATH
12+
if command -v fintool &>/dev/null; then
13+
exec fintool "$@"
14+
fi
15+
16+
echo "Error: fintool binary not found. Build with: cd $REPO_DIR && cargo build --release" >&2
17+
exit 1

0 commit comments

Comments
 (0)