Motivation
Longbridge Securities (长桥证券) is a multi-market broker covering HK, US, Shanghai (Stock Connect), Shenzhen (Stock Connect), and Singapore equities — with a clean REST/WebSocket OpenAPI and an official Node.js SDK (longbridge@^4.0.5).
Currently OpenAlice supports IBKR, Alpaca, and CCXT. Adding Longbridge would significantly expand the broker coverage, especially for:
- HK equities (not covered by any existing broker)
- A-share Stock Connect (Shanghai + Shenzhen)
- SG equities (Singapore Exchange)
Technical Fit
Longbridge's API is a strong match for OpenAlice's UTA architecture:
| OpenAlice IBroker method |
Longbridge API |
searchContracts |
No public search API → static registry needed (similar to IBKR's approach) |
getPositions |
TradeContext.stockPositions() |
getAccount |
TradeContext.accountBalance() |
placeOrder |
TradeContext.submitOrder() |
cancelOrder |
TradeContext.cancelOrder() |
getOpenOrders |
TradeContext.todayOrders() |
getMarketClock |
QuoteContext.tradingCalendar() |
getQuote |
QuoteContext.staticInfo() + QuoteContext.subscribe() |
Implementation Notes
A reference implementation patch is available at:
https://github.com/Jubeing/openalice-longbridge-broker
Key design decisions:
- Symbol format:
700.HK (HK) / AAPL.US (US) / SH.600000 (Shanghai) / SZ.000001 (Shenzhen) / STI.SG (SG)
- Chinese stock names: Fetched dynamically via
QuoteContext.staticInfo().nameCn, with a static registry fallback for search
- Option PnL: US options use ×100 contract multiplier (each contract = 100 shares)
- Auth: AppKey + AppSecret + AccessToken (OAuth bearer, long-lived)
Request
Consider merging Longbridge as a first-class broker type (type: "longbridge" in accounts.json), or alternatively, accept contributions to the patch repo above as the canonical integration point.
Happy to provide further details on API behavior, edge cases, or testing approach.
Related links
Motivation
Longbridge Securities (长桥证券) is a multi-market broker covering HK, US, Shanghai (Stock Connect), Shenzhen (Stock Connect), and Singapore equities — with a clean REST/WebSocket OpenAPI and an official Node.js SDK (
longbridge@^4.0.5).Currently OpenAlice supports IBKR, Alpaca, and CCXT. Adding Longbridge would significantly expand the broker coverage, especially for:
Technical Fit
Longbridge's API is a strong match for OpenAlice's UTA architecture:
searchContractsgetPositionsTradeContext.stockPositions()getAccountTradeContext.accountBalance()placeOrderTradeContext.submitOrder()cancelOrderTradeContext.cancelOrder()getOpenOrdersTradeContext.todayOrders()getMarketClockQuoteContext.tradingCalendar()getQuoteQuoteContext.staticInfo()+QuoteContext.subscribe()Implementation Notes
A reference implementation patch is available at:
https://github.com/Jubeing/openalice-longbridge-broker
Key design decisions:
700.HK(HK) /AAPL.US(US) /SH.600000(Shanghai) /SZ.000001(Shenzhen) /STI.SG(SG)QuoteContext.staticInfo().nameCn, with a static registry fallback for searchRequest
Consider merging Longbridge as a first-class broker type (
type: "longbridge"inaccounts.json), or alternatively, accept contributions to the patch repo above as the canonical integration point.Happy to provide further details on API behavior, edge cases, or testing approach.
Related links