General
Market Data Permission Grabbing
Corresponding request class: TigerHttpRequest(MethodName.GRAB_QUOTE_PERMISSION)
Description
When the same account is used on multiple devices simultaneously, market data is only returned on the primary device. To view market data on other devices, you need to execute "grab quote permission" to set the current device as the primary device. If you don't switch devices, this operation is not required.
By default, grab quote permission is executed once at startup. If you need to configure not to execute grab permission at startup, you can configure isAutoGrabPermission = false before getting the TigerHttpClient instance.
ClientConfig.DEFAULT_CONFIG.isAutoGrabPermission = false;
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(ClientConfig.DEFAULT_CONFIG);Parameters
None
Returns
| Field Name | Type | Description |
|---|---|---|
| name | string | Permission name, see below for specific permission values |
| expireAt | long | Expiration time in timestamp format, -1 indicates unlimited |
Permission name enumeration values for the name field:
| Name Field Value | Description |
|---|---|
| usQuoteBasic | US Stock L1 market data permission |
| usStockQuoteLv2Totalview | US Stock L2 market data permission |
| usOptionQuote | US Option L1 market data permission |
Example
TigerHttpRequest request = new TigerHttpRequest(MethodName.GRAB_QUOTE_PERMISSION);
String bizContent = AccountParamBuilder.instance()
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);Return Example
{
"code": 0,
"message": "success",
"timestamp": 1525938835697,
"data": [
{
"name": "usQuoteBasic",
"expireAt": 1621931026000
}
]
}Query Market Data Permissions
Corresponding request class: TigerHttpRequest(MethodName.GET_QUOTE_PERMISSION)
Description
Query the currently owned market data permissions.
Parameters
None
Returns
| Field Name | Type | Description |
|---|---|---|
| name | string | Permission name |
| expireAt | long | Expiration time in timestamp format, -1 indicates unlimited |
Example
TigerHttpRequest request = new TigerHttpRequest(MethodName.GET_QUOTE_PERMISSION);
String bizContent = AccountParamBuilder.instance()
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);Return Example
{
"code": 0,
"message": "success",
"timestamp": 1651734899995,
"data": [
{
"name": "usStockQuote",
"expireAt": 1698767999000
},
{
"name": "usStockQuoteLv2Arca",
"expireAt": 1698767999000
},
{
"name": "usStockQuoteLv2Totalview",
"expireAt": 1698767999000
},
{
"name": "usOptionQuote",
"expireAt": 1698767999000
}
]
}Historical Market Data Quota
Corresponding request class: KlineQuotaRequest
Description
Based on user level, count the number of symbols that the user has used and remaining available for subscription (different options of the same stock only occupy one symbol, other rules can refer to Historical Quote Limits & Subscription Limits)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| with_details | bool | No | Whether to return requested symbol details, default false |
Returns
com.tigerbrokers.stock.openapi.client.https.response.quote.KlineQuotaResponsesource
Return data can be accessed through KlineQuotaResponse.getQuotaItems() method, returning a list of QuotaItem objects, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.QuotaItem properties are:
| Field | Type | Description |
|---|---|---|
| used | int | Used quantity |
| remain | int | Remaining quantity |
| method | String | API interface name (kline: stock K-line; future_kline; option_kline: option K-line;) |
| symbolDetails | List<SymbolDetail> | List of used symbols, including the last fetch time for each symbol |
SymbolDetail type:
| Field | Type | Description |
|---|---|---|
| code | string | Stock code |
| lastRequestTimestamp | string | Last fetch time string |
Example
KlineQuotaRequest request = KlineQuotaRequest.newRequest(Boolean.TRUE);
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
KlineQuotaResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(JSONObject.toJSON(response));
} else {
System.out.println("response error:" + response.getMessage());
}Return Example
{
"code": 0,
"message": "success",
"timestamp": 1750851389623,
"sign": "myCpSB+GFgzlgOMnyIyD6yXib0m5LjKvRq+gT3sARfX4Z6AgNib/s0mpVniQs+H85yP1GlLHmAE/pCCKPNvGKyITynUiPWAIippg/o3Z4W//KlA868LaukA0Y+3fmqB4pnDQgoMH4zdcKEGgYS6X6bTPDCPTWCDAk43rXGJW94g=",
"quotaItems": [
{
"remain": 200,
"used": 0,
"method": "kline",
"symbolDetails": []
},
{
"remain": 20,
"used": 0,
"method": "future_kline",
"symbolDetails": []
},
{
"remain": 197,
"used": 3,
"method": "option_kline",
"symbolDetails": [
{
"code": "XYZ",
"lastRequestTimestamp": "1750851341848"
},
{
"code": "YZX",
"lastRequestTimestamp": "1750851341848"
},
{
"code": "ZXY",
"lastRequestTimestamp": "1750851341848"
}
]
}
],
"success": true
}Updated 7 days ago