Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
run: |
bun run build:canary
env:
NODE_OPTIONS: --max-old-space-size=10240 --expose-gc
NODE_OPTIONS: --max-old-space-size=12288 --expose-gc
2 changes: 1 addition & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: bun run build:canary
env:
VITE_PORTAL_GATEWAY_BASE_URL: 'https://m.longbridge.xyz'
NODE_OPTIONS: --max-old-space-size=10240 --expose-gc
NODE_OPTIONS: --max-old-space-size=12288 --expose-gc

- name: Upload to Aliyun OSS
run: |
Expand Down
10 changes: 10 additions & 0 deletions docs/en/docs/cli/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ sidebar_icon: newspaper

# Release Notes

### [v0.22.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.22.0)

- **New `shareholder --top`** — Top-20 major shareholders (institutions, individuals, insiders) with multi-period comparison; `--object-id <id>` for single shareholder holding history and trade details
- **Extended `short-positions`** — Added HK market support (`.HK` suffix auto-routes to HKEX short-position data)
- **New `short-trades`** — Daily short sale volume (US: FINRA/NASDAQ; HK: HKEX disclosure data)
- **New `compare`** — Multi-stock valuation comparison (PE/PB/PS/market-cap/close); server auto-selects peers when no comparison symbols given
- **New `top-movers`** — Stocks whose price movement exceeds the 20-day standard deviation, with correlated news; supports `--market`, `--sort time|change|hot`
- **New `screener` command group** — Stock screener: `strategies` (recommended/saved), `search --strategy-id <id>` or `--filter key:min:max`, `indicators` to list available filters
- **New `rank`** — Popularity leaderboard; list all categories without `--key`, or pass `--key <key>` for a specific ranking (e.g. `ib_hot_all-us`)

### [v0.21.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.21.0)

- **New: `business-segments`** — revenue breakdown by business segment, current period or historical trend
Expand Down
232 changes: 232 additions & 0 deletions docs/en/docs/fundamental/fundamental/business_segments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
---
slug: business-segments
title: Business Segments
sidebar_position: 21
language_tabs: false
toc_footers: []
includes: []
search: true
highlight_theme: ''
headingLevel: 2
---

Get the current-period revenue segment breakdown for a listed company.

<CliCommand>
longbridge business-segments AAPL.US
longbridge business-segments 700.HK
</CliCommand>

<SDKLinks module="fundamental" klass="FundamentalContext" method="business_segments" />


## Parameters

> **SDK method parameters.**

| Name | Type | Required | Description |
| ---- | ---- | -------- | ----------- |
| symbol | string | YES | Security symbol, e.g. `AAPL.US` |

## Request Example

<Tabs groupId="request-example">
<TabItem value="python" label="Python">

```python
from longbridge.openapi import FundamentalContext, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = FundamentalContext(config)

resp = ctx.business_segments("AAPL.US")
print(resp)
```

</TabItem>
<TabItem value="python-async" label="Python (async)">

```python
import asyncio
from longbridge.openapi import AsyncFundamentalContext, Config, OAuthBuilder

async def main() -> None:
oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = AsyncFundamentalContext.create(config)

resp = await ctx.business_segments("AAPL.US")
print(resp)

if __name__ == "__main__":
asyncio.run(main())
```

</TabItem>
<TabItem value="nodejs" label="Node.js">

```javascript
const { Config, FundamentalContext, OAuth } = require('longbridge')

async function main() {
const oauth = await OAuth.build('your-client-id', (_, url) => {
console.log('Open this URL to authorize: ' + url)
})
const config = Config.fromOAuth(oauth)
const ctx = FundamentalContext.new(config)
const resp = await ctx.businessSegments('AAPL.US')
console.log(resp)
}
main().catch(console.error)
```

</TabItem>
<TabItem value="java" label="Java">

```java
import com.longbridge.*;
import com.longbridge.fundamental.*;

class Main {
public static void main(String[] args) throws Exception {
try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
Config config = Config.fromOAuth(oauth);
FundamentalContext ctx = FundamentalContext.create(config)) {
var resp = ctx.getBusinessSegments("AAPL.US").get();
System.out.println(resp);
}
}
}
```

</TabItem>
<TabItem value="rust" label="Rust">

```rust
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open: {url}")).await?;
let config = Arc::new(Config::from_oauth(oauth));
let ctx = FundamentalContext::new(config);
let resp = ctx.business_segments("AAPL.US").await?;
println!("{:?}", resp);
Ok(())
}
```

</TabItem>
<TabItem value="cpp" label="C++">

```cpp
#include <iostream>
#include <longbridge.hpp>

using namespace longbridge;
using namespace longbridge::fundamental;

int main() {
OAuthBuilder("your-client-id").build(
[](const std::string& url) { std::cout << "Open: " << url << std::endl; },
[](auto res) {
if (!res) return;
Config config = Config::from_oauth(*res);
FundamentalContext ctx = FundamentalContext::create(config);
ctx.business_segments("AAPL.US", [](auto resp) {
if (resp) std::cout << "OK" << std::endl;
});
});
std::cin.get();
}
```

</TabItem>
<TabItem value="go" label="Go">

```go
package main

import (
"context"
"fmt"
"log"

"github.com/longbridge/openapi-go/config"
"github.com/longbridge/openapi-go/oauth"
"github.com/longbridge/openapi-go/fundamental"
)

func main() {
o := oauth.New("your-client-id").
OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) })
if err := o.Build(context.Background()); err != nil {
log.Fatal(err)
}
conf, err := config.New(config.WithOAuthClient(o))
if err != nil {
log.Fatal(err)
}
c, err := fundamental.NewFromCfg(conf)
if err != nil {
log.Fatal(err)
}
defer c.Close()
resp, err := c.BusinessSegments(context.Background(), "AAPL.US")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", resp)
}
```

</TabItem>
</Tabs>

## Response


### Response Example

```json
{
"code": 0,
"message": "success",
"data": {
"date": "20260331",
"total": "124300000000",
"currency": "USD",
"business": [
{"name": "iPhone", "percent": "56.19"},
{"name": "Services", "percent": "21.96"},
{"name": "Mac", "percent": "8.04"},
{"name": "iPad", "percent": "7.00"},
{"name": "Wearables", "percent": "6.81"}
]
}
}
```

### Response Status

| Status | Description | Schema |
| ------ | ----------- | ------ |
| 200 | Success | [BusinessSegmentsResponse](#BusinessSegmentsResponse) |
| 400 | Bad request | None |

## Schemas

### BusinessSegmentsResponse

<a id="BusinessSegmentsResponse"></a>

| Name | Type | Required | Description |
| ---- | ---- | -------- | ----------- |
| date | string | false | Report period in YYYYMMDD format, e.g. `20260331` |
| total | string | false | Total revenue for the period |
| currency | string | false | Currency code, e.g. `USD` |
| business | object[] | false | Business segment list |
| ∟ name | string | false | Segment name |
| ∟ percent | string | false | Revenue share percentage, e.g. `40.56` |
Loading
Loading