股单详情
获取股单详情,包括名称、描述及成分股列表。
SDK Links
Python |
Rust |
Go |
Node.js |
Java |
C++ |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | integer | 是 | 股单 ID |
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.detail(123)
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.detail(123)
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.detail(123)
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.detail(123).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.detail(123).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.Detail(context.Background(), 123)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", resp)
}Response
Response Example
{
"code": 0,
"message": "success",
"data": {
"id": 123,
"name": "AI Picks",
"description": "Top AI infrastructure stocks",
"securities": ["AAPL.US", "NVDA.US"]
}
}
Response Status
| Status | Description | Schema |
|---|---|---|
| 200 | 成功 | SharelistDetail |
| 400 | 请求错误 | None |
Schemas
SharelistDetailResponse
| Name | Type | Required | Description |
|---|---|---|---|
| sharelist | object | true | 股单详情 |
| scopes | object | false | 订阅权限信息 |
SharelistInfo
| Name | Type | Required | Description |
|---|---|---|---|
| id | integer | true | 股单 ID |
| name | string | false | 名称 |
| description | string | false | 描述 |
| cover | string | false | 封面图 URL |
| subscribers_count | integer | false | 订阅人数 |
| chg | string | false | 当日涨跌幅 |
| this_year_chg | string | false | 年初至今涨跌幅 |
| subscribed | boolean | false | 是否已订阅 |
| sharelist_type | integer | false | 类型:0=普通,3=官方,4=行业 |
| industry_code | string | false | 行业代码 |
| stocks | object[] | false | 成分股列表,见 SharelistStock |
SharelistScopes
| Name | Type | Required | Description |
|---|---|---|---|
| is_self | boolean | false | 是否为创建者 |
| subscription | boolean | false | 是否已订阅 |