Stocks
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
Parameter | Type | Required | Description |
---|---|---|---|
market | Market | Yes | US-U.S. Stocks,HK-Hongkong Stocks,CN-A-Shares, ALL-all markets |
lang | Language | No | Language: zh_CN,zh_TW,en_US, By default: en_US |
Response
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteMarketResponse
source
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:
Name | Type | Description |
---|---|---|
market | String | name of the Market being queried(US, CN, HK, etc.) |
marketStatus | String | Market Status, not a constant. This information includes holidays |
status | String | Market Status, NOT_YET_OPEN,PRE_HOUR_TRADING, TRADING,MIDDLE_CLOSE,POST_HOUR_TRADING, CLOSING,EARLY_CLOSED, MARKET_CLOSED |
openTime | String | Most 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
Parameter | Type | Required | Description |
---|---|---|---|
market | Market | Yes | filter by market, you can use the enums defined in Market, such as Market.US, Market.HK, Market.CN |
begin_date | String | No | begin date of calendar,include this day. format yyyy-MM-dd, like '2022-06-01' |
end_date | String | No | end date of calendar,exclude this day. format yyyy-MM-dd |
begin_date and end_date parameters description:
begin_date provided | end_date provided | Date Range Result |
---|---|---|
yes | yes | (begin_date, end_date) |
yes | no | (begin_date, begin_date+365) |
no | yes | (end_date-365,end_date) |
no | no | (Today, Today + 30) |
Response
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteTradeCalendarResponse
source
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:
Name | Type | Description |
---|---|---|
date | String | trade day date |
type | String | trade 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
Parameter | Type | Required | Description |
---|---|---|---|
market | Market | Yes | US, HK, CN |
lang | Language | No | Language: 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.QuoteSymbolResponse
source
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
Parameter | Type | Required | Description |
---|---|---|---|
market | Market | Yes | US, HK, CN |
lang | Language | No | Language: 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.QuoteSymbolNameResponse
source
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:
Name | Type | Description |
---|---|---|
name | String | Name |
symbol | String | Symbol |
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
Parameter | Type | Required | Description |
---|---|---|---|
symbols | List<String> | Yes | Stock 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
source
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:
Parameter | Type | Description |
---|---|---|
symbol | String | Stock symbol |
open | Double | Opening price |
high | Double | Highest price |
low | Double | Lowest price |
close | Double | Closing price |
preClose | Double | Yesterday's closing price |
halted | Double | Stock status (0: Normal 3: Suspended 4: Delisted 7: New Stock 8: Changed) |
time | Long | Last market time |
volume | Long | Volume 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
Parameter | Type | Required | Description |
---|---|---|---|
symbols | List<String> | Yes | An array of stock ticker symbols |
begin_time | Long | No | Begin time (timestamp in ms), default value is to return the data starting from today |
trade_session | TradeSession | No | TradeSession:PreMarket,Regular,AfterHours; Regular by default |
timelineType | TimeLineType | No | period. 'day' or 'day5' |
lang | Language | No | Langauge: 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.QuoteTimelineResponse
source
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:
Name | Type | Description |
---|---|---|
symbol | String | Ticker symbol of the stocks |
period | String | period, day or 5day |
preClose | Double | close price of the last trading day |
intraday | TimelineRange | intraday data, see below for contained data fields |
preMarket | TimelineRange | (U.S. Stocks Only) pre-market data object |
afterHours | TimelineRange | (U.S. Stocks Only) after-market data object |
Use corresponding get method, such as getSymbol()
to access data in TimelineItem
TimelineRange:
Name | Type |
---|---|
items | List<TimelinePoint> |
beginTime | Long |
endTime | Long |
TimelinePoint:
Name | Description |
---|---|
price | Last price |
avgPrice | Average price |
time | Starting timestamp |
volume | Volume |
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
Parameter | Type | Required | Description |
---|---|---|---|
symbols | List<String> | Yes | Stock symbol list |
date | String/Long | No | year, month, day yyyyMMdd, such as 20220420 |
zoneId | TimeZoneId | No | Description of the timezone used |
lang | Language | No | Language 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:
Field | Type | Description |
---|---|---|
symbol | string | stock code |
items | TimelinePoint | Intraday 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:
Field | Description |
---|---|
volume | Volume |
avgPrice | average transaction price |
price | Latest Price |
time | current 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
Parameter | Type | Required | Description |
---|---|---|---|
symbols | List<String> | Yes | list of stock ticker symbols (maximum 50 per request) |
includeHourTrading | boolean | No | Whether to include U.S. stocks before and after the market data, default: false |
lang | Language | No | language: zh_CN,zh_TW,en_US. en_US by default |
Response
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteRealTimeQuoteResponse
source
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:
Name | Type | Description |
---|---|---|
symbol | String | stock ticker symbol |
open | Double | opening price |
high | Double | high price |
low | Double | low price |
close | Double | close price |
preClose | Double | close price of last trading day |
latestPrice | Double | last price |
latestTime | Long | latest trade time |
askPrice | Double | ask price |
askSize | Long | ask size |
bidPrice | Double | bid price |
bidSize | Long | bid size |
volume | Long | volume |
status | StockStatus | 0: Normal, 3: Suspended, 4: Delisted, 7: New Stock, 8: Changed |
hourTrading | HourTrading | U.S. stocks pre-market and post-market data(Response hourTrading only before and after the market time) |
hourTrading
has the following attributes:
Name | Type | Description |
---|---|---|
tag | String | pre-market("Pre-Mkt")、post-market("Post-Mkt") tag |
latestPrice | Double | last price |
preClose | Double | close price of the last trading day |
latestTime | String | latest trade time |
volume | Long | trading volume |
timestamp | Long | latest 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
Argument | Type | Required | Description |
---|---|---|---|
symbols | List<String> | Yes | A list of symbols. Maximum 50 per request, 10 for A-Shares |
kType | KType | Yes | K line period, possible values are: day, week, month, year, 1min, 3min, 5min, 15min, 30min, 60min, 120min, 240min |
begin_time | Long/String | No | Begin time. Unix time stamp in millisecond or a date string. Example: 1639371600000, default value is -1, which means unbounded. |
end_time | Long/String | No | End time. Unix time stamp in millisecond or a date string. Example: 1639371600000, default value is -1, which means unbounded. |
zoneId | TimeZoneId | No | Description 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.QuoteKlineResponse
source
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 :
Name | Type | Description |
---|---|---|
symbol | String | Symbol |
period | String | K-line period |
nextPageToken | String | the page token used for querying the next page, if there is no more data, return null |
items | List<KlinePoint> | array that contains the KlinePoint object |
KlinePoint
have the following attributes:
Name | Type | Description |
---|---|---|
open | Double | open price |
close | Double | close price |
high | Double | high price |
low | Double | low price |
time | Long | time |
volume | Long | volume |
amount | Double | trading 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
Parameter | type | required | description |
---|---|---|---|
symbols | List<String> | Yes | Stock code list (up to 50 for one time) |
market | String | Yes | US US stocks, HK stocks, CN A shares, ALL (refer to the Market enumeration class) |
return
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteDepthResponse
source
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:
Field | Type | Description |
---|---|---|
symbol | String | stock code |
asks | List<DepthEntry> | ask order |
bids | List<DepthEntry> | buy order |
DepthEntry fields are as follows:
Field | Type | Description |
---|---|---|
price | Double | order price |
count | Integer | Number of entrusted orders (only available in the Hong Kong stock market, not available in the US stock market) |
volume | Integer | order 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
Parameter | Type | Required | Description |
---|---|---|---|
symbols | List<String> | Yes | An array of ticker symbol of a list of stocks |
lang | Language | No | Language: zh_CN,zh_TW,en_US, en_US by default |
limit | Integer | No | Maximum number of data points, 2000 by default. Returns the number of recent deals for each symbol. |
beginIndex | Long | No | |
endIndex | Long | No |
beginIndex and endIndex parameter usage instructions
Query method | beginIndex | endIndex | Description |
---|---|---|---|
Query the latest record by record | -1 | -1 | By default, return the latest record by limit. limit is 200 by default |
Query each day according to the interval | Specific value | Specific value | For 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.QuoteTradeTickResponse
source
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:
Name | Type | Description |
---|---|---|
beginIndex | Long | Start index of the returned data |
endIndex | Long | End index of the returned data |
symbol | String | Stock ticker symbol |
items | List<TickPoint> | List contains the actual data, a TickPoint corresponds to a data point |
TickPoint
has the following attributes:
Name | Type | Description |
---|---|---|
price | Double | Price |
type | String | Direction of the price change, "+" stands for "active buy", "-" stands for "active sell", "*" stands for "neutral transaction" |
time | Long | Trading time |
volume | Long | Volume |
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
Parameter | Type | Required | Description |
---|---|---|---|
symbols | List<String> | Yes | Symbols, maximum number supported is 50 |
Response
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteStockTradeResponse
source
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:
Name | Type | Description |
---|---|---|
symbol | String | symbol |
lotSize | Integer | lotsize |
spreadScale | Integer | tick size |
minTick | Double | minimum 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
Parameter | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | symbol |
market | Market | Yes | US-U.S. Stocks, HK-Hongkong Stocks, CN-A-Shares |
period | CapitalPeriod | Yes | period, 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.QuoteCapitalFlowResponse
source
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 :
Name | Type | Description |
---|---|---|
symbol | String | Symbol |
period | String | Capital period |
items | List<CapitalFlowPoint> | List of capital flow data |
CapitalFlowPoint has the following attributes:
Name | Type | Description |
---|---|---|
time | String | time, "11-25 12:48:00 EST" |
timestamp | Long | timestamp |
netInflow | Double | net 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
Parameter | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | symbol |
market | Market | Yes | US-U.S. Stocks, HK-Hongkong Stocks, CN-A-Shares |
lang | Language | No | Language: zh_CN,zh_TW,en_US. en_US by default |
Response
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteCapitalDistributionResponse
source
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 :
Name | Type | Description |
---|---|---|
symbol | String | symbol |
netInflow | Double | net inflow(inAll - outAll) |
inAll | Double | all inflow(inBig + inMid + inSmall) |
inBig | Double | big orders's inflow |
inMid | Double | median orders's inflow |
inSmall | Double | small orders's inflow |
outAll | Double | all outflow(outBig + outMid + outSmall) |
outBig | Double | big orders's outflow |
outMid | Double | median orders's outflow |
outSmall | Double | small 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
Parameter | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | symbol |
limit | Integer | No | The maximum number of points returned. Default value is 40. Maximum is 60 |
lang | String | No | Language: zh_CN,zh_TW,en_US. en_US by default |
Response
com.tigerbrokers.stock.openapi.client.https.response.quote.QuoteStockBrokerResponse
source
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 :
Name | Type | Description |
---|---|---|
symbol | String | symbol |
bidBroker | List<LevelBroker> | List of bid broker data |
askBroker | List<LevelBroker> | List of ask broker data |
'LevelBroker' has the following attributes:
Name | Type | Description |
---|---|---|
level | Integer | price level |
price | Double | price |
brokerCount | Integer | the number of brokers |
broker | List<Broker> | the list of brokers |
'Broker' has the following attributes:
Name | Type | Description |
---|---|---|
id | String | Broker Number Id |
name | String | Broker 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
Parameter | Type | Required | Description |
---|---|---|---|
market | Market | Yes | Common 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 |
limit | Integer | No | The 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 |
page | Integer | No | Pagination page number, starting from 0. Defaults to 0. |
orderBy | String | No | Sorting field, default is "marketValue". Available options: marketValue/sharesHold/buyAmount/buyAmount5/buyAmount20/buyAmount60 |
direction | String | No | Sort order, DESC for descending / ASC for ascending. Default is DESC. |
lang | Language | No | Supported 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:
Field | Type | Description |
---|---|---|
orgId | String | Broker ID |
orgName | String | Broker Name |
date | String | Most Recent Trading Day |
sharesHold | Long | Holding quantity |
marketValue | Double | Market value of holdings |
buyAmount | Long | Net Buy Volume (1 Day) |
buyAmount5 | Long | Net Buy Volume (5 Days) |
buyAmount20 | Long | Net Buy Volume (20 Days) |
buyAmount60 | Long | Net Buy Volume (60 Days) |
market | String | Market |
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
Parameter | Type | Required | Description |
---|---|---|---|
market | Market | Yes | US-U.S. Stocks, HK-Hongkong Stocks, SG-Singapore Stocks |
lang | Language | No | Language: 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.QuoteTradeRankResponse
source
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 :
Name | Type | Description |
---|---|---|
symbol | String | Symbol |
market | String | Market |
name | String | Name |
secType | String | Security type |
changeRate | Double | Change rate. If the current time is not in the trading time, it is the change rate of the previous trading day. |
sellOrderRate | Double | Sell 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. |
buyOrderRate | Double | Buy order rate. The calculation method is the same as the above. |
hourTrading | TradeRankHourTradingItem | Hour 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"}]