Options
Get option expiration date
Corresponding request class: OptionExpirationQueryRequest
description
Get the option expiration date, the request limit is 30 stocks
parameter
parameter | type | required | description |
---|---|---|---|
symbols | array | Yes | A list of stock symbols, the upper limit is: 30 |
return
com.tigerbrokers.stock.openapi.client.https.response.option.OptionExpirationResponse
[source](https://github.com/tigerfintech/openapi-java-sdk/blob/master/src/main/java/com /tigerbrokers/stock/openapi/client/https/response/option/OptionExpirationResponse.java)
The structure is as follows:
public class OptionExpirationResponse extends TigerResponse {
@JSONField(name = "data")
private List<OptionExpirationItem> optionExpirationItems;
}
The returned data can be accessed through the OptionExpirationResponse.getOptionExpirationItems()
method, which returns the OptionExpirationItem
object, where com.tigerbrokers.stock.openapi.client.https.domain.option.item.OptionExpirationItem
properties are as follows:
name | type | description |
---|---|---|
symbol | string | stock code |
count | int | expiration date number |
dates | array | expiration time, date format, such as: 2018-12-01 |
timestamps | array | expiration date, timestamp format, such as: 1544763600000 (timestamp corresponding to New York time in the United States) |
periodTags | array | Option period tag, "m" is the monthly option, "w" is the weekly option |
Specific fields can be accessed through the get method of the object, such as getSymbol()
, or converted to a string by the toString()
method of the object
example
OptionExpirationResponse response = client.execute(new OptionExpirationQueryRequest(List.of("AAPL", "GOOG")));
if (response. isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
System.out.println("response error:" + response.getMessage());
}
response
{
"code": 0,
"data": [{
"count": 22,
"dates": ["2023-01-13", "2023-01-20", "2023-01-27", "2023-02-03", "2023-02-10", "2023-02- 17", "2023-02-24", "2023-03-03", "2023-03-17", "2023-04-21", "2023-05-19", "2023-06-16" , "2023-07-21", "2023-08-18", "2023-09-15", "2023-10-20", "2023-12-15", "2024-01-19", " 2024-03-15", "2024-06-21", "2025-01-17", "2025-06-20"],
"symbol": "AAPL",
"timestamps": [1673586000000, 1674190800000, 1674795600000, 1675400400000, 1676005200000, 1676610000000, 1677214800000, 167781960 0000, 1679025600000, 1682049600000, 1684468800000, 1686888000000, 1689912000000, 1692331200000, 1694750400000, 169777440000 0, 1702616400000, 1705640400000, 1710475200000, 1718942400000, 1737090000000, 1750392000000]
}, {
"count": 16,
"dates": ["2023-01-13", "2023-01-20", "2023-01-27", "2023-02-03", "2023-02-10", "2023-02- 17", "2023-02-24", "2023-03-03", "2023-03-17", "2023-04-21", "2023-06-16", "2023-09-15" , "2024-01-19", "2024-06-21", "2025-01-17", "2025-06-20"],
"symbol": "GOOG",
"timestamps": [1673586000000, 1674190800000, 1674795600000, 1675400400000, 1676005200000, 1676610000000, 1677214800000, 167781960 0000, 1679025600000, 1682049600000, 1686888000000, 1694750400000, 1705640400000, 1718942400000, 1737090000000, 175039200000 0]
}],
"message": "success",
"sign": "VIXQAvI3HOpmEY2ZO+VO08ECVbKclsYtU980Euac240Bfd...",
"success": true,
"timestamp": 1673513141352
}
Get option chain
Corresponding request class: OptionChainQueryV3Request
description
Get option chain. The returned Greek letters are the last updated data of the previous trading day, and you can use Option indicator calculation to calculate the latest value in the intraday
parameter
parameter | type | required | description |
---|---|---|---|
symbol | string | Yes | Stock code, the maximum combination of symbol and expiry is: 30 |
expiry | String | Yes | Option expiration date, example: '2022-01-01' |
Filter parameters:
parameter | type | required | description |
---|---|---|---|
implied_volatility | double | No | implied volatility |
in_the_money | boolean | No | whether in the money |
open_interest | int | No | open interest |
delta | double | No | delta |
gamma | double | No | gamma |
theta | double | No | theta |
vega | double | No | vega |
rho | double | No | rho |
return
com.tigerbrokers.stock.openapi.client.https.response.option.OptionChainResponse
[source](https://github.com/tigerfintech/openapi-java-sdk/blob/master/src/main/java/com /tigerbrokers/stock/openapi/client/https/response/option/OptionChainResponse.java)
The structure is as follows:
public class OptionChainResponse extends TigerResponse {
@JSONField(name = "data")
private List<OptionChainItem> optionChainItems;
}
The returned data can be accessed through the OptionChainResponse.getOptionChainItems()
method, which returns the OptionChainItem
object, where com.tigerbrokers.stock.openapi.client.https.domain.option.item.OptionChainItem
properties are as follows:
name | type | description |
---|---|---|
symbol | string | underlying stock code |
expiry | long | option expiration date |
items | List<OptionRealTimeQuoteGroup> | list, including OptionRealTimeQuoteGroup objects, saving option chain data, see below for description |
OptionRealTimeQuoteGroup
object structure:
name | type | description |
---|---|---|
put | OptionRealTimeQuote | put option contract |
call | OptionRealTimeQuote | Call option contract |
OptionRealTimeQuote
object structure:
name | type | description |
---|---|---|
identifier | string | option identifier, such as: AAPL 210115C00095000 |
strike | double | strike price |
right | string | option direction PUT/CALL |
askPrice | double | ask price |
askSize | int | ask size |
bidPrice | double | bid price |
bidSize | int | number of bids |
lastTimestamp | long | The latest transaction time such as: 1543343800698 |
latestPrice | double | latest price |
multiplier | double | multiplier, US stock options default 100 |
openInterest | int | open interest |
preClose | double | The closing price of the previous trading day |
volume | long | volume |
impliedVol | double | implied volatility |
delta | double | delta |
gamma | double | gamma |
theta | double | theta |
vega | double | vega |
rho | double | rho |
Specific fields can be accessed through the get method of the object, such as getSymbol()
, or converted to a string by the toString()
method of the object example
OptionChainModel basicModel = new OptionChainModel("AAPL", "2023-06-30");
OptionChainFilterModel filterModel = new OptionChainFilterModel()
.inTheMoney(true)
.impliedVolatility(0.1537, 0.8282)
.openInterest(10, 50000)
.greeks(new OptionChainFilterModel.Greeks()
.delta(-0.8, 0.6)
.gamma(0.024, 0.30)
.vega(0.019, 0.343)
.theta(-0.1, 0.1)
.rho(-0.096, 0.101)
);
OptionChainResponse response = client.execute(OptionChainQueryV3Request.of(basicModel, filterModel).setReturnGreekValue(Boolean.FALSE));
if (response.isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
System.out.println("response error:" + response.getMessage());
}
response
{
"code":0,
"data":[
{
"expiry":1688097600000,
"items":[
{
"call":{
"askPrice": 15.55,
"askSize": 1,
"bidPrice": 15.45,
"bidSize": 31,
"delta":0.586154,
"gamma":0.0267244,
"identifier":"AAPL 230630C00170000",
"impliedVol":0.269788,
"latestPrice":7.4,
"multiplier":100,
"openInterest":844,
"preClose":6.45,
"rho":0.0922716,
"right":"call",
"strike":"170.0",
"theta":-0.0906834,
"vega":0.210679,
"volume":0
}
},
{
"call":{
"askPrice": 10.6,
"askSize": 91,
"bidPrice": 10.5,
"bidSize": 31,
"delta":0.441268,
"gamma":0.0301519,
"identifier":"AAPL 230630C00175000",
"impliedVol":0.242371,
"latestPrice":4.35,
"multiplier":100,
"openInterest":1312,
"preClose":3.6,
"rho":0.070743,
"right":"call",
"strike":"175.0",
"theta":-0.0812508,
"vega":0.214568,
"volume":0
}
},
{
"call":{
"askPrice": 5.75,
"askSize": 42,
"bidPrice": 5.65,
"bidSize": 31,
"delta":0.282778,
"gamma":0.0283256,
"identifier":"AAPL 230630C00180000",
"impliedVol":0.221261,
"latestPrice":2.01,
"multiplier":100,
"openInterest":3402,
"preClose":1.65,
"rho":0.0460161,
"right":"call",
"strike":"180.0",
"theta":-0.062506,
"vega":0.187295,
"volume":0
}
}
],
"symbol":"AAPL"
}
],
"message":"success",
"sign":"WAmfDX0fBA+PNVeLcrq8aB/p8OTJL9ATbwlLkRpL0KSyT60cYK8WePucYaaem17E7j3v/fsW4RSYm3xFGkGDcelLTCORZonA3jmbeGB9QY10sFuY02rhUUTivxxE4QYYv+ujC3EMF+aBfuDJjvjqXqlvcYE01HY48FhoTH1pfi8=",
"success":true,
"timestamp":1687856340521
}
Get option market summary
Corresponding request class: OptionBriefQueryRequest
description
Get Options Quote Summary.The parameter batch limit is 30
parameter
parameter | type | required | description |
---|---|---|---|
symbol | string | yes | stock code |
right | string | yes | Long or short (CALL/PUT) |
expiry | long | yes | expiry time (the value in milliseconds corresponding to 0:00 of New York time in the United States) |
strike | string | yes | strike price |
return
com.tigerbrokers.stock.openapi.client.https.request.option.OptionBriefResponse
[source](https://github.com/tigerfintech/openapi-java-sdk/blob/master/src/main/java/com /tigerbrokers/stock/openapi/client/https/response/option/OptionBriefResponse.java)
The structure is as follows:
public class OptionBriefResponse extends TigerResponse {
@JSONField(name = "data")
private List<OptionBriefItem> optionBriefItems;
}
The returned data can be accessed through the TigerResponse.getOptionBriefItems()
method, which returns an OptionBriefItem
object, where the properties of com.tigerbrokers.stock.openapi.client.https.domain.option.item.OptionBriefItem
are as follows:
field | type | description |
---|---|---|
symbol | string | stock code |
strike | string | strike price |
bidPrice | double | bid price |
bidSize | int | number of bids |
askPrice | double | ask price |
askSize | int | ask size |
latestPrice | double | latest price |
timestamp | long | latest transaction time |
volume | int | volume |
high | double | highest price |
low | double | lowest price |
open | double | opening price |
preClose | double | The closing price of the previous trading day |
openInterest | int | open interest |
change | double | change amount |
multiplier | int | multiplier, US stock options default 100 |
ratesBonds | double | One-year U.S. Treasury bond rate, updated once a day, such as: 0.0078 means the actual interest rate is: 0.78% |
right | string | direction (PUT/CALL) |
volatility | string | historical volatility |
expiry | long | expiry time (milliseconds, 0:00 of the day) |
Specific fields can be accessed through the get method of the object, such as getSymbol()
, or converted to a string by the toString()
method of the object
example
OptionCommonModel model = new OptionCommonModel();
model.setSymbol("AAPL");
model.setRight("CALL");
model.setStrike("160.0");
model.setExpiry("2021-12-03");
OptionBriefResponse response = client. execute(OptionBriefQueryRequest. of(model));
if (response. isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
System.out.println("response error:" + response.getMessage());
}
response
{
"code": 0,
"data": [{
"askPrice": 1.53,
"askSize": 128,
"bidPrice": 1.32,
"bidSize": 1,
"change": -2.52,
"expiry": 1638507600000,
"high": 3.12,
"identifier": "AAPL 211203C00160000",
"latestPrice": 1.35,
"low": 1.25,
"multiplier": 100,
"open": 2.74,
"openInterest": 79355,
"preClose": 3.87,
"ratesBonds": 0.002,
"right": "call",
"strike": "160.0",
"symbol": "AAPL",
"timestamp": 1637949599936,
"volatility": "20.43%",
"volume": 113452
}],
"message": "",
"timestamp": 1543831981533
}
Get option K-line
Corresponding request class: OptionKlineQueryRequest
description
Get option candlestick.The parameter batch limit is 30
parameter
parameter | type | required | description |
---|---|---|---|
symbol | string | yes | stock code |
right | string | yes | Long or short (CALL/PUT) |
expiry | long | yes | expiry time (the value in milliseconds corresponding to 0:00 of New York time in the United States) |
strike | string | yes | strike price |
begin_time | long | yes | start time (the millisecond value corresponding to NewYork time in the United States) |
end_time | long | yes | end time (the millisecond value corresponding to NewYork time in the United States) |
period | string | no | K line type, value range (day: day K, 1min: 1 minute, 5min: 5 minutes, 30min: 30 minutes, 60min: 60 minutes) |
limit | int | no | The minute line returns the number of recent records, the default is 300, and the maximum is 1200. If the limit setting is greater than 1200, only 1200 pieces of data will be returned. The daily K-line is not currently supported |
sort_dir | string | no | Sort Direction, include SortDir_Ascend and SortDir_Descend, enum:sort direction |
return
com.tigerbrokers.stock.openapi.client.https.domain.option.item.OptionKlineResponse
[source](https://github.com/tigerfintech/openapi-java-sdk/blob/master/src/main/java /com/tigerbrokers/stock/openapi/client/https/response/option/OptionKlineResponse.java)
The structure is as follows:
public class OptionKlineResponse extends TigerResponse {
@JSONField(name = "data")
private List<OptionKlineItem> klineItems;
}
The returned data can be accessed through the OptionKlineResponse.getKlineItems()
method, which returns the OptionKlineItem
object, where com.tigerbrokers.stock.openapi.client.https.domain.option.item.OptionKlineItem
properties are as follows:
name | type | description |
---|---|---|
symbol | string | stock code |
period | string | period type |
right | string | Look long or short, value CALL/PUT |
strike | string | strike price |
expiry | long | expiry time, milliseconds |
items | List<OptionKlinePoint> | Contains the List of OptionKlinePoint, OptionKlinePoint is an array of k-lines, the specific data contained in it is shown below |
OptionKlinePoint object properties are as follows:
name | type | description |
---|---|---|
high | double | highest price |
low | double | lowest price |
open | double | opening price |
close | double | closing price |
time | long | k-line time |
volume | int | volume |
openInterest | int | open interest (only daily K-line has value) |
Specific fields can be accessed through the get method of the object, such as getSymbol()
, or converted to a string by the toString()
method of the object
example
OptionKlineModel model = new OptionKlineModel();
model.setSymbol("AAPL");
model.setRight("PUT");
model.setStrike("150.0");
model.setExpiry("2023-04-14", TimeZoneId.NewYork);
model.setBeginTime("2023-03-21", TimeZoneId.NewYork);
model.setEndTime("2023-03-24", TimeZoneId.NewYork);
model.setPeriod(OptionKType.min60.getValue());
OptionKlineResponse response = client.execute(OptionKlineQueryRequest.of(model));
if (response. isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
System.out.println("response error:" + response.getMessage());
}
response
{"code":0,"data":[{"expiry":1681444800000,"items":[{"close":2.0,"high":2.0,"low":2.0,"open":2.0," time":1679340600000,"volume":0},{"close":1.86,"high":1.95,"low":1.66,"open":1.8,"time":1679405400000,"volume":183}, {"close":1.76,"high":2.02,"low":1.74,"open":1.87,"time":1679409000000,"volume":104},{"close":1.68,"high":1.88 ,"low":1.67,"open":1.76,"time":1679412600000,"volume":43},{"close":1.53,"high":1.73,"low":1.48,"open":1.68 ,"time":1679416200000,"volume":175},{"close":1.52,"high":1.53,"low":1.44,"open":1.48,"time":1679419800000,"volume":276 },{"close":1.47,"high":1.52,"low":1.41,"open":1.52,"time":1679423400000,"volume":21},{"close":1.35,"high" :1.47,"low":1.34,"open":1.47,"time":1679427000000,"volume":119},{"close":1.15,"high":1.35,"low":1.15,"open" :1.35,"time":1679491800000,"volume":148},{"close":1.15,"high":1.17,"low":1.12,"open":1.14,"time":1679495400000,"volume" :93},{"close":1.23,"high":1.27,"low":1.1,"open":1.13,"time":1679499000000,"volume":62},{"close":1.25," high":1.29,"low":1.23,"open":1.23,"time":1679502600000,"volume":33},{"close":1.02,"high":1.25,"low":0.96," open":1.25,"time":1679506200000,"volume":323},{"close":1.12,"high":1.36,"low":0.85,"open":1.02,"time":1679509800000," volume":180},{"close":1.6,"high":1.6,"low":1.12,"open":1.12,"time":1679513400000,"volume":86},{"close":1.06 ,"high":1.35,"low":1.06,"open":1.33,"time":1679578200000,"volume":75},{"close":1.02,"high":1.08,"low":0.9 ,"open":1.08,"time":1679581800000,"volume":127},{"close":1.04,"high":1.05,"low":0.99,"open":1.02,"time":1679585400000 ,"volume":71},{"close":1.22,"high":1.22,"low":1.01,"open":1.04,"time":1679589000000,"volume":96},{"close" :1.48,"high":1.48,"low":1.17,"open":1.22,"time":1679592600000,"volume":33},{"close":1.61,"high":1.8,"low" :1.37,"open":1.5,"time":1679596200000,"volume":255},{"close":1.6,"high":1.61,"low":1.6,"open":1.61,"time" :1679599800000,"volume":8}],"period":"60min","right":"PUT","strike":"150.0","symbol":"AAPL"}],"message":" success","sign":"BPH1fQ5kt/N2SVuUa2FA+/bsvRzBtZySgefqJ3CdZe51Dyfrllg/9lPhNC9gXcEZidogIMJ7Bu5gYFyPqcfmW9xx0PtWzRxn53LC6hj1z5m0JvLVB9cBUM2S8Q92o 3WWhFR+c8qrvQ0xzh8sRPJSHZIHqNWK0umjFSqy3Y1wvBo=","success":true,"timestamp":1679886982705}
Obtain option transaction by transaction
Corresponding request class: OptionTradeTickQueryRequest
illustrate
Obtain tick-by-tick transaction data of options.The parameter batch limit is 30
parameter
parameter | type | required | description |
---|---|---|---|
symbol | string | yes | stock code |
right | string | yes | Look long or short (call/put) |
expiry | long | yes | expiry time (the value in milliseconds corresponding to 0:00 of New York time in the United States) |
strike | string | yes | strike price |
return
com.tigerbrokers.stock.openapi.client.https.response.option.OptionTradeTickResponse
[source](https://github.com/tigerfintech/openapi-java-sdk/blob/master/src/main/java/com /tigerbrokers/stock/openapi/client/https/response/option/OptionTradeTickResponse.java)
The structure is as follows:
public class OptionTradeTickResponse extends TigerResponse {
@JSONField(name = "data")
private List<OptionTradeTickItem> optionTradeTickItems;
}
Half an hour before the market opens, you can get all the data of the previous trading day, and after the market opens, you can get the data of the new day.
The returned data can be accessed through the OptionTradeTickResponse.getOptionTradeTickItems()
method, which returns a list of OptionTradeTickItem
objects, where com.tigerbrokers.stock.openapi.client.https.domain.option.item.OptionTradeTickItem
properties are as follows:
name | type | description |
---|---|---|
symbol | string | underlying stock code |
expiry | long | expiry time |
strike | string | strike price |
right | string | PUT or CALL |
items | List<TradeTickPoint> | TradeTickPoint object list, each TradeTickPoint object corresponds to a single transaction data |
The TradeTickPoint object structure is as follows:
name | type | description |
---|---|---|
price | double | transaction price |
time | long | transaction time |
volume | long | volume |
Specific fields can be accessed through the get method of the object, such as getSymbol()
, or converted to a string by the toString()
method of the object
example
List<OptionCommonModel> modelList = new ArrayList<>();
OptionCommonModel model1 = new OptionCommonModel();
model1.setSymbol("AAPL");
model1.setRight("PUT");
model1.setStrike("185.0");
model1.setExpiry("2024-03-08", TimeZoneId.NewYork);
modelList.add(model1);
OptionCommonModel model2 = new OptionCommonModel();
model2.setSymbol("AAPL");
model2.setRight("CALL");
model2.setStrike("185.0");
model2.setExpiry("2024-03-08", TimeZoneId.NewYork);
modelList.add(model2);
OptionTradeTickResponse response = client.execute(OptionTradeTickQueryRequest.of(modelList));
if (response. isSuccess()) {
System.out.println(JSONObject.toJSONString(response);
} else {
System.out.println("response error:" + response.getMessage());
}
response
{
"code": 0,
"data": [{
"expiry": 1709874000000,
"items": [{
"price": 2.63,
"time": 1708698601086,
"volume": 4
}, {
"price": 2.62,
"time": 1708698602594,
"volume": 6
}, {
"price": 2.73,
"time": 1708698606317,
"volume": 4
}, {
"price": 2.72,
"time": 1708698607576,
"volume": 38
}, {
"price": 2.72,
"time": 1708698610488,
"volume": 7
}],
"right": "put",
"strike": "185.0",
"symbol": "AAPL"
}, {
"expiry": 1709874000000,
"items": [{
"price": 2.98,
"time": 1708698600473,
"volume": 1
}, {
"price": 2.98,
"time": 1708698601051,
"volume": 5
}, {
"price": 2.98,
"time": 1708698601051,
"volume": 23
}, {
"price": 2.98,
"time": 1708698601051,
"volume": 5
}, {
"price": 2.99,
"time": 1708698601051,
"volume": 11
}],
"right": "call",
"strike": "185.0",
"symbol": "AAPL"
}],
"message": "success",
"success": true,
"timestamp": 1708918385248
}
Option indicator calculation
description
Calculation of various indicators for selected options
parameter
Parameter | Type | Required | Description |
---|---|---|---|
client | object | yes | SDK Htttp client |
symbol | string | yes | stock code |
right | string | yes | Long or short (CALL/PUT) |
strike | string | yes | strike price |
expiry | long | yes | expiry time (the value in milliseconds corresponding to 0:00 of New York time in the United States) |
underlyingSymbol | string | no | underlying symbol(if null or empty, defaults to the same value as 'symbol') |
return
name | type | description |
---|---|---|
delta | double | Greek letter delta |
gamma | double | Greek letter gamma |
theta | double | Greek letter theta |
vega | double | Greek letter vega |
insideValue | double | Intrinsic value |
timeValue | double | time value |
leverage | double | leverage |
openInterest | int | open interest |
historyVolatility | double | historical volatility, a percentage value |
premiumRate | double | premium rate, percentage value |
profitRate | double | Buy profit rate, percentage value |
volatility | double | implied volatility, a percentage value |
example
OptionFundamentals optionFundamentals = OptionCalcUtils.getOptionFundamentals(client,"BABA", "CALL", "205.0", "2019-11-01");
System.out.println(JSONObject.toJSONString(optionFundamentals));
response
{
"delta": 0.8573062699731591,
"gamma": 0.05151538284065261,
"historyVolatility": 24.38, //percentage format, expressed as 24.38%
"insideValue": 4.550000000000011,
"leverage": 30.695960907449216,
"openInterest": 35417.0,
"premiumRate": 0.18619306788885054, //percentage format, expressed as 0.186%
"profitRate": 47.138051059662665, //percentage format, expressed as 47.138%
"rho": 1.1107261502375654,
"theta": -0.17927469728943862,
"timeValue": 0.32499999999998863,
"vega": 0.034473845504081974,
"volatility": 28.62548828125 //percentage format, expressed as 28.62%
}