Skip to main content
magicmarkets is the MagicMarkets CLI (command line interface) for the v2 API, written in Go and released under the MIT licence. It is the quickest way to start with the API: install it, add your key, and run magicmarkets status. It streams live prices, quotes selections, places and manages orders, runs heartbeats, and inspects your position. The same binary is an MCP server. Source: github.com/magicmarkets/magicmarkets-cli

Install

make build produces ./build/magicmarkets without installing, and make where prints where make install puts the binary. If magicmarkets is not found afterwards, add $(go env GOPATH)/bin to your PATH. You need Go 1.25.10 or later. There are no releases or prebuilt binaries yet, and go install against the GitHub URL does not work because the module path is not a URL.

Configure

The CLI reads its configuration from environment variables, then ./.env, then ~/.magicmarkets/.env, then ~/.env. Global flags: --json for machine-readable output, --verbose or -v, --api-key, --api-url, --ws-url.

Commands

Safety features

  • Order placement takes --request-uuid, so a retry cannot double-place.
  • Order placement snaps an off-tick price before it sends it. Check the snapped price in the confirmation.
  • order place, order close-many and order close-all ask for confirmation unless you pass --yes. order close for a single order does not ask.
  • heartbeat run keeps a heartbeat alive while it runs. If the process or the machine dies, every open order on the account closes.
  • The client identifies itself as User-Agent: magicmarkets-cli/<version>.

JSON output

Every command accepts --json. Pipe it into jq or into your own tooling.

Contributing

The repository carries a contributing guide, a security policy, and a contract test that compares the hand-written types with the vendored OpenAPI spec in both directions. When a maintainer refreshes the spec with make update-spec, any field the API added, removed or renamed fails the tests. Issues and pull requests are welcome.