diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4dd88102..eb449c51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index a23c5759..208379ef 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -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: | diff --git a/docs/en/docs/fundamental/fundamental/business_segments.md b/docs/en/docs/fundamental/fundamental/business_segments.md new file mode 100644 index 00000000..dbc255c6 --- /dev/null +++ b/docs/en/docs/fundamental/fundamental/business_segments.md @@ -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. + + +longbridge business-segments AAPL.US +longbridge business-segments 700.HK + + + + + +## Parameters + +> **SDK method parameters.** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | YES | Security symbol, e.g. `AAPL.US` | + +## Request Example + + + + +```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) +``` + + + + +```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()) +``` + + + + +```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) +``` + + + + +```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); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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(()) +} +``` + + + + +```cpp +#include +#include + +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(); +} +``` + + + + +```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) +} +``` + + + + +## 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 + + + +| 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` | diff --git a/docs/en/docs/fundamental/fundamental/business_segments_history.md b/docs/en/docs/fundamental/fundamental/business_segments_history.md new file mode 100644 index 00000000..91864aa5 --- /dev/null +++ b/docs/en/docs/fundamental/fundamental/business_segments_history.md @@ -0,0 +1,243 @@ +--- +slug: business-segments-history +title: Business Segments History +sidebar_position: 22 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +Get historical business segment revenue trends across reporting periods. + + +longbridge business-segments AAPL.US --history +longbridge business-segments AAPL.US --history --report qf + + + + + +## Parameters + +> **SDK method parameters.** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | YES | Security symbol, e.g. `AAPL.US` | +| report | string | NO | Report type: `qf` (quarterly) / `saf` (semi-annual) / `af` (annual) | +| cate | string | NO | Segment category filter | + +## Request Example + + + + +```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_history("AAPL.US", report="qf") +print(resp) +``` + + + + +```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_history("AAPL.US", report="qf") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.businessSegmentsHistory('AAPL.US', { report: 'qf' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getBusinessSegmentsHistory("AAPL.US", "qf", null).get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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_history("AAPL.US", Some("qf"), None).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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_history("AAPL.US", "qf", "", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.BusinessSegmentsHistory(context.Background(), "AAPL.US", "qf", "") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "historical": [ + { + "date": "20260331", + "total": "124300000000", + "currency": "USD", + "business": [ + {"name": "美洲", "percent": "40.80", "value": "31968000000"}, + {"name": "欧洲", "percent": "23.64", "value": "18521000000"}, + {"name": "大中华区", "percent": "20.72", "value": "16233000000"} + ], + "regionals": [] + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | Success | [BusinessSegmentsHistoryResponse](#BusinessSegmentsHistoryResponse) | +| 400 | Bad request | None | + +## Schemas + +### BusinessSegmentsHistoryResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| historical | object[] | false | Historical period snapshots | +| ∟ date | string | false | Report period in YYYYMMDD format, e.g. `20260331` | +| ∟ total | string | false | Total revenue for the period | +| ∟ currency | string | false | Currency code | +| ∟ business | object[] | false | Business segment list | +| ∟ ∟ name | string | false | Segment name | +| ∟ ∟ percent | string | false | Revenue share percentage, e.g. `40.80` | +| ∟ ∟ value | string | false | Absolute revenue value | +| ∟ regionals | object[] | false | Regional segment list (typically empty) | +| ∟ ∟ name | string | false | Region name | +| ∟ ∟ percent | string | false | Revenue share percentage | +| ∟ ∟ value | string | false | Absolute revenue value | diff --git a/docs/en/docs/fundamental/fundamental/financial_report_snapshot.md b/docs/en/docs/fundamental/fundamental/financial_report_snapshot.md new file mode 100644 index 00000000..0b4146d7 --- /dev/null +++ b/docs/en/docs/fundamental/fundamental/financial_report_snapshot.md @@ -0,0 +1,275 @@ +--- +slug: financial-report-snapshot +title: Financial Report Snapshot +sidebar_position: 26 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +Get an AI-generated earnings summary, revenue/EBIT/EPS forecast vs actual (beat/miss analysis), and key financial ratios. + + +longbridge financial-report snapshot AAPL.US +longbridge financial-report snapshot AAPL.US --report qf --year 2024 --period 4 + + + + + +## Parameters + +> **SDK method parameters.** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | YES | Security symbol, e.g. `AAPL.US` | +| report | string | NO | Report type: `qf` (quarterly) / `saf` (semi-annual) / `af` (annual) | +| fiscal_year | uint32 | NO | Fiscal year, e.g. `2024` | +| fiscal_period | string | NO | Fiscal period, e.g. `1` / `2` / `3` / `4` | + +## Request Example + + + + +```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.financial_report_snapshot("AAPL.US", report="qf", fiscal_year=2024, fiscal_period="4") +print(resp) +``` + + + + +```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.financial_report_snapshot("AAPL.US", report="qf", fiscal_year=2024, fiscal_period="4") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.financialReportSnapshot('AAPL.US', { report: 'qf', fiscalYear: 2024, fiscalPeriod: '4' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getFinancialReportSnapshot("AAPL.US", "qf", 2024, "4").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.financial_report_snapshot("AAPL.US", Some("qf"), Some(2024), Some("4")).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.financial_report_snapshot("AAPL.US", "qf", 2024, "4", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.FinancialReportSnapshot(context.Background(), "AAPL.US", "qf", 2024, "4") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "name": "苹果", + "ticker": "AAPL", + "fp_start": "2025.12.28", + "fp_end": "2026.03.28", + "currency": "USD", + "report_desc": "概要:苹果(AAPL)的营业收入是 1112 亿(+16.6%);每股收益是 2.01(+21.82%)。", + "fo_revenue": {"value": "111184000000.0000", "yoy": "16.6", "cmp_desc": "", "est_value": ""}, + "fo_ebit": {"value": "35885000000.0000", "yoy": "21.28", "cmp_desc": "", "est_value": ""}, + "fo_eps": {"value": "2.0100", "yoy": "21.82", "cmp_desc": "", "est_value": ""}, + "fr_revenue": {"value": "111184000000.0000", "yoy": "16.6"}, + "fr_profit": {"value": "29578000000.0000", "yoy": "19.36"}, + "fr_roe_ttm": "141.4705", + "fr_profit_margin": "26.6027", + "fr_debt_assets_ratio": "71.3025" + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | Success | [FinancialReportSnapshotResponse](#FinancialReportSnapshotResponse) | +| 400 | Bad request | None | + +## Schemas + +### FinancialReportSnapshotResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | false | Company name | +| ticker | string | false | Ticker symbol without market suffix, e.g. `AAPL` | +| fp_start | string | false | Fiscal period start date in `YYYY.MM.DD` format | +| fp_end | string | false | Fiscal period end date in `YYYY.MM.DD` format | +| currency | string | false | Currency code | +| report_desc | string | false | AI-generated earnings summary | +| fo_revenue | object | false | Revenue forecast vs actual, see [ForecastMetric](#ForecastMetric) | +| fo_ebit | object | false | EBIT forecast vs actual, see [ForecastMetric](#ForecastMetric) | +| fo_eps | object | false | EPS forecast vs actual, see [ForecastMetric](#ForecastMetric) | +| fr_revenue | object | false | Reported revenue, see [ReportedMetric](#ReportedMetric) | +| fr_profit | object | false | Reported net profit, see [ReportedMetric](#ReportedMetric) | +| fr_operate_cash | object | false | Operating cash flow, see [ReportedMetric](#ReportedMetric) | +| fr_invest_cash | object | false | Investing cash flow, see [ReportedMetric](#ReportedMetric) | +| fr_finance_cash | object | false | Financing cash flow, see [ReportedMetric](#ReportedMetric) | +| fr_total_assets | object | false | Total assets, see [ReportedMetric](#ReportedMetric) | +| fr_total_liability | object | false | Total liabilities, see [ReportedMetric](#ReportedMetric) | +| fr_roe_ttm | string | false | ROE TTM as percentage, e.g. `141.47` | +| fr_profit_margin | string | false | Net profit margin as percentage | +| fr_profit_margin_ttm | string | false | Net profit margin TTM as percentage | +| fr_asset_turn_ttm | string | false | Asset turnover TTM as percentage | +| fr_leverage_ttm | string | false | Leverage TTM as percentage | +| fr_debt_assets_ratio | string | false | Debt-to-assets ratio as percentage | + +### ForecastMetric + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| value | string | false | Actual value | +| yoy | string | false | Year-over-year growth as percentage, e.g. `16.6` | +| cmp_desc | string | false | Beat/miss description (may be empty) | +| est_value | string | false | Consensus estimate (may be empty) | + +### ReportedMetric + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| value | string | false | Value | +| yoy | string | false | Year-over-year growth as percentage | diff --git a/docs/en/docs/fundamental/fundamental/industry_peers.md b/docs/en/docs/fundamental/fundamental/industry_peers.md new file mode 100644 index 00000000..a1aca54f --- /dev/null +++ b/docs/en/docs/fundamental/fundamental/industry_peers.md @@ -0,0 +1,259 @@ +--- +slug: industry-peers +title: Industry Peer Hierarchy +sidebar_position: 25 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +Get the hierarchical sub-sector tree for an industry group, including stock count, daily change, and YTD change at each node. Counter IDs come from `industry_rank`. + + +longbridge industry-peers BK/US/IN00258 +longbridge industry-peers BK/HK/IN20337 + + + + + +## Parameters + +> **SDK method parameters.** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| counter_id | string | YES | Industry unique identifier (BK/MARKET/ID format) from `industry_rank` | +| market | string | YES | Market code: `US` / `HK` / `CN` / `SG` | + +## Request Example + + + + +```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.industry_peers("BK/US/IN00258", "US") +print(resp) +``` + + + + +```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.industry_peers("BK/US/IN00258", "US") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.industryPeers('BK/US/IN00258', 'US') + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getIndustryPeers("BK/US/IN00258", "US").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.industry_peers("BK/US/IN00258", "US").await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.industry_peers("BK/US/IN00258", "US", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.IndustryPeers(context.Background(), "BK/US/IN00258", "US") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "top": {"name": "All Industries", "market": "US"}, + "chain": { + "name": "Technology", + "counter_id": "BK/US/IN00258", + "stock_num": 542, + "chg": "0.0231", + "ytd_chg": "0.0875", + "next": [ + { + "name": "在线消费电子产品零售", + "counter_id": "", + "stock_num": 4, + "chg": "0.0268", + "ytd_chg": "-0.1869", + "next": [] + } + ] + } + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | Success | [IndustryPeersResponse](#IndustryPeersResponse) | +| 400 | Bad request | None | + +## Schemas + +### IndustryPeersResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| top | object | false | Top-level industry info, see [IndustryPeersTop](#IndustryPeersTop) | +| chain | object | false | Industry hierarchy root node, see [IndustryPeerNode](#IndustryPeerNode) | + +### IndustryPeersTop + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | false | Top-level industry name | +| market | string | false | Market code | + +### IndustryPeerNode + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | false | Sector name | +| counter_id | string | false | Sector counter ID (present on root node; empty string on child nodes) | +| stock_num | integer | false | Number of stocks in this sector | +| chg | string | false | Daily change (decimal; may be empty string) | +| ytd_chg | string | false | Year-to-date change (decimal; may be empty string) | +| next | object[] | false | Child sector list with the same structure (recursive) | diff --git a/docs/en/docs/fundamental/fundamental/industry_rank.md b/docs/en/docs/fundamental/fundamental/industry_rank.md new file mode 100644 index 00000000..93ac410b --- /dev/null +++ b/docs/en/docs/fundamental/fundamental/industry_rank.md @@ -0,0 +1,245 @@ +--- +slug: industry-rank +title: Industry Ranking +sidebar_position: 24 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +Get the industry ranking list by market and indicator. The returned Counter ID can be passed directly to `industry_peers` to explore the sub-sector hierarchy. + + +longbridge industry-rank --market US +longbridge industry-rank --market HK --indicator market-cap + + + + + +## Parameters + +> **SDK method parameters.** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| market | string | YES | Market code: `US` / `HK` / `CN` / `SG` | +| indicator | string | YES | Ranking indicator: `leading-gainer` / `today-trend` / `popularity` / `market-cap` / `revenue` / `revenue-growth` / `net-profit` / `net-profit-growth` | +| sort_type | string | YES | Sort mode: `single` / `multi` | +| limit | uint32 | YES | Number of results to return, default 20 | + +## Request Example + + + + +```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.industry_rank("US", "leading-gainer", "single", 20) +print(resp) +``` + + + + +```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.industry_rank("US", "leading-gainer", "single", 20) + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.industryRank('US', 'leading-gainer', 'single', 20) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getIndustryRank("US", "leading-gainer", "single", 20).get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.industry_rank("US", "leading-gainer", "single", 20).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.industry_rank("US", "leading-gainer", "single", 20, [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.IndustryRank(context.Background(), "US", "leading-gainer", "single", 20) + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "items": [ + { + "lists": [ + { + "name": "Technology", + "counter_id": "BK/US/IN00258", + "chg": "0.0231", + "leading_name": "NVIDIA", + "leading_ticker": "NVDA.US", + "leading_chg": "0.0512", + "value_name": "", + "value_data": "" + } + ] + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | Success | [IndustryRankResponse](#IndustryRankResponse) | +| 400 | Bad request | None | + +## Schemas + +### IndustryRankResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| items | object[] | false | Ranked group list | +| ∟ lists | object[] | false | Industry item list | +| ∟ ∟ name | string | false | Industry name | +| ∟ ∟ counter_id | string | false | Industry counter ID (`BK/MARKET/ID` format), usable in `industry_peers` | +| ∟ ∟ chg | string | false | Daily change (decimal) | +| ∟ ∟ leading_name | string | false | Leading stock name | +| ∟ ∟ leading_ticker | string | false | Leading stock ticker | +| ∟ ∟ leading_chg | string | false | Leading stock daily change (decimal) | +| ∟ ∟ value_name | string | false | Indicator label (may be empty depending on indicator type) | +| ∟ ∟ value_data | string | false | Indicator value (may be empty) | diff --git a/docs/en/docs/fundamental/fundamental/institution_rating_views.md b/docs/en/docs/fundamental/fundamental/institution_rating_views.md new file mode 100644 index 00000000..650054d5 --- /dev/null +++ b/docs/en/docs/fundamental/fundamental/institution_rating_views.md @@ -0,0 +1,244 @@ +--- +slug: institution-rating-views +title: Institutional Rating Views Timeline +sidebar_position: 23 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +Get the monthly institutional rating (buy/hold/sell) distribution timeline, newest first. + + +longbridge institution-rating AAPL.US --views +longbridge institution-rating TSLA.US --views + + + + + +## Parameters + +> **SDK method parameters.** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | YES | Security symbol, e.g. `AAPL.US` | + +## Request Example + + + + +```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.institution_rating_views("AAPL.US") +print(resp) +``` + + + + +```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.institution_rating_views("AAPL.US") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.institutionRatingViews('AAPL.US') + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getInstitutionRatingViews("AAPL.US").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.institution_rating_views("AAPL.US").await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.institution_rating_views("AAPL.US", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.InstitutionRatingViews(context.Background(), "AAPL.US") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "elist": [ + { + "date": 1746057600, + "buy": "18", + "over": "5", + "hold": "17", + "under": "3", + "sell": "4", + "total": "51" + }, + { + "date": 1743379200, + "buy": "17", + "over": "6", + "hold": "18", + "under": "3", + "sell": "5", + "total": "53" + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | Success | [InstitutionRatingViewsResponse](#InstitutionRatingViewsResponse) | +| 400 | Bad request | None | + +## Schemas + +### InstitutionRatingViewsResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| elist | object[] | false | Monthly rating distribution list, newest first | +| ∟ date | integer | false | Unix timestamp (seconds) | +| ∟ buy | string | false | Number of Buy ratings | +| ∟ over | string | false | Number of Outperform ratings | +| ∟ hold | string | false | Number of Hold ratings | +| ∟ under | string | false | Number of Underperform ratings | +| ∟ sell | string | false | Number of Sell ratings | +| ∟ total | string | false | Total analyst count | diff --git a/docs/zh-CN/docs/fundamental/fundamental/business_segments.md b/docs/zh-CN/docs/fundamental/fundamental/business_segments.md new file mode 100644 index 00000000..c62a59a9 --- /dev/null +++ b/docs/zh-CN/docs/fundamental/fundamental/business_segments.md @@ -0,0 +1,232 @@ +--- +slug: business-segments +title: 业务分部(当前期) +sidebar_position: 21 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +获取上市公司当前报告期的业务分部收入占比。 + + +longbridge business-segments AAPL.US +longbridge business-segments 700.HK + + + + + +## Parameters + +> **SDK 方法参数。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 证券代码,例如 `AAPL.US` | + +## Request Example + + + + +```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) +``` + + + + +```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()) +``` + + + + +```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) +``` + + + + +```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); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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(()) +} +``` + + + + +```cpp +#include +#include + +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(); +} +``` + + + + +```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) +} +``` + + + + +## 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 | 成功 | [BusinessSegmentsResponse](#BusinessSegmentsResponse) | +| 400 | 请求错误 | None | + +## Schemas + +### BusinessSegmentsResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| date | string | 否 | 报告期,格式 YYYYMMDD,例如 `20260331` | +| total | string | 否 | 当期总收入 | +| currency | string | 否 | 货币代码,例如 `USD` | +| business | object[] | 否 | 业务分部列表 | +| ∟ name | string | 否 | 业务分部名称 | +| ∟ percent | string | 否 | 收入占比(百分比,例如 `40.56`) | diff --git a/docs/zh-CN/docs/fundamental/fundamental/business_segments_history.md b/docs/zh-CN/docs/fundamental/fundamental/business_segments_history.md new file mode 100644 index 00000000..34dd189e --- /dev/null +++ b/docs/zh-CN/docs/fundamental/fundamental/business_segments_history.md @@ -0,0 +1,243 @@ +--- +slug: business-segments-history +title: 业务分部(历史趋势) +sidebar_position: 22 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +获取上市公司按报告期的历史业务分部收入趋势。 + + +longbridge business-segments AAPL.US --history +longbridge business-segments AAPL.US --history --report qf + + + + + +## Parameters + +> **SDK 方法参数。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 证券代码,例如 `AAPL.US` | +| report | string | 否 | 报告类型:`qf`(季报)/ `saf`(半年报)/ `af`(年报) | +| cate | string | 否 | 分部类别过滤 | + +## Request Example + + + + +```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_history("AAPL.US", report="qf") +print(resp) +``` + + + + +```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_history("AAPL.US", report="qf") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.businessSegmentsHistory('AAPL.US', { report: 'qf' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getBusinessSegmentsHistory("AAPL.US", "qf", null).get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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_history("AAPL.US", Some("qf"), None).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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_history("AAPL.US", "qf", "", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.BusinessSegmentsHistory(context.Background(), "AAPL.US", "qf", "") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "historical": [ + { + "date": "20260331", + "total": "124300000000", + "currency": "USD", + "business": [ + {"name": "美洲", "percent": "40.80", "value": "31968000000"}, + {"name": "欧洲", "percent": "23.64", "value": "18521000000"}, + {"name": "大中华区", "percent": "20.72", "value": "16233000000"} + ], + "regionals": [] + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [BusinessSegmentsHistoryResponse](#BusinessSegmentsHistoryResponse) | +| 400 | 请求错误 | None | + +## Schemas + +### BusinessSegmentsHistoryResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| historical | object[] | 否 | 历史报告期列表 | +| ∟ date | string | 否 | 报告期,格式 YYYYMMDD,例如 `20260331` | +| ∟ total | string | 否 | 当期总收入 | +| ∟ currency | string | 否 | 货币代码 | +| ∟ business | object[] | 否 | 业务分部列表 | +| ∟ ∟ name | string | 否 | 业务分部名称 | +| ∟ ∟ percent | string | 否 | 收入占比(百分比,例如 `40.80`) | +| ∟ ∟ value | string | 否 | 绝对收入数值 | +| ∟ regionals | object[] | 否 | 地区分部列表(当前通常为空数组) | +| ∟ ∟ name | string | 否 | 地区名称 | +| ∟ ∟ percent | string | 否 | 收入占比(百分比) | +| ∟ ∟ value | string | 否 | 绝对收入数值 | diff --git a/docs/zh-CN/docs/fundamental/fundamental/financial_report_snapshot.md b/docs/zh-CN/docs/fundamental/fundamental/financial_report_snapshot.md new file mode 100644 index 00000000..067268d0 --- /dev/null +++ b/docs/zh-CN/docs/fundamental/fundamental/financial_report_snapshot.md @@ -0,0 +1,275 @@ +--- +slug: financial-report-snapshot +title: 财报快照(AI 摘要 + 预测对比) +sidebar_position: 26 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +获取 AI 生成的财报摘要、营收/EBIT/EPS 预测对比(超预期/低于预期),以及关键财务指标。 + + +longbridge financial-report snapshot AAPL.US +longbridge financial-report snapshot AAPL.US --report qf --year 2024 --period 4 + + + + + +## Parameters + +> **SDK 方法参数。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 证券代码,例如 `AAPL.US` | +| report | string | 否 | 报告类型:`qf`(季报)/ `saf`(半年报)/ `af`(年报) | +| fiscal_year | uint32 | 否 | 财政年度,例如 `2024` | +| fiscal_period | string | 否 | 财政季度,例如 `1` / `2` / `3` / `4` | + +## Request Example + + + + +```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.financial_report_snapshot("AAPL.US", report="qf", fiscal_year=2024, fiscal_period="4") +print(resp) +``` + + + + +```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.financial_report_snapshot("AAPL.US", report="qf", fiscal_year=2024, fiscal_period="4") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.financialReportSnapshot('AAPL.US', { report: 'qf', fiscalYear: 2024, fiscalPeriod: '4' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getFinancialReportSnapshot("AAPL.US", "qf", 2024, "4").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.financial_report_snapshot("AAPL.US", Some("qf"), Some(2024), Some("4")).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.financial_report_snapshot("AAPL.US", "qf", 2024, "4", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.FinancialReportSnapshot(context.Background(), "AAPL.US", "qf", 2024, "4") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "name": "苹果", + "ticker": "AAPL", + "fp_start": "2025.12.28", + "fp_end": "2026.03.28", + "currency": "USD", + "report_desc": "概要:苹果(AAPL)的营业收入是 1112 亿(+16.6%);每股收益是 2.01(+21.82%)。", + "fo_revenue": {"value": "111184000000.0000", "yoy": "16.6", "cmp_desc": "", "est_value": ""}, + "fo_ebit": {"value": "35885000000.0000", "yoy": "21.28", "cmp_desc": "", "est_value": ""}, + "fo_eps": {"value": "2.0100", "yoy": "21.82", "cmp_desc": "", "est_value": ""}, + "fr_revenue": {"value": "111184000000.0000", "yoy": "16.6"}, + "fr_profit": {"value": "29578000000.0000", "yoy": "19.36"}, + "fr_roe_ttm": "141.4705", + "fr_profit_margin": "26.6027", + "fr_debt_assets_ratio": "71.3025" + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [FinancialReportSnapshotResponse](#FinancialReportSnapshotResponse) | +| 400 | 请求错误 | None | + +## Schemas + +### FinancialReportSnapshotResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | 否 | 公司名称 | +| ticker | string | 否 | 证券代码(不含市场后缀,例如 `AAPL`) | +| fp_start | string | 否 | 财政期开始日期,格式 `YYYY.MM.DD` | +| fp_end | string | 否 | 财政期结束日期,格式 `YYYY.MM.DD` | +| currency | string | 否 | 货币代码 | +| report_desc | string | 否 | AI 生成的财报摘要 | +| fo_revenue | object | 否 | 营收预测对比,见 [ForecastMetric](#ForecastMetric) | +| fo_ebit | object | 否 | EBIT 预测对比,见 [ForecastMetric](#ForecastMetric) | +| fo_eps | object | 否 | EPS 预测对比,见 [ForecastMetric](#ForecastMetric) | +| fr_revenue | object | 否 | 营收财务数据,见 [ReportedMetric](#ReportedMetric) | +| fr_profit | object | 否 | 净利润财务数据,见 [ReportedMetric](#ReportedMetric) | +| fr_operate_cash | object | 否 | 经营现金流,见 [ReportedMetric](#ReportedMetric) | +| fr_invest_cash | object | 否 | 投资现金流,见 [ReportedMetric](#ReportedMetric) | +| fr_finance_cash | object | 否 | 融资现金流,见 [ReportedMetric](#ReportedMetric) | +| fr_total_assets | object | 否 | 总资产,见 [ReportedMetric](#ReportedMetric) | +| fr_total_liability | object | 否 | 总负债,见 [ReportedMetric](#ReportedMetric) | +| fr_roe_ttm | string | 否 | 净资产收益率 TTM(百分比,例如 `141.47`) | +| fr_profit_margin | string | 否 | 净利率(百分比) | +| fr_profit_margin_ttm | string | 否 | 净利率 TTM(百分比) | +| fr_asset_turn_ttm | string | 否 | 资产周转率 TTM(百分比) | +| fr_leverage_ttm | string | 否 | 杠杆率 TTM(百分比) | +| fr_debt_assets_ratio | string | 否 | 资产负债率(百分比) | + +### ForecastMetric + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| value | string | 否 | 实际值 | +| yoy | string | 否 | 同比增速(百分比,例如 `16.6`) | +| cmp_desc | string | 否 | 超预期/低于预期描述(可能为空) | +| est_value | string | 否 | 一致预期值(可能为空) | + +### ReportedMetric + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| value | string | 否 | 数值 | +| yoy | string | 否 | 同比增速(百分比) | diff --git a/docs/zh-CN/docs/fundamental/fundamental/industry_peers.md b/docs/zh-CN/docs/fundamental/fundamental/industry_peers.md new file mode 100644 index 00000000..41403f67 --- /dev/null +++ b/docs/zh-CN/docs/fundamental/fundamental/industry_peers.md @@ -0,0 +1,259 @@ +--- +slug: industry-peers +title: 行业子板块层级树 +sidebar_position: 25 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +获取行业分组的层级子板块树,含各节点股票数量、日涨跌幅和年初至今涨跌幅。Counter ID 可从 `industry_rank` 返回结果中获取。 + + +longbridge industry-peers BK/US/IN00258 +longbridge industry-peers BK/HK/IN20337 + + + + + +## Parameters + +> **SDK 方法参数。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| counter_id | string | 是 | 行业唯一标识(BK/市场/ID 格式),来源于 `industry_rank` | +| market | string | 是 | 市场代码:`US` / `HK` / `CN` / `SG` | + +## Request Example + + + + +```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.industry_peers("BK/US/IN00258", "US") +print(resp) +``` + + + + +```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.industry_peers("BK/US/IN00258", "US") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.industryPeers('BK/US/IN00258', 'US') + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getIndustryPeers("BK/US/IN00258", "US").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.industry_peers("BK/US/IN00258", "US").await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.industry_peers("BK/US/IN00258", "US", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.IndustryPeers(context.Background(), "BK/US/IN00258", "US") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "top": {"name": "All Industries", "market": "US"}, + "chain": { + "name": "Technology", + "counter_id": "BK/US/IN00258", + "stock_num": 542, + "chg": "0.0231", + "ytd_chg": "0.0875", + "next": [ + { + "name": "在线消费电子产品零售", + "counter_id": "", + "stock_num": 4, + "chg": "0.0268", + "ytd_chg": "-0.1869", + "next": [] + } + ] + } + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [IndustryPeersResponse](#IndustryPeersResponse) | +| 400 | 请求错误 | None | + +## Schemas + +### IndustryPeersResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| top | object | 否 | 顶层行业信息,见 [IndustryPeersTop](#IndustryPeersTop) | +| chain | object | 否 | 行业层级树根节点,见 [IndustryPeerNode](#IndustryPeerNode) | + +### IndustryPeersTop + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | 否 | 顶层行业名称 | +| market | string | 否 | 市场代码 | + +### IndustryPeerNode + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | 否 | 板块名称 | +| counter_id | string | 否 | 板块唯一标识(根节点有值,子节点为空字符串) | +| stock_num | integer | 否 | 板块内股票数量 | +| chg | string | 否 | 当日涨跌幅(小数,可能为空字符串) | +| ytd_chg | string | 否 | 年初至今涨跌幅(小数,可能为空字符串) | +| next | object[] | 否 | 子板块列表,结构与当前节点相同(递归) | diff --git a/docs/zh-CN/docs/fundamental/fundamental/industry_rank.md b/docs/zh-CN/docs/fundamental/fundamental/industry_rank.md new file mode 100644 index 00000000..604eaee7 --- /dev/null +++ b/docs/zh-CN/docs/fundamental/fundamental/industry_rank.md @@ -0,0 +1,245 @@ +--- +slug: industry-rank +title: 行业排行榜 +sidebar_position: 24 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +按市场和指标获取行业排行榜。返回的 Counter ID 可直接传入 `industry_peers` 查询子行业树。 + + +longbridge industry-rank --market US +longbridge industry-rank --market HK --indicator market-cap + + + + + +## Parameters + +> **SDK 方法参数。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| market | string | 是 | 市场代码:`US` / `HK` / `CN` / `SG` | +| indicator | string | 是 | 排行指标:`leading-gainer` / `today-trend` / `popularity` / `market-cap` / `revenue` / `revenue-growth` / `net-profit` / `net-profit-growth` | +| sort_type | string | 是 | 排序方式:`single`(单一排序)/ `multi`(多维排序) | +| limit | uint32 | 是 | 返回条数,默认 20 | + +## Request Example + + + + +```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.industry_rank("US", "leading-gainer", "single", 20) +print(resp) +``` + + + + +```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.industry_rank("US", "leading-gainer", "single", 20) + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.industryRank('US', 'leading-gainer', 'single', 20) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getIndustryRank("US", "leading-gainer", "single", 20).get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.industry_rank("US", "leading-gainer", "single", 20).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.industry_rank("US", "leading-gainer", "single", 20, [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.IndustryRank(context.Background(), "US", "leading-gainer", "single", 20) + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "items": [ + { + "lists": [ + { + "name": "Technology", + "counter_id": "BK/US/IN00258", + "chg": "0.0231", + "leading_name": "NVIDIA", + "leading_ticker": "NVDA.US", + "leading_chg": "0.0512", + "value_name": "", + "value_data": "" + } + ] + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [IndustryRankResponse](#IndustryRankResponse) | +| 400 | 请求错误 | None | + +## Schemas + +### IndustryRankResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| items | object[] | 否 | 排行分组列表 | +| ∟ lists | object[] | 否 | 行业条目列表 | +| ∟ ∟ name | string | 否 | 行业名称 | +| ∟ ∟ counter_id | string | 否 | 行业唯一标识(`BK/市场/ID` 格式),可直接传入 `industry_peers` | +| ∟ ∟ chg | string | 否 | 当日涨跌幅(小数) | +| ∟ ∟ leading_name | string | 否 | 涨幅领先个股名称 | +| ∟ ∟ leading_ticker | string | 否 | 涨幅领先个股代码 | +| ∟ ∟ leading_chg | string | 否 | 涨幅领先个股涨跌幅(小数) | +| ∟ ∟ value_name | string | 否 | 指标名称(按指标类型填充,可能为空) | +| ∟ ∟ value_data | string | 否 | 指标数值(可能为空) | diff --git a/docs/zh-CN/docs/fundamental/fundamental/institution_rating_views.md b/docs/zh-CN/docs/fundamental/fundamental/institution_rating_views.md new file mode 100644 index 00000000..e8e57988 --- /dev/null +++ b/docs/zh-CN/docs/fundamental/fundamental/institution_rating_views.md @@ -0,0 +1,244 @@ +--- +slug: institution-rating-views +title: 机构评级分布时间线 +sidebar_position: 23 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +获取按月统计的机构评级(买入/持有/卖出)分布时间线,最新月份在前。 + + +longbridge institution-rating AAPL.US --views +longbridge institution-rating TSLA.US --views + + + + + +## Parameters + +> **SDK 方法参数。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 证券代码,例如 `AAPL.US` | + +## Request Example + + + + +```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.institution_rating_views("AAPL.US") +print(resp) +``` + + + + +```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.institution_rating_views("AAPL.US") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.institutionRatingViews('AAPL.US') + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getInstitutionRatingViews("AAPL.US").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.institution_rating_views("AAPL.US").await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.institution_rating_views("AAPL.US", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.InstitutionRatingViews(context.Background(), "AAPL.US") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "elist": [ + { + "date": 1746057600, + "buy": "18", + "over": "5", + "hold": "17", + "under": "3", + "sell": "4", + "total": "51" + }, + { + "date": 1743379200, + "buy": "17", + "over": "6", + "hold": "18", + "under": "3", + "sell": "5", + "total": "53" + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [InstitutionRatingViewsResponse](#InstitutionRatingViewsResponse) | +| 400 | 请求错误 | None | + +## Schemas + +### InstitutionRatingViewsResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| elist | object[] | 否 | 月度评级分布列表,最新月份在前 | +| ∟ date | integer | 否 | Unix 时间戳(秒) | +| ∟ buy | string | 否 | 买入评级数量 | +| ∟ over | string | 否 | 跑赢市场评级数量 | +| ∟ hold | string | 否 | 持有评级数量 | +| ∟ under | string | 否 | 跑输市场评级数量 | +| ∟ sell | string | 否 | 卖出评级数量 | +| ∟ total | string | 否 | 机构总数 | diff --git a/docs/zh-HK/docs/fundamental/fundamental/business_segments.md b/docs/zh-HK/docs/fundamental/fundamental/business_segments.md new file mode 100644 index 00000000..7f518ba6 --- /dev/null +++ b/docs/zh-HK/docs/fundamental/fundamental/business_segments.md @@ -0,0 +1,232 @@ +--- +slug: business-segments +title: 業務分部(當前期) +sidebar_position: 21 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +獲取上市公司當前報告期的業務分部收入佔比。 + + +longbridge business-segments AAPL.US +longbridge business-segments 700.HK + + + + + +## Parameters + +> **SDK 方法參數。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 證券代碼,例如 `AAPL.US` | + +## Request Example + + + + +```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) +``` + + + + +```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()) +``` + + + + +```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) +``` + + + + +```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); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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(()) +} +``` + + + + +```cpp +#include +#include + +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(); +} +``` + + + + +```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) +} +``` + + + + +## 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 | 成功 | [BusinessSegmentsResponse](#BusinessSegmentsResponse) | +| 400 | 請求錯誤 | None | + +## Schemas + +### BusinessSegmentsResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| date | string | 否 | 報告期,格式 YYYYMMDD,例如 `20260331` | +| total | string | 否 | 當期總收入 | +| currency | string | 否 | 貨幣代碼,例如 `USD` | +| business | object[] | 否 | 業務分部列表 | +| ∟ name | string | 否 | 業務分部名稱 | +| ∟ percent | string | 否 | 收入佔比(百分比,例如 `40.56`) | diff --git a/docs/zh-HK/docs/fundamental/fundamental/business_segments_history.md b/docs/zh-HK/docs/fundamental/fundamental/business_segments_history.md new file mode 100644 index 00000000..51b2e7c4 --- /dev/null +++ b/docs/zh-HK/docs/fundamental/fundamental/business_segments_history.md @@ -0,0 +1,243 @@ +--- +slug: business-segments-history +title: 業務分部(歷史趨勢) +sidebar_position: 22 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +獲取上市公司按報告期的歷史業務分部收入趨勢。 + + +longbridge business-segments AAPL.US --history +longbridge business-segments AAPL.US --history --report qf + + + + + +## Parameters + +> **SDK 方法參數。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 證券代碼,例如 `AAPL.US` | +| report | string | 否 | 報告類型:`qf`(季報)/ `saf`(半年報)/ `af`(年報) | +| cate | string | 否 | 分部類別過濾 | + +## Request Example + + + + +```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_history("AAPL.US", report="qf") +print(resp) +``` + + + + +```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_history("AAPL.US", report="qf") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.businessSegmentsHistory('AAPL.US', { report: 'qf' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getBusinessSegmentsHistory("AAPL.US", "qf", null).get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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_history("AAPL.US", Some("qf"), None).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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_history("AAPL.US", "qf", "", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.BusinessSegmentsHistory(context.Background(), "AAPL.US", "qf", "") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "historical": [ + { + "date": "20260331", + "total": "124300000000", + "currency": "USD", + "business": [ + {"name": "美洲", "percent": "40.80", "value": "31968000000"}, + {"name": "欧洲", "percent": "23.64", "value": "18521000000"}, + {"name": "大中华区", "percent": "20.72", "value": "16233000000"} + ], + "regionals": [] + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [BusinessSegmentsHistoryResponse](#BusinessSegmentsHistoryResponse) | +| 400 | 請求錯誤 | None | + +## Schemas + +### BusinessSegmentsHistoryResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| historical | object[] | 否 | 歷史報告期列表 | +| ∟ date | string | 否 | 報告期,格式 YYYYMMDD,例如 `20260331` | +| ∟ total | string | 否 | 當期總收入 | +| ∟ currency | string | 否 | 貨幣代碼 | +| ∟ business | object[] | 否 | 業務分部列表 | +| ∟ ∟ name | string | 否 | 業務分部名稱 | +| ∟ ∟ percent | string | 否 | 收入佔比(百分比,例如 `40.80`) | +| ∟ ∟ value | string | 否 | 絕對收入數值 | +| ∟ regionals | object[] | 否 | 地區分部列表(當前通常為空數組) | +| ∟ ∟ name | string | 否 | 地區名稱 | +| ∟ ∟ percent | string | 否 | 收入佔比(百分比) | +| ∟ ∟ value | string | 否 | 絕對收入數值 | diff --git a/docs/zh-HK/docs/fundamental/fundamental/financial_report_snapshot.md b/docs/zh-HK/docs/fundamental/fundamental/financial_report_snapshot.md new file mode 100644 index 00000000..e88f4ec8 --- /dev/null +++ b/docs/zh-HK/docs/fundamental/fundamental/financial_report_snapshot.md @@ -0,0 +1,275 @@ +--- +slug: financial-report-snapshot +title: 財報快照(AI 摘要 + 預測對比) +sidebar_position: 26 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +獲取 AI 生成的財報摘要、營收/EBIT/EPS 預測對比(超預期/低於預期),以及關鍵財務指標。 + + +longbridge financial-report snapshot AAPL.US +longbridge financial-report snapshot AAPL.US --report qf --year 2024 --period 4 + + + + + +## Parameters + +> **SDK 方法參數。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 證券代碼,例如 `AAPL.US` | +| report | string | 否 | 報告類型:`qf`(季報)/ `saf`(半年報)/ `af`(年報) | +| fiscal_year | uint32 | 否 | 財政年度,例如 `2024` | +| fiscal_period | string | 否 | 財政季度,例如 `1` / `2` / `3` / `4` | + +## Request Example + + + + +```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.financial_report_snapshot("AAPL.US", report="qf", fiscal_year=2024, fiscal_period="4") +print(resp) +``` + + + + +```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.financial_report_snapshot("AAPL.US", report="qf", fiscal_year=2024, fiscal_period="4") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.financialReportSnapshot('AAPL.US', { report: 'qf', fiscalYear: 2024, fiscalPeriod: '4' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getFinancialReportSnapshot("AAPL.US", "qf", 2024, "4").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.financial_report_snapshot("AAPL.US", Some("qf"), Some(2024), Some("4")).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.financial_report_snapshot("AAPL.US", "qf", 2024, "4", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.FinancialReportSnapshot(context.Background(), "AAPL.US", "qf", 2024, "4") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "name": "苹果", + "ticker": "AAPL", + "fp_start": "2025.12.28", + "fp_end": "2026.03.28", + "currency": "USD", + "report_desc": "概要:苹果(AAPL)的营业收入是 1112 亿(+16.6%);每股收益是 2.01(+21.82%)。", + "fo_revenue": {"value": "111184000000.0000", "yoy": "16.6", "cmp_desc": "", "est_value": ""}, + "fo_ebit": {"value": "35885000000.0000", "yoy": "21.28", "cmp_desc": "", "est_value": ""}, + "fo_eps": {"value": "2.0100", "yoy": "21.82", "cmp_desc": "", "est_value": ""}, + "fr_revenue": {"value": "111184000000.0000", "yoy": "16.6"}, + "fr_profit": {"value": "29578000000.0000", "yoy": "19.36"}, + "fr_roe_ttm": "141.4705", + "fr_profit_margin": "26.6027", + "fr_debt_assets_ratio": "71.3025" + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [FinancialReportSnapshotResponse](#FinancialReportSnapshotResponse) | +| 400 | 請求錯誤 | None | + +## Schemas + +### FinancialReportSnapshotResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | 否 | 公司名稱 | +| ticker | string | 否 | 證券代碼(不含市場後綴,例如 `AAPL`) | +| fp_start | string | 否 | 財政期開始日期,格式 `YYYY.MM.DD` | +| fp_end | string | 否 | 財政期結束日期,格式 `YYYY.MM.DD` | +| currency | string | 否 | 貨幣代碼 | +| report_desc | string | 否 | AI 生成的財報摘要 | +| fo_revenue | object | 否 | 營收預測對比,見 [ForecastMetric](#ForecastMetric) | +| fo_ebit | object | 否 | EBIT 預測對比,見 [ForecastMetric](#ForecastMetric) | +| fo_eps | object | 否 | EPS 預測對比,見 [ForecastMetric](#ForecastMetric) | +| fr_revenue | object | 否 | 營收財務數據,見 [ReportedMetric](#ReportedMetric) | +| fr_profit | object | 否 | 淨利潤財務數據,見 [ReportedMetric](#ReportedMetric) | +| fr_operate_cash | object | 否 | 經營現金流,見 [ReportedMetric](#ReportedMetric) | +| fr_invest_cash | object | 否 | 投資現金流,見 [ReportedMetric](#ReportedMetric) | +| fr_finance_cash | object | 否 | 融資現金流,見 [ReportedMetric](#ReportedMetric) | +| fr_total_assets | object | 否 | 總資產,見 [ReportedMetric](#ReportedMetric) | +| fr_total_liability | object | 否 | 總負債,見 [ReportedMetric](#ReportedMetric) | +| fr_roe_ttm | string | 否 | 淨資產收益率 TTM(百分比,例如 `141.47`) | +| fr_profit_margin | string | 否 | 淨利率(百分比) | +| fr_profit_margin_ttm | string | 否 | 淨利率 TTM(百分比) | +| fr_asset_turn_ttm | string | 否 | 資產周轉率 TTM(百分比) | +| fr_leverage_ttm | string | 否 | 槓桿率 TTM(百分比) | +| fr_debt_assets_ratio | string | 否 | 資產負債率(百分比) | + +### ForecastMetric + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| value | string | 否 | 實際值 | +| yoy | string | 否 | 同比增速(百分比,例如 `16.6`) | +| cmp_desc | string | 否 | 超預期/低於預期描述(可能為空) | +| est_value | string | 否 | 一致預期值(可能為空) | + +### ReportedMetric + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| value | string | 否 | 數值 | +| yoy | string | 否 | 同比增速(百分比) | diff --git a/docs/zh-HK/docs/fundamental/fundamental/industry_peers.md b/docs/zh-HK/docs/fundamental/fundamental/industry_peers.md new file mode 100644 index 00000000..7012084b --- /dev/null +++ b/docs/zh-HK/docs/fundamental/fundamental/industry_peers.md @@ -0,0 +1,259 @@ +--- +slug: industry-peers +title: 行業子板塊層級樹 +sidebar_position: 25 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +獲取行業分組的層級子板塊樹,含各節點股票數量、日漲跌幅和年初至今漲跌幅。Counter ID 可從 `industry_rank` 返回結果中獲取。 + + +longbridge industry-peers BK/US/IN00258 +longbridge industry-peers BK/HK/IN20337 + + + + + +## Parameters + +> **SDK 方法參數。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| counter_id | string | 是 | 行業唯一標識(BK/市場/ID 格式),來源於 `industry_rank` | +| market | string | 是 | 市場代碼:`US` / `HK` / `CN` / `SG` | + +## Request Example + + + + +```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.industry_peers("BK/US/IN00258", "US") +print(resp) +``` + + + + +```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.industry_peers("BK/US/IN00258", "US") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.industryPeers('BK/US/IN00258', 'US') + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getIndustryPeers("BK/US/IN00258", "US").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.industry_peers("BK/US/IN00258", "US").await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.industry_peers("BK/US/IN00258", "US", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.IndustryPeers(context.Background(), "BK/US/IN00258", "US") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "top": {"name": "All Industries", "market": "US"}, + "chain": { + "name": "Technology", + "counter_id": "BK/US/IN00258", + "stock_num": 542, + "chg": "0.0231", + "ytd_chg": "0.0875", + "next": [ + { + "name": "在线消费电子产品零售", + "counter_id": "", + "stock_num": 4, + "chg": "0.0268", + "ytd_chg": "-0.1869", + "next": [] + } + ] + } + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [IndustryPeersResponse](#IndustryPeersResponse) | +| 400 | 請求錯誤 | None | + +## Schemas + +### IndustryPeersResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| top | object | 否 | 頂層行業資訊,見 [IndustryPeersTop](#IndustryPeersTop) | +| chain | object | 否 | 行業層級樹根節點,見 [IndustryPeerNode](#IndustryPeerNode) | + +### IndustryPeersTop + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | 否 | 頂層行業名稱 | +| market | string | 否 | 市場代碼 | + +### IndustryPeerNode + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| name | string | 否 | 板塊名稱 | +| counter_id | string | 否 | 板塊唯一標識(根節點有值,子節點為空字串) | +| stock_num | integer | 否 | 板塊內股票數量 | +| chg | string | 否 | 當日漲跌幅(小數,可能為空字串) | +| ytd_chg | string | 否 | 年初至今漲跌幅(小數,可能為空字串) | +| next | object[] | 否 | 子板塊列表,結構與當前節點相同(遞迴) | diff --git a/docs/zh-HK/docs/fundamental/fundamental/industry_rank.md b/docs/zh-HK/docs/fundamental/fundamental/industry_rank.md new file mode 100644 index 00000000..6dabcf30 --- /dev/null +++ b/docs/zh-HK/docs/fundamental/fundamental/industry_rank.md @@ -0,0 +1,245 @@ +--- +slug: industry-rank +title: 行業排行榜 +sidebar_position: 24 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +按市場和指標獲取行業排行榜。返回的 Counter ID 可直接傳入 `industry_peers` 查詢子行業樹。 + + +longbridge industry-rank --market US +longbridge industry-rank --market HK --indicator market-cap + + + + + +## Parameters + +> **SDK 方法參數。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| market | string | 是 | 市場代碼:`US` / `HK` / `CN` / `SG` | +| indicator | string | 是 | 排行指標:`leading-gainer` / `today-trend` / `popularity` / `market-cap` / `revenue` / `revenue-growth` / `net-profit` / `net-profit-growth` | +| sort_type | string | 是 | 排序方式:`single`(單一排序)/ `multi`(多維排序) | +| limit | uint32 | 是 | 返回條數,預設 20 | + +## Request Example + + + + +```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.industry_rank("US", "leading-gainer", "single", 20) +print(resp) +``` + + + + +```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.industry_rank("US", "leading-gainer", "single", 20) + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.industryRank('US', 'leading-gainer', 'single', 20) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getIndustryRank("US", "leading-gainer", "single", 20).get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.industry_rank("US", "leading-gainer", "single", 20).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.industry_rank("US", "leading-gainer", "single", 20, [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.IndustryRank(context.Background(), "US", "leading-gainer", "single", 20) + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "items": [ + { + "lists": [ + { + "name": "Technology", + "counter_id": "BK/US/IN00258", + "chg": "0.0231", + "leading_name": "NVIDIA", + "leading_ticker": "NVDA.US", + "leading_chg": "0.0512", + "value_name": "", + "value_data": "" + } + ] + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [IndustryRankResponse](#IndustryRankResponse) | +| 400 | 請求錯誤 | None | + +## Schemas + +### IndustryRankResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| items | object[] | 否 | 排行分組列表 | +| ∟ lists | object[] | 否 | 行業條目列表 | +| ∟ ∟ name | string | 否 | 行業名稱 | +| ∟ ∟ counter_id | string | 否 | 行業唯一標識(`BK/市場/ID` 格式),可直接傳入 `industry_peers` | +| ∟ ∟ chg | string | 否 | 當日漲跌幅(小數) | +| ∟ ∟ leading_name | string | 否 | 漲幅領先個股名稱 | +| ∟ ∟ leading_ticker | string | 否 | 漲幅領先個股代碼 | +| ∟ ∟ leading_chg | string | 否 | 漲幅領先個股漲跌幅(小數) | +| ∟ ∟ value_name | string | 否 | 指標名稱(按指標類型填充,可能為空) | +| ∟ ∟ value_data | string | 否 | 指標數值(可能為空) | diff --git a/docs/zh-HK/docs/fundamental/fundamental/institution_rating_views.md b/docs/zh-HK/docs/fundamental/fundamental/institution_rating_views.md new file mode 100644 index 00000000..bc69d671 --- /dev/null +++ b/docs/zh-HK/docs/fundamental/fundamental/institution_rating_views.md @@ -0,0 +1,244 @@ +--- +slug: institution-rating-views +title: 機構評級分佈時間線 +sidebar_position: 23 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +獲取按月統計的機構評級(買入/持有/賣出)分佈時間線,最新月份在前。 + + +longbridge institution-rating AAPL.US --views +longbridge institution-rating TSLA.US --views + + + + + +## Parameters + +> **SDK 方法參數。** + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| symbol | string | 是 | 證券代碼,例如 `AAPL.US` | + +## Request Example + + + + +```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.institution_rating_views("AAPL.US") +print(resp) +``` + + + + +```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.institution_rating_views("AAPL.US") + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```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.institutionRatingViews('AAPL.US') + console.log(resp) +} +main().catch(console.error) +``` + + + + +```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.getInstitutionRatingViews("AAPL.US").get(); + System.out.println(resp); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + 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.institution_rating_views("AAPL.US").await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +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.institution_rating_views("AAPL.US", [](auto resp) { + if (resp) std::cout << "OK" << std::endl; + }); + }); + std::cin.get(); +} +``` + + + + +```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.InstitutionRatingViews(context.Background(), "AAPL.US") + if err != nil { + log.Fatal(err) + } + fmt.Printf("%+v\n", resp) +} +``` + + + + +## Response + + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "elist": [ + { + "date": 1746057600, + "buy": "18", + "over": "5", + "hold": "17", + "under": "3", + "sell": "4", + "total": "51" + }, + { + "date": 1743379200, + "buy": "17", + "over": "6", + "hold": "18", + "under": "3", + "sell": "5", + "total": "53" + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ----------- | ------ | +| 200 | 成功 | [InstitutionRatingViewsResponse](#InstitutionRatingViewsResponse) | +| 400 | 請求錯誤 | None | + +## Schemas + +### InstitutionRatingViewsResponse + + + +| Name | Type | Required | Description | +| ---- | ---- | -------- | ----------- | +| elist | object[] | 否 | 月度評級分佈列表,最新月份在前 | +| ∟ date | integer | 否 | Unix 時間戳(秒) | +| ∟ buy | string | 否 | 買入評級數量 | +| ∟ over | string | 否 | 跑贏市場評級數量 | +| ∟ hold | string | 否 | 持有評級數量 | +| ∟ under | string | 否 | 跑輸市場評級數量 | +| ∟ sell | string | 否 | 賣出評級數量 | +| ∟ total | string | 否 | 機構總數 | diff --git a/package.json b/package.json index 6a90a333..e7e85be4 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "dev": "vitepress dev docs", "dev:canary": "cross-env VITE_API_BASE_URL=https://openapi.longbridge.xyz npx vitepress dev docs", "dev:cn": "cross-env VITE_REGION=cn VITE_API_BASE_URL=https://openapi.longbridge.cn VITE_SITE_HOSTNAME=https://open.longbridge.cn npx vitepress dev docs", - "build:canary": "cross-env \"NODE_OPTIONS=--max-old-space-size=10240 --expose-gc\" VITE_API_BASE_URL=https://openapi.longbridge.xyz npx vitepress build docs && bun run build:llms && bun run build:copy-routes", - "build:release": "cross-env \"NODE_OPTIONS=--max-old-space-size=10240 --expose-gc\" VITE_API_BASE_URL=https://openapi.longbridge.com npx vitepress build docs && bun run build:llms && bun run build:copy-routes", - "build:cn": "cross-env \"NODE_OPTIONS=--max-old-space-size=10240 --expose-gc\" VITE_REGION=cn VITE_API_BASE_URL=https://openapi.longbridge.cn VITE_PORTAL_GATEWAY_BASE_URL=https://m.lbkrs.com VITE_SITE_HOSTNAME=https://open.longbridge.cn npx vitepress build docs && bun run build:llms && bun run build:copy-routes", + "build:canary": "cross-env \"NODE_OPTIONS=--max-old-space-size=12288 --expose-gc\" VITE_API_BASE_URL=https://openapi.longbridge.xyz npx vitepress build docs && bun run build:llms && bun run build:copy-routes", + "build:release": "cross-env \"NODE_OPTIONS=--max-old-space-size=12288 --expose-gc\" VITE_API_BASE_URL=https://openapi.longbridge.com npx vitepress build docs && bun run build:llms && bun run build:copy-routes", + "build:cn": "cross-env \"NODE_OPTIONS=--max-old-space-size=12288 --expose-gc\" VITE_REGION=cn VITE_API_BASE_URL=https://openapi.longbridge.cn VITE_PORTAL_GATEWAY_BASE_URL=https://m.lbkrs.com VITE_SITE_HOSTNAME=https://open.longbridge.cn npx vitepress build docs && bun run build:llms && bun run build:copy-routes", "build:llms": "bun run scripts/normalize_md.ts && bun run scripts/generate-llms.ts", "build:copy-routes": "bun run scripts/copy-routes.ts", "preview": "vitepress preview docs",