Install
Sign in
The budget is one dollar amount for both live runs and single orders,
$100 by default. Choose Approve, and the CLI finishes signing in on its own.
The login stays active while you use it and ends after 30 days without use, so you do not need to sign in again for routine use. It appears on Connected agents (in the account menu, or at app.miramarket.org/settings/agents) as Miramarket CLI followed by your computer’s name. There you can change its budget or revoke it at any time.
Check whether you are signed in, what the login may do, and how much of its budget is in use:
miramarket-cli login --force and approve a new login with the switches you want. Then revoke the old one on Connected agents.
A login from a CLI older than 1.6.0 no longer works. Run
npm install -g @miramarket/cli to update, then miramarket-cli login.Update the CLI
npm install -g again. To only check whether a newer release exists, add --check. Versions before 1.6.0 do not have update; update those once with npm install -g @miramarket/cli.
If you run the CLI through npx, as a project dependency, or from source, update installs nothing and prints the command to run instead. If it has no permission to write to the install directory, run it again with those rights, for example sudo miramarket-cli update.
Finish account setup
Signing in is not enough to trade. Two more things are required: accepting the current Terms, Privacy Policy, and Risk Disclosure, and delegating your wallet. Check what is still needed:-
Accept the current policies, from an interactive terminal:
If you have not accepted them yet, the app also asks you to when you sign in to approve the login.
-
Delegate your wallet, by opening app.miramarket.org and signing in once in a browser.
miramarket-cli account statuswill confirm once this is done.
miramarket-cli account status again afterward to confirm you are ready to trade. When the Terms, Privacy Policy, or Risk Disclosure change, account status reports them as not accepted until you run account accept-policies again.
Post your first strategy
Use the guided wizard, which walks you through choosing a starting point, validating, previewing, and posting:--demo to post to simulate a run instead of using real funds.
A live run starts right away when it fits within the login’s budget, counting the live runs it already has in the market. A run beyond the budget is saved but does not start. It waits for you to choose Approve on Connected agents, and post prints the command that reports where it stands:
Describe a strategy instead of writing it
You do not have to write the JSON yourself. Describe what the strategy should do and the CLI builds it with the same assistant that powers the visual builder, then hands you a file to validate, preview, and post:./fed.json only when it reports result: strategy. If the description could mean several markets, it lists them and asks which one you meant; if it is missing something, it says what; if you asked a question, it answers. Read the result before going on, including unmatched, which lists anything you named that could not be matched and was substituted or left out. Once a file is written, continue as with any other strategy file:
"buy TSLA if it crosses $400, sell at $450" or "go 3x short on ETH, close it if it rises above $4,200". You can also describe a news situation instead of a trade, such as "build a strategy around this week's Fed meeting": the CLI researches the news and the markets it moves first, and prints a short note on why it chose them. Generated strategies use two venues by default: a trade you name on one venue gets a related position on another for 30% of the budget, which the notices name. Say “just” or “only” in the description to keep one venue (details). To change a generated file, describe the change: miramarket-cli strategies generate "also sell everything below 30 cents" --strategy ./fed.json --out ./fed.json.
Everyday commands
A command the login was not allowed, such as
account withdraw with Withdraw funds off, stops with a message that names the switch. Approve a new login with that switch on to use it.
Every command supports a --json flag for machine-readable output, which agents and scripts should always use. Run any command with --help to see its full set of options. See the CLI reference for every command, flag, JSON shape, and exit code.
Using it with an AI agent
The CLI is designed so an AI coding agent (such as Claude Code) can drive it directly: runmiramarket-cli account status --json first to confirm the account can trade, then either miramarket-cli strategies generate "<description>" --out ./s.json --json or miramarket-cli schema plus hand-authored JSON, then validate, preview, and post. Signing in and accepting policies still require a human — an agent should stop and ask you to complete those steps rather than attempting them.
An agent signs in with miramarket-cli login --events, which prints the link and code as soon as they exist, so the agent can show them to you while the CLI waits. You approve the login and choose its switches and budget yourself; the agent cannot change them. A live run beyond the budget waits for your approval, as described in Post your first strategy.
If your agent supports MCP, you can connect it to the MCP server instead (agents: see the MCP reference): it gets the same strategy tools without shell access, with the same budget and approvals, but it cannot place single orders, bridge, or withdraw.
For the full strategy JSON format, worked examples, and the rules that determine whether a strategy actually behaves as intended (most of which validate can’t check for you), point your agent at /agent-strategy-guide.md — a single markdown file meant to be fetched and read directly, not browsed.