日度成交量
获取美股期权的历史每日认购/认沽成交量和未平仓量数据。
SDK Links
Python |
Rust |
Go |
Node.js |
Java |
C++ |
Parameters
SDK 方法参数。
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | YES | Underlying US stock symbol, e.g. AAPL.US, TSLA.US |
| timestamp | integer | NO | Start Unix timestamp (seconds); 0 returns the most recent (default 0) |
| count | integer | NO | Number of trading days to return (default 30) |
Go SDK 使用
start/end日期区间(time.Time)而非timestamp/count。
Request Example
from longbridge.openapi import QuoteContext, Config, OAuthBuilder
oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = QuoteContext(config)
resp = ctx.option_volume_daily("AAPL.US", count=30)
print(resp)import asyncio
from longbridge.openapi import AsyncQuoteContext, 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 = AsyncQuoteContext.create(config)
resp = await ctx.option_volume_daily("AAPL.US", count=30)
print(resp)
if __name__ == "__main__":
asyncio.run(main())const { Config, QuoteContext, 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 = QuoteContext.new(config)
const resp = await ctx.optionVolumeDaily('AAPL.US', 0, 30)
console.log(resp)
}
main().catch(console.error)import com.longbridge.*;
import com.longbridge.quote.*;
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);
QuoteContext ctx = QuoteContext.create(config)) {
OptionVolumeDailyOptions opts = new OptionVolumeDailyOptions();
opts.symbol = "AAPL.US";
opts.count = 30;
var resp = ctx.getOptionVolumeDaily(opts).get();
System.out.println(resp);
}
}
}use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, quote::QuoteContext, 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, _) = QuoteContext::new(config);
let resp = ctx.option_volume_daily("AAPL.US", 0, 30).await?;
println!("{:?}", resp);
Ok(())
}#include <iostream>
#include <longbridge.hpp>
using namespace longbridge;
using namespace longbridge::quote;
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);
QuoteContext ctx = QuoteContext::create(config);
ctx.option_volume_daily("AAPL.US", 0, 30, [](auto resp) {
if (resp) std::cout << resp->size() << std::endl;
});
});
std::cin.get();
}package main
import (
"context"
"fmt"
"log"
"time"
"github.com/longbridge/openapi-go/config"
"github.com/longbridge/openapi-go/oauth"
"github.com/longbridge/openapi-go/quote"
)
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)
}
qctx, err := quote.NewFromCfg(conf)
if err != nil {
log.Fatal(err)
}
defer qctx.Close()
end := time.Now()
start := end.AddDate(0, 0, -30)
resp, err := qctx.OptionVolumeDaily(context.Background(), "AAPL.US", start, end)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", resp)
}Response
Response Example
{
"code": 0,
"message": "success",
"data": {
"symbol": "AAPL.US",
"stats": [
{
"symbol": "AAPL.US",
"date": "2026-05-07",
"call_volume": 284512,
"put_volume": 195830,
"call_open_interest": 1824500,
"put_open_interest": 1532100,
"total_volume": 480342,
"total_open_interest": 3356600,
"pc_vol": 0.6886,
"pc_oi": 0.8398
}
]
}
}
Response Status
| Status | Description | Schema |
|---|---|---|
| 200 | Success | option_volume_daily_rsp |
| 400 | Bad request | None |
Schemas
option_volume_daily_rsp
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | true | Security symbol |
| stats | object[] | true | Daily volume records |
| ∟ symbol | string | true | Security symbol |
| ∟ date | string | true | Date in YYYY-MM-DD format |
| ∟ call_volume | int64 | true | Call volume on that day |
| ∟ put_volume | int64 | true | Put volume on that day |
| ∟ call_open_interest | int64 | true | Call open interest |
| ∟ put_open_interest | int64 | true | Put open interest |
| ∟ total_volume | int64 | true | Total options volume |
| ∟ total_open_interest | int64 | true | Total options open interest |
| ∟ pc_vol | float | true | Put/call volume ratio |
| ∟ pc_oi | float | true | Put/call open interest ratio |