Skip to content

Commit 5e37d4d

Browse files
committed
chore: bump version to 4.0.3, migrate OAuth URL to openapi.longbridge.com
1 parent 08eb19a commit 5e37d4d

27 files changed

Lines changed: 117 additions & 106 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# [4.0.3]
8+
9+
## Changed
10+
11+
- Migrate OAuth base URL from `openapi.longbridgeapp.com` to `openapi.longbridge.com`.
12+
- Migrate CN endpoint URLs from `longportapp.cn` to `longbridge.cn`.
13+
- Change OAuth token storage path from `~/.longbridge-openapi/` to `~/.longbridge/openapi/`.
14+
- Update all README docs to use `openapi.longbridge.com` for OAuth registration endpoints.
15+
- Update proto submodule with latest upstream changes (URL migration in proto comments).
16+
717
# [4.0.2]
818

919
## Added
@@ -24,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2434

2535
## Added
2636

27-
- **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.
37+
- **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.
2838

2939
- **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.
3040
- **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.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ resolver = "3"
33
members = ["rust", "python", "nodejs", "java", "c", "mcp"]
44

55
[workspace.package]
6-
version = "4.0.2"
6+
version = "4.0.3"
77
edition = "2024"
88

99
[profile.release]
1010
lto = true
1111

1212
[workspace.dependencies]
13-
longbridge-wscli = { path = "rust/crates/wsclient", version = "4.0.2" }
14-
longbridge-httpcli = { path = "rust/crates/httpclient", version = "4.0.2" }
15-
longbridge-proto = { path = "rust/crates/proto", version = "4.0.2" }
16-
longbridge-candlesticks = { path = "rust/crates/candlesticks", version = "4.0.2" }
17-
longbridge-oauth = { path = "rust/crates/oauth", version = "4.0.2" }
18-
longbridge = { path = "rust", version = "4.0.2" }
13+
longbridge-wscli = { path = "rust/crates/wsclient", version = "4.0.3" }
14+
longbridge-httpcli = { path = "rust/crates/httpclient", version = "4.0.3" }
15+
longbridge-proto = { path = "rust/crates/proto", version = "4.0.3" }
16+
longbridge-candlesticks = { path = "rust/crates/candlesticks", version = "4.0.3" }
17+
longbridge-oauth = { path = "rust/crates/oauth", version = "4.0.3" }
18+
longbridge = { path = "rust", version = "4.0.3" }
1919

2020
tokio = "1.47.1"
2121
tokio-tungstenite = "0.27.0"

c/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ First, register an OAuth client to get your `client_id`:
3939
_bash / macOS / Linux_
4040

