CLI Trading (Beta)
Introduction
This Command Line Interface (CLI) provides a set of commands for interacting with a trading system. The commands cover various operations such as placing market and limit orders, canceling orders, and managing aliases for custom commands.
Table of Contents
Order Actions
- buy: Initiates a buy order.
- sell: Initiates a sell order.
- long: Equivalent to "buy".
- short: Equivalent to "sell".
Order Types
- market: Places a market order.
- limit: Places a limit order.
- stop: Places a stop order.
Order Parameters
- number: Represents a numerical value (float or integer).
- symbol: Represents a trading instrument (at least 5 characters).
- post: Specifies a "post only" order.
- reduce: Specifies a "reduce only" order.
- word: Represents a word.
- usd_currency: Represents a US dollar currency symbol (e.g., "$", "dollars", "usd").
Commands
Market Order
Grammar:
[order_type 'market'] <action: buy | sell | long | short> [usd_currency] <amount: number> [usd_currency] [usd_currency] [of] <symbol: symbol> [with [exec_params: post | reduce | <trigger type> | <margin mode> | <position mode> | bind stops]]
Example:
market buy 10 BTC with post
Limit Order
Grammar:
[order_type 'limit'] <action: buy | sell | long | short> [usd_currency] <amount: number> [usd_currency] [usd_currency] [of] <symbol: symbol> at [$] <price: number> [with [exec_params: post | reduce | <trigger type> | <margin mode> | <position mode> | bind stops]]
Example:
limit sell 5 ETH at $200 with reduce
Stop Order
Grammar:
[order_type 'stop'] <action: buy | sell | long | short> [usd_currency] <amount: number> [usd_currency] [usd_currency] [of] <symbol: symbol> at [$] <price: number> [with [exec_params: post | reduce | <trigger type> | <margin mode> | <position mode> | bind stops]]
Example:
stop sell 2 BTC at $35000 with post, reduce, mark
Cancel All Orders
Grammar:
cancel [all] orders
Example:
cancel all orders
Cancel All Orders for Symbol
Grammar:
cancel [all] <symbol: symbol> orders
Example:
cancel all BTC orders
Flatten All Positions
Grammar:
flatten [all] [positions]
Example:
flatten all
Flatten Position for Symbol
Grammar:
flatten [all] <symbol: symbol> [positions] [position]
Example:
flatten BTC positions
Ensure Position
Grammar:
ensure <action: long | short> [usd_currency] <amount: number> [usd_currency] [usd_currency] [of] <symbol: symbol> [with [exec_params: post | reduce | <trigger type> | <margin mode> | <position mode> | bind stops]]
Example:
ensure long $500 btcusdt
Sleep
Grammar:
sleep <seconds: SleepTime>
Example:
sleep 5
List Command Aliases
Grammar:
alias list
Example:
alias list
Show Command Alias
Grammar:
alias show <name: word>
Example:
alias show my_alias
Create Command Alias
Grammar:
alias [create] <name: word> [(args: word, ...)] = <command: restline>
Example:
alias create my_alias (arg1, arg2) = limit buy {arg1} at $500 with post
Delete Command Alias
Grammar:
alias [delete | remove | rm] <name: word>
Example:
alias delete my_alias
Parse Command Alias
Grammar:
<alias: word> [(args: word, ...)]
Example:
my_alias (value1, value2)
This documentation provides an overview of the available commands and their grammar. Users can customize and execute these commands based on their trading needs.
Considerations and Limitations
- The CLI supports the use of additional or extra 'exec' args or parameters. For example certain exchanges require bindStop, marginMode, positionMode etc. These can be added to the command line and will be passed through to the exchange.