Skip to content

Latest commit

 

History

History
343 lines (204 loc) · 17.3 KB

File metadata and controls

343 lines (204 loc) · 17.3 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

Added

  • Rust: market::TradeStatus models /v1/quote/market-status trade status codes, including engine-compatible normalization and display helpers.
  • C++: market::TradeStatus models /v1/quote/market-status trade status codes, with status-code conversion, normalization, display helpers, and typed MarketTimeItem status fields.

Fixed

  • All languages: corrected market trade status documentation and aligned market::TradeStatus with the status definition table, including code 2001 and the 123/1009/1010 display names.

[4.3.2] - 2026-06-13

Added

  • All languages: macroeconomic_indicators gains keyword parameter for fuzzy name filtering
  • All languages: macroeconomic switches to GET /v2/quote/macrodata/{id}, defaults to sort=desc

Changed

  • MacroeconomicIndicator.name / .describe: MultiLanguageTextstring
  • Macroeconomic.unit / .unit_prefix: MultiLanguageTextstring

[4.3.1] - 2026-06-12

Added

  • All languages: FundamentalContext gains macroeconomic_indicators(country, offset, limit) — list macroeconomic indicators via GET /v1/quote/macrodata; filter by country (MacroeconomicCountry::HongKong / China / UnitedStates / EuroZone / Japan / Singapore); response includes count (total matching)
  • All languages: FundamentalContext gains macroeconomic(indicator_code, start_date, end_date, offset, limit) — historical data for a specific indicator via GET /v1/quote/macrodata/{indicator_code}; start_date / end_date accept "YYYY-MM-DD" strings; response includes count (total data points)
  • New types: MultiLanguageText, MacroeconomicCountry, MacroeconomicImportance, MacroeconomicIndicator, MacroeconomicIndicatorListResponse, Macroeconomic, MacroeconomicResponse

Fixed

  • MacroeconomicIndicator.describe / name / MacroeconomicResponse.info: handle null responses from API without deserializing error

[4.3.0]

Added

  • All languages: FundamentalContext gains etf_asset_allocation(symbol) — queries GET /v1/quote/etf-asset-allocation for ETF asset allocation grouped by element type (Holdings / Regional / AssetClass / Industry); returns AssetAllocationResponse with report date, position ratios, localized names, and per-holding detail
  • Rust: new public longbridge::counter module — symbol_to_counter_id, index_symbol_to_counter_id, counter_id_to_symbol, and is_etf, backed by the embedded ETF + index + warrant directory, so downstream consumers (CLI / MCP) no longer need their own copies
  • Rust: QuoteContext gains symbol_to_counter_ids(symbols) (batch conversion via POST /v1/quote/symbol-to-counter-ids) and resolve_counter_ids(symbols) (local-first resolution with remote fallback) — remotely resolved entries are persisted to ~/.longbridge/cache/counter-ids.csv (one counter_id per line, override the directory with LONGBRIDGE_CACHE_DIR) and consulted by subsequent counter lookups, so symbols missing from the embedded directory (e.g. newly listed ETFs) resolve correctly after the first query

Changed

  • symbol_to_counter_id now also consults the embedded index and warrant directories — e.g. HSI.HKIX/HK/HSI, 10005.HKWT/HK/10005; leading zeros are stripped from numeric .HK codes (00700.HKST/HK/700, A-share codes are kept verbatim)

Fixed

  • Refreshed the embedded US ETF list (4574 → 7250 entries, from the instrument-management export) and added index (648) + warrant (17693) directories — newer ETFs (e.g. DRAM.US) were resolved to ST/... instead of ETF/... counter IDs, breaking ETF-specific APIs such as etf_asset_allocation

[4.2.2]

Fixed

  • All languages: CalendarEventsResponse now exposes next_date cursor — callers can pass it as start (with the same end) to fetch the next page of /v1/quote/finance_calendar results
  • All languages: CalendarEventInfo.symbol now returns standard symbol format (e.g. CRM.US) instead of raw counter_id format (e.g. ST/US/CRM)

[4.2.1]

