Natural language Perpl commands - trades, queries, and account management
Convert natural language into PerplBot CLI commands.
/perpl-type <describe what you want to do>
| Input | Command |
|---|---|
| "show me my account" | manage status |
| "what's my balance" | manage status |
| "show my positions" | manage status |
| "account info" | manage status |
| Input | Command |
|---|---|
| "show markets" | manage markets |
| "what are the prices" | manage markets |
| "show funding rates" | manage markets |
| "btc order book" | show book --perp btc |
| "show eth depth" | show book --perp eth |
| "recent btc trades" | show trades --perp btc |
| "my btc orders" | show orders --perp btc |
| "open eth orders" | show orders --perp eth |
| Input | Command |
|---|---|
| "deposit 100" | manage deposit --amount 100 |
| "withdraw 50" | manage withdraw --amount 50 |
| Input | Command |
|---|---|
| "cancel all btc orders" | trade cancel-all --perp btc |
| "cancel btc order 123" | trade cancel --perp btc --order-id 123 |
| Input | Command |
|---|---|
| "long 0.01 btc at 78000 5x" | trade open --perp btc --side long ... |
| "short 1 eth at market 10x" | trade open --perp eth --side short ... --ioc |
| "long btc $100 at market 3x" | trade open (USD converted to size) |
| "close my btc long 0.01 at 80000" | trade close --perp btc --side long ... |
| "close position btc" | Close entire position at market |
| "close all" | Cancel all orders + close all positions |
$ARGUMENTS| Input phrases | Parameter |
|---|---|
| "buy", "long", "go long" | --side long |
| "sell", "short", "go short" | --side short |
| "btc", "bitcoin" | --perp btc |
| "eth", "ethereum" | --perp eth |
| "sol", "solana" | --perp sol |
| "mon", "monad" | --perp mon |
| "zec", "zcash" | --perp zec |
| "at market", "market order" | --ioc |
| "maker only", "post only" | --post-only |
| "close", "exit" | trade close |
/perpl-type show me my account
/perpl-type what are the current prices
/perpl-type show btc order book
/perpl-type recent eth trades
/perpl-type deposit 100
/perpl-type withdraw 50
/perpl-type cancel all btc orders
/perpl-type long 0.01 btc at 78000 with 5x leverage
/perpl-type short 1 eth at market 10x
/perpl-type close my btc long 0.001 at 80000
Before executing a trade, ask user to confirm with AskUserQuestion:
Trade: OPEN LONG 0.01 BTC @ $78,000 (5x leverage)
Command: npm run dev -- trade open --perp btc --side long --size 0.01 --price 78000 --leverage 5
Options: "Execute trade" or "Cancel"
Summarize the result clearly.
The parsing logic is implemented in src/cli/tradeParser.ts with full test coverage in test/tradeParser.test.ts. The module exports:
parseCommand(input: string) - Parse any natural language inputparseTrade(input: string) - Parse trade-specific inputbuildCommand(trade: ParsedTrade) - Build CLI command stringformatTrade(trade: ParsedTrade) - Format trade for display