All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.1.0 — Initial beta release
Initial public beta. The SDK implements the Longbridge OpenAPI binary protocol over WebSocket for the quote and trade endpoints, plus 8 HTTP-backed context modules for alerts, asset, calendar, content, DCA, fundamental, market, portfolio, screener, sharelist, and quote-HTTP endpoints.
The SDK is feature-complete against the upstream protocol for the pinned
longbridge/openapi-protobufs@gen/go/v0.7.0 protobuf definitions.
Added
Longbridge.QuoteContextrealtime push-data cache —realtime_quote/2,realtime_depth/2,realtime_brokers/2,realtime_trades/3, andreset_realtime_cache/1. Mirrors the in-memory store pattern from the upstream Rust/Go SDKs, backed by an ETS table owned by the context.Longbridge.QuoteContext.RealtimeStore— internal GenServer that owns the:longbridge_quote_realtimeETS table.Longbridge.QuoteHTTPContext.filings/2— regulatory filings for a symbol (e.g. SEC 10-K, 10-Q). MirrorsFilingsfrom upstream.Longbridge.QuoteHTTPContext.symbol_to_counter_ids/2— HTTP-only batch symbol → counter_id lookup. For local-first resolution with embedded directory + cache, useLongbridge.Symbol.resolve_counter_ids/2.Longbridge.OAuth.InMemoryTokenStorage— in-memory implementation of theLongbridge.OAuth.TokenStoragebehaviour for tests and ephemeral CLI sessions. Mirrors the v4.2.0 in-memory storage patterns from upstream.Longbridge.TradeContextHTTP 401 auto-refresh + retry — all HTTP calls (order_detail,today_orders,submit_order, etc.) automatically retry once on a401 Unauthorizedresponse after refreshing the access token viaConfig.refresh_access_token/2.Longbridge.OAuth.load_token/2:refresh_skewoption — refresh tokens proactively when within:refresh_skewseconds of expiry. Default0(only refresh after expiry).Longbridge.OAuth.load_token/2error wrapping — refresh failures are now wrapped as{:error, {:refresh_failed, reason}}(network/parse errors) or{:error, {:refresh_token_revoked, error, data}}(server rejected, user must re-authorize). Previously these were indistinguishable from "no token file" errors.
Changed
Longbridge.QuoteHTTPContext.option_volumepaths renamed —GET /v1/quote/option-volume→/v1/quote/option-volume-statsand/v1/quote/option-volume-daily→/v1/quote/option-volume-stats/daily. Params renamedstart_date/end_date→start/end. Response shapes updated. Mirrors upstream renaming.Longbridge.TradeContext.estimate_max_purchase_quantity/2endpoint corrected —POST /v1/trade/estimate→GET /v1/trade/estimate/buy_limitwith query params (matches upstream).Longbridge.TradeContext.replace_orderandcancel_orderHTTP methods corrected — both were usingPOST /v1/trade/order/{replace,cancel}which don't exist. Now usePUT /v1/trade/orderandDELETE /v1/trade/order?order_id=...matching upstream.
Endpoints
- QuoteContext (28 methods) — static_info, quote, option_quote,
warrant_quote, depth, brokers, participant_broker_ids, trades, intraday,
candlesticks, history_candlesticks_by_offset, history_candlesticks_by_date,
option_chain_date, option_chain_strike_info, warrant_issuer_info,
warrant_list, calc_index, capital_flow_intraday, capital_flow_distribution,
market_trade_period, market_trade_day, subscription, subscribe, unsubscribe,
user_quote_profile, typed push callbacks
(
set_on_quote/depth/brokers/trades) - TradeContext (16 methods) — submit_order, replace_order, cancel_order, history_orders, today_orders, history_executions, today_executions, order_detail, account_balance, cash_flow, fund_positions, stock_positions, margin_ratio, estimate_max_purchase_quantity, subscribe/unsubscribe (push)
- QuoteHTTPContext (15 methods) — short_positions, option_volume, option_volume_daily, security_list, watchlist_groups CRUD + update_pinned, market_temperature, history_market_temperature, short_trades
- Other HTTP contexts — AlertContext, AssetContext, CalendarContext, ContentContext, DCAContext, FundamentalContext, MarketContext, PortfolioContext, ScreenerContext, SharelistContext
Transport
- WebSocket transport via Mint + Finch (binary protocol with custom 11/10/5-byte header layouts, gzip-compressed response bodies)
- HTTP transport via Finch for REST endpoints (HMAC-SHA256 signed)
- Pluggable OAuth token storage (
Longbridge.OAuth.TokenStoragebehaviour) with defaultLongbridge.OAuth.FileTokenStorage
Test coverage
- 642 tests pass, 0 credo, 0 dialyzer, 0 ex_dna, 0 reach.
- Total coverage: 90.8% (above 89% threshold).
Longbridge.TradeContext: 95.9%.Longbridge.QuoteContext.RealtimeStore: 100%.