An experimental terminal-based stock trading app built with Longbridge OpenAPI.
A Rust-based TUI (Terminal User Interface) for monitoring market data and managing stock portfolios. Built to showcase the capabilities of the Longbridge OpenAPI SDK.
- Real-time watchlist with live market data
- Portfolio management
- Stock search and quotes
- Candlestick charts
- Multi-market support (Hong Kong, US, China A-share)
- Built on Rust + Ratatui
- Vim-like keybindings
- macOS or Linux
- Longbridge OpenAPI credentials (free to obtain)
If you're on macOS or Linux, run the following command in your terminal:
curl -sSL https://github.com/longbridge/longbridge-terminal/raw/main/install | shThis will install the longbridge command in your terminal.
Before running the app, you need to configure your Longbridge OpenAPI credentials:
-
Get API Credentials: Visit Longbridge Open Platform to create an application and obtain:
APP_KEYAPP_SECRETACCESS_TOKEN
-
Configure Environment Variables:
Create a
.envfile in the project root:cp .env.example .env
Edit
.envand add your credentials:LONGPORT_APP_KEY=your_app_key LONGPORT_APP_SECRET=your_app_secret LONGPORT_ACCESS_TOKEN=your_access_token
Alternatively, export them as environment variables:
export LONGPORT_APP_KEY=your_app_key export LONGPORT_APP_SECRET=your_app_secret export LONGPORT_ACCESS_TOKEN=your_access_token
-
Run the App:
longbridge
The Longbridge OpenAPI has rate limiting:
- Maximum 10 API calls per second
- Access tokens expire every 3 months and need to be renewed
MIT