Skip to content

Connect moomoo to a trading bot

Stocks, ETFs · Paper or real money · facts last checked Oct 13, 2026

moomoo's OpenAPI needs an API questionnaire and agreement first. The connection itself is coming soon, so wait before creating keys.

Coming soon: Tallimark can't connect to moomoo yet. This guide gets your keys ready for when it can.

Before you start(3)
Practise first, with no real money(1)

Steps to get ready

  1. Sign in at open.moomoo.com and complete the API questionnaire and agreements.

    Source: moomoo API docs: permissions and agreements (opens in a new tab) (checked Oct 11, 2026) · moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)

  2. In the dashboard (User Center), create an AppKey and upload a public key. The private key stays with whoever signs requests: when the connection ships, the platform will make the key pair and give you only the public key to upload.

    Not yet checked against the broker's own screen: names may differ slightly.

    Why it isn't checked

    Because the broker shows this screen only after you sign in, and no public page describes it; the key-pair upload is described in moomoo's getting-started page.

    Source: moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)

  3. Never give any service your moomoo login password or trade password. The older OpenD gateway needs them, which is why the platform won't use it.

    Source: moomoo US support: API (opens in a new tab) (checked Oct 11, 2026)

Permissions at moomoo

Turn on

  • trade:write (on the one account the bot trades)
  • trade:read and quote:read
Why each setting

IP allow-list

moomoo documents no IP restriction for API keys.

Source: moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)

Coming soon: no moomoo connection exists yet. moomoo's API has no withdrawal or transfer endpoints.

Does the connection expire? It renews by itself

Sign-in access lasts 2 hours and renews by itself; how long the renewal lasts isn't published.

Not yet checked against the broker's own screen: names may differ slightly.

Why it isn't checked

Because moomoo doesn't publish the refresh token's lifetime.

Source: moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)

What Tallimark does: When the connection ships: if moomoo stops renewing it, bots using it pause, send no orders, and you're asked to sign in again.

If something goes wrong(4)
-12006 (time out of sync)
Why: The request clock differs from moomoo's by more than 5 seconds.
Fix: A server-side fix; report it if you see it.

Source: moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)

4003 (scope)
Why: The key or sign-in doesn't cover that account or action.
Fix: Grant trade:write on the account the bot trades.

Source: moomoo OpenAPI: error codes (opens in a new tab) (checked Oct 11, 2026)

Insufficient buying power
Why: Not enough cash or margin for a market order.
Fix: Lower the trade size or use a limit order.

Source: moomoo API docs: trading Q&A (opens in a new tab) (checked Oct 11, 2026)

Pattern day trader limit
Why: A margin account under $25,000 can't open new positions once flagged as a pattern day trader.
Fix: Trade less often intraday or hold more than $25,000.

Source: moomoo API docs: trading Q&A (opens in a new tab) (checked Oct 11, 2026)

All sources (last checked Oct 13, 2026)

Other brokers and exchanges