Skip to content

v5.5.0

Choose a tag to compare

@hogan-yuan hogan-yuan released this 20 Nov 08:21
· 8 commits to main since this release
4fddc66
  • TradeContext.risk_assessment(): returns the member's risk assessment (suitability questionnaire) result from GET /v1/members/me/risk-assessment — risk level, score, professional-investor status and the approval state of each item. Mirrors the server response field for field; decoding is lenient so a change in how the gateway encodes a value cannot fail the call. Available in Rust, C, C++, Java, Node.js and Python (#625)

  • TLS now trusts the operating system's certificate store in addition to the bundled webpki roots. Behind a corporate TLS-inspecting proxy every HTTPS call previously failed with invalid peer certificate: UnknownIssuer even though other clients on the same machine worked. The two root sets are unioned, so a machine with an empty or unreadable OS store behaves exactly as before. Covers the HTTP client, the geo lookup and the quote/trade WebSocket connections (#628)

    This widens what the SDK trusts: previously only the roots compiled into the binary were accepted, so a certificate authority installed on the machine could not intercept SDK traffic; now one can. That is what makes an inspecting proxy work, and it is the same trust the rest of the software on that host already relies on — but if you ran the SDK specifically because it ignored the local trust store, this changes that.

  • history_orders() now returns every page. The endpoint caps a response at 1000 records and reports the overflow in has_more, which the SDK dropped, so a caller whose window held more than 1000 orders silently got a truncated list with no way to tell. The return type is unchanged, so no code needs updating — but the call now issues one request per page instead of always one, so a wide window is slower and consumes more of your rate limit. Narrow start_at/end_at if that matters; with neither set the server defaults to a 90-day window (#627)

  • Zero-padded HK symbols are accepted on trade and asset calls. 00700.HK, the form the Longbridge apps display, is canonicalized to 700.HK. Previously /v1/asset/stock?symbol=00700.HK answered 200 with no positions instead of an error, so a padded symbol looked like an empty account rather than a mistake. Covers stock_positions, history_orders, today_orders, history_executions, today_executions, all_executions, cash_flow, margin_ratio, estimate_max_purchase_quantity and submit_order. Other markets, A-share codes included, are sent unchanged (#627)

  • OAuth authorization errors include error_description, e.g. OAuth authorization failed: internal_server_error: validate client err:oauth client not found instead of only the bare error code, which makes an unknown or placeholder client_id easy to spot (#626)

  • Security: the local OAuth callback page HTML-escapes the error text taken from the redirect. It was previously inserted as raw HTML, so any web page could redirect the browser to http://localhost:<port>/callback?error=<script>… and run script on the localhost origin while an authorization was pending (#626)

  • Security: the OAuth callback checks state on error redirects too. A callback whose state does not match the pending authorization is answered with an error page and ignored, and the flow keeps waiting for the real redirect. Previously any web page could end a pending authorization with an error text of its choosing. The flow no longer returns CsrfTokenMismatch; a redirect with a wrong or missing state now leaves it waiting, so without a valid redirect it ends with AuthorizationTimeout after 5 minutes. Rust code matching CsrfTokenMismatch from the authorization flow should handle AuthorizationTimeout instead (#626)

  • Internal: the WebSocket TLS connector and the OAuth token HTTP client are each built once instead of per connection and per token refresh. Reading the OS trust store costs ~90ms and is not cached, so without this the first change above would have added that to every reconnect and every refresh (#628)