Stocks

About 19 min

Get Market Status

Request: QuoteMarketRequest

Description

Get the market status of a queried market, and get the most recent open time of this market

Parameters

ParameterTypeRequiredDescription
marketMarketYesUS-U.S. Stocks,HK-Hongkong Stocks,CN-A-Shares, ALL-all markets
langLanguageNoLanguage: zh_CN,zh_TW,en_US, By default: en_US

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteMarketResponsesourceopen in new window

Structured as follows:

public class QuoteMarketResponse extends TigerResponse {
  @JSONField(
    name = "data"
  )
  private List<MarketItem> marketItems;
}

Use QuoteMarketResponse.getMarketItems(), actual data returned is a list of marketItem. com.tigerbrokers.stock.openapi.client.https.domain.quote.item.MarketItem has the following attributes:

NameTypeDescription
marketStringname of the Market being queried(US, CN, HK, etc.)
marketStatusStringMarket Status, not a constant. This information includes holidays
statusStringMarket Status, NOT_YET_OPEN,PRE_HOUR_TRADING, TRADING,MIDDLE_CLOSE,POST_HOUR_TRADING, CLOSING,EARLY_CLOSED, MARKET_CLOSED
openTimeStringMost recent future open time MM-dd HH:mm:ss

Use get() method of MarketItem, in this case, getMarket(), to acess the data. or use toString() to convert the data to a string

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
    ClientConfig.DEFAULT_CONFIG);
