Registry / finance / longbridge

longbridge

JSON →
library4.3.0pypypiunverified

Official Python SDK for Longbridge Open API, providing access to trading, market data, account management, and real-time quote streaming. Current version 4.3.0, requires Python >= 3.8, with regular releases.

pip install longbridge
INSTALL
IMPORT
SIG · LONGBRIDGE
L
longbridge
financepythonv4.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Longbridge
from longbridge import Longbridge
Main client class for REST API
Config
from longbridge import Config
Configuration for client authentication
QuoteContext
from longbridge.quote import QuoteContext
Real-time quote streaming context
TradeContext
from longbridge.trade import TradeContext
Trading operations context

Initialize client with credentials from environment variables.

import os from longbridge import Longbridge, Config config = Config( app_key=os.environ.get('LONGBRIDGE_APP_KEY', ''), app_secret=os.environ.get('LONGBRIDGE_APP_SECRET', ''), access_token=os.environ.get('LONGBRIDGE_ACCESS_TOKEN', '') ) client = Longbridge(config) print(client.user.account())
Debug
Known issues
breakingVersion 4.x removed the legacy 'longbridge.openapi' import path. Use 'longbridge' directly.
fix
Change import from 'from longbridge.openapi import Longbridge' to 'from longbridge import Longbridge'.
affects: 4.0.0+
gotchaAccess tokens expire after 24 hours. Persistent clients must implement token refresh.
fix
Use the on_token_refresh callback in Config to refresh tokens automatically.
affects: all
deprecatedThe 'Longbridge.connect()' method is deprecated in favor of using 'Config' object directly.
fix
Instantiate Longbridge with a Config object instead of calling connect().
affects: 4.1.0+
Upgrade
Version history
4.3.0latest on PyPI · released Jun 4, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
56 hits · last 30 days
node
48
Amazon
1
OpenAI (training)
1
Resources
longbridge — pip install longbridge · libregistry