Changed

  • ScreenerContext: screener endpoints migrated to /v1/quote/ai/screener/*; screener_recommend_strategies / screener_user_strategies now accept a market parameter; screener_search accepts typed ScreenerCondition objects (Mode B) instead of raw strings

Fixed

  • OperatingFinancial: renamed counter_idsymbol (converts ST/US/AAPLAAPL.US)

[4.2.0]

Added

  • 19 new APIs: FundamentalContext +9, QuoteContext +1 (short_trades), MarketContext +3, new ScreenerContext +5 — see PR #526, #527
  • Rust: OAuthBuilder gains TokenStorage trait for custom token persistence

Changed

  • short_positions unified for HK+US; typed structs with RFC 3339 timestamps
  • top_movers, rank_list, valuation_comparison: typed structs, counter_id → symbol, RFC 3339 timestamps

Breaking changes

  • stock_eventstop_movers; StockEventsResponseTopMoversResponse
  • hk_short_positions removed; use short_positions(symbol, count)
  • ShortPositionsResponse, ShortTradesResponse, TopMoversResponse, RankListResponse, ValuationComparisonResponse changed from raw JSON to typed structs

[4.1.0]

Breaking changes

  • All languages (Rust, Python, Node.js, Java, C, C++): AlertContext::enable() and AlertContext::disable() have been replaced by a single AlertContext::update(item, enabled) method. Pass the AlertItem from list() directly — enabled = true enables, enabled = false disables. This fixes invalid frequency / invalid indicator id API errors caused by the old methods sending incomplete fields.

[4.0.6]

Added

  • All languages (Rust, Python, Node.js, Java, C, C++): Seven new context types covering all major data APIs:
    • FundamentalContext — financial reports, analyst ratings, dividends, EPS forecasts, consensus estimates, valuation (PE/PB/PS), industry valuation, company overview, executives, shareholders, fund holders, corporate actions, investor relations, operating reports, buyback data, stock ratings.
    • MarketContext — market status, broker holding (top/detail/daily), A/H premium (klines/intraday), trade statistics, market anomalies, index constituents.
    • CalendarContext — finance calendar (earnings, dividends, splits, IPOs, macro data, market closures, meetings, mergers).
    • PortfolioContext — exchange rates, P&L analysis (summary/detail/by-market/flows).
    • AlertContext — price alert management (list/add/delete/enable/disable).
    • DCAContext — dollar-cost-averaging plan management (list/create/update/pause/resume/stop/history/stats/check-support/calc-date/set-reminder).
    • SharelistContext — community sharelist management (list/detail/popular/create/delete/add-securities/remove-securities/sort-securities).
  • All languages: QuoteContext gains short_positions, option_volume, option_volume_daily, and update_pinned.
  • All languages: ContentContext gains topic_detail, list_topic_replies, and create_topic_reply.
  • Rust: Config::header(key, value) builder method for injecting custom HTTP/WebSocket headers.
  • All languages (Rust, Python, Node.js, Java, C, C++): Restore Config::refresh_access_token (and refresh_access_token_blocking in Rust). Refreshes the access token via the Longbridge token-refresh API. Only available with Legacy API Key authentication (Config::from_apikey); not supported in OAuth 2.0 mode.

Changed

  • All languages: Method parameters now use typed enums instead of raw integers: DCAFrequency, DCAStatus, AlertCondition, AlertFrequency, CalendarCategory, FinancialReportKind, FinancialReportPeriod, BrokerHoldingPeriod, AhPremiumPeriod.
  • All languages: Response struct fields are typed enums where applicable: DcaPlan.status / invest_frequency / market, MarketTimeItem.market, FlowItem.direction, ProfitSummaryInfo.asset_type, InstitutionRatingSummary.recommend.
  • All languages: All SDK responses are fully typed structs — no method returns a raw JSON string.
  • All languages: Monetary/numeric fields use Decimal/Option<Decimal> (Rust) or BigDecimal (Java). Non-parseable values such as "" or "--" deserialize as None/null.

Fixed

  • Rust: Fix incorrect cache expiry checks in QuoteContext.

[4.0.6]

Added

  • All bindings: ContentContext adds two new methods (Rust, Go, C, C++, Java, Python, Node.js):
    • my_topics(opts) — get topics created by the current authenticated user, with optional page/size/topic_type filtering.
    • create_topic(opts) — create a new topic; returns the topic ID (String) on success.
  • All bindings: New types OwnedTopic, MyTopicsOptions, and CreateTopicOptions to support the above methods.
  • Python: Added type stubs (openapi.pyi) for ContentContext, AsyncContentContext, OwnedTopic, TopicReply, TopicAuthor, and TopicImage.

Fixed

  • C++: create_topic callback now correctly yields std::string (topic ID) instead of OwnedTopic.

[4.0.5]

Changed

  • All bindings: QuoteContext::new / TradeContext::new / ContentContext::new are now synchronous and infallible — no more await, .get(), or callback at construction time. The WebSocket connection is established lazily on first use.
  • All bindings: member_id, quote_level, and quote_package_details are now async methods (were previously sync fields/properties).
  • Rust: A single global Tokio runtime is shared across all SDK components; per-binding runtimes removed.

Performance

  • Reduced connection latency by ~1.3 s by fixing a geo-probe cache issue and a WebSocket rate-limiter initialisation bug.
  • Quote: trading days are now loaded lazily on first use instead of eagerly at connect time.

Fixed

  • OAuth token refresh now triggers at 5 minutes before expiry instead of only after expiry, preventing a blocking refresh on the first API call.
  • CN region detection updated to use a new probe endpoint.

[4.0.4]

Fixed

  • Rust: Fix copy-paste field mapping bugs in TryFrom<quote::FilterWarrant> for WarrantInfo where strike_price, itm_otm, implied_volatility, delta, effective_leverage, conversion_ratio, and balance_point were incorrectly mapped to last_done. (#485)

[4.0.3]

Changed

  • Migrate OAuth base URL from openapi.longbridgeapp.com to openapi.longbridge.com.
  • Migrate CN endpoint URLs from longportapp.cn to longbridge.cn.
  • Change OAuth token storage path from ~/.longbridge-openapi/ to ~/.longbridge/openapi/.
  • Update all README docs to use openapi.longbridge.com for OAuth registration endpoints.
  • Update proto submodule with latest upstream changes (URL migration in proto comments).

[4.0.2]

Added

  • All bindings: New ContentContext (Rust, C, C++, Java, Python, Node.js) with two methods:
    • topics(symbol) — get discussion topics for a security.
    • news(symbol) — get news list for a security.
  • Quote API: QuoteContext.filings(symbol) — get regulatory filings for a security. Available in all bindings (Rust, C, C++, Java, Python, Node.js).
  • MCP server: Expose news, topics, and filings as MCP tools.

[4.0.1]

Fixed

  • Python: Fix str() on enum fields (e.g. CashFlow.direction, Subscription, OptionDirection) causing a hang/deadlock by registering previously missing types in the quote and trade modules. (#476)

[4.0.0]

Added

  • OAuth 2.0 authentication for all language bindings (Rust, C, C++, Java, Python, Node.js). Use OAuthBuilder to run the browser flow; pass the resulting OAuth handle to Config::from_oauth(). Tokens are persisted under ~/.longbridge/openapi/tokens/<client_id> and reused; the browser is only opened when no valid token exists.

  • Python — async callbacks: AsyncQuoteContext and AsyncTradeContext accept async callbacks for set_on_quote, set_on_depth, set_on_brokers, set_on_trades, set_on_candlestick, and set_on_order_changed. If a callback returns a coroutine, the SDK schedules it on the asyncio loop. Sync callbacks still work as before.

  • Python — loop_ parameter: AsyncQuoteContext.create() and AsyncTradeContext.create() take an optional loop_ argument. When using async callbacks, pass loop_=asyncio.get_running_loop() so the SDK can schedule coroutines with asyncio.run_coroutine_threadsafe. Omit loop_ when using only sync callbacks.

Breaking changes

  • Rust: Config::newConfig::from_apikey, Config::from_envConfig::from_apikey_env; removed Config::refresh_access_token and Config::refresh_access_token_blocking.
  • C/C++: lb_config_newlb_config_from_apikey, lb_config_from_envlb_config_from_apikey_env, removed lb_config_refresh_access_token; lb_http_client_newlb_http_client_from_apikey, lb_http_client_from_envlb_http_client_from_apikey_env.
  • Java: Config.fromEnv()Config.fromApikeyEnv(), removed Config.refreshAccessToken().
  • Python: Config.from_env()Config.from_apikey_env(), removed Config.refresh_access_token(); HttpClient.from_env()HttpClient.from_apikey_env().
  • Node.js: Config.fromEnv()Config.fromApikeyEnv().

[3.0.22]

  • python: add asyncio support for quote, trade, and HTTP client; existing sync API unchanged.
  • rust: fix incorrect field mapping in WarrantInfo for warrant filter API.

[3.0.21]

  • java-sdk: fix limit_depth_level and trigger_count being correctly passed and read as Integer in submit/replace order options and order detail.

[3.0.20]

  • add limit_depth_level, trigger_count, monitor_price to OrderDetail, 'Order' types.
  • add support specify limit_depth_level, trigger_count, monitor_price when placing order.

[3.0.18] 2025-11-13

  • add US_VIX market definition.
  • python: add support Python 3.14.

[3.0.17] 2025-10-22

  • fix candlesticks (K-line) might be generated incorrectly in certain situations.
  • fix parsing OrderDetail may fail in certain situations.

[3.0.16] 2025-10-20

  • add SecurityBoard.SPXIndex and SecurityBoard.VIXIndex.

[3.0.15] 2025-10-13

  • add ErrorKind enum to represent error kinds.

[3.0.14] 2025-09-05

  • fix candlesticks (K-line) might be generated incorrectly in certain situations.

[3.0.13] 2025-08-22

[3.0.12] 2025-08-08

  • add trade_session for query all session intraday.
  • add Market.Crypto.
  • fix subscription index K-line.

[3.0.10] 2025-07-27

  • python: fix unable to import SecurityBoard

[3.0.9] 2025-07-24

  • A connection limit exceeded error occurred while creating an OTP.

[3.0.8] 2025-07-15

  • fix: subscribe candlesticks with Period::Day.

[3.0.7] 2025-06-09

  • add AccountBalance.frozen_transaction_fees
  • fix(nodejs): correct condition for disabling quote package printing #230

[3.0.6] 2025-06-02

  • fix: Add missing types register #226

[3.0.4] 2025-05-15

  • java-sdk: rename QuoteContext.securityList to QuoteContext.getSecurityList
  • java-sdk: add QuoteContext.getMarketTemperature and QuoteContext.getHistoryMarketTemperature methods

[3.0.3] 2025-05-14

[3.0.1] 2025-05-13

[3.0.0] 2025-05-13

  • add support extended hours candlesticks
  • add market temperature api
  • add support use environment variable LONGBRIDGE_LANGUAGE to set the response language
  • java-sdk: add QuoteContext.getCapitalDistribution method
  • fix #208

[2.1.8] 2025-01-27

  • add log_path field to Config

[2.1.6] 2025-01-10

  • add support for more candlesticks periods
  • add PushQuote.current_volume, PushQuote.current_turnover

[2.1.5] 2024-12-21

  • Add PushCandlestick.is_confirmed field.

[2.1.0] 2024-11-14

  • Update candlesticks rule.

[2.0.5] 2024-11-16

  • Add Serialize/Deserialize to response types.

[2.0.4] 2024-11-15

  • Add LONGBRIDGE_PRINT_QUOTE_PACKAGES environment variable to enable printing the opened quote packages when connected to the server, default is true.

[2.0.3] 2024-11-14

  • Changed the time parameter of Quote.history_candlesticks_by_offset method to be optional.

[2.0.2] 2024-10-31

  • [python] Change TradeStatus.SuspendTrade to TradeStatus.Suspend in pyi.

[2.0.1] 2024-10-22

  • Returns the most recent historical candlesticks after subscribing to the candlesticks.

[2.0.0] 2024-10-09

Added

  • Print the opened quote packages when connected to the server.
  • Add EstimateMaxPurchaseQuantityOptions.fractional_shares field, sets to true to get the maximum fractional share buying power.
  • The quantity type in the trading API has changed from int to Decimal.

[1.0.32] 2024-08-28

  • make Depth.price to optional type