Longbridge Developers
立即開始

熱門股單

獲取社區熱門股單列表。

>_ CLI
longbridge sharelist popular --count 10

Parameters

NameTypeRequiredDescription
countinteger否返回數量上限,默認 20

Request Example

from longbridge.openapi import SharelistContext, Config, OAuthBuilder

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

resp = ctx.popular(10)
print(resp)
import asyncio
from longbridge.openapi import AsyncSharelistContext, 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 = AsyncSharelistContext.create(config)

    resp = await ctx.popular(10)
    print(resp)

if __name__ == "__main__":
    asyncio.run(main())
const { Config, SharelistContext, 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 = SharelistContext.new(config)
  const resp = await ctx.popular(10)
  console.log(resp)
}
main().catch(console.error)
import com.longbridge.*;
import com.longbridge.sharelist.*;

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);
             SharelistContext ctx = SharelistContext.create(config)) {
            var resp = ctx.popular(10).get();
            System.out.println(resp);
        }
    }
}
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, sharelist::SharelistContext, 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 = SharelistContext::new(config);
    let resp = ctx.popular(10).await?;
    println!("{:?}", resp);
    Ok(())
}
package main

import (
	"context"
	"fmt"
	"log"

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

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 := sharelist.NewFromCfg(conf)
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()
	resp, err := c.Popular(context.Background(), 10)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", resp)
}

Response

Response Example

{
  "code": 0,
  "message": "success",
  "data": {
    "list": [
      { "id": 123, "name": "AI Picks", "description": "Top AI infrastructure stocks" },
      { "id": 456, "name": "EV Leaders", "description": "Electric vehicle sector leaders" }
    ]
  }
}

Response Status

StatusDescriptionSchema
200成功SharelistListResponse
400請求錯誤None

Schemas

SharelistListResponse

NameTypeRequiredDescription
sharelistsobject[]false用戶自建股單列表,見 SharelistInfo
subscribed_sharelistsobject[]false已訂閱股單列表,見 SharelistInfo
tail_markstringfalse已訂閱列表的分頁游標

SharelistInfo

NameTypeRequiredDescription
idintegertrue股單 ID
namestringfalse股單名稱
descriptionstringfalse描述
coverstringfalse封面圖片 URL
subscribers_countintegerfalse訂閱人數
chgstringfalse日漲跌幅
this_year_chgstringfalse今年以來漲跌幅
subscribedbooleanfalse當前用戶是否已訂閱
sharelist_typeintegerfalse類型:0=普通,3=官方,4=行業
industry_codestringfalse行業代碼(行業股單適用)
stocksobject[]false成份股列表,見 SharelistStock

SharelistStock

NameTypeRequiredDescription
symbolstringtrue證券代碼
codestringfalse股票代碼
namestringfalse證券名稱
marketstringfalse市場
introstringfalse簡介
last_donestringfalse最新價格
changestringfalse日漲跌幅
trade_statusintegerfalse交易狀態碼
latencybooleanfalse是否為延遲行情數據
unread_change_log_categorystringfalse未讀變更日誌分類