4141
```bash
42-
curl -X POST https://openapi.longbridgeapp.com/oauth2/register \
42+
curl -X POST https://openapi.longbridge.com/oauth2/register \
4343
-H "Content-Type: application/json" \
4444
-d '{
4545
"client_name": "My Application",
@@ -51,7 +51,7 @@ curl -X POST https://openapi.longbridgeapp.com/oauth2/register \
5151
_PowerShell (Windows)_
5252

5353
```powershell
54-
Invoke-RestMethod -Method Post -Uri https://openapi.longbridgeapp.com/oauth2/register `
54+
Invoke-RestMethod -Method Post -Uri https://openapi.longbridge.com/oauth2/register `
5555
-ContentType "application/json" `
5656
-Body '{
5757
"client_name": "My Application",
@@ -75,7 +75,7 @@ Save the `client_id` for use in your application.
7575
**Step 2: Build OAuth client and create a Config**
7676

7777
`lb_oauth_new` loads a cached token from
78-
`~/.longbridge-openapi/tokens/<client_id>` (`%USERPROFILE%\.longbridge-openapi\tokens\<client_id>` on Windows)
78+
`~/.longbridge/openapi/tokens/<client_id>` (`%USERPROFILE%\.longbridge\openapi\tokens\<client_id>` on Windows)
7979
if one exists and is still valid, or starts the browser authorization flow
8080
automatically. The token is persisted to the same path after a successful
8181
authorization or refresh. The resulting `lb_oauth_t*` handle is passed
@@ -135,14 +135,14 @@ setx LONGBRIDGE_ACCESS_TOKEN "Access Token get from user center"
135135

136136
### Other environment variables
137137

138-
| Name | Description |
139-
|--------------------------------|----------------------------------------------------------------------------------|
140-
| LONGBRIDGE_LANGUAGE | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
141-
| LONGBRIDGE_HTTP_URL | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
142-
| LONGBRIDGE_QUOTE_WS_URL | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
143-
| LONGBRIDGE_TRADE_WS_URL | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
144-
| LONGBRIDGE_ENABLE_OVERNIGHT | Enable overnight quote, `true` or `false` (Default: `false`) |
145-
| LONGBRIDGE_PUSH_CANDLESTICK_MODE | `realtime` or `confirmed` (Default: `realtime`) |
138+
| Name | Description |
139+
|----------------------------------|---------------------------------------------------------------------------------|
140+
| LONGBRIDGE_LANGUAGE | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
141+
| LONGBRIDGE_HTTP_URL | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
142+
| LONGBRIDGE_QUOTE_WS_URL | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
143+
| LONGBRIDGE_TRADE_WS_URL | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
144+
| LONGBRIDGE_ENABLE_OVERNIGHT | Enable overnight quote, `true` or `false` (Default: `false`) |
145+
| LONGBRIDGE_PUSH_CANDLESTICK_MODE | `realtime` or `confirmed` (Default: `realtime`) |
146146
| LONGBRIDGE_PRINT_QUOTE_PACKAGES | Print quote packages when connected, `true` or `false` (Default: `true`) |
147147
| LONGBRIDGE_LOG_PATH | Set the path of the log files (Default: `no logs`) |
148148

c/csrc/include/longbridge.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4226,7 +4226,7 @@ const char *lb_http_result_response_body(const struct lb_http_result_t *http_res
42264226
* Asynchronously build an OAuth 2.0 client.
42274227
*
42284228
* Tries to load an existing token from
4229-
* `~/.longbridge-openapi/tokens/<client_id>`. If the token is missing or
4229+
* `~/.longbridge/openapi/tokens/<client_id>`. If the token is missing or
42304230
* expired, starts a local callback server and calls `open_url_callback` so
42314231
* the caller can open the authorization URL in a browser.
42324232
*

c/src/oauth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct COAuth {
1515
/// Asynchronously build an OAuth 2.0 client.
1616
///
1717
/// Tries to load an existing token from
18-
/// `~/.longbridge-openapi/tokens/<client_id>`. If the token is missing or
18+
/// `~/.longbridge/openapi/tokens/<client_id>`. If the token is missing or
1919
/// expired, starts a local callback server and calls `open_url_callback` so
2020
/// the caller can open the authorization URL in a browser.
2121
///

cpp/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ First, register an OAuth client to get your `client_id`:
4040
_bash / macOS / Linux_
4141

4242
```bash
43-
curl -X POST https://openapi.longbridgeapp.com/oauth2/register \
43+
curl -X POST https://openapi.longbridge.com/oauth2/register \
4444
-H "Content-Type: application/json" \
4545
-d '{
4646
"client_name": "My Application",
@@ -52,7 +52,7 @@ curl -X POST https://openapi.longbridgeapp.com/oauth2/register \
5252
_PowerShell (Windows)_
5353

5454
```powershell
55-
Invoke-RestMethod -Method Post -Uri https://openapi.longbridgeapp.com/oauth2/register `
55+
Invoke-RestMethod -Method Post -Uri https://openapi.longbridge.com/oauth2/register `
5656
-ContentType "application/json" `
5757
-Body '{
5858
"client_name": "My Application",
@@ -76,7 +76,7 @@ Save the `client_id` for use in your application.
7676
**Step 2: Build OAuth client and create a Config**
7777

7878
`OAuthBuilder::build` loads a cached token from
79-
`~/.longbridge-openapi/tokens/<client_id>` (`%USERPROFILE%\.longbridge-openapi\tokens\<client_id>` on Windows)
79+
`~/.longbridge/openapi/tokens/<client_id>` (`%USERPROFILE%\.longbridge\openapi\tokens\<client_id>` on Windows)
8080
if one exists and is still valid, or starts the browser authorization flow
8181
automatically. The token is persisted to the same path after a successful
8282
authorization or refresh. The resulting `OAuth` handle is passed directly to
@@ -130,14 +130,14 @@ setx LONGBRIDGE_ACCESS_TOKEN "Access Token get from user center"
130130

131131
### Other environment variables
132132

133-
| Name | Description |
134-
|--------------------------------|----------------------------------------------------------------------------------|
135-
| LONGBRIDGE_LANGUAGE | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
136-
| LONGBRIDGE_HTTP_URL | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
137-
| LONGBRIDGE_QUOTE_WS_URL | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
138-
| LONGBRIDGE_TRADE_WS_URL | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
139-
| LONGBRIDGE_ENABLE_OVERNIGHT | Enable overnight quote, `true` or `false` (Default: `false`) |
140-
| LONGBRIDGE_PUSH_CANDLESTICK_MODE | `realtime` or `confirmed` (Default: `realtime`) |
133+
| Name | Description |
134+
|----------------------------------|---------------------------------------------------------------------------------|
135+
| LONGBRIDGE_LANGUAGE | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
136+
| LONGBRIDGE_HTTP_URL | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
137+
| LONGBRIDGE_QUOTE_WS_URL | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
138+
| LONGBRIDGE_TRADE_WS_URL | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
139+
| LONGBRIDGE_ENABLE_OVERNIGHT | Enable overnight quote, `true` or `false` (Default: `false`) |
140+
| LONGBRIDGE_PUSH_CANDLESTICK_MODE | `realtime` or `confirmed` (Default: `realtime`) |
141141
| LONGBRIDGE_PRINT_QUOTE_PACKAGES | Print quote packages when connected, `true` or `false` (Default: `true`) |
142142
| LONGBRIDGE_LOG_PATH | Set the path of the log files (Default: `no logs`) |
143143

cpp/include/oauth.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class OAuth
3434
/// Builder for constructing an OAuth 2.0 client
3535
///
3636
/// Tries to load an existing token from
37-
/// `~/.longbridge-openapi/tokens/<client_id>`. If the token is missing or
37+
/// `~/.longbridge/openapi/tokens/<client_id>`. If the token is missing or
3838
/// expired, starts a local callback server and calls `open_url` so the caller
3939
/// can open the authorization URL in a browser.
4040
class OAuthBuilder

examples/rust/subscribe_quote/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1313
.with_env_filter(EnvFilter::from_default_env())
1414
.init();
1515

16-
let oauth = OAuthBuilder::new("your-client-id")
16+
let oauth = OAuthBuilder::new("691c5ae5-a6d2-4d6b-a680-da27cb219226")
1717
.build(|url| println!("Open this URL to authorize: {url}"))
1818
.await?;
1919
let config = Arc::new(Config::from_oauth(oauth));

examples/rust/today_orders/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
99
.with_env_filter(EnvFilter::from_default_env())
1010
.init();
1111

12-
let oauth = OAuthBuilder::new("your-client-id")
12+
let oauth = OAuthBuilder::new("691c5ae5-a6d2-4d6b-a680-da27cb219226")
1313
.build(|url| println!("Open this URL to authorize: {url}"))
1414
.await?;
1515
let config = Arc::new(Config::from_oauth(oauth));

java/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ First, register an OAuth client to get your `client_id`:
4848
_bash / macOS / Linux_
4949

5050
```bash
51-
curl -X POST https://openapi.longbridgeapp.com/oauth2/register \
51+
curl -X POST https://openapi.longbridge.com/oauth2/register \
5252
-H "Content-Type: application/json" \
5353
-d '{
5454
"client_name": "My Application",
@@ -60,7 +60,7 @@ curl -X POST https://openapi.longbridgeapp.com/oauth2/register \
6060
_PowerShell (Windows)_
6161

