Guide
BrokerMarket dataStocksETFsOptionsFutures API key

moomoo (Futu OpenAPI) guide

Futu’s OpenAPI is one of the most complete retail APIs in Asia. Like Interactive Brokers, it runs through a local gateway rather than a cloud REST endpoint.

Last verified · Also known as Futu API, Futu OpenAPI, moomoo API, OpenD, futu-api

Quick answer

moomoo (and Futubull in Hong Kong) offers the Futu OpenAPI: your program talks to OpenD, a gateway you run locally and log in to, over a TCP Protobuf protocol wrapped by official Python, Java, C#, C++ and JavaScript SDKs. It covers US, Hong Kong and China A-share stocks plus options and futures, with simulated (paper) accounts through the same gateway.

moomoo (Futu OpenAPI) at a glance

Pricing
API free; quote levels depend on account and subscriptions
Availability
US, Hong Kong, Singapore, Australia, Canada, Japan, Malaysia
Paper trading
Paper trading (simulated) accounts through the same OpenD
Integration type
Local gateway
In AlgoGP
Design and backtest in AlgoGP, connect the exported code
Gateway
OpenD (GUI or command line), default port 11111
SDKs
Python moomoo-api / futu-api, Java, C#, C++, JS
Markets
US, HK, China A-shares (Connect), SG, JP
Trading
unlock_trade with the trade password first

A first connection

from moomoo import OpenQuoteContext, OpenSecTradeContext, TrdEnv, TrdSide, OrderType
quote = OpenQuoteContext(host="127.0.0.1", port=11111)
print(quote.request_history_kline("US.AAPL", ktype="K_DAY", max_count=5)[1])
trade = OpenSecTradeContext(host="127.0.0.1", port=11111)
print(trade.place_order(price=0, qty=1, code="US.AAPL", trd_side=TrdSide.BUY,
                        order_type=OrderType.MARKET, trd_env=TrdEnv.SIMULATE))
quote.close(); trade.close()
Daily bars and a simulated order (pip install moomoo-api).

Build a moomoo (Futu OpenAPI) strategy with AlgoGP

AlgoGP does not connect to moomoo (Futu OpenAPI) natively yet. moomoo (Futu OpenAPI) connects through a local gateway, socket, FIX or Protobuf stack rather than plain HTTPS, so it runs as a separate process next to your strategy.

  1. 1

    Design and backtest in AlgoGP

    Describe the strategy to the copilot and backtest it on years of normalized history. The result does not depend on any vendor.

  2. 2

    Export the Python project

    Every project exports strategy.py, market_data.py, brokers.py and live.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format.

  3. 3

    Plug in moomoo (Futu OpenAPI)

    Implement the four adapter methods (account, positions, submit_market_order and a candle fetcher) with moomoo (Futu OpenAPI)’s SDK, or keep a built-in platform for paper trading and add moomoo (Futu OpenAPI) when you go live.

Built-in brokers for the same markets: Alpaca, Tradier, Interactive Brokers, OKX.

moomoo (Futu OpenAPI): frequently asked questions

Is the moomoo API free?

Yes. Quote depth and markets depend on your account level and quote subscriptions.

Do I have to run OpenD?

Yes. Every SDK connects to a logged-in OpenD, locally or on your server.

What is the difference between futu-api and moomoo-api?

Same API, different branding: futu-api for Futubull accounts, moomoo-api for moomoo.

Design and backtest your moomoo (Futu OpenAPI) strategy first

AlgoGP turns an idea into Python and tests it on years of history before you connect it to moomoo (Futu OpenAPI). The exported code keeps the broker behind four small adapter methods.

  • AI copilot writes and revises the rules
  • Backtests with realistic costs
  • Exported Python ready to wire to moomoo (Futu OpenAPI)

Free plan, no card required.

moomoo (Futu OpenAPI) alternatives

Independent guide. AlgoGP is not affiliated with moomoo (Futu OpenAPI). Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.

Build a strategy