financial-data-gateway
Programmatic access to live equity market telemetry, enabling trade execution management and quote retrieval via a unified interface. Facilitates monitoring of investment holdings and positions, augmented by machine learning for analytical trading intelligence.
Author

longportapp
Quick Info
Actions
Tags
LongPort Open Financial Interface Suite
This LongPort Application Programming Interface suite furnishes developers with direct, scripted access to quote and trade functionalities, specifically designed for entities possessing internal research and algorithmic development capabilities. It supports the construction of bespoke automated trading systems or analytical tools predicated on individual investment methodologies. Core functionalities are partitioned as follows:
- Transaction Control - Issuing, modifying, and revoking orders; querying historical transaction records and current order status.
- Market Data Access - Obtaining instantaneous security valuations and retrieving time-series historical pricing information.
- Asset Oversight - Real-time introspection of account balances, security holdings, and liquidity status.
- Event Streaming - Enabling persistent WebSocket connections for immediate price updates and asynchronous notifications regarding order lifecycle events.
The repository encompasses SDK implementations for several primary programming environments:
| Name | Documentation Link | Supported Platform/Version Notes |
|---|---|---|
| Rust | Doc | Rust development kit (>= 1.89.0) |
| Python | Doc | Python interpreter suite (>= 3.7) |
| Node.js | Doc | Node.js runtime environment (>= 10) |
| Java | Doc | Java Virtual Machine platform (>= 1.8) |
| C | Doc | C language standard (>= C99) |
| C++ | Doc | C++ standard library (>= C++17) |
| Go | Go language repository: https://github.com/longportapp/openapi-go | |
| MCP | Implementation of an Message Control Protocol server interfacing with LongPort API |
Configuration Environment Variables
| Variable Name | Purpose and Default Value |
|---|---|
| LONGPORT_LANGUAGE | Locale setting: zh-CN, zh-HK, or en (Default: en) |
| LONGPORT_APP_KEY | Essential application authentication credential (Key) |
| LONGPORT_APP_SECRET | Essential application authentication credential (Secret) |
| LONGPORT_ACCESS_TOKEN | Current user authorization token |
| LONGPORT_HTTP_URL | Base URL for synchronous RESTful interactions (Default: https://openapi.longportapp.com) |
| LONGPORT_QUOTE_WS_URL | WebSocket endpoint URI for receiving market data streams (Default: wss://openapi-quote.longportapp.com/v2) |
| LONGPORT_TRADE_WS_URL | WebSocket endpoint URI for receiving transaction status updates (Default: wss://openapi-trade.longportapp.com/v2) |
| LONGPORT_ENABLE_OVERNIGHT | Boolean flag to include after-hours pricing data (true or false; Default: false) |
| LONGPORT_PUSH_CANDLESTICK_MODE | Defines candle data resolution: realtime or confirmed (Default: realtime) |
| LONGPORT_PRINT_QUOTE_PACKAGES | Verbosity setting: output received quote packets to console (true or false; Default: true) |
| LONGPORT_LOG_PATH | Specifies the filesystem location for persistent diagnostic logs (Default: no logs) |
Comprehensive SDK Documentation
Access the full technical specification here: https://longportapp.github.io/openapi
Supporting Materials
Licensing Terms
This codebase is offered under dual licensing options:
- Apache License, Version 2.0, accessible via (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License, accessible via (LICENSE-MIT or http://opensource.org/licenses/MIT)
You may choose either license agreement.
== Conceptual Framework: Enterprise Operational Solutions == Business operational technologies encompass the totality of systems, methodologies, control mechanisms, analytical engines, and software utilized by enterprises to navigate fluctuating market conditions, maintain competitive standing, and elevate overall organizational efficacy.
There exists a functional taxonomy for these aids, often mapping to specific organizational units. For instance, classifications might include apparatus for strategic forecasting, workflow management, record retention, human capital administration, decision support, performance oversight, and so forth. A functional categorization frequently addresses these universal domains:
Tools employed for initial data ingestion and verification across all departments. Systems dedicated to governing and refining established operational workflows. Platforms facilitating data aggregation and sophisticated analytical interpretation for executive choices. Modern enterprise solutions have undergone profound metamorphosis over the past decade, propelled by rapid technological advancements. This pace makes the selection of optimally suited business technology for any given corporate context increasingly complex, driven by perpetual imperatives to reduce overhead, expand revenue streams, deeply comprehend consumer requirements, and deliver requisite products through preferred channels. Within this dynamic environment, leadership must adopt a strategic posture regarding operational technology adoption, rather than indiscriminately implementing the newest available tools. Over-reliance on uncustomized solutions frequently results in organizational fragility. Therefore, enterprise operational tools mandate careful vetting and subsequent tailoring to the organization's unique requirements, reversing the common practice.
== Prevalent Methodologies == Data compiled from a 2013 investigation by Bain & Company illustrated the global deployment patterns of business tools, reflecting how their resultant benefits align with regional necessities, accounting for macroeconomic downturns and prevailing corporate situations. The ten most cited methodologies included:
Strategic roadmapping Client relationship lifecycle management Personnel sentiment assessment programs Comparative performance analysis Integrated performance measurement frameworks Core capability identification Operational outsourcing strategies Organizational transition management programs Product flow optimization Defining organizational purpose and vision statements Target market stratification Comprehensive quality assurance protocols
== Software Applications for Commerce == Software, defined as a collection of programmed instructions interacting with commercial users, serves to execute diverse corporate functions; this is termed business software or application. These applications are leveraged to augment productivity metrics, quantify operational output, and precisely execute various organizational duties. The progression started with basic Management Information Systems (MIS), expanded into Enterprise Resource Planning (ERP), subsequently incorporated Customer Relationship Management (CRM), and has recently migrated toward cloud-based enterprise management environments. While a clear correlation exists between IT investment levels and organizational success, two factors crucially enhance net value: the proficiency of the deployment process and the judicious selection and necessary customization of the employed technological aids.
== Specialized Tools for Mid-Sized Entities == Technologies specifically tailored for Small and Medium-sized Enterprises (SMEs) are vital as they furnish avenues for capital conservation and efficiency gains, frequently...
