機構共識

獲取機構共識預測,包括營收、EPS 和淨利潤預測。

>_ CLI
longbridge consensus TSLA.US
longbridge consensus AAPL.US

Parameters

SDK 方法參數。

NameTypeRequiredDescription
symbolstring是證券代碼,例如 TSLA.US

Request Example

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.consensus("TSLA.US")
print(resp)
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.consensus("TSLA.US")
    print(resp)

if __name__ == "__main__":
    asyncio.run(main())
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.consensus('TSLA.US')
  console.log(resp)
}
main().catch(console.error)
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.getConsensus("TSLA.US").get();
            System.out.println(resp);
        }
    }
}
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config};

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

using namespace longbridge;
using namespace longbridge::fundamental;

int main() {
    OAuthBuilder("your-client-id").build(
        [](const std::string& url) { std::cout << "Open: " << url << std::endl; },
        [](auto res) {
            if (!res) return;
            Config config = Config::from_oauth(*res);
            FundamentalContext ctx = FundamentalContext::create(config);
            ctx.consensus("TSLA.US", [](auto resp) {
                if (resp) std::cout << "OK" << std::endl;
            });
        });
    std::cin.get();
}
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.Consensus(context.Background(), "TSLA.US")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", resp)
}

Response

Response Example

{
  "code": 0,
  "message": "success",
  "data": {
    "currency": "USD",
    "current_index": 3,
    "current_period": "qf",
    "opt_periods": [
      "qf",
      "af",
      "saf"
    ],
    "list": [
      {
        "fiscal_year": 2026,
        "fiscal_period": "Q2 FY2026",
        "period_text": "Q2 FY2026",
        "details": [
          {
            "key": "revenue",
            "name": "Revenue",
            "estimate": "95000000000",
            "actual": "",
            "comp": "",
            "comp_value": null,
            "comp_desc": "",
            "description": "",
            "is_released": false
          }
        ]
      }
    ]
  }
}

Response Status

StatusDescriptionSchema
200成功FinancialConsensus
400請求錯誤None

Schemas

FinancialConsensus

NameTypeRequiredDescription
symbolstring是證券代碼
listobject[]是共識預測期列表,見 ConsensusListItem
list[].periodstring否財報期(如 FY2024)
list[].revenueint64否共識營收預測
list[].epsdouble否共識 EPS 預測
list[].net_incomeint64否共識淨利潤預測
list[].analyst_countint32否參與預測的分析師數量