QuoteMarketResponse response = client.execute(QuoteMarketRequest.newRequest(Market.US));
if (response.isSuccess()) {
  System.out.println(Arrays.toString(response.getMarketItems().toArray()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
  "code": 0,
  "message": "success",
  "timestamp": 1525938835697,
  "data": [{"market":"US","marketStatus":"Closed Independence Day","status":"CLOSING","openTime":"07-04 09:30:00 EDT"}]
}

Get Trading Calendar

Request: QuoteTradeCalendarRequest

Description

The trading day is obtained by excluding weekends and holidays from the natural day and does not exclude temporary market closures

Parameters

ParameterTypeRequiredDescription
marketMarketYesfilter by market, you can use the enums defined in Market, such as Market.US, Market.HK, Market.CN
begin_dateStringNobegin date of calendar,include this day. format yyyy-MM-dd, like '2022-06-01'
end_dateStringNoend date of calendar,exclude this day. format yyyy-MM-dd

begin_date and end_date parameters description:

begin_date providedend_date providedDate Range Result
yesyes(begin_date, end_date)
yesno(begin_date, begin_date+365)
noyes(end_date-365,end_date)
nono(Today, Today + 30)

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteTradeCalendarResponsesourceopen in new window

Structured as follows:

public class QuoteTradeCalendarResponse extends TigerResponse {

  @JSONField(name = "data")
  private List<TradeCalendar> items;
}

Use QuoteTradeCalendarResponse.getItems(), actual data returned is a list of TradeCalendar. com.tigerbrokers.stock.openapi.client.https.domain.quote.item.TradeCalendar has the following attributes:

NameTypeDescription
dateStringtrade day date
typeStringtrade day type. TRADING: whole day trading; EARLY_CLOSE: close market early

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
QuoteTradeCalendarRequest request = QuoteTradeCalendarRequest.newRequest(
        Market.US, "2022-06-01", "2022-06-30");
QuoteTradeCalendarResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(Arrays.toString(response.getItems().toArray()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
    "code":0,
    "message":"success",
    "timestamp":1655968809209,
    "data":[{"date":"2022-06-01","type":"TRADING"},{"date":"2022-06-02","type":"TRADING"},{"date":"2022-06-03","type":"TRADING"},{"date":"2022-06-06","type":"TRADING"},{"date":"2022-06-07","type":"TRADING"},{"date":"2022-06-08","type":"TRADING"},{"date":"2022-06-09","type":"TRADING"},{"date":"2022-06-10","type":"TRADING"},{"date":"2022-06-13","type":"TRADING"},{"date":"2022-06-14","type":"TRADING"},{"date":"2022-06-15","type":"TRADING"},{"date":"2022-06-16","type":"TRADING"},{"date":"2022-06-17","type":"TRADING"},{"date":"2022-06-21","type":"TRADING"},{"date":"2022-06-22","type":"TRADING"},{"date":"2022-06-23","type":"TRADING"},{"date":"2022-06-24","type":"TRADING"},{"date":"2022-06-27","type":"TRADING"},{"date":"2022-06-28","type":"TRADING"},{"date":"2022-06-29","type":"TRADING"}],
    "sign":"QEHsOPx7JSp5VZ3eYatbTLXy7wK7RIgWMqQfqEuEog+tQ12ThnucHPoXpcFj8wgwUU77KhLDL6KVgNBPC/D1GgXKPaWPo1E77d9Nabd9OYAwqNINP//GSuEd8ai7b32EQ4uWTrF3ycQh7g7Lb7f5nvqZypmFuaphFyTEoQfwKp8="
}

Get Symbol List

Request: QuoteSymbolRequest

Description

Get a list of all symbols filtered by market

Parameters

ParameterTypeRequiredDescription
marketMarketYesUS, HK, CN
langLanguageNoLanguage: zh_CN,zh_TW,en_US. en_US by default

Additional Methods

public QuoteSymbolRequest packageName(PackageName packageName) { //set package name
    getApiModel().setPackageName(packageName);
    return this;
  }
public QuoteSymbolRequest market(Market market) { //set market
  getApiModel().setMarket(market);
  return this;
}
public QuoteSymbolRequest includeOTC(Boolean includeOTC) { //if true, include OTC symbols, default: false
  getApiModel().setIncludeOTC(includeOTC);
  return this;
}

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteSymbolResponsesourceopen in new window

Structured as follows

public class QuoteSymbolResponse extends TigerResponse {

  @JSONField(name = "data")
  private List<String> symbols;
}

Use QuoteSymbolResponse.getSymbols() to get the data returned from the server. The result is a list that contains the stock symbols

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(ClientConfig.DEFAULT_CONFIG);
QuoteSymbolResponse response = client.execute(QuoteSymbolRequest.newRequest(Market.US).includeOTC(false));
if (response.isSuccess()) {
  System.out.println(Arrays.toString(response.getSymbols().toArray()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Return Example

{
  "code": 0,
  "message": "success",
  "timestamp": 1525938835697,
  "data": ["A", "A.W", "AA", "AA-B", "AAAP", "AABA", "AAC", "AADR", "AAIT", "AAL", "AALCP", "AAMC", "AAME"]
}

Get Symbols and Names

Request: QuoteSymbolNameRequest

Description

Get the ticker symbols and names of all securities in the selected market

Parameters

ParameterTypeRequiredDescription
marketMarketYesUS, HK, CN
langLanguageNoLanguage: zh_CN,zh_TW,en_US, en_US by default

Additional Methods

public QuoteSymbolRequest packageName(PackageName packageName) { //set package name
    getApiModel().setPackageName(packageName);
    return this;
  }
public QuoteSymbolRequest market(Market market) { //set market
  getApiModel().setMarket(market);
  return this;
}
public QuoteSymbolRequest includeOTC(Boolean includeOTC) { //if true, include OTC symbols, default: false
  getApiModel().setIncludeOTC(includeOTC);
  return this;
}

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteSymbolNameResponsesourceopen in new window

Structured as follows

public class QuoteSymbolNameResponse extends TigerResponse {

  @JSONField(name = "data")
  private List<SymbolNameItem> symbolNameItems;
}

Use QuoteSymbolNameResponse.getSymbolNameItems() to access the data. The return of this method is a list of SymbolNameItem objects, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.symbolNameItems has the following attributes:

NameTypeDescription
nameStringName
symbolStringSymbol

To access the data in SymbolNameItem object, one can use getName() method, or use toString() method to convert the data to a string

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(ClientConfig.DEFAULT_CONFIG);
QuoteSymbolNameResponse response = client.execute(QuoteSymbolNameRequest.newRequest(Market.US).includeOTC(false));
if (response.isSuccess()) {
  System.out.println(Arrays.toString(response.getSymbolNameItems().toArray()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
  "code": 0,
  "message": "success",
  "timestamp": 1525938835697,
  "data": [{"name":"CKH Holdings","symbol":"00001"},{"name":"CLP","symbol":"00002"}]
}

Get Delayed Data

Request: QuoteDelayRequest

Description

Get delayed market data for U.S. stocks. An active market data permission subscription is not required. This data is only available for U.S stocks. The data is delayed by 15 minutes

Parameters

ParameterTypeRequiredDescription
symbolsList<String>YesStock ticker symbols, U.S. stock only

Example

List<String> symbols = new ArrayList<>();
symbols.add("AAPL");
symbols.add("TSLA");
QuoteDelayRequest delayRequest = QuoteDelayRequest.newRequest(symbols);
QuoteDelayResponse response = client.execute(delayRequest);

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteDelayResponse sourceopen in new window

Structured as follows:

public class QuoteDelayResponse extends TigerResponse {

  @JSONField(name = "data")
  private List<QuoteDelayItem> quoteDelayItems;
  }

Use TigerResponse.getQuoteDelayItems() to access the data. This method will return a list of QuoteDelayItem objects, wherecom.tigerbrokers.stock.openapi.client.https.domain.quote.item.quoteDelayItem has the following attributes:

ParameterTypeDescription
symbolStringStock symbol
openDoubleOpening price
highDoubleHighest price
lowDoubleLowest price
closeDoubleClosing price
preCloseDoubleYesterday's closing price
haltedDoubleStock status (0: Normal 3: Suspended 4: Delisted 7: New Stock 8: Changed)
timeLongLast market time
volumeLongVolume traded today

Use the get method, such as getClose() , to access the data fields in QuoteDelayItem

Response Example

[
  {
    "close": 156.81,
    "halted": 0,
    "high": 160.45,
    "low": 156.36,
    "open": 159.565,
    "preClose": 161.94,
    "symbol": "AAPL",
    "time": 1637949600000,
    "volume": 76959752
  },
  {
    "close": 1081.92,
    "halted": 0,
    "high": 1108.7827,
    "low": 1081,
    "open": 1099.47,
    "preClose": 1116,
    "symbol": "TSLA",
    "time": 1637949600000,
    "volume": 11680890
  }
]

Get Timeline Data

Request: QuoteTimelineRequest

Description

Get timeline data

Parameters

ParameterTypeRequiredDescription
symbolsList<String>YesAn array of stock ticker symbols
begin_timeLongNoBegin time (timestamp in ms), default value is to return the data starting from today
trade_sessionTradeSessionNoTradeSession:PreMarket,Regular,AfterHours; Regular by default
timelineTypeTimeLineTypeNoperiod. 'day' or 'day5'
langLanguageNoLangauge: zh_CN,zh_TW,en_US. en_US by default

Additional Methods

public void setTradeSession(TradeSession tradeSession) {
    getApiModel().setTradeSession(tradeSession);
  }

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteTimelineResponsesourceopen in new window

structured as follows:

The returned data can be accessed with QuoteTimelineResponse.getTimelineItems(). This method will return a list of TimelineItem objects, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.TimelineItem has the following attributes:

NameTypeDescription
symbolStringTicker symbol of the stocks
periodStringperiod, day or 5day
preCloseDoubleclose price of the last trading day
intradayTimelineRangeintraday data, see below for contained data fields
preMarketTimelineRange(U.S. Stocks Only) pre-market data object
afterHoursTimelineRange(U.S. Stocks Only) after-market data object

Use corresponding get method, such as getSymbol() to access data in TimelineItem

TimelineRange:

NameType
itemsList<TimelinePoint>
beginTimeLong
endTimeLong

TimelinePoint:

NameDescription
priceLast price
avgPriceAverage price
timeStarting timestamp
volumeVolume

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(ClientConfig.DEFAULT_CONFIG);
QuoteTimelineResponse response = client.execute(QuoteTimelineRequest.newRequest(List.of("AAPL"), 1544129760000L));
if (response.isSuccess()) {
  System.out.println(Arrays.toString(response.getTimelineItems().toArray()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
  "code": 0,
  "data": [
    {
      "symbol": "AAPL",
      "preMarket": {
        "endTime": 1544106600000,
        "beginTime": 1544086800000,
        "items": [
           
        ]
      },
      "period": "day",
      "preClose": 176.69000244140625,
      "afterHours": {
        "endTime": 1544144400000,
        "beginTime": 1544130000000,
        "items": [
          {
            "volume": 872772,
            "avgPrice": 174.71916,
            "price": 174.69,
            "time": 1544130000000
          },
          {
            "volume": 3792,
            "avgPrice": 174.71893,
            "price": 174.66,
            "time": 1544130060000
          }
        ]
      },
      "intraday": [
        {
          "items": [
            {
              "volume": 201594,
              "avgPrice": 172.0327,
              "price": 174.34,
              "time": 1544129760000
            },
            {
              "volume": 139040,
              "avgPrice": 172.03645,
              "price": 174.4156,
              "time": 1544129820000
            },
            {
              "volume": 178427,
              "avgPrice": 172.0413,
              "price": 174.44,
              "time": 1544129880000
            },
            {
              "volume": 2969567,
              "avgPrice": 172.21619,
              "price": 174.72,
              "time": 1544129940000
            }
          ]
        }
      ]
    }
  ],
  "timestamp": 1544185099595,
  "message": "success"
}

Get Historical Timeline Data

Request: QuoteHistoryTimelineRequest

Description

Obtain historical time-sharing data of 1 minute

Parameter

ParameterTypeRequiredDescription
symbolsList<String>YesStock symbol list
dateString/LongNoyear, month, day yyyyMMdd, such as 20220420
zoneIdTimeZoneIdNoDescription of the timezone used
langLanguageNoLanguage used

Additional Methods

public QuoteHistoryTimelineRequest withRight(RightOption rightOption) {
    QuoteHistoryTimelineModel timelimeModel = (QuoteHistoryTimelineModel) apiModel;
    timelimeModel.setRight(rightOption);
    return this;
  }

public QuoteHistoryTimelineRequest withRight(RightOption rightOption) {
    QuoteHistoryTimelineModel timelimeModel = (QuoteHistoryTimelineModel) apiModel;
    timelimeModel.setRight(rightOption);
    return this;
  }

return

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteHistoryTimelineResponse [source](https://github.com/tigerfintech/openapi-java-sdk/blob/master/src/main/java/com /tigerbrokers/stock/openapi/client/https/response/quote/QuoteHistoryTimelineResponse.java)

The specific structure is as follows:

The returned data can be accessed through the QuoteHistoryTimelineResponse.getTimelineItems() method, which returns a List containing HistoryTimelineItem objects, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.HistoryTimelineItem properties are as follows:

FieldTypeDescription
symbolstringstock code
itemsTimelinePointIntraday time-sharing array, please refer to the description below for the fields

The specific fields of TimelineItem can be accessed through the get method of the object, such as getSymbol()

Time-sharing data items field TimelinePoint:

FieldDescription
volumeVolume
avgPriceaverage transaction price
priceLatest Price
timecurrent time-sharing time

example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
       ClientConfig.DEFAULT_CONFIG);
List<String> symbols = new ArrayList<>();
symbols.add("AAPL");
QuoteHistoryTimelineRequest request = QuoteHistoryTimelineRequest.newRequest(symbols, "20220420");
request.withRight(RightOption.br);
QuoteHistoryTimelineResponse response = client.execute(request);
if (response. isSuccess()) {
   System.out.println(Arrays.toString(response.getTimelineItems().toArray()));
} else {
   System.out.println("response error:" + response.getMessage());
}

Response

{
     "code": 0,
     "message": "success",
     "timestamp": 1651737871819,
     "data":[
         {
             "symbol": "AAPL",
             "items":[
                 {
                     "time": 1650461400000,
                     "volume": 1414143,
                     "price": 168.75,
                     "avgPrice": 168.66885
                 },
                 {
                     "time": 1650461460000,
                     "volume":392862,
                     "price": 168.25,
                     "avgPrice": 168.65086
                 },
                 // ....
                 {
                     "time": 1650484680000,
                     "volume": 443549,
                     "price": 167.24,
                     "avgPrice": 167.47902
                 },
                 {
                     "time": 1650484740000,
                     "volume":6457118,
                     "price": 167.23,
                     "avgPrice": 167.45808
                 }
             ]
         }
     ]
}

Get Realtime Quote

Request: QuoteRealTimeQuoteRequest

Description

Get real-time data for a stock/stocks. An active market quote permission is required.

Parameters

ParameterTypeRequiredDescription
symbolsList<String>Yeslist of stock ticker symbols (maximum 50 per request)
includeHourTradingbooleanNoWhether to include U.S. stocks before and after the market data, default: false
langLanguageNolanguage: zh_CN,zh_TW,en_US. en_US by default

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteRealTimeQuoteResponsesourceopen in new window

Use QuoteRealTimeQuoteResponse.getRealTimeQuoteItems() to access data. The method returns a RealTimeQuoteItem object,where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.RealTimeQuoteItem has the following attributes:

NameTypeDescription
symbolStringstock ticker symbol
openDoubleopening price
highDoublehigh price
lowDoublelow price
closeDoubleclose price
preCloseDoubleclose price of last trading day
latestPriceDoublelast price
latestTimeLonglatest trade time
askPriceDoubleask price
askSizeLongask size
bidPriceDoublebid price
bidSizeLongbid size
volumeLongvolume
statusStockStatus0: Normal, 3: Suspended, 4: Delisted, 7: New Stock, 8: Changed
hourTradingHourTradingU.S. stocks pre-market and post-market data(Response hourTrading only before and after the market time)

hourTrading has the following attributes:

NameTypeDescription
tagStringpre-market("Pre-Mkt")、post-market("Post-Mkt") tag
latestPriceDoublelast price
preCloseDoubleclose price of the last trading day
latestTimeStringlatest trade time
volumeLongtrading volume
timestampLonglatest trade time in timestamp(ms)

Use the get method, getTag() to access the actual data

Example

QuoteRealTimeQuoteResponse response = client.execute(QuoteRealTimeQuoteRequest.newRequest(List.of("AAPL"), true));
if (response.isSuccess()) {
  System.out.println(Arrays.toString(response.getRealTimeQuoteItems().toArray()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response

{
    "code":0,
    "data":[
        {
            "askPrice":174.8,
            "latestPrice":175.08,
            "symbol":"AAPL",
            "bidSize":200,
            "bidPrice":174.71,
            "volume":116803357,
            "high":175.96,
            "preClose":171.18,
            "low":170.7,
            "hourTrading":{
                "volume":3418089,
                "latestPrice":174.72,
                "preClose":175.08,
                "latestTime":"18:50 EST",
                "tag":"Post-Mkt",
                "timestamp":1639007439976
            },
            "latestTime":1638997200000,
            "close":175.08,
            "askSize":200,
            "open":172.125,
            "status":"NORMAL"
        }
    ],
    "success":true,
    "sign":"BxcUz9YfmWcnSsmQKLcnFnVpHAT5bDdX69YntqaVIVdVqMlhSaaaW8ur3yaWP6GB6NAec2ds6s1ZB/4X40kg8lHb6u6y2V0hvHE2Q3uDNgkoukmDcAetdwRo/MAiqtQRACFGAd/AOlyhDsJyuzTf7T14zDMl5cfOfbwe2+RDjgg=",
    "message":"success",
    "timestamp":1639007449806
}

Get Bars

Request: QuoteKlineRequest

Description

Get K-line (bar) Data, including different time periods, such as daily, weekly, minute, etc.

Argument

ArgumentTypeRequiredDescription
symbolsList<String>YesA list of symbols. Maximum 50 per request, 10 for A-Shares
kTypeKTypeYesK line period, possible values are: day, week, month, year, 1min, 3min, 5min, 15min, 30min, 60min, 120min, 240min
begin_timeLong/StringNoBegin time. Unix time stamp in millisecond or a date string. Example: 1639371600000, default value is -1, which means unbounded.
end_timeLong/StringNoEnd time. Unix time stamp in millisecond or a date string. Example: 1639371600000, default value is -1, which means unbounded.
zoneIdTimeZoneIdNoDescription of the timezone used

Additional Methods

public QuoteKlineRequest withLimit(int limit) {
    if (limit > 0) {
      getApiModel().setLimit(limit);
    }
    return this;
  }
  
public QuoteKlineRequest withRight(RightOption rightOption) {
    if (rightOption != null) {
      getApiModel().setRight(rightOption);
    }
    return this;
  }

public QuoteKlineRequest withRight(String rightOption) {
    if (rightOption != null) {
      getApiModel().setRight(rightOption);
    }
    return this;
  }
  
public void setTradeSession(TradeSession tradeSession) {
    getApiModel().setTradeSession(tradeSession);
  }
  
/**
   * set pageToken,only for single symbol
   * @param pageToken
   */
  public void withPageToken(String pageToken) {
    getApiModel().setPageToken(pageToken);
  }

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteKlineResponsesourceopen in new window

Use QuoteKlineResponse.getKlineItems() to access the data. This method returns a KlineItem object list, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.KlineItem has the following attributes :

NameTypeDescription
symbolStringSymbol
periodStringK-line period
nextPageTokenStringthe page token used for querying the next page, if there is no more data, return null
itemsList<KlinePoint>array that contains the KlinePoint object

KlinePoint have the following attributes:

NameTypeDescription
openDoubleopen price
closeDoubleclose price
highDoublehigh price
lowDoublelow price
timeLongtime
volumeLongvolume
amountDoubletrading amount

Use the get method like getOpen() to access the actual data

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
List<String> symbols = new ArrayList<>();
symbols.add("AAPL");
QuoteKlineResponse response = client.execute(QuoteKlineRequest.newRequest(symbols, KType.day, "2023-05-16", "2023-05-19")
        .withLimit(1000)
        .withRight(RightOption.br));
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSONString(response));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
    "code":0,
    "data":[
        {
            "items":[
                {
                    "amount":7140962535.379684,
                    "close":172.07,
                    "high":173.1383,
                    "low":171.7991,
                    "open":171.99,
                    "time":1684209600000,
                    "volume":42110293
                },
                {
                    "amount":9878512463.233082,
                    "close":172.69,
                    "high":172.925,
                    "low":170.4201,
                    "open":171.71,
                    "time":1684296000000,
                    "volume":57951604
                },
                {
                    "amount":9839606365.96335,
                    "close":175.05,
                    "high":175.24,
                    "low":172.58,
                    "open":173,
                    "time":1684382400000,
                    "volume":65496657
                }
            ],
            "period":"day",
            "symbol":"AAPL"
        }
    ],
    "message":"success",
    "sign":"vayBuY47WEr6fJeKKlylYqtpNHlWLbguhO9EbUQNR8Y0MdN51ju2BnPuGnNMyBZkiwBL+rG0KuUW0vbQYXGGmiIV3gfxAJA2NwXaLvOK2iQiSOzc6fAuBzyGe1etDtcvnn5apBFB5opLKVqb+lpLEhsPLzcv8rPV6I1ZCLMeQhU=",
    "success":true,
    "timestamp":1684831488647
}

PageToken Example

    List<String> symbols = new ArrayList<>();
    symbols.add("AAPL");
    QuoteKlineRequest request = QuoteKlineRequest.newRequest(symbols, KType.min1,
        "2022-04-25 00:00:00",
        "2022-04-28 00:00:00", TimeZoneId.NewYork);
    request.withLimit(200);
    request.withRight(RightOption.br);

    int count = 1;
    while (true) {
      QuoteKlineResponse response = client.execute(request);
      System.out.println(
          "search time:" + count + ", success:" + response.isSuccess() + ", msg:" + response.getMessage());
      if (!response.isSuccess()) {
        break;
      }
      System.out.println(response.getKlineItems());
      if (response.getKlineItems().size() == 0) {
        break;
      }
      KlineItem klineItem = response.getKlineItems().get(0);
      if (klineItem.getNextPageToken() == null) {
        break;
      }
      count++;
      // 10 times per minute
      try {
        TimeUnit.SECONDS.sleep(6);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      // set pagination token then query the next page
      request.withPageToken(klineItem.getNextPageToken());
    }

PageToken Tools The default is 1,000 per page, and 10,000 pieces of data for paging query will be returned after the client merges. You can refer to several overloaded methods provided by the tool class. The tool method can collect up to 10,000 pieces of data at a time; in addition, pay attention to the data size setting of each page. The server will calculate a request for each paging request, which will affect the frequency of interface calls. You can implement it yourself by referring to the example, pay attention to the page turning boundary to avoid infinite loops


  List<KlinePoint> list =
      PageTokenUtil.getKlineByPage("AAPL", KType.min1,
          "2022-04-25 00:00:00",
          "2022-04-28 00:00:00", TimeZoneId.NewYork,
          RightOption.br, 10, 30, PageTokenUtil.DEFAULT_TIME_INTERVAL);
  for (KlinePoint item : list) {
    System.out.println("content:" + item);
  }

Get in-depth market data

Request: QuoteDepthRequest

Description

Obtain the N file pending order data of the input securities code, including entrusted price, quantity and order number, and the upper limit of a single request is 50

warning CAUTION The closing auction time of Hong Kong stocks trading day is 16:00-16:10 (the market is randomly closed between 16:08 and 16:10), and the last in-depth ranking data of the day is usually updated a minute or two after 16:10 US stock market depth data includes pre-market and after-hours information. No parameters are required, and real-time data can be retrieved instantly upon request

Request Frequency For frequency limit, please refer to: Request Frequency Limit

Parameters

Parametertyperequireddescription
symbolsList<String>YesStock code list (up to 50 for one time)
marketStringYesUS US stocks, HK stocks, CN A shares, ALL (refer to the Market enumeration class)

return

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteDepthResponsesourceopen in new window

The specific structure is as follows

public class QuoteDepthResponse extends TigerResponse {

   @JSONField(name = "data")
   private List<QuoteDepthItem> quoteDepthItems;
}

The returned data can be accessed through the QuoteDepthResponse.getQuoteDepthItems() method, which returns a List containing QuoteDepthItem objects, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.QuoteDepthItem properties are as follows:

FieldTypeDescription
symbolStringstock code
asksList<DepthEntry>ask order
bidsList<DepthEntry>buy order

DepthEntry fields are as follows:

FieldTypeDescription
priceDoubleorder price
countIntegerNumber of entrusted orders (only available in the Hong Kong stock market, not available in the US stock market)
volumeIntegerorder volume

Example

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

List<String> symbols = new ArrayList<>();
symbols.add("DD");
QuoteDepthResponse response = client.execute(QuoteDepthRequest.newRequest(symbols, Market.US.name()));
if (response. isSuccess()) {
   for (QuoteDepthItem item : response. getQuoteDepthItems()) {
     System.out.println(item.getSymbol());
     System.out.println(Arrays.toString(item.getAsks().toArray()));
     System.out.println(Arrays.toString(item.getBids().toArray()));
   }
} else {
   System.out.println("response error:" + response.getMessage());
}

Response

{
   "code": 0,
   "message": "success",
   "timestamp": 1653064415298,
   "data":[
     {"symbol":"DD",
      "asks":[{"price":62.88,"count":0,"volume":50},{"price":62.88,"count":0,"volume":27},{"price": 62.89,"count":0,"volume":50},{"price":62.89,"count":0,"volume":200},{"price":62.89,"count":0,"volume ":100},{"price":62.9,"count":0,"volume":50},{"price":62.9,"count":0,"volume":10},{"price": 62.91,"count":0,"volume":50},{"price":62.91,"count":0,"volume":100},{"price":62.92,"count":0,"volume ":50},{"price":62.92,"count":0,"volume":50},{"price":62.92,"count":0,"volume":100},{"price": 62.93,"count":0,"volume":50},{"price":62.93,"count":0,"volume":49},{"price":62.93,"count":0,"volume ":100},{"price":62.94,"count":0,"volume":50},{"price":62.94,"count":0,"volume":300},{"price": 62.95,"count":0,"volume":50},{"price":62.96,"count":0,"volume":50},{"price":62.97,"count":0,"volume ":50},{"price":62.98,"count":0,"volume":50},{"price":62.99,"count":0,"volume":50},{"price": 62.99,"count":0,"volume":100},{"price":63.0,"count":0,"volume":50},{"price":63.01,"count":0,"volume ":50},{"price":63.02,"count":0,"volume":100},{"price":63.02,"count":0,"volume":50},{"price": 63.03,"count":0,"volume":100},{"price":63.03,"count":0,"volume":50},{"price":63.05,"count":0,"volume ":18},{"price":63.05,"count":0,"volume":100},{"price":63.07,"count":0,"volume":200},{"price": 63.16,"count":0,"volume":100},{"price":63.32,"count":0,"volume":100},{"price":63.32,"count":0,"volume ":100},{"price":63.48,"count":0,"volume":100},{"price":63.5,"count":0,"volume":100},{"price": 63.88,"count":0,"volume":800},{"price":63.88,"count":0,"volume":100},{"price":64.14,"count":0,"volume ":100}],
      "bids":[{"price":62.86,"count":0,"volume":50},{"price":62.86,"count":0,"volume":200},{"price": 62.86,"count":0,"volume":2},{"price":62.86,"count":0,"volume":6},{"price":62.85,"count":0,"volume ":50},{"price":62.84,"count":0,"volume":50},{"price":62.84,"count":0,"volume":100},{"price": 62.83,"count":0,"volume":50},{"price":62.82,"count":0,"volume":50},{"price":62.82,"count":0,"volume ":300},{"price":62.81,"count":0,"volume":50},{"price":62.8,"count":0,"volume":50},{"price": 62.79,"count":0,"volume":50},{"price":62.78,"count":0,"volume":50},{"price":62.77,"count":0,"volume ":50},{"price":62.76,"count":0,"volume":50},{"price":62.76,"count":0,"volume":100},{"price": 62.75,"count":0,"volume":50},{"price":62.75,"count":0,"volume":100},{"price":62.74,"count":0,"volume ":50},{"price":62.73,"count":0,"volume":50},{"price":62.73,"count":0,"volume":100},{"price": 62.7,"count":0,"volume":100},{"price":62.67,"count":0,"volume":50},{"price":62.67,"count":0,"volume ":200},{"price":62.62,"count":0,"volume":11},{"price":62.62,"count":0,"volume":100},{"price": 62.61,"count":0,"volume":100},{"price":62.59,"count":0,"volume":100},{"price":62.58,"count":0,"volume ":45},{"price":62.5,"count":0,"volume":20},{"price":62.27,"count":0,"volume":100},{"price": 62.25,"count":0,"volume":100},{"price":62.25,"count":0,"volume":100},{"price":62.1,"count":0,"volume ":500},{"price":62.1,"count":0,"volume":10},{"price":62.0,"count":0,"volume":8},{"price": 61.94,"count":0,"volume":100},{"price":61.9,"count":0,"volume":100},{"price":61.74,"count":0,"volume ":800}]
     }
   ]
}

Get Trade Ticks QuoteTradeTickRequest

Request: QuoteTradeTickRequest

Description

Get the tick data of selected stocks

Parameters

ParameterTypeRequiredDescription
symbolsList<String>YesAn array of ticker symbol of a list of stocks
langLanguageNoLanguage: zh_CN,zh_TW,en_US, en_US by default
limitIntegerNoMaximum number of data points, 2000 by default. Returns the number of recent deals for each symbol.
beginIndexLongNo
endIndexLongNo

beginIndex and endIndex parameter usage instructions

Query methodbeginIndexendIndexDescription
Query the latest record by record-1-1By default, return the latest record by limit. limit is 200 by default
Query each day according to the intervalSpecific valueSpecific valueFor example: beginIndex=10, endIndex=100, 90 records including 10 to 99 will be returned. If limit is set to 20, 20 records from 10 to 29 will be returned.

Additional Methods

public void setTradeSession(TradeSession tradeSession) {
    ((QuoteTradeTickModel)apiModel).setTradeSession(tradeSession);
  }

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteTradeTickResponsesourceopen in new window

Structured as follows:

public class QuoteTradeTickResponse extends TigerResponse {

  @JSONField(name = "data")
  private List<TradeTickItem> tradeTickItems;
}

Use QuoteTradeTickResponse.getTradeTickItems() to access returned data. The method will return a TradeTickItem object,com.tigerbrokers.stock.openapi.client.https.domain.quote.item.TradeTickItem has the following attributes:

NameTypeDescription
beginIndexLongStart index of the returned data
endIndexLongEnd index of the returned data
symbolStringStock ticker symbol
itemsList<TickPoint>List contains the actual data, a TickPoint corresponds to a data point

TickPoint has the following attributes:

NameTypeDescription
priceDoublePrice
typeStringDirection of the price change, "+" stands for "active buy", "-" stands for "active sell", "*" stands for "neutral transaction"
timeLongTrading time
volumeLongVolume

Use the get method, getTime() to access the data, or use toString() method to convert the data to a string

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
List<String> symbols = new ArrayList<>();
symbols.add("AAPL");
QuoteTradeTickRequest request = QuoteTradeTickRequest.newRequest(symbols, 0, 30, 10);
request.setTradeSession(TradeSession.Regular);
QuoteTradeTickResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSONString(response));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
    "code": 0,
    "data": [
        {
            "beginIndex": 0,
            "endIndex": 10,
            "items": [
                {
                    "price": 169.59,
                    "time": 1712323800003,
                    "type": "*",
                    "volume": 32
                },
                {
                    "price": 169.59,
                    "time": 1712323800003,
                    "type": "*",
                    "volume": 8
                },
                {
                    "price": 169.59,
                    "time": 1712323800003,
                    "type": "*",
                    "volume": 148
                },
                {
                    "price": 169.59,
                    "time": 1712323800003,
                    "type": "*",
                    "volume": 1010
                },
                {
                    "price": 169.59,
                    "time": 1712323800005,
                    "type": "*",
                    "volume": 600
                },
                {
                    "price": 169.59,
                    "time": 1712323800007,
                    "type": "*",
                    "volume": 32
                },
                {
                    "price": 169.59,
                    "time": 1712323800008,
                    "type": "*",
                    "volume": 33
                },
                {
                    "price": 169.59,
                    "time": 1712323800011,
                    "type": "*",
                    "volume": 12
                },
                {
                    "price": 169.59,
                    "time": 1712323800011,
                    "type": "*",
                    "volume": 186
                },
                {
                    "price": 169.59,
                    "time": 1712323800012,
                    "type": "*",
                    "volume": 40
                }
            ],
            "symbol": "AAPL"
        }
    ],
    "message": "success",
    "sign": "XEEDI1HLzWT8rkZp4boFge4OehCeXOVuXJ6U4Lgve1vUz898Ne8Q4CF/f/OIUVcHfC7XbrjqYmHJBwDdQEdfucRdsKH7g0SimlMAnyimNnya4lKIaQ6CRbfE5faEe2sdopjnwZggFkycnCeB0JhiTK72xR5uTC0gGlcaaPY36o4=",
    "success": true,
    "timestamp": 1712557783317
}

Get Trading Requirement

Request: QuoteStockTradeRequest

Description

Get the required information for trading, such as lot size, for a tradable asset.

Parameters

ParameterTypeRequiredDescription
symbolsList<String>YesSymbols, maximum number supported is 50

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteStockTradeResponsesourceopen in new window

Structured as follows:

public class QuoteStockTradeResponse extends TigerResponse {

  @JSONField(name = "data")
  private List<QuoteStockTradeItem> stockTradeItems;

  public List<QuoteStockTradeItem> getStockTradeItems() {
    return stockTradeItems;
  }
}

Use QuoteStockTradeResponse.getStockTradeItems()to access the response. The data is contained in QuoteStockTradeItem objects,com.tigerbrokers.stock.openapi.client.https.domain.quote.item.QuoteStockTradeItem has the following attributes:

NameTypeDescription
symbolStringsymbol
lotSizeIntegerlotsize
spreadScaleIntegertick size
minTickDoubleminimum tick

Use the get method getSymbol() to access, or use toString() method to convert the data to a string.

Example

List<String> symbols = new ArrayList<>();
symbols.add("00700");
symbols.add("00810");
QuoteStockTradeResponse response = client.execute(QuoteStockTradeRequest.newRequest(symbols));
if (response.isSuccess()) {
  System.out.println(Arrays.toString(response.getStockTradeItems().toArray()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
  "code": 0,
  "data": [{
    "lotSize": 100,
    "minTick": 0.2,
    "spreadScale": 0,
    "symbol": "00700"
  }, {
    "lotSize": 6000,
    "minTick": 0.001,
    "spreadScale": 0,
    "symbol": "00810"
  }],
  "message": "success",
  "timestamp": 1546853907390
}

Get Capital Flow

Request: QuoteCapitalFlowRequest

Description

Get capital net inflow Data, including different time periods, such as daily, weekly, monthly, etc.

Parameters

ParameterTypeRequiredDescription
symbolStringYessymbol
marketMarketYesUS-U.S. Stocks, HK-Hongkong Stocks, CN-A-Shares
periodCapitalPeriodYesperiod, possible values are: intraday, day, week, month, year, quarter, 6month

Additional Methods

public void setLang(Language lang) {
    QuoteCapitalFlowModel model = (QuoteCapitalFlowModel)getApiModel();
    if (model != null) {
      model.setLang(lang);
    }
  }

public void setBeginTime(Long beginTime) {
    QuoteCapitalFlowModel model = (QuoteCapitalFlowModel)getApiModel();
    if (model != null) {
      model.setBeginTime(beginTime);
    }
  }

public void setEndTime(Long endTime) {
    QuoteCapitalFlowModel model = (QuoteCapitalFlowModel)getApiModel();
    if (model != null) {
      model.setEndTime(endTime);
    }
  }
  
public void setLimit(Integer limit) {
    QuoteCapitalFlowModel model = (QuoteCapitalFlowModel)getApiModel();
    if (model != null) {
      model.setLimit(limit);
    }
  }

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteCapitalFlowResponsesourceopen in new window

Use QuoteCapitalFlowResponse.getCapitalFlowItem() to access the data. This method returns a CapitalFlowItem object, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.CapitalFlowItem has the following attributes :

NameTypeDescription
symbolStringSymbol
periodStringCapital period
itemsList<CapitalFlowPoint>List of capital flow data

CapitalFlowPoint has the following attributes:

NameTypeDescription
timeStringtime, "11-25 12:48:00 EST"
timestampLongtimestamp
netInflowDoublenet inflow

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
// real-time data
QuoteCapitalFlowRequest request = QuoteCapitalFlowRequest.newRequest(
  "AAPL", Market.US, CapitalPeriod.intraday);
QuoteCapitalFlowResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSON(response.getCapitalFlowItem()));
} else {
  System.out.println("response error:" + response.getMessage());
}

// net capital inflow data in the last 10 days
QuoteCapitalFlowRequest request = QuoteCapitalFlowRequest.newRequest(
  "00700", Market.HK, CapitalPeriod.day);
request.setLimit(10);
QuoteCapitalFlowResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSON(response.getCapitalFlowItem()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

// real-time data
{
    "symbol":"AAPL",
    "items":[
        {
            "netInflow":-109057032.2042,
            "time":"11-25 09:30:00 EST",
            "timestamp":1669386600000
        },
        {
            "netInflow":-116890065.471,
            "time":"11-25 09:31:00 EST",
            "timestamp":1669386660000
        }
    ]
}

// net capital inflow data in the last 10 days
{
    "symbol":"00700",
    "period":"day",
    "items":[
        {
            "netInflow":687742300,
            "time":"2022-11-14",
            "timestamp":1668355200000
        },
        {
            "netInflow":1926444000,
            "time":"2022-11-15",
            "timestamp":1668441600000
        },
        {
            "netInflow":1033900840,
            "time":"2022-11-16",
            "timestamp":1668528000000
        },
        {
            "netInflow":1667729580,
            "time":"2022-11-17",
            "timestamp":1668614400000
        },
        {
            "netInflow":284728680,
            "time":"2022-11-18",
            "timestamp":1668700800000
        },
        {
            "netInflow":661046060,
            "time":"2022-11-21",
            "timestamp":1668960000000
        },
        {
            "netInflow":-86129700,
            "time":"2022-11-22",
            "timestamp":1669046400000
        },
        {
            "netInflow":350223200,
            "time":"2022-11-23",
            "timestamp":1669132800000
        },
        {
            "netInflow":-161005460,
            "time":"2022-11-24",
            "timestamp":1669219200000
        },
        {
            "netInflow":17355680,
            "time":"2022-11-25",
            "timestamp":1669305600000
        }
    ]
}

Get Capital Distribution QuoteCapitalDistributionRequest

Request: QuoteCapitalDistributionRequest

Description

Get capital distribution.

Parameters

ParameterTypeRequiredDescription
symbolStringYessymbol
marketMarketYesUS-U.S. Stocks, HK-Hongkong Stocks, CN-A-Shares
langLanguageNoLanguage: zh_CN,zh_TW,en_US. en_US by default

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteCapitalDistributionResponsesourceopen in new window

Use QuoteCapitalDistributionResponse.getCapitalDistributionItem() to access the data. This method returns a CapitalDistributionItem object, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.CapitalDistributionItem has the following attributes :

NameTypeDescription
symbolStringsymbol
netInflowDoublenet inflow(inAll - outAll)
inAllDoubleall inflow(inBig + inMid + inSmall)
inBigDoublebig orders's inflow
inMidDoublemedian orders's inflow
inSmallDoublesmall orders's inflow
outAllDoubleall outflow(outBig + outMid + outSmall)
outBigDoublebig orders's outflow
outMidDoublemedian orders's outflow
outSmallDoublesmall orders's outflow

Example

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

QuoteCapitalDistributionRequest request = QuoteCapitalDistributionRequest.newRequest(
    "00700", Market.HK);
QuoteCapitalDistributionResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSON(response.getCapitalDistributionItem()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
    "inBig":721190520,
    "netInflow":481406280,
    "symbol":"00700",
    "outBig":464624440,
    "outAll":3639820460,
    "inAll":4121226740,
    "inMid":604918520,
    "inSmall":2795117700,
    "outMid":572017220,
    "outSmall":2603178800
}

Get Stock Broker

Request: QuoteStockBrokerRequest

Description

Get stock broker information.

Parameters

ParameterTypeRequiredDescription
symbolStringYessymbol
limitIntegerNoThe maximum number of points returned. Default value is 40. Maximum is 60
langStringNoLanguage: zh_CN,zh_TW,en_US. en_US by default

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteStockBrokerResponsesourceopen in new window

Use QuoteStockBrokerResponse.getStockBrokerItem() to access the data. This method returns a StockBrokerItem object, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.StockBrokerItem has the following attributes :

NameTypeDescription
symbolStringsymbol
bidBrokerList<LevelBroker>List of bid broker data
askBrokerList<LevelBroker>List of ask broker data

'LevelBroker' has the following attributes:

NameTypeDescription
levelIntegerprice level
priceDoubleprice
brokerCountIntegerthe number of brokers
brokerList<Broker>the list of brokers

'Broker' has the following attributes:

NameTypeDescription
idStringBroker Number Id
nameStringBroker Name

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
QuoteStockBrokerRequest request = QuoteStockBrokerRequest.newRequest("00700", 10, Language.en_US);
QuoteStockBrokerResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSON(response.getStockBrokerItem()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{
    "bidBroker":[
        {
            "level":1,
            "price":287.8,
            "brokerCount":7,
            "broker":[
                {
                    "name":"China Investment",
                    "id":"6997"
                },
                {
                    "name":"China Investment",
                    "id":"6998"
                },
                {
                    "name":"BOCI",
                    "id":"8134"
                },
                {
                    "name":"China Investment",
                    "id":"6998"
                },
                {
                    "name":"China Innovation",
                    "id":"5999"
                },
                {
                    "name":"China Investment",
                    "id":"6996"
                },
                {
                    "name":"J.P. Morgan",
                    "id":"5342"
                }
            ]
        },
        {
            "level":2,
            "price":287.6,
            "brokerCount":3,
            "broker":[
                {
                    "name":"China Investment",
                    "id":"6998"
                },
                {
                    "name":"China Investment",
                    "id":"6999"
                },
                {
                    "name":"China Innovation",
                    "id":"5998"
                }
            ]
        }
    ],
    "symbol":"00700",
    "askBroker":[
        {
            "level":1,
            "price":288,
            "brokerCount":10,
            "broker":[
                {
                    "name":"FUTU Securities",
                    "id":"8461"
                },
                {
                    "name":"China Innovation",
                    "id":"5998"
                },
                {
                    "name":"ICBC (Asia)",
                    "id":"8117"
                },
                {
                    "name":"China Innovation",
                    "id":"5998"
                },
                {
                    "name":"China Investment",
                    "id":"6999"
                },
                {
                    "name":"HSBC Securities Brokers",
                    "id":"8577"
                },
                {
                    "name":"China Investment",
                    "id":"6996"
                },
                {
                    "name":"China Investment",
                    "id":"6999"
                },
                {
                    "name":"FUTU Securities",
                    "id":"8462"
                },
                {
                    "name":"HSBC Securities Brokers",
                    "id":"8575"
                }
            ]
        }
    ]
}

Get Hong Kong Stock Broker Holdings

Request: QuoteBrokerHoldRequest

Description

Retrieve the market value of Hong Kong stock broker holdings

Parameters

ParameterTypeRequiredDescription
marketMarketYesCommon market enumeration values: US for US stocks, HK for Hong Kong stocks, CN for A-shares, ALL for all. For more details, refer to: Market Enumeration
limitIntegerNoThe number of items per page for pagination. Defaults to 50. Maximum 500. If limit is set to more than 500, only the first 500 are returned
pageIntegerNoPagination page number, starting from 0. Defaults to 0.
orderByStringNoSorting field, default is "marketValue". Available options: marketValue/sharesHold/buyAmount/buyAmount5/buyAmount20/buyAmount60
directionStringNoSort order, DESC for descending / ASC for ascending. Default is DESC.
langLanguageNoSupported languages: zh_CN, zh_TW, en_US. Default is en_US

Response

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteBrokerHoldResponse

The returned data can be accessed through the QuoteBrokerHoldResponse.getBrokerHoldPageItem() method, which returns a BrokerHoldPageItem object. The properties of com.tigerbrokers.stock.openapi.client.https.domain.quote.item.BrokerHoldItem are as follows:

FieldTypeDescription
orgIdStringBroker ID
orgNameStringBroker Name
dateStringMost Recent Trading Day
sharesHoldLongHolding quantity
marketValueDoubleMarket value of holdings
buyAmountLongNet Buy Volume (1 Day)
buyAmount5LongNet Buy Volume (5 Days)
buyAmount20LongNet Buy Volume (20 Days)
buyAmount60LongNet Buy Volume (60 Days)
marketStringMarket

Example

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

QuoteBrokerHoldResponse response = client.execute(QuoteBrokerHoldRequest.newRequest(market, limit, page, "buyAmount", "DESC"));

if (response.isSuccess()) {
  System.out.println(JSONObject.toJSON(response.getBrokerHoldPageItem()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

{"items":[{"buyAmount":-664008615,"buyAmount20":-7689110984,"buyAmount5":-3624382900,"buyAmount60":-32074599790,"date":"2025-04-14","market":"HK","marketValue":9.194317557765623E12,"orgId":"C00019","orgName":"HONGKONG SHANGHAI BANKING","sharesHold":696720677628},
{"buyAmount":-141033766,"buyAmount20":10883985046,"buyAmount5":4542732770,"buyAmount60":17917177125,"date":"2025-04-14","market":"HK","marketValue":2.604522670544478E12,"orgId":"A00003","orgName":"(SH)-HK Stock Connect","sharesHold":294896574932},
{"buyAmount":92657497,"buyAmount20":-120870931,"buyAmount5":-209014086,"buyAmount60":-5366617605,"date":"2025-04-14","market":"HK","marketValue":1.9825098585195176E12,"orgId":"C00010","orgName":"CITIBANK N.A.","sharesHold":206374851472},
{"buyAmount":220232675,"buyAmount20":5542004542,"buyAmount5":2942019847,"buyAmount60":4379764988,"date":"2025-04-14","market":"HK","marketValue":1.7997280891850354E12,"orgId":"A00004","orgName":"(SZ)-HK Stock Connect","sharesHold":199832572853},
{"buyAmount":48566660,"buyAmount20":-3485972222,"buyAmount5":1044767966,"buyAmount60":-1685601977,"date":"2025-04-14","market":"HK","marketValue":1.0904056485834637E12,"orgId":"B01161","orgName":"UBS","sharesHold":156347776229}],
"page":0,"totalCount":672,"totalPage":135}

Get Trade Rank

Request: QuoteTradeRankRequest

Description

Get market trading rankings data

Parameters

ParameterTypeRequiredDescription
marketMarketYesUS-U.S. Stocks, HK-Hongkong Stocks, SG-Singapore Stocks
langLanguageNoLanguage: zh_CN,zh_TW,en_US. en_US by default

Response

US stocks return 30 rows, HK and Singapore stocks return 10 rows.

com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteTradeRankResponsesourceopen in new window

Use QuoteTradeRankResponse.getTradeRankItem() to access the data. This method returns a TradeRankItem object, where com.tigerbrokers.stock.openapi.client.https.domain.quote.item.TradeRankItem has the following attributes :

NameTypeDescription
symbolStringSymbol
marketStringMarket
nameStringName
secTypeStringSecurity type
changeRateDoubleChange rate. If the current time is not in the trading time, it is the change rate of the previous trading day.
sellOrderRateDoubleSell order rate. The cumulative buy and sell ratio of the day, for example, in the trading session, it is the cumulative buy and sell ratio of the day, in the after-hours session, it is the cumulative buy and sell ratio of the day, including the pre-market and post-market.
buyOrderRateDoubleBuy order rate. The calculation method is the same as the above.
hourTradingTradeRankHourTradingItemHour trading

Example

TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
      ClientConfig.DEFAULT_CONFIG);
QuoteTradeRankRequest request = QuoteTradeRankRequest.newRequest(Market.US, Language.en_US);
QuoteTradeRankResponse response = client.execute(request);
if (response.isSuccess()) {
  System.out.println(JSONObject.toJSON(response.getTradeRankItem()));
} else {
  System.out.println("response error:" + response.getMessage());
}

Response Example

[{"buyOrderRate":0.606061,"changeRate":-0.030871,"hourTrading":{"changeRate":-0.009057,"tradingStatus":1},"market":"US","name":"NVIDIA","secType":"STK","sellOrderRate":0.393939,"symbol":"NVDA"},{"buyOrderRate":0.409091,"changeRate":-0.021522,"hourTrading":{"changeRate":-0.004568,"tradingStatus":1},"market":"US","name":"Tesla Motors","secType":"STK","sellOrderRate":0.590909,"symbol":"TSLA"},{"buyOrderRate":0.157895,"changeRate":-0.040058,"hourTrading":{"changeRate":0.150228,"tradingStatus":1},"market":"US","name":"Li Auto","secType":"STK","sellOrderRate":0.842105,"symbol":"LI"},{"buyOrderRate":0.333333,"changeRate":-0.10233,"hourTrading":{"changeRate":0.033246,"tradingStatus":1},"market":"US","name":"Alibaba","secType":"STK","sellOrderRate":0.666667,"symbol":"BABA"},{"buyOrderRate":0.333333,"changeRate":-0.079543,"hourTrading":{"changeRate":-0.03759,"tradingStatus":1},"market":"US","name":"SUPER MICRO COMPUTER INC","secType":"STK","sellOrderRate":0.666667,"symbol":"SMCI"}]
Last update: