Loading...

LongPort OpenAPI provides programmatic access to trading, quotes, and portfolio data, enabling custom trading tools and strategy analysis, secured via API keys and tokens.
Boost this tool
Subscribe to listing upgrades or segmented pushes.
LongPort OpenAPI provides programmatic access to trading, quotes, and portfolio data, enabling custom trading tools and strategy analysis, secured via API keys and tokens.
The LongPort OpenAPI offers powerful trading and data access capabilities, but the ability to execute trades and access sensitive financial data introduces risk. Secure handling of API keys, access tokens, and adherence to best practices for secrets management are crucial. The availability of multiple SDKs can improve security if used correctly, but also increases the attack surface if vulnerabilities exist within the SDKs themselves.
Performance will depend on network latency, API usage patterns, and the efficiency of the chosen SDK. WebSocket connections are generally more efficient for real-time data than HTTP polling.
Costs will be incurred based on API usage, including data subscriptions and trading fees. Consider optimizing API calls and data subscriptions to minimize costs.
create_orderCreates a new trading order.
Can execute trades, potentially leading to financial loss.
amend_orderModifies an existing trading order.
Incorrect modifications can lead to unintended trades.
cancel_orderCancels a pending trading order.
Canceling the wrong order can have financial implications.
query_quotesRetrieves real-time or historical stock quotes.
Read-only operation, no side effects.
query_portfolioRetrieves real-time data about account assets and positions.
Read-only operation, no side effects.
API Key
cloud
The LongPort OpenAPI offers powerful trading and data access capabilities, but the ability to execute trades and access sensitive financial data introduces risk. Secure handling of API keys, access tokens, and adherence to best practices for secrets management are crucial. The availability of multiple SDKs can improve security if used correctly, but also increases the attack surface if vulnerabilities exist within the SDKs themselves.
Autonomy is highly dependent on the configured trading strategies and risk management parameters. Careful consideration should be given to the potential impact of automated trading decisions.
Production Tip
Implement robust error handling and monitoring to detect and respond to issues in real-time. Thoroughly test trading strategies in a simulated environment before deploying them to production.
The API uses API Key, App Secret, and Access Token for authentication.
The documentation does not explicitly mention rate limits. It's recommended to implement your own rate limiting logic and monitor API usage to avoid being throttled.
The documentation does not mention a dedicated sandbox environment. It is crucial to thoroughly test your application in a simulated environment before deploying it to production.
Set the `LONGPORT_LOG_PATH` environment variable to the desired path for log files.
Use the WebSocket endpoints (`LONGPORT_QUOTE_WS_URL`) to subscribe to real-time quote data. Refer to the SDK documentation for specific instructions.
SDKs are available for Rust, Python, Node.js, Java, C, C++, and Go.
Error handling depends on the specific SDK being used. Refer to the SDK documentation for error codes and recommended handling strategies.