Skip to Content

Local API, SDK and MCP

Read market data and the account from a running Spectre Terminal and trade through it from your own programs.

The Local API is an HTTP and WebSocket interface that a running Spectre Terminal serves on 127.0.0.1. A program on the same machine reads what the terminal window shows and sends the same commands, including orders.

Where to start

  1. Getting started: switch the API on, get the token, make the first request.
  2. Authentication: send the token and fix a refused request.
  3. The guide for your task: market data, the account, trading, the layout, settings or live streams.

Client packages

PackageForInstall
spectre-terminalPython 3.10 or newerpip install spectre-terminal
@spectre-trade/terminalTypeScript and JavaScript, Node 22 or newernpm install @spectre-trade/terminal
spectre-terminal-mcpAI agents, as an MCP serverpip install spectre-terminal-mcp

The clients find the port on their own and read the token from the environment. See Discovery.

Reference

Keep in mind

  • The API is off by default. Switch it on in Settings App → General → Local API.
  • The token is a secret. It allows everything the terminal window can do, including placing orders.
  • Web pages cannot call the API. Run the examples from a script or a program.
  • Prices and sizes are decimal strings. Times are UTC milliseconds.
  • accepted is not filled. A trading call says the terminal took the command. Read the outcome from the account.

On this page