General

Set the Current Market Data Device

Request class: TigerHttpRequest(MethodName.GRAB_QUOTE_PERMISSION)

Description

When the same account is used on multiple devices, market data is available only on the active device. Call this endpoint to claim market data device access and make the current device active. You do not need to call it when you continue using the same device.

By default, the SDK claims market data device access once at startup. To disable this behavior, set isAutoGrabPermission = false before obtaining the TigerHttpClient instance.

ClientConfig.DEFAULT_CONFIG.isAutoGrabPermission = false;
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(ClientConfig.DEFAULT_CONFIG);

Parameters

None

Response

Field NameTypeDescription
namestringMarket data permission name; see the values below
expireAtlongExpiration time in timestamp format, -1 indicates unlimited

Market data permission values for the name field:

name Field ValueDescription
usQuoteBasicUS Stock L1 market data access
usStockQuoteLv2TotalviewUS Stock L2 market data access
hkStockQuoteLv2HK Stock L2 market data access for mainland users
hkStockQuoteLv2GlobalHK Stock L2 market data access for non-mainland users
usOptionQuoteUS Option L1 market data access
CBOEFuturesQuoteLv2Chicago Board Options Exchange L2 market data access
HKEXFuturesQuoteLv2Hong Kong Futures Exchange L2 market data access
SGXFuturesQuoteLv2Singapore Exchange L2 market data access
OSEFuturesQuoteLv2Osaka Exchange L2 market data access

Example

TigerHttpRequest request = new TigerHttpRequest(MethodName.GRAB_QUOTE_PERMISSION);
String bizContent = AccountParamBuilder.instance()
        .buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);

Example Response

{
  "code": 0,
  "message": "success",
  "timestamp": 1525938835697,
  "data": [
    {
      "name": "usQuoteBasic",
      "expireAt": 1621931026000
    }
  ]
}

Rate Limit

The base rate limit is 10 requests/min.


Query Market Data Permissions

Request class: TigerHttpRequest(MethodName.GET_QUOTE_PERMISSION)

Description

Query the account's current market data permissions.

If the requesting device does not hold market data device access, the endpoint returns an empty list.

Parameters

None

Response

Field NameTypeDescription
namestringMarket data permission name
expireAtlongExpiration 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);

Example Response

{
  "code": 0,
  "message": "success",
  "timestamp": 1651734899995,
  "data": [
    {
      "name": "usStockQuote",
      "expireAt": 1698767999000
    },
    {
      "name": "usStockQuoteLv2Arca",
      "expireAt": 1698767999000
    },
    {
      "name": "usStockQuoteLv2Totalview",
      "expireAt": 1698767999000
    },
    {
      "name": "hkStockQuoteLv2",
      "expireAt": 1698767999000
    },
    {
      "name": "usOptionQuote",
      "expireAt": 1698767999000
    },
    {
      "name": "hkStockQuoteLv2",
      "expireAt": -1
    }
  ]
}

Rate Limit

The base rate limit is 10 requests/min.


Refresh Token

Request class: UserTokenRefreshRequest

Description

Only Hong Kong license TBHK needs to use Token (user license can be viewed by logging into the developer information page).

The refresh-token API accepts only a valid local token. If the token has expired, refresh it on the developer information registration page and export it to the local tiger_openapi_token.properties file before use.
After successful refresh, the local tiger_openapi_token.properties file will be updated simultaneously, and the Token value in the memory ClientConfig will be updated. You can configure the automatic refresh cycle days (refreshTokenIntervalDays) and specific time (refreshTokenTime). If you need to refresh the Token manually, please configure ClientConfig.DEFAULT_CONFIG.isAutoRefreshToken = false and refresh the Token manually.
Token validity period is 15 days, SDK does not refresh by default.

Parameters

None, the SDK will automatically add the Token to the Http request header Authorization for each request, and the server will validate the Token.

Response

