Skip to content

A TUI trading application based on Longbridge OpenAPI.

License

Notifications You must be signed in to change notification settings

longbridge/longbridge-terminal

Repository files navigation

Longbridge Terminal

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.

asciicast

Features

  • 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

System Requirements

  • macOS or Linux
  • Longbridge OpenAPI credentials (free to obtain)

Installation

From Binary

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 | sh

This will install the longbridge command in your terminal.

Configuration

Before running the app, you need to configure your Longbridge OpenAPI credentials:

  1. Get API Credentials: Visit Longbridge Open Platform to create an application and obtain:

    • APP_KEY
    • APP_SECRET
    • ACCESS_TOKEN
  2. Configure Environment Variables:

    Create a .env file in the project root:

    cp .env.example .env

    Edit .env and 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
  3. Run the App:

    longbridge

API Rate Limits

The Longbridge OpenAPI has rate limiting:

  • Maximum 10 API calls per second
  • Access tokens expire every 3 months and need to be renewed

Documentation

License

MIT

About

A TUI trading application based on Longbridge OpenAPI.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •