LongPort OpenAPI
LongPort OpenAPI 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.
Overview
LongPort OpenAPI provides programmatic quote trading interfaces for investors, enabling them to build trading or quote strategy analysis tools based on their own investment strategies.
To use LongPort OpenAPI, developers can integrate the SDK into their applications using various programming languages such as Rust, Python, Node.js, Java, C, C++, and Go. Documentation for each language is available in the repository.
- Trading functionalities: Create, amend, cancel orders, and query orders and transaction details. - Real-time quotes and historical quote acquisition. - Portfolio management: Real-time query of account assets, positions, and funds. - Real-time subscription for quotes and order status notifications.
- Building automated trading systems.
- Analyzing trading strategies based on historical data.
- Monitoring real-time market conditions and portfolio performance.
Add to your AI client
Use these steps to connect LongPort OpenAPI in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"longport": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-longport"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"longport": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-longport"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"longport": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-longport"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"longport": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-longport"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"longport": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-longport"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"longport": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-longport"
]
}
}
}FAQ
What programming languages are supported?
LongPort OpenAPI supports Rust, Python, Node.js, Java, C, C++, and Go.
Is there documentation available?
Yes, comprehensive documentation is available for each SDK in the repository.
Is LongPort OpenAPI free to use?
Yes, it is open-source and available under Apache License 2.0 and MIT License.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":3416,"uuid":"27afd88d-b216-4111-a6b3-6efe1156c70c","name":"longport","title":"LongPort OpenAPI","description":"LongPort OpenAPI 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. ","avatar_url":"https://assets.lbkrs.com/uploads/44b37f0e-dc3a-4c46-af44-aa42ce73608e/longport-512x512.png","created_at":"$D2025-03-19T12:22:15.217Z","updated_at":"$D2025-03-19T13:34:10.208Z","status":"created","author_name":"","author_avatar_url":null,"tags":"mathgpt,math-solver,math-assistant","category":"research-and-data","is_featured":false,"sort":1,"url":"https://github.com/longportapp/openapi","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":null,"user_uuid":"d6776c31-e553-4520-b173-06f0a0cd1f5e","tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]