CLI Trading
Introduction
The Command Line Interface (CLI) provides a powerful set of commands for trading operations in Tealstreet. The CLI supports market orders, limit orders, stop orders, position management, and various utility commands.
Type help to see all available commands, or help <command> to see examples for a specific command.
Table of Contents
- Trading Commands
- Position Management
- Order Management
- Price Information
- Account Management
- Utility Commands
- Variables & Constants
- Command Chaining
Trading Commands
Buy Command
Places a buy order (market or limit).
Syntax:
buy <size> [at <price>] [reduce]
buy <symbol> <size> [at <price>] [reduce]
buy <symbol1,symbol2,...> <size> [at <price>] [reduce]
Examples:
buy $100
buy $100 reduce
buy WIFUSDT $100
buy WIFUSDT,ENAUSDT $100
buy WIFUSDT,ETHUSDT $100 reduce
buy $500 at 50000
buy BTCUSDT $500 at 50000 reduce
Parameters:
size: Order size in USD notional (e.g.,$100,$1000.50)symbol: Trading symbol(s) - optional, uses current symbol if not specified. Multiple symbols can be comma-separated.at <price>: For limit orders, specifies the price. Supports absolute prices, percentages (+1%,-0.5%), or relative offsets (+100,-50).reduce: Makes the order reduce-only
Sell Command
Places a sell order (market or limit).
Syntax:
sell <size> [at <price>] [reduce]
sell <symbol> <size> [at <price>] [reduce]
sell <symbol1,symbol2,...> <size> [at <price>] [reduce]
Examples:
sell $100
sell $100 reduce
sell WIFUSDT $100
sell WIFUSDT,ENAUSDT $100
sell WIFUSDT,ETHUSDT $100 reduce
sell $500 at 52000
sell BTCUSDT $500 at -1% reduce
Parameters:
size: Order size in USD notional (e.g.,$100,$1000.50)symbol: Trading symbol(s) - optional, uses current symbol if not specified. Multiple symbols can be comma-separated.at <price>: For limit orders, specifies the price. Supports absolute prices, percentages (+1%,-0.5%), or relative offsets (+100,-50).reduce: Makes the order reduce-only
Chase Command
Chases the price to execute orders at the best bid/ask prices. The chaser continuously updates limit orders to stay at the top of the book until filled.
Syntax:
chase <buy|sell> <size> [reduce]
chase <buy|sell> <symbol> <size> [reduce]
chase <buy|sell> <symbol1,symbol2,...> <size> [reduce]
chase <buy|sell> %all% <percentage>% reduce
Examples:
chase buy $100
chase buy $100 reduce
chase buy WIFUSDT $100
chase buy WIFUSDT,ENAUSDT $100
chase buy WIFUSDT,ETHUSDT $100 reduce
chase sell $120
chase sell $120 reduce
chase sell %all% 20% reduce
chase sell ETHUSDT,ENAUSDT $100
Parameters:
buy|sell: Order side (required)size: Order size in USD notional (e.g.,$100) or percentage of position (e.g.,20%- only for reduce-only orders)symbol: Trading symbol(s) - optional, uses current symbol if not specified%all%: Special keyword to target all positions of the specified sidereduce: Makes the order reduce-only
Scale Command
Creates a set of scaled orders distributed across a price range.
Syntax:
scale <buy|sell> <total_size> into <count> from <start_price> to <end_price> [reduce] [taker]
Examples:
scale buy 10 into 10 from 31000 to 32000
scale sell $10000 into 25 from 50000 to 48500 reduce
scale sell $10000 into 25 from 50000 to 48500 reduce taker
scale buy $1000 into 10 from -0.25% to -1%
scale sell 1 into 5 from +1% to 32000 reduce
Parameters:
buy|sell: Order sidetotal_size: Total size to distribute across orders (USD notional with$prefix)count: Number of orders to createstart_price: Starting price (absolute, percentage like+1%,-0.25%, or relative offset)end_price: Ending price (same format as start_price)reduce: Makes orders reduce-onlytaker: Allows taker orders (default is post-only/maker)
Stop Command
Places stop orders (take profit or stop loss) for position management. The order type (TP or SL) is automatically determined based on the price relative to the current mark price.
Syntax:
stop at <price>
stop <buy|sell> at <price>
stop <size> at <price>
stop <buy|sell> <size> at <price>
Examples:
stop at 0.1%
stop at -100
stop at 18500
stop buy at +100
stop sell at 1%
stop $500 at 1%
stop buy $500 at 1%
stop sell 0.01 at -100
Parameters:
buy|sell: Order side - optional, inferred from current position if not specified. Required if you have both long and short positions.size: Order size (USD notional with$or raw amount) - optional, uses full position size if not specified (size=0 means infinity/full position)at <price>: Stop trigger price (required). Supports:- Absolute price:
18500 - Percentage from current:
0.1%,1%,-0.5% - Relative offset:
+100,-500
- Absolute price:
Position Management
Close Command
Closes positions with a market order.
Syntax:
close
close <long|short>
close <symbol>
close <long|short> <symbol>
close <long|short> <symbol1,symbol2,...>
Examples:
close
close short
close short WIFUSDT
close short WIFUSDT,ETHUSDT
close long
close long BTCUSDT
close BTCUSDT
Parameters:
long|short: Close only long or short positions (optional)symbol: Trading symbol(s) to close (optional, uses current symbol if not specified). Multiple symbols can be comma-separated.
Nuke Command
Instantly closes all positions and/or cancels all orders across all symbols.
Syntax:
nuke
nuke all
nuke positions
nuke pos
nuke orders
nuke ord
Examples:
nuke
nuke all
nuke positions
nuke pos
nuke orders
nuke ord
Parameters:
- No argument or
all: Nuke everything (positions and orders) positionsorpos: Close all positions onlyordersorord: Cancel all orders only
Order Management
Cancel Command
Cancels orders for the current symbol.
Syntax:
cancel
cancel buys
cancel sells
cancel stops
cancel buy stops
cancel sell stops
Examples:
cancel
cancel buys
cancel sells
cancel stops
cancel buy stops
cancel sell stops
Parameters:
- No argument: Cancel all orders for current symbol
buys: Cancel all buy limit orderssells: Cancel all sell limit ordersstops: Cancel all stop orders (TP/SL)buy stops: Cancel all buy stop orderssell stops: Cancel all sell stop orders
Price Information
Last Price Command
Returns the current last traded price of given ticker(s).
Syntax:
last-price
last-price <symbol>
last-price <symbol1,symbol2,...>
Examples:
last-price
last-price BTCUSDT
last-price BTCUSDT,ETHUSDT
Mark Price Command
Returns the current mark price of given ticker(s).
Syntax:
mark-price
mark-price <symbol>
mark-price <symbol1,symbol2,...>
Examples:
mark-price
mark-price BTCUSDT
mark-price BTCUSDT,ETHUSDT
Index Price Command
Returns the current index price of given ticker(s).
Syntax:
index-price
index-price <symbol>
index-price <symbol1,symbol2,...>
Examples:
index-price
index-price BTCUSDT
index-price BTCUSDT,ETHUSDT
Account Management
Balance Command
Shows available balances including USD available margin, total balance, and spot coin holdings.
Syntax:
balance
Example:
balance
Account Command
Lists available accounts or switches to a different account.
Syntax:
account list
account <account_number>
Examples:
account list
account 0
account 1
account 2
Parameters:
list: Lists all available accounts with their index numbers<account_number>: Switches to the specified account by index (0-based)
Switch Command
Switches the current trading instrument/symbol.
Syntax:
switch <symbol>
Examples:
switch btc
switch BTCUSDT
switch eth
Notes:
- Symbol matching is flexible - you can use shorthand like
btcand it will findBTCUSDT - Only one symbol can be switched to at a time
Utility Commands
Echo Command
Echoes the message back. Useful for testing variable substitution.
Syntax:
echo <message>
Example:
echo Hello World
echo Current position size: $size
echo Entry price: $entry
Help Command
Shows available commands or examples for a specific command.
Syntax:
help
help <command>
Examples:
help
help buy
help scale
help chase
Variables & Constants
The CLI supports special variables that are replaced with current position/market data:
Position Variables (Current Position)
| Variable | Description |
|---|---|
$size | Current position size in contracts |
$sizeusd | Current position size in USD notional |
$entry | Current position entry price |
Long Position Variables
| Variable | Description |
|---|---|
$lsize | Long position size in contracts |
$lsizeusd | Long position size in USD notional |
$lentry | Long position entry price |
Short Position Variables
| Variable | Description |
|---|---|
$ssize | Short position size in contracts |
$ssizeusd | Short position size in USD notional |
$sentry | Short position entry price |
Example Usage:
echo My position size is $size contracts worth $sizeusd USD
echo Entry price was $entry
stop at $entry
Price and Size Formats
Price Formats
The CLI supports various price formats:
| Format | Example | Description |
|---|---|---|
| Absolute | 50000 | Exact price |
| Percentage | +1%, -0.25% | Relative to current price |
| Offset | +100, -500 | Added to current price |
Size Formats
| Format | Example | Description |
|---|---|---|
| USD Notional | $100, $1000.50 | Size in USD value |
| Percentage | 20%, 50% | Percentage of position (reduce-only orders only, with chase command) |
For safety reasons, only USD notional sizes (with $ prefix) are supported for opening new positions. Percentage sizes are only available for reduce-only orders with the chase command.
Command Chaining
Sequential Execution
Chain multiple commands with semicolons. Commands execute one after another:
buy btc $200; sell sol $100
close long; close short
cancel; nuke positions
Parallel Execution
Prefix commands with @ to execute them in parallel (non-blocking):
@buy btc $200; @sell sol $100
@chase buy BTCUSDT $500; @chase sell ETHUSDT $300
Parallel execution is useful when you want to place orders on multiple symbols simultaneously without waiting for each to complete.
Notes
- All commands operate in the context of the current active symbol and account (shown at the top of the CLI)
- Symbol matching is flexible -
btcwill matchBTCUSDT,BTC-PERP, etc. based on your exchange - Multiple symbols can be specified with comma separation (e.g.,
BTCUSDT,ETHUSDT) - The CLI automatically handles symbol transformation and validation
- Commands are case-insensitive for keywords (
buy,sell,BUY,SELLall work)