Skip to content
The Mog guide

CLI quick start

The mog CLI trades from a terminal. A person can use it by hand, and an agent or a strategy can use it unattended. It never prompts: every input is a flag or an environment variable.

PlatformCommand
macOS, Linuxbrew install mog-xyz/tap/mog
Windowsscoop bucket add mog-xyz https://github.com/Mog-xyz/homebrew-tap, then scoop install mog

A new install starts on testnet. mog network mainnet switches to mainnet.

Terminal window
mog connect

The CLI makes a session key and opens the app’s connect page. Your wallet signs one grant there. The private key stays on your machine. The CLI stores it with owner-only permissions. Set MOG_PASSPHRASE to encrypt it.

For an agent that has no browser, mog session new --account 0xYOUR_WALLET prints the request for your wallet to sign. Your wallet key never reaches the machine that trades.

Terminal window
mog deposit # your deposit address and a QR code
mog markets
mog price BTC
mog long BTC 10 --lev 50 --dry-run
mog long BTC 10 --lev 50
mog positions
mog close BTC <posId> --fraction 50%

An order fills at the next attested price, not the price you see when you send it. A market order usually fills within a few seconds. See Positions and leverage.

--dry-run signs and sends nothing. It shows the order the CLI would sign.

Add --json to any command. The output is one object:

{ "ok": true, "data": { } }
{ "ok": false, "error": { "code": "…", "message": "…", "retryable": false, "exit": 4 } }

Progress goes to stderr. mog schema prints every command and exit code as JSON. Read the exit code before you retry: see Errors. Exit code 6 means a signed instruction may already be on chain.

mog skill install adds the agent guide for Claude Code. mog skill show prints it for any other agent.

  • Run mog doctor when something fails. It checks the network, the keys and the endpoints.
  • Learn the fees and the close curve before you automate. A strategy that trades often pays the open fee every time.