Skip to main content

Documentation Index

Fetch the complete documentation index at: https://pmxt-feat-series-api.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The PMXT SDKs manage a local server automatically. When you create an exchange instance without a hosted API key, the SDK spawns a local server process, waits for it to become healthy, and routes every request through it. The server namespace gives you explicit control over that local server lifecycle.

Quick reference

MethodDescription
server.start()Start the local server if it is not already running (idempotent).
server.stop()Stop the running local server (SIGTERM + lock file cleanup).
server.restart()Stop then start.
server.status()Structured snapshot: running, pid, port, version, uptime.
server.health()true/True if /health responds OK, false/False otherwise.
server.logs(n)Last n lines from ~/.pmxt/server.log (default 50).

Start

Idempotent. If the local server is already running and healthy, returns immediately. Otherwise spawns pmxt-ensure-server and waits for the health check.
import pmxt

pmxt.server.start()
You rarely need to call start() yourself — creating an exchange instance (e.g. pmxt.Polymarket()) calls it automatically.

Stop

Reads the lock file at ~/.pmxt/server.lock, sends SIGTERM to the local server process, and removes the lock file.
pmxt.server.stop()

Restart

Equivalent to stop() followed by start().
pmxt.server.restart()

Status

Returns a structured snapshot of the local server state. A new object is returned on every call (no shared mutable references).
info = pmxt.server.status()
print(info)
# {
#   "running": True,
#   "pid": 4242,
#   "port": 3847,
#   "version": "2.30.9",
#   "uptime_seconds": 3612.5,
#   "lock_file": "/Users/you/.pmxt/server.lock"
# }
FieldTypeDescription
runningboolWhether the local server is alive and responding to /health.
pidint | nullProcess ID from the lock file.
portint | nullPort the local server is listening on (default 3847).
versionstring | nullServer version from the lock file.
uptime_seconds / uptimeSecondsfloat | nullSeconds since the lock file was written.
lock_file / lockFilestringAbsolute path to ~/.pmxt/server.lock.

Health

Returns true/True if the local server’s /health endpoint responds with {"status": "ok"}, false/False otherwise.
if pmxt.server.health():
    print("local server is up")

Logs

Returns the last n lines from ~/.pmxt/server.log. Defaults to 50. Returns an empty list/array if the log file does not exist.
for line in pmxt.server.logs(20):
    print(line)

Deprecated aliases

The top-level stop_server() / stopServer() and restart_server() / restartServer() functions still work but emit deprecation warnings. Use the server namespace instead.
# Old (deprecated)
pmxt.stop_server()

# New
pmxt.server.stop()

Environment variables

VariableEffect
PMXT_ALWAYS_RESTART=1Force-restart the local server on every ensure_server_running / ensureServerRunning call (useful during development).