6262
```powershell
63-
Invoke-RestMethod -Method Post -Uri https://openapi.longbridgeapp.com/oauth2/register `
63+
Invoke-RestMethod -Method Post -Uri https://openapi.longbridge.com/oauth2/register `
6464
-ContentType "application/json" `
6565
-Body '{
6666
"client_name": "My Application",
@@ -84,7 +84,7 @@ Save the `client_id` for use in your application.
8484
**Step 2: Build OAuth client and create a Config**
8585

8686
`OAuthBuilder.build` loads a cached token from
87-
`~/.longbridge-openapi/tokens/<client_id>` (`%USERPROFILE%\.longbridge-openapi\tokens\<client_id>` on Windows)
87+
`~/.longbridge/openapi/tokens/<client_id>` (`%USERPROFILE%\.longbridge\openapi\tokens\<client_id>` on Windows)
8888
if one exists and is still valid, or starts the browser authorization flow
8989
automatically. The token is persisted to the same path after a successful
9090
authorization or refresh. The resulting `OAuth` handle is passed directly to
@@ -125,14 +125,14 @@ setx LONGBRIDGE_ACCESS_TOKEN "Access Token get from user center"
125125

126126
### Other environment variables
127127

128-
| Name | Description |
129-
|--------------------------------|----------------------------------------------------------------------------------|
130-
| LONGBRIDGE_LANGUAGE | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
131-
| LONGBRIDGE_HTTP_URL | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
132-
| LONGBRIDGE_QUOTE_WS_URL | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
133-
| LONGBRIDGE_TRADE_WS_URL | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
134-
| LONGBRIDGE_ENABLE_OVERNIGHT | Enable overnight quote, `true` or `false` (Default: `false`) |
135-
| LONGBRIDGE_PUSH_CANDLESTICK_MODE | `realtime` or `confirmed` (Default: `realtime`) |
128+
| Name | Description |
129+
|----------------------------------|---------------------------------------------------------------------------------|
130+
| LONGBRIDGE_LANGUAGE | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
131+
| LONGBRIDGE_HTTP_URL | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
132+
| LONGBRIDGE_QUOTE_WS_URL | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
133+
| LONGBRIDGE_TRADE_WS_URL | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
134+
| LONGBRIDGE_ENABLE_OVERNIGHT | Enable overnight quote, `true` or `false` (Default: `false`) |
135+
| LONGBRIDGE_PUSH_CANDLESTICK_MODE | `realtime` or `confirmed` (Default: `realtime`) |
136136
| LONGBRIDGE_PRINT_QUOTE_PACKAGES | Print quote packages when connected, `true` or `false` (Default: `true`) |
137137
| LONGBRIDGE_LOG_PATH | Set the path of the log files (Default: `no logs`) |
138138

0 commit comments

Comments
 (0)