Field NameTypeDescription
tigerIdstringtigerId
licensestringLicense info
tokenstringToken string
createTimelongCreation time
expiredTimelongExpiration time

Example

    UserTokenRefreshRequest request = new UserTokenRefreshRequest();
    UserTokenResponse response = TigerHttpClient.getInstance().execute(request);
    if (response.isSuccess()) {
      System.out.println(JSONObject.toJSONString(response));
      List<RefreshTokenCallback> callbackList = TokenManager.getInstance().getCallbackList();
      for (RefreshTokenCallback callback : callbackList) {
        try {
          System.out.println(callback.getClass() + " tokenChange() is called");
          callback.tokenChange(ClientConfig.DEFAULT_CONFIG,
              ClientConfig.DEFAULT_CONFIG.token,
              response.getUserToken());
        } catch (Throwable th) {
          th.printStackTrace();
        }
      }
    } else {
      System.out.println("response error:" + response.getMessage());
    }

Example Response

{
    "code":0,
    "data":{
        "createTime":1676547570673,
        "expiredTime":1677152370673,
        "license":"TBHK",
        "tigerId":"YOUR_TIGER_ID",
        "token":"MTY3NjU0NzU3MDY3MywxNjc3MTUyMzcwNjczCJ/FLxjALbWg0cVW3R4bHg=="
    },
    "message":"success",
    "sign":"Yufg4/bYSeuvZz3b+7MsSAde+lgUCNJskle1zbOSxta66b9h0LjfZAmHNpx1tz4HnPK1AGfS9cdNaC964ts7Uakvr/kKzFEN3y5CfB8UgRsPKSR75z1GwSFq5v6gc/1hEAdrFdcHTmRbHhT362E5GYEuvvlfwIEX60/GYveSHIo=",
    "success":true,
    "timestamp":1676547570681
}

Rate Limit

The base rate limit is 10 requests/min.


Historical Market Data Quota

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

ParameterTypeRequiredDescription
with_detailsboolNoWhether to return requested symbol details, default false

Response

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:

FieldTypeDescription
usedintNumber of symbols used
remainintNumber of symbols remaining
methodStringQuota category: kline (stock bars), future_kline (futures bars), or option_kline (option bars)
detailsList<String>Used symbol codes; populated only when with_details=true
symbolDetailsList<SymbolDetail>Used symbols and their last request times; populated only when with_details=true

SymbolDetail type:

FieldTypeDescription
codestringStock symbol
lastRequestTimestampstringUnix timestamp in milliseconds for the last request, represented as a 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());
}

Example Response

{
  "code": 0,
  "message": "success",
  "timestamp": 1750851389623,
  "sign": "myCpSB+GFgzlgOMnyIyD6yXib0m5LjKvRq+gT3sARfX4Z6AgNib/s0mpVniQs+H85yP1GlLHmAE/pCCKPNvGKyITynUiPWAIippg/o3Z4W//KlA868LaukA0Y+3fmqB4pnDQgoMH4zdcKEGgYS6X6bTPDCPTWCDAk43rXGJW94g=",
  "quotaItems": [
    {
      "remain": 200,
      "used": 0,
      "method": "kline",
      "details": [],
      "symbolDetails": []
    },
    {
      "remain": 20,
      "used": 0,
      "method": "future_kline",
      "details": [],
      "symbolDetails": []
    },
    {
      "remain": 197,
      "used": 3,
      "method": "option_kline",
      "details": [
        "TCH.HK",
        "ALB.HK",
        "LNI.HK"
      ],
      "symbolDetails": [
        {
          "code": "TCH.HK",
          "lastRequestTimestamp": "1750851341848"
        },
        {
          "code": "ALB.HK",
          "lastRequestTimestamp": "1750851341848"
        },
        {
          "code": "LNI.HK",
          "lastRequestTimestamp": "1750851341848"
        }
      ]
    }
  ],
  "success": true
}

Rate Limit

The base rate limit is 10 requests/min.


Did this page help you?