|
| 1 | +--- |
| 2 | +slug: shareholder-detail |
| 3 | +title: Shareholder Detail |
| 4 | +sidebar_position: 28 |
| 5 | +language_tabs: false |
| 6 | +toc_footers: [] |
| 7 | +includes: [] |
| 8 | +search: true |
| 9 | +highlight_theme: '' |
| 10 | +headingLevel: 2 |
| 11 | +--- |
| 12 | + |
| 13 | +Get holding history and trade details for a specific shareholder. The `object_id` comes from the `shareholder_top` response. |
| 14 | + |
| 15 | +<CliCommand> |
| 16 | +longbridge shareholder AAPL.US --object-id 19463 |
| 17 | +longbridge shareholder 700.HK --object-id 20181 |
| 18 | +</CliCommand> |
| 19 | + |
| 20 | +<SDKLinks module="fundamental" klass="FundamentalContext" method="shareholder_detail" /> |
| 21 | + |
| 22 | + |
| 23 | +## Parameters |
| 24 | + |
| 25 | +> **SDK method parameters.** |
| 26 | +
|
| 27 | +| Name | Type | Required | Description | |
| 28 | +| ---- | ---- | -------- | ----------- | |
| 29 | +| symbol | string | YES | Security symbol, e.g. `AAPL.US` | |
| 30 | +| object_id | integer | YES | Shareholder ID from `shareholder_top` `object_id` field | |
| 31 | + |
| 32 | +## Request Example |
| 33 | + |
| 34 | +<Tabs groupId="request-example"> |
| 35 | + <TabItem value="python" label="Python"> |
| 36 | + |
| 37 | +```python |
| 38 | +from longbridge.openapi import FundamentalContext, Config, OAuthBuilder |
| 39 | + |
| 40 | +oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url)) |
| 41 | +config = Config.from_oauth(oauth) |
| 42 | +ctx = FundamentalContext(config) |
| 43 | + |
| 44 | +resp = ctx.shareholder_detail("AAPL.US", 19463) |
| 45 | +print(resp) |
| 46 | +``` |
| 47 | + |
| 48 | + </TabItem> |
| 49 | + <TabItem value="python-async" label="Python (async)"> |
| 50 | + |
| 51 | +```python |
| 52 | +import asyncio |
| 53 | +from longbridge.openapi import AsyncFundamentalContext, Config, OAuthBuilder |
| 54 | + |
| 55 | +async def main() -> None: |
| 56 | + oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url)) |
| 57 | + config = Config.from_oauth(oauth) |
| 58 | + ctx = AsyncFundamentalContext.create(config) |
| 59 | + |
| 60 | + resp = await ctx.shareholder_detail("AAPL.US", 19463) |
| 61 | + print(resp) |
| 62 | + |
| 63 | +if __name__ == "__main__": |
| 64 | + asyncio.run(main()) |
| 65 | +``` |
| 66 | + |
| 67 | + </TabItem> |
| 68 | + <TabItem value="nodejs" label="Node.js"> |
| 69 | + |
| 70 | +```javascript |
| 71 | +const { Config, FundamentalContext, OAuth } = require('longbridge') |
| 72 | + |
| 73 | +async function main() { |
| 74 | + const oauth = await OAuth.build('your-client-id', (_, url) => { |
| 75 | + console.log('Open this URL to authorize: ' + url) |
| 76 | + }) |
| 77 | + const config = Config.fromOAuth(oauth) |
| 78 | + const ctx = FundamentalContext.new(config) |
| 79 | + const resp = await ctx.shareholderDetail('AAPL.US', 19463) |
| 80 | + console.log(resp) |
| 81 | +} |
| 82 | +main().catch(console.error) |
| 83 | +``` |
| 84 | + |
| 85 | + </TabItem> |
| 86 | + <TabItem value="java" label="Java"> |
| 87 | + |
| 88 | +```java |
| 89 | +import com.longbridge.*; |
| 90 | +import com.longbridge.fundamental.*; |
| 91 | + |
| 92 | +class Main { |
| 93 | + public static void main(String[] args) throws Exception { |
| 94 | + try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get(); |
| 95 | + Config config = Config.fromOAuth(oauth); |
| 96 | + FundamentalContext ctx = FundamentalContext.create(config)) { |
| 97 | + var resp = ctx.getShareholderDetail("AAPL.US", 19463L).get(); |
| 98 | + System.out.println(resp); |
| 99 | + } |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | + </TabItem> |
| 105 | + <TabItem value="rust" label="Rust"> |
| 106 | + |
| 107 | +```rust |
| 108 | +use std::sync::Arc; |
| 109 | +use longbridge::{oauth::OAuthBuilder, fundamental::FundamentalContext, Config}; |
| 110 | + |
| 111 | +#[tokio::main] |
| 112 | +async fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 113 | + let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open: {url}")).await?; |
| 114 | + let config = Arc::new(Config::from_oauth(oauth)); |
| 115 | + let ctx = FundamentalContext::new(config); |
| 116 | + let resp = ctx.shareholder_detail("AAPL.US", 19463).await?; |
| 117 | + println!("{:?}", resp); |
| 118 | + Ok(()) |
| 119 | +} |
| 120 | +``` |
| 121 | + |
| 122 | + </TabItem> |
| 123 | + <TabItem value="cpp" label="C++"> |
| 124 | + |
| 125 | +```cpp |
| 126 | +#include <iostream> |
| 127 | +#include <longbridge.hpp> |
| 128 | + |
| 129 | +using namespace longbridge; |
| 130 | +using namespace longbridge::fundamental; |
| 131 | + |
| 132 | +int main() { |
| 133 | + OAuthBuilder("your-client-id").build( |
| 134 | + [](const std::string& url) { std::cout << "Open: " << url << std::endl; }, |
| 135 | + [](auto res) { |
| 136 | + if (!res) return; |
| 137 | + Config config = Config::from_oauth(*res); |
| 138 | + FundamentalContext ctx = FundamentalContext::create(config); |
| 139 | + ctx.shareholder_detail("AAPL.US", 19463, [](auto resp) { |
| 140 | + if (resp) std::cout << "OK" << std::endl; |
| 141 | + }); |
| 142 | + }); |
| 143 | + std::cin.get(); |
| 144 | +} |
| 145 | +``` |
| 146 | +
|
| 147 | + </TabItem> |
| 148 | + <TabItem value="go" label="Go"> |
| 149 | +
|
| 150 | +```go |
| 151 | +package main |
| 152 | +
|
| 153 | +import ( |
| 154 | + "context" |
| 155 | + "fmt" |
| 156 | + "log" |
| 157 | +
|
| 158 | + "github.com/longbridge/openapi-go/config" |
| 159 | + "github.com/longbridge/openapi-go/oauth" |
| 160 | + "github.com/longbridge/openapi-go/fundamental" |
| 161 | +) |
| 162 | +
|
| 163 | +func main() { |
| 164 | + o := oauth.New("your-client-id"). |
| 165 | + OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) }) |
| 166 | + if err := o.Build(context.Background()); err != nil { |
| 167 | + log.Fatal(err) |
| 168 | + } |
| 169 | + conf, err := config.New(config.WithOAuthClient(o)) |
| 170 | + if err != nil { |
| 171 | + log.Fatal(err) |
| 172 | + } |
| 173 | + c, err := fundamental.NewFromCfg(conf) |
| 174 | + if err != nil { |
| 175 | + log.Fatal(err) |
| 176 | + } |
| 177 | + defer c.Close() |
| 178 | + resp, err := c.ShareholderDetail(context.Background(), "AAPL.US", 19463) |
| 179 | + if err != nil { |
| 180 | + log.Fatal(err) |
| 181 | + } |
| 182 | + fmt.Printf("%+v\n", resp) |
| 183 | +} |
| 184 | +``` |
| 185 | + |
| 186 | + </TabItem> |
| 187 | +</Tabs> |
| 188 | + |
| 189 | +## Response |
| 190 | + |
| 191 | + |
| 192 | +### Response Example |
| 193 | + |
| 194 | +```json |
| 195 | +{ |
| 196 | + "code": 0, |
| 197 | + "message": "success", |
| 198 | + "data": { |
| 199 | + "name": "The Vanguard Group, Inc.", |
| 200 | + "title": "", |
| 201 | + "avatar": "", |
| 202 | + "owner_source": "Institution", |
| 203 | + "holding_periods": [], |
| 204 | + "holding_details": [], |
| 205 | + "holding_summary": [], |
| 206 | + "trading_periods": ["Past 1 Month", "Past 3 Months", "Past 1 Year", "Past 3 Years"], |
| 207 | + "tradings": [ |
| 208 | + { |
| 209 | + "period": "Past 1 Month", |
| 210 | + "accum_buy": "8500000.00", |
| 211 | + "accum_sell": "2687264.00", |
| 212 | + "net_buy": "5812736.00", |
| 213 | + "trading_details": [ |
| 214 | + { |
| 215 | + "trading_date": "2025-12-18", |
| 216 | + "trading_shares": "5200000", |
| 217 | + "trading_price": "248.12", |
| 218 | + "trading_type": "Buy" |
| 219 | + } |
| 220 | + ] |
| 221 | + } |
| 222 | + ] |
| 223 | + } |
| 224 | +} |
| 225 | +``` |
| 226 | + |
| 227 | +### Response Status |
| 228 | + |
| 229 | +| Status | Description | Schema | |
| 230 | +| ------ | ----------- | ------ | |
| 231 | +| 200 | Success | [ShareholderDetailResponse](#ShareholderDetailResponse) | |
| 232 | +| 400 | Bad request | None | |
| 233 | + |
| 234 | +## Schemas |
| 235 | + |
| 236 | +### ShareholderDetailResponse |
| 237 | + |
| 238 | +<a id="ShareholderDetailResponse"></a> |
| 239 | + |
| 240 | +| Name | Type | Required | Description | |
| 241 | +| ---- | ---- | -------- | ----------- | |
| 242 | +| name | string | false | Shareholder name | |
| 243 | +| title | string | false | Shareholder title / type | |
| 244 | +| avatar | string | false | Avatar URL | |
| 245 | +| owner_source | string | false | Shareholder type: `Company`, `Institution`, `Person`, `Insider` | |
| 246 | +| holding_periods | string[] | false | Available holding periods | |
| 247 | +| holding_details | object[] | false | Holding detail records | |
| 248 | +| holding_summary | object[] | false | Holding summary records | |
| 249 | +| trading_periods | string[] | false | Available trading periods (e.g. `Past 1 Month`, `Past 3 Months`) | |
| 250 | +| tradings | object[] | false | Trade aggregates per period | |
| 251 | +| ∟ period | string | false | Period label (e.g. `Past 1 Month`) | |
| 252 | +| ∟ accum_buy | string | false | Cumulative shares bought in this period | |
| 253 | +| ∟ accum_sell | string | false | Cumulative shares sold in this period | |
| 254 | +| ∟ net_buy | string | false | Net shares bought (buy minus sell) in this period | |
| 255 | +| ∟ trading_details | object[] | false | Individual transactions within the period | |
| 256 | +| ∟ ∟ trading_date | string | false | Trade date | |
| 257 | +| ∟ ∟ trading_shares | string | false | Number of shares traded | |
| 258 | +| ∟ ∟ trading_price | string | false | Trade price | |
| 259 | +| ∟ ∟ trading_type | string | false | Trade direction: `Buy` or `Sell` | |
| 260 | + |
| 261 | +> Note: Some fields return an empty string or empty array when data is unavailable. |
0 commit comments