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)
Trading through the moomoo API costs nothing extra.
Source: moomoo US support: API (opens in a new tab) (checked Oct 11, 2026)
Before using the API you complete moomoo's API Questionnaire and Agreements.
Source: moomoo API docs: permissions and agreements (opens in a new tab) (checked Oct 11, 2026)
Whether moomoo US accounts can use moomoo's newer web API (keys and sign-in) rather than the older OpenD gateway.
Not yet checked against the broker's own screen: names may differ slightly.
Why it isn't checked
Because no public moomoo US page says so; needs a check after signing in.
Source: moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)
Practise first, with no real money(1)
Paper trading uses real market data and needs no securities account. It accepts day orders only.
Source: moomoo API docs: introduction (opens in a new tab) (checked Oct 11, 2026) · moomoo OpenAPI: simulated accounts (opens in a new tab) (checked Oct 11, 2026)
Steps to get ready
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)
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)
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
trade:write (on the one account the bot trades) (turn on): Lets the bot place and cancel orders on that account only.
Source: moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)
trade:read and quote:read (turn on): Lets the bot read orders, positions and prices.
Source: moomoo OpenAPI: getting started (opens in a new tab) (checked Oct 11, 2026)
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)
- moomoo US support: API (opens in a new tab) · checked Oct 11, 2026
- moomoo API docs: permissions and agreements (opens in a new tab) · checked Oct 11, 2026
- moomoo API docs: introduction (opens in a new tab) · checked Oct 11, 2026
- moomoo OpenAPI: getting started (opens in a new tab) · checked Oct 11, 2026
- moomoo OpenAPI: simulated accounts (opens in a new tab) · checked Oct 11, 2026
- moomoo OpenAPI: error codes (opens in a new tab) · checked Oct 11, 2026
- moomoo API docs: trading Q&A (opens in a new tab) · checked Oct 11, 2026
- moomoo US support: how to open an account (opens in a new tab) · checked Oct 13, 2026
- moomoo: paper trading (opens in a new tab) · checked Oct 13, 2026
Broker screens change often: if a button has moved, follow moomoo's own page.
Ready to build a bot?
Other brokers and exchanges
- AlpacaStocks, ETFs, crypto · Paper or real money
- Coinbase Advanced TradeCrypto · Real money
- KrakenCrypto · Real money
- TradierStocks, ETFs · Paper or real money
- WebullStocks, ETFs, crypto · Paper or real money
- GeminiCrypto · Paper or real money
- TradeStationStocks, ETFs, options, futures · Paper or real money
- Charles SchwabStocks, ETFs · Real money