# LongPort Developers Documentation
LongPort Developers provides programmatic quote trading interfaces for investors with research and development capabilities and assists them to build trading or quote strategy analysis tools based on their own investment strategies. The functions fall into the following categories:
- **Trading** - Create, amend, cancel orders, query today's/past orders and transaction details, etc.
- **Quotes** - Real-time quotes, acquisition of historical quotes, etc.
- **Portfolio** - Real-time query of the account assets, positions, funds
- **Real-time subscription** - Provides real-time quotes and push notifications for order status changes
## Interface Type
LongPort provides diversified access methods such as HTTP / WebSockets interfaces for accessing the underlying services and SDK (Python / C++, etc.) encapsulated in the upper layer, allowing flexible choices.
## How to Enable OpenAPI
1. Log in to the [LongPort App](https://longportapp.com/download) to complete the account opening process;
2. Log in to the [longportapp.com](https://longportapp.com) and enter the developer platform, complete the developer verification (OpenAPI permission application), and obtain a token.
## Quote Coverage
| Market |
Symbol |
| HK Market |
Securities (including equities, ETFs, Warrants, CBBCs) |
| Hang Seng Index |
| US Market |
Securities (including stocks, ETFs) |
| Nasdsaq Index |
| OPRA Options |
| CN Market |
Securities (including stocks, ETFs) |
| Index |
## Trading
Supported trading functions include:
| Market | Stock and ETF | Warrant & CBBC | Options |
| --------- | ------------- | -------------- | ------- |
| HK Market | ✓ | ✓ | |
| US Market | ✓ | ✓ | ✓ |
## Rate Limit {#rate-limit}
| Category | Limitation |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Quote API | - One account can only create one long link and subscribe to a maximum of 500 symbols at the same time
- No more than 10 calls in a 1-second interval and the number of concurrent requests should not exceed 5
|
| Trade API | - No more than 30 calls in a 30-second interval, and the interval between two calls should not be less than 0.02 seconds
|
:::success
The [OpenAPI SDK](https://open.longportapp.com/sdk) has done effective frequency control internally:
- Quote: The methods under `QuoteContext` will be actively controlled by the SDK according to the server's rate limit. When the request is too fast, the SDK will automatically delay the request. Therefore, you do not need to implement the frequency control details separately.
- Trade: The methods under `TradeContext` are not limited by the SDK. Due to the special nature of the trading order placement scenario, this is left to the user to handle.
:::
## Pricing {#pricing}
LongPort does not charge any additional fees for activating or using interface services. You only need to open a LongPort Integrated A/C and get OpenAPI service permissions to use it for free. For actual transaction fees, please contact the brokerage firm where you have opened your securities account.
## Other
The OpenAPI services are provided by LongPort and the applicable affiliates (subject to the agreement).
openapi-trade.longportapp.com
## SDK
- [Overview](https://open.longportapp.com/docs.md)
## Skill
- [LongPort Skill](https://open.longportapp.com/skill/index.md)
- [LongPort Skill Installation Guide](https://open.longportapp.com/skill/install.md)
## Docs
- [API Reference](https://open.longportapp.com/docs/api.md)
- [Getting Started](https://open.longportapp.com/docs/getting-started.md)
- [LongPort MCP](https://open.longportapp.com/docs/mcp.md)
- [llm](https://open.longportapp.com/docs/llm.md)
- [Overview](https://open.longportapp.com/docs/how-to-access-api.md)
- [Error Codes](https://open.longportapp.com/docs/error-codes.md)
- [Get Socket OTP (One time password)](https://open.longportapp.com/docs/socket-token-api.md)
- [Refresh Token](https://open.longportapp.com/docs/refresh-token-api.md)
## Socket
- [Subscribe Real-Time Trading Data](https://open.longportapp.com/docs/socket/subscribe_trade.md)
- [Access differences between WebSocket and TCP](https://open.longportapp.com/docs/socket/diff_ws_tcp.md)
- [Data Commands](https://open.longportapp.com/docs/socket/biz_command.md)
- [Subscribe Real-Time Market Data](https://open.longportapp.com/docs/socket/subscribe_quote.md)
- [Control commands](https://open.longportapp.com/docs/socket/control-command.md)
- [Endpoints](https://open.longportapp.com/docs/socket/hosts.md)
## Protocol
- [Communication Model](https://open.longportapp.com/docs/socket/protocol/connect.md)
- [Parse Request Packet](https://open.longportapp.com/docs/socket/protocol/request.md)
- [Parse Handshake](https://open.longportapp.com/docs/socket/protocol/handshake.md)
- [Parse Header of Packet](https://open.longportapp.com/docs/socket/protocol/header.md)
- [Protocol Overview](https://open.longportapp.com/docs/socket/protocol/overview.md)
- [Parse Push Packet](https://open.longportapp.com/docs/socket/protocol/push.md)
- [Parse Response Packet](https://open.longportapp.com/docs/socket/protocol/response.md)
## Screener
- [Screener Indicators](https://open.longportapp.com/docs/screener/screener-indicators.md)
- [Screener Strategy Detail](https://open.longportapp.com/docs/screener/screener-strategy.md)
- [My Screener Strategies](https://open.longportapp.com/docs/screener/screener-user-strategies.md)
- [Preset Screener Strategies](https://open.longportapp.com/docs/screener/screener-recommend-strategies.md)
- [Screener Search](https://open.longportapp.com/docs/screener/screener-search.md)
## Fundamental
- [Overview](https://open.longportapp.com/docs/fundamental/overview.md)
## Fundamental
- [Business Segments](https://open.longportapp.com/docs/fundamental/fundamental/business-segments.md)
- [Industry Ranking](https://open.longportapp.com/docs/fundamental/fundamental/industry-rank.md)
- [Shareholders](https://open.longportapp.com/docs/fundamental/fundamental/shareholders.md)
- [Industry Valuation](https://open.longportapp.com/docs/fundamental/fundamental/industry-valuation.md)
- [Corporate Actions](https://open.longportapp.com/docs/fundamental/fundamental/corporate-actions.md)
- [Institution Rating Detail](https://open.longportapp.com/docs/fundamental/fundamental/institution-rating-detail.md)
- [Top Shareholders](https://open.longportapp.com/docs/fundamental/fundamental/shareholder-top.md)
- [Valuation History](https://open.longportapp.com/docs/fundamental/fundamental/valuation-history.md)
- [Valuation Comparison](https://open.longportapp.com/docs/fundamental/fundamental/valuation-comparison.md)
- [Fund Holdings](https://open.longportapp.com/docs/fundamental/fundamental/fund-holdings.md)
- [Analyst Ratings](https://open.longportapp.com/docs/fundamental/fundamental/ratings.md)
- [Industry Peer Hierarchy](https://open.longportapp.com/docs/fundamental/fundamental/industry-peers.md)
- [Operating Metrics](https://open.longportapp.com/docs/fundamental/fundamental/operating.md)
- [Macroeconomic Indicators](https://open.longportapp.com/docs/fundamental/fundamental/macroeconomic-indicators.md)
- [Financial Consensus](https://open.longportapp.com/docs/fundamental/fundamental/consensus.md)
- [Shareholder Detail](https://open.longportapp.com/docs/fundamental/fundamental/shareholder-detail.md)
- [Industry Valuation Distribution](https://open.longportapp.com/docs/fundamental/fundamental/industry-valuation-dist.md)
- [Institution Rating](https://open.longportapp.com/docs/fundamental/fundamental/institution-rating.md)
- [Financial Report](https://open.longportapp.com/docs/fundamental/fundamental/financial-report.md)
- [Dividend Detail](https://open.longportapp.com/docs/fundamental/fundamental/dividend-detail.md)
- [Investment Relations](https://open.longportapp.com/docs/fundamental/fundamental/invest-relation.md)
- [Forecast EPS](https://open.longportapp.com/docs/fundamental/fundamental/forecast-eps.md)
- [Buyback](https://open.longportapp.com/docs/fundamental/fundamental/buyback.md)
- [Macroeconomic Historical Data](https://open.longportapp.com/docs/fundamental/fundamental/macroeconomic.md)
- [Financial Report Snapshot](https://open.longportapp.com/docs/fundamental/fundamental/financial-report-snapshot.md)
- [Dividends](https://open.longportapp.com/docs/fundamental/fundamental/dividends.md)
- [Business Segments History](https://open.longportapp.com/docs/fundamental/fundamental/business-segments-history.md)
- [Company Profile](https://open.longportapp.com/docs/fundamental/fundamental/company-profile.md)
- [Institutional Rating Views Timeline](https://open.longportapp.com/docs/fundamental/fundamental/institution-rating-views.md)
- [Executives](https://open.longportapp.com/docs/fundamental/fundamental/executives.md)
- [ETF Asset Allocation](https://open.longportapp.com/docs/fundamental/fundamental/etf-asset-allocation.md)
- [Valuations](https://open.longportapp.com/docs/fundamental/fundamental/valuations.md)
## Market
- [Trading Stats](https://open.longportapp.com/docs/fundamental/market/trading-stats.md)
- [A/H Premium Intraday](https://open.longportapp.com/docs/fundamental/market/ah-premium-intraday.md)
- [Index Components](https://open.longportapp.com/docs/fundamental/market/index-components.md)
- [Broker Positions](https://open.longportapp.com/docs/fundamental/market/broker-positions.md)
- [A/H Premium](https://open.longportapp.com/docs/fundamental/market/ah-premium.md)
- [Broker Holding Daily](https://open.longportapp.com/docs/fundamental/market/broker-holding-daily.md)
- [Broker Holding Detail](https://open.longportapp.com/docs/fundamental/market/broker-holding-detail.md)
## Quote
- [Definition](https://open.longportapp.com/docs/quote/objects.md)
- [Overview](https://open.longportapp.com/docs/quote/overview.md)
## Pull
- [Option Chain Expiry Date List](https://open.longportapp.com/docs/quote/pull/optionchain-date.md)
- [Historical Market Temperature](https://open.longportapp.com/docs/quote/pull/history_market_temperature.md)
- [Daily Short Sale Volume](https://open.longportapp.com/docs/quote/pull/short-trades.md)
- [Security Intraday](https://open.longportapp.com/docs/quote/pull/intraday.md)
- [Current Market Temperature](https://open.longportapp.com/docs/quote/pull/market_temperature.md)
- [Security History Candlesticks](https://open.longportapp.com/docs/quote/pull/history-candlestick.md)
- [Security Brokers](https://open.longportapp.com/docs/quote/pull/brokers.md)
- [Basic Information of Securities](https://open.longportapp.com/docs/quote/pull/static.md)
- [Option Chain By Date](https://open.longportapp.com/docs/quote/pull/optionchain-date-strike.md)
- [Trading Session of The Day](https://open.longportapp.com/docs/quote/pull/trade-session.md)
- [Warrant Filter](https://open.longportapp.com/docs/quote/pull/warrant-filter.md)
- [Real-time Quotes of Warrant](https://open.longportapp.com/docs/quote/pull/warrant-quote.md)
- [Security Trades](https://open.longportapp.com/docs/quote/pull/trade.md)
- [Broker IDs](https://open.longportapp.com/docs/quote/pull/broker-ids.md)
- [Security Candlesticks](https://open.longportapp.com/docs/quote/pull/candlestick.md)
- [Security Depth](https://open.longportapp.com/docs/quote/pull/depth.md)
- [Security Capital Distribution](https://open.longportapp.com/docs/quote/pull/capital-distribution.md)
- [Real-time Quotes of Option](https://open.longportapp.com/docs/quote/pull/option-quote.md)
- [Security Capital Flow Intraday](https://open.longportapp.com/docs/quote/pull/capital-flow-intraday.md)
- [Short Positions (US & HK)](https://open.longportapp.com/docs/quote/pull/short-positions.md)
- [Real-time Quotes Of Securities](https://open.longportapp.com/docs/quote/pull/quote.md)
- [Calculate Indexes Of Securities](https://open.longportapp.com/docs/quote/pull/calc-index.md)
- [Warrant Issuer IDs](https://open.longportapp.com/docs/quote/pull/issuer.md)
- [Market Trading Days](https://open.longportapp.com/docs/quote/pull/trade-day.md)
- [Filings](https://open.longportapp.com/docs/quote/pull/filings.md)
## Push
- [Trades](https://open.longportapp.com/docs/quote/push/trade.md)
- [Depth](https://open.longportapp.com/docs/quote/push/depth.md)
- [Brokers](https://open.longportapp.com/docs/quote/push/broker.md)
- [Quote](https://open.longportapp.com/docs/quote/push/quote.md)
## Stocks
- [Intraday](https://open.longportapp.com/docs/quote/stocks/intraday.md)
- [Historical Candlesticks](https://open.longportapp.com/docs/quote/stocks/history-candlestick.md)
- [Broker Queue](https://open.longportapp.com/docs/quote/stocks/brokers.md)
- [Static Info](https://open.longportapp.com/docs/quote/stocks/static.md)
- [Trades](https://open.longportapp.com/docs/quote/stocks/trade.md)
- [Broker IDs](https://open.longportapp.com/docs/quote/stocks/broker-ids.md)
- [Candlesticks](https://open.longportapp.com/docs/quote/stocks/candlestick.md)
- [Depth](https://open.longportapp.com/docs/quote/stocks/depth.md)
- [Quotes](https://open.longportapp.com/docs/quote/stocks/quote.md)
## Warrants
- [Screener](https://open.longportapp.com/docs/quote/warrants/warrant-filter.md)
- [Quotes](https://open.longportapp.com/docs/quote/warrants/warrant-quote.md)
- [Issuers](https://open.longportapp.com/docs/quote/warrants/issuer.md)
## Security
- [Overnight Eligible Securities](https://open.longportapp.com/docs/quote/security/security_list.md)
## Options
- [Expiry Dates](https://open.longportapp.com/docs/quote/options/optionchain-date.md)
- [Volume](https://open.longportapp.com/docs/quote/options/option-volume.md)
- [Option Chain](https://open.longportapp.com/docs/quote/options/optionchain-date-strike.md)
- [Option Quotes](https://open.longportapp.com/docs/quote/options/option-quote.md)
- [Daily Volume](https://open.longportapp.com/docs/quote/options/option-volume-daily.md)
## Subscribe
- [Unsubscribe](https://open.longportapp.com/docs/quote/subscribe/unsubscribe.md)
- [Get Subscriptions](https://open.longportapp.com/docs/quote/subscribe/subscription.md)
- [Overview](https://open.longportapp.com/docs/quote/subscribe/overview.md)
- [Subscribe Quote](https://open.longportapp.com/docs/quote/subscribe/subscribe.md)
## Individual
- [Delete Watchlist Group](https://open.longportapp.com/docs/quote/individual/watchlist_delete_group.md)
- [Watchlist Group](https://open.longportapp.com/docs/quote/individual/watchlist_groups.md)
- [Create Watchlist Group](https://open.longportapp.com/docs/quote/individual/watchlist_create_group.md)
- [Update Watchlist Group](https://open.longportapp.com/docs/quote/individual/watchlist_update_group.md)
## Watchlist
- [Delete Group](https://open.longportapp.com/docs/quote/watchlist/watchlist_delete_group.md)
- [Watchlist Groups](https://open.longportapp.com/docs/quote/watchlist/watchlist_groups.md)
- [Create Group](https://open.longportapp.com/docs/quote/watchlist/watchlist_create_group.md)
- [Manage Group Securities](https://open.longportapp.com/docs/quote/watchlist/watchlist_update_group.md)
- [Update Pinned](https://open.longportapp.com/docs/quote/watchlist/update-pinned.md)
## Analytics
- [Capital Distribution](https://open.longportapp.com/docs/quote/analytics/capital-distribution.md)
- [Capital Flow](https://open.longportapp.com/docs/quote/analytics/capital-flow-intraday.md)
- [Calc Index](https://open.longportapp.com/docs/quote/analytics/calc-index.md)
## Legal
- [Legal](https://open.longportapp.com/docs/legal/index.md)
- [User Data Authorisation and Acknowledgement — SG](https://open.longportapp.com/docs/legal/user-data-authorization-sg.md)
- [LongPort Developers Platform Disclaimer — SG](https://open.longportapp.com/docs/legal/developers-platform-disclaimer-sg.md)
- [LongPort Developers Platform Disclaimer — HK](https://open.longportapp.com/docs/legal/developers-platform-disclaimer-hk.md)
- [LongPort Developers API Non-Commercial Licence Agreement — SG](https://open.longportapp.com/docs/legal/api-license-agreement-sg.md)
- [LongPort API Non-Commercial Licence Agreement — HK](https://open.longportapp.com/docs/legal/api-license-agreement-hk.md)
- [User Data Authorisation and Acknowledgement — HK](https://open.longportapp.com/docs/legal/user-data-authorization-hk.md)
## Market
- [Historical Temperature](https://open.longportapp.com/docs/market/history-market-temperature.md)
- [Market Temperature](https://open.longportapp.com/docs/market/market-temperature.md)
- [Popularity Leaderboard](https://open.longportapp.com/docs/market/rank-list.md)
- [Unusual Items](https://open.longportapp.com/docs/market/unusual-items.md)
- [Trading Days](https://open.longportapp.com/docs/market/trade-days.md)
- [Trading Sessions](https://open.longportapp.com/docs/market/trade-session.md)
- [Rank Categories](https://open.longportapp.com/docs/market/rank-categories.md)
- [Top Movers](https://open.longportapp.com/docs/market/top-movers.md)
- [Market Status](https://open.longportapp.com/docs/market/market-status.md)
## Calendar
- [IPO Calendar](https://open.longportapp.com/docs/market/calendar/ipo-calendar.md)
- [Macro Calendar](https://open.longportapp.com/docs/market/calendar/macro-calendar.md)
- [Earnings Calendar](https://open.longportapp.com/docs/market/calendar/earnings-calendar.md)
- [Dividend Calendar](https://open.longportapp.com/docs/market/calendar/dividend-calendar.md)
- [Merge Calendar](https://open.longportapp.com/docs/market/calendar/merge-calendar.md)
- [Meeting Calendar](https://open.longportapp.com/docs/market/calendar/meeting-calendar.md)
- [Split Calendar](https://open.longportapp.com/docs/market/calendar/split-calendar.md)
## Trade
- [Definition](https://open.longportapp.com/docs/trade/trade-definition.md)
- [Overview](https://open.longportapp.com/docs/trade/trade-overview.md)
- [Trade Push](https://open.longportapp.com/docs/trade/trade-push.md)
## Order
- [Estimate Maximum Purchase Quantity](https://open.longportapp.com/docs/trade/order/estimate_available_buy_limit.md)
- [Submit Order](https://open.longportapp.com/docs/trade/order/submit.md)
- [History Orders](https://open.longportapp.com/docs/trade/order/history_orders.md)
- [Cancel Order](https://open.longportapp.com/docs/trade/order/withdraw.md)
- [Today Orders](https://open.longportapp.com/docs/trade/order/today_orders.md)
- [Order Details](https://open.longportapp.com/docs/trade/order/order_detail.md)
- [Replace Order](https://open.longportapp.com/docs/trade/order/replace.md)
## Execution
- [Today Executions](https://open.longportapp.com/docs/trade/execution/today_executions.md)
- [History Executions](https://open.longportapp.com/docs/trade/execution/history_executions.md)
## Asset
- [Fund Positions](https://open.longportapp.com/docs/trade/asset/fund.md)
- [Account Assets](https://open.longportapp.com/docs/trade/asset/account.md)
- [Stock Positions](https://open.longportapp.com/docs/trade/asset/stock.md)
- [Margin Ratio](https://open.longportapp.com/docs/trade/asset/margin_ratio.md)
- [Cash Flow](https://open.longportapp.com/docs/trade/asset/cashflow.md)
## Qa
- [Trade](https://open.longportapp.com/docs/qa/trade.md)
- [Quote Releated](https://open.longportapp.com/docs/qa/broker.md)
- [General](https://open.longportapp.com/docs/qa/general.md)
## Account
- [Overview](https://open.longportapp.com/docs/account/overview.md)
## Portfolio
- [Profit Analysis Detail](https://open.longportapp.com/docs/account/portfolio/profit-analysis-detail.md)
- [Profit Analysis Flows](https://open.longportapp.com/docs/account/portfolio/profit-analysis-flows.md)
- [Profit Analysis Summary](https://open.longportapp.com/docs/account/portfolio/profit-analysis-summary.md)
- [Exchange Rates](https://open.longportapp.com/docs/account/portfolio/exchange-rates.md)
- [Profit Analysis by Market](https://open.longportapp.com/docs/account/portfolio/profit-analysis-by-market.md)
## Dca
- [Stop DCA Plan](https://open.longportapp.com/docs/account/dca/stop-dca.md)
- [Create DCA Plan](https://open.longportapp.com/docs/account/dca/create-dca.md)
- [Set DCA Reminder](https://open.longportapp.com/docs/account/dca/set-reminder.md)
- [Pause DCA Plan](https://open.longportapp.com/docs/account/dca/pause-dca.md)
- [Calculate DCA Date](https://open.longportapp.com/docs/account/dca/calc-date.md)
- [List DCA Plans](https://open.longportapp.com/docs/account/dca/list-dca.md)
- [DCA Trade History](https://open.longportapp.com/docs/account/dca/dca-history.md)
- [Update DCA Plan](https://open.longportapp.com/docs/account/dca/update-dca.md)
- [Check DCA Support](https://open.longportapp.com/docs/account/dca/check-support.md)
- [Resume DCA Plan](https://open.longportapp.com/docs/account/dca/resume-dca.md)
- [DCA Statistics](https://open.longportapp.com/docs/account/dca/dca-stats.md)
## Alert
- [Create Alert](https://open.longportapp.com/docs/account/alert/create-alert.md)
- [Update Alert](https://open.longportapp.com/docs/account/alert/update-alert.md)
- [List Alerts](https://open.longportapp.com/docs/account/alert/list-alerts.md)
- [Delete Alert](https://open.longportapp.com/docs/account/alert/delete-alert.md)