--- id: longbridge version: "4.5.0" license: unclear license_treatment: unclear maintenance: active --- # longbridge — A Python library for Longbridge Open API License: unclear · Maintenance: active · Downloads: 363.8K/mo ## What it is and what it does Longbridge is a Python SDK that wraps the Longbridge OpenAPI, a financial data and trading platform. It provides synchronous and asynchronous interfaces to multiple specialized contexts: QuoteContext for real-time quotes and candlesticks, TradeContext for order and position management, FundamentalContext for financial reports and analyst ratings, MarketContext for market status and holdings, and several others for calendar data, alerts, and portfolio analysis. The package is built with Rust bindings for performance and supports OAuth 2.0 authentication as the recommended method, with legacy API key support available. The SDK is designed for developers building trading applications, market analysis tools, and portfolio management systems. It handles WebSocket subscriptions for push data, supports both synchronous and asynchronous workflows, and includes configuration management for multiple environments and language settings. Zero runtime dependencies keep the install footprint minimal. Use it for: - Build a real-time stock quote dashboard that subscribes to price updates and displays candlestick data for multiple securities. - Automate order submission and monitor execution status, positions, and account balance across trading sessions. - Retrieve financial reports, analyst ratings, and dividend information for fundamental analysis and valuation workflows. - Implement price alerts and manage watchlists programmatically for custom trading workflows. - Analyze portfolio P&L using exchange rates and portfolio context APIs for multi-currency portfolios. - Fetch financial calendar events (earnings, splits, IPOs) to schedule market analysis or trading strategies. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Longbridge provides a Python SDK for accessing Longbridge's OpenAPI, enabling programmatic access to real-time quotes, trading, account management, and financial data across multiple market contexts. Yes, with conditions. Longbridge is actively maintained, has no known vulnerabilities, and offers a comprehensive API surface for trading and market data. However, the unclear license status is a blocker for commercial use—verify licensing terms in the repository before deploying in proprietary projects. Install friction is moderate due to compiled wheels, but this is typical for performance-critical financial libraries. Suitable for retail traders, fintech developers, and market data consumers with Longbridge account access. ## Install pip install longbridge uv add longbridge poetry add longbridge ## Installing longbridge Before you install: Medium install friction due to compiled wheels across multiple Python versions and platforms (cp310–cp312, macOS, Linux, Windows). Package is actively maintained with recent releases and no known vulnerabilities. License in practice: License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms in the repository before use in proprietary or commercial projects. Quickstart: pip install longbridge from longbridge.openapi import Config, QuoteContext, OAuthBuilder oauth = OAuthBuilder("your-client-id").build( lambda url: print(f"Open this URL to authorize: {url}") ) config = Config.from_oauth(oauth) ctx = QuoteContext(config) resp = ctx.quote(["700.HK", "AAPL.US"]) print(resp) Requires OAuth client registration or legacy API key credentials (LONGBRIDGE_APP_KEY, LONGBRIDGE_APP_SECRET, LONGBRIDGE_ACCESS_TOKEN environment variables). Python >= 3.8 required. Verify before relying: - Whether the unclear license permits commercial or proprietary use without restriction - Real-world latency and throughput characteristics for high-frequency trading scenarios - Completeness of async API coverage across all context types ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 363.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags trading api python sdk, stock market quotes api, real-time financial data, order management api, portfolio analysis tools, financial market data access, broker api integration, trading-api, financial-data, async-support [View on SkillFed](https://skillfed.io/packages/longbridge) · [View on PyPI](https://pypi.org/project/longbridge/)