Market Data Subscription Push

Subscribe to Stock Quotes

subscribeQuote(Set<String> symbols)


Cancellation Method

cancelSubscribeQuote(Set<String> symbols)

Description

Subscribe to real-time stock quote updates.
Updates are asynchronous. Implement ApiComposeCallback to receive QuoteBasicData and best bid/offer QuoteBBOData objects.

Input Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesStock symbol list, stock symbol format: e.g., AAPL, 00700

Response

FieldTypeDescription
idstringID generated locally by the SDK when making a subscription request, incrementally sequential. Returns the request ID and subscription success result in the subscribeEnd(int id, String subject, String result) callback method

Callback Interfaces

  • void quoteChange(QuoteBasicData data)
  • void quoteAskBidChange(QuoteBBOData data)

Example

Define callback interfaces. After successful subscription, data will be received in the corresponding interfaces of this callback class.

package com.tigerbrokers.stock.openapi.demo;

import com.alibaba.fastjson.JSONObject;
import com.tigerbrokers.stock.openapi.client.config.ClientConfig;
import com.tigerbrokers.stock.openapi.client.socket.ApiComposeCallback;
import com.tigerbrokers.stock.openapi.client.socket.WebSocketClient;
import com.tigerbrokers.stock.openapi.client.socket.data.TradeTick;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.AssetData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.KlineData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.OptionTopData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.OrderStatusData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.OrderTransactionData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.PositionData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.QuoteBBOData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.QuoteBasicData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.QuoteDepthData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.StockTopData;
import com.tigerbrokers.stock.openapi.client.socket.data.pb.TickData;
import com.tigerbrokers.stock.openapi.client.struct.Indicator;
import com.tigerbrokers.stock.openapi.client.struct.SubscribedSymbol;
import com.tigerbrokers.stock.openapi.client.struct.enums.Market;
import com.tigerbrokers.stock.openapi.client.struct.enums.OptionRankingIndicator;
import com.tigerbrokers.stock.openapi.client.struct.enums.StockRankingIndicator;
import com.tigerbrokers.stock.openapi.client.util.ApiLogger;
import com.tigerbrokers.stock.openapi.client.util.ProtoMessageUtil;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;

public class DefaultApiComposeCallback implements ApiComposeCallback {

  @Override
  public void error(String errorMsg) {
    ApiLogger.error(errorMsg);
  }

  @Override
  public void error(int id, int errorCode, String errorMsg) {
    ApiLogger.error("request error. id:" + id + ", code:" + errorCode + ", message:" + errorMsg);
  }

  @Override
  public void connectionClosed() {
    ApiLogger.info("connectionClosed");
  }

  @Override
  public void connectionKickout(int errorCode, String errorMsg) {
    ApiLogger.error("connectionKickout. code:" + errorCode + ", message:" + errorMsg);
  }

  @Override
  public void connectionAck() {
    ApiLogger.info("connectionAck");
  }

  @Override
  public void connectionAck(int serverSendInterval, int serverReceiveInterval) {
    ApiLogger.info("connectionAck. serverSendInterval:" + serverSendInterval
        + ", serverReceiveInterval:" + serverReceiveInterval);
  }

  @Override
  public void hearBeat(String heartBeatContent) {
    ApiLogger.info("hearBeat:" + heartBeatContent);
  }

  @Override
  public void serverHeartBeatTimeOut(String channelId) {
    ApiLogger.error("serverHeartBeatTimeOut. channelId:" + channelId);
  }

  @Override
  public void orderStatusChange(OrderStatusData data) {
    ApiLogger.info("orderStatusChange:" + ProtoMessageUtil.toJson(data));
  }

  @Override
  public void orderTransactionChange(OrderTransactionData data) {
    ApiLogger.info("orderTransactionChange:" + ProtoMessageUtil.toJson(data));
  }

  @Override
  public void positionChange(PositionData data) {
    ApiLogger.info("positionChange:" + ProtoMessageUtil.toJson(data));
  }

  @Override
  public void assetChange(AssetData data) {
    ApiLogger.info("assetChange:" + ProtoMessageUtil.toJson(data));
  }

  /*Stock basic quote callback*/
  @Override
  public void quoteChange(QuoteBasicData data) {
    ApiLogger.info("quoteChange:" + ProtoMessageUtil.toJson(data));
  }
  /*Stock best bid/ask quote callback*/
  @Override
  public void quoteAskBidChange(QuoteBBOData data) {
    ApiLogger.info("quoteAskBidChange:" + ProtoMessageUtil.toJson(data));
  }
  
  /*Option quote callback*/
  @Override
  public void optionChange(QuoteBasicData data) {
    ApiLogger.info("optionChange:" + ProtoMessageUtil.toJson(data));
  }
  /*Option best bid/ask quote callback*/
  @Override
  public void optionAskBidChange(QuoteBBOData data) {
    ApiLogger.info("optionAskBidChange:" + ProtoMessageUtil.toJson(data));
  }

  /*Future quote callback*/
  @Override
  public void futureChange(QuoteBasicData data) {
    ApiLogger.info("futureChange:" + ProtoMessageUtil.toJson(data));
  }
  /*Future best bid/ask quote callback*/
  @Override
  public void futureAskBidChange(QuoteBBOData data) {
    ApiLogger.info("futureAskBidChange:" + ProtoMessageUtil.toJson(data));
  }

  /*Crypto quote callback*/
  @Override
  public void ccChange(QuoteBasicData data) {
    ApiLogger.info("ccChange:" + ProtoMessageUtil.toJson(data));
  }

  /*Crypto best bid/ask quote callback*/
  @Override
  public void ccAskBidChange(QuoteBBOData data) {
    ApiLogger.info("ccAskBidChange:" + ProtoMessageUtil.toJson(data));
  }

  /*Depth quote callback*/
  @Override
  public void depthQuoteChange(QuoteDepthData data) {
    ApiLogger.info("depthQuoteChange:" + ProtoMessageUtil.toJson(data));
  }
  
  /*Tick-by-tick trade data callback*/
  @Override
  public void tradeTickChange(TradeTick data) {
    ApiLogger.info("tradeTickChange:" + JSONObject.toJSONString(data));
  }
  /*Full tick-by-tick trade data callback*/
  @Override
  public void fullTickChange(TickData data) {
      ApiLogger.info("fullTickChange:" + ProtoMessageUtil.toJson(data));
  }
  /*Minute K-line data callback*/
  @Override
  public void klineChange(KlineData data) {
    ApiLogger.info("klineChange:" + ProtoMessageUtil.toJson(data));
  }

  /**Stock quote ranking data push*/
  @Override
  public void stockTopPush(StockTopData data) {
    ApiLogger.info("stockTopPush, market:" + data.getMarket());
    for (StockTopData.TopData topData : data.getTopDataList()) {
      ApiLogger.info("stockTopPush, targetName:" + topData.getTargetName()
          + ", topList:" + ProtoMessageUtil.toJson(topData));
    }
  }

  /**Option quote ranking data push*/
  @Override
  public void optionTopPush(OptionTopData data) {
    ApiLogger.info("optionTopPush, market:" + data.getMarket());
    for (OptionTopData.TopData topData : data.getTopDataList()) {
      ApiLogger.info("optionTopPush, targetName:" + topData.getTargetName()
          + ", topList:" + ProtoMessageUtil.toJson(topData));
    }
  }
  
  /*Subscription success callback*/
  @Override
  public void subscribeEnd(int id, String subject, String result) {
    ApiLogger.info("subscribe " + subject + " end. id:" + id + ", " + result);
  }

  /*Cancel subscription callback*/
  @Override
  public void cancelSubscribeEnd(int id, String subject, String result) {
    ApiLogger.info("cancel subscribe " + subject + " end. id:" + id + ", " + result);
  }

  /*Query subscribed symbol callback*/
  @Override
  public void getSubscribedSymbolEnd(SubscribedSymbol subscribedSymbol) {
    ApiLogger.info("getSubscribedSymbolEnd:" + JSONObject.toJSONString(subscribedSymbol));
  }
}

Perform subscription

public class WebSocketDemo {

//When actually subscribing, you need to fill in tigerId and privateKey, and implement the ApiComposeCallback interface. The example uses DefaultApiComposeCallback
  private static ClientConfig clientConfig = ClientConfig.DEFAULT_CONFIG;
  private static WebSocketClient client;
  static {
    //Path where configuration files tiger_openapi_config.properties and tiger_openapi_token.properties exported from developer information page are stored
    clientConfig.configFilePath = "your_config_directory_path";
    // clientConfig.secretKey = "xxxxxx";// institutional trader private key
    client = WebSocketClient.getInstance().clientConfig(clientConfig).apiComposeCallback(new DefaultApiComposeCallback());
  }

  public static void subscribe() throws InterruptedException {
    client.connect();
    Set<String> symbols = new HashSet<>();

    //Stock subscription
    symbols.add("AAPL");
    symbols.add("SPY");

    //Subscribe to related symbols
    client.subscribeQuote(symbols);

    //Subscribe to depth data (stocks, options, and futures; availability varies by market)
    client.subscribeDepthQuote(symbols);

    //Query subscription details
    client.getSubscribedSymbols();

    //Wait to receive data
    TimeUnit.SECONDS.sleep(60);
    // Cancel the specified symbols
    client.cancelSubscribeQuote(symbols);
    client.cancelSubscribeDepthQuote(symbols);

    //Note: Actively disconnecting will clear all subscription data
    //client.disconnect();
  }
}

The SDK attempts to reconnect. After reconnection, query the current subscription state if needed.

Return Data

For all fields in stock quote callback data, refer to Quote Push Data.

⚠️

NOTE

Stock quote callback data has two types: basic quote QuoteBasicData and best bid/offer QuoteBBOData. The two data types return different fields.

timestamp and serverTimestamp are millisecond timestamp fields.

Hong Kong stock quote data example:

{
    "symbol":"00700",
    "type":"BASIC",
    "timestamp":"1684721758123",
    "serverTimestamp":"1684721758228",
    "avgPrice":330.493,
    "latestPrice":332.2,
    "latestPriceTimestamp":"1684721758103",
    "latestTime":"05-22 10:15:58",
    "preClose":333.2,
    "volume":"4400026",
    "amount":1454057948,
    "open":331.8,
    "high":334.2,
    "low":328.2,
    "marketStatus":"Trading",
    "mi":{
        "p":332.2,
        "a":330.493,
        "t":"1684721700000",
        "v":"75400",
        "o":331.6,
        "h":332.2,
        "l":331.4
    }
}

Hong Kong stock best bid/ask quote data example:

{
    "symbol":"00700",
    "type":"BBO",
    "timestamp":"1684721757927",
    "askPrice":332.2,
    "askSize":"32100",
    "askTimestamp":"1684721757344",
    "bidPrice":332,
    "bidSize":"3500",
    "bidTimestamp":"1684721757773"
}

US stock quote data example:

{
    "symbol":"AAPL",
    "type":"BASIC",
    "timestamp":"1684766012120",
    "serverTimestamp":"1684766012129",
    "avgPrice":174.1721,
    "latestPrice":174.175,
    "latestPriceTimestamp":"1684766011918",
    "latestTime":"05-22 10:33:31 EDT",
    "preClose":175.16,
    "volume":"12314802",
    "amount":2144365591.410586,
    "open":173.98,
    "high":174.71,
    "low":173.45,
    "marketStatus":"Trading",
    "mi":{
        "p":174.175,
        "a":174.1721,
        "t":"1684765980000",
        "v":"57641",
        "o":174.21,
        "h":174.22,
        "l":174.14
    }
}

US stock order book data example:

{
    "symbol":"AAPL",
    "type":"BBO",
    "timestamp":"1676992715509",
    "askPrice":149.96,
    "askSize":"200",
    "askTimestamp":"1676992715367",
    "bidPrice":149.94,
    "bidSize":"700",
    "bidTimestamp":"1676992715367"
}

US stock pre-market trading data example:

⚠️

NOTE

The fields for US stock pre-market and after-hours trading are different from regular trading hours

{
    "symbol":"AAPL",
    "type":"BASIC",
    "timestamp":"1684753559744",
    "serverTimestamp":"1684753559752",
    "latestPrice":173.66,
    "latestPriceTimestamp":"1684753559744",
    "latestTime":"07:05 EDT",
    "preClose":175.16,
    "volume":"366849",
    "amount":63731858.18000001,
    "hourTradingTag":"PreMarket",
    "mi":{
        "p":173.66,
        "a":173.72891,
        "t":"1684753500000",
        "v":"5604",
        "o":173.64,
        "h":173.67,
        "l":173.63
    }
}

Subscribe to Option Quotes

subscribeOption(Set<String> symbols)


Cancellation Method

cancelSubscribeOption(Set<String> symbols)

Description

Create a market data subscription for real-time US and Hong Kong option quotes.
Updates are asynchronous. Implement ApiComposeCallback to receive QuoteBasicData and best bid/offer QuoteBBOData objects.

Request Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesOption symbol list

Option symbol format: Option symbols support 2 formats

  • One format is symbol name + expiration date + strike price + direction, separated by spaces. E.g., (AAPL 20190329 182.5 PUT).
  • The other format is identifier, which is returned when querying option quotes. E.g., (SPY 190508C00290000)

Response

FieldTypeDescription
idstringID generated locally by the SDK when making a subscription request, incrementally sequential. Returns the request ID and subscription success result in the subscribeEnd(int id, String subject, String result) callback method

Subscription Example

Set<String> symbols = new HashSet<>();
//One way to subscribe to options
symbols.add("AAPL 20230317 150.0 CALL");
symbols.add("ALB.HK 20250730 117.50 CALL");
//Another way to subscribe to options
symbols.add("SPY   190508C00290000");

client.subscribeOption(symbols);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription
client.cancelSubscribeOption(symbols);

Corresponding Callback Interfaces

  • void optionChange(QuoteBasicData data)
  • void optionAskBidChange(QuoteBBOData data)

Return Data

Option trading data example:

{
    "symbol":"AAPL 20230317 150.0 CALL",
    "type":"BASIC",
    "timestamp":"1676994444927",
    "latestPrice":4.83,
    "latestPriceTimestamp":"1676994444927",
    "latestTime":"",
    "preClose":6.21,
    "volume":"3181",
    "amount":939117.0060634613,
    "open":4.85,
    "high":5.6,
    "low":4.64,
    "identifier":"AAPL  230317C00150000",
    "openInt":"82677"
}

Option order book data example:

{
    "symbol":"AAPL 20230317 150.0 CALL",
    "type":"BBO",
    "timestamp":"1676994393156",
    "askPrice":4.85,
    "askSize":"11",
    "askTimestamp":"1676994393156",
    "bidPrice":4.8,
    "bidSize":"992",
    "bidTimestamp":"1676994390931"
}

Subscribe to Futures Quotes

subscribeFuture(Set<String> symbols)


Cancellation Method

cancelSubscribeFuture(Set<String> symbols)

Description

Subscribe to real-time futures quotes.
Updates are asynchronous. Implement ApiComposeCallback to receive QuoteBasicData and best bid/offer QuoteBBOData objects.

Request Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesFuture symbol list

Response

FieldTypeDescription
idstringID generated locally by the SDK when making a subscription request, incrementally sequential. Returns the request ID and subscription success result in the subscribeEnd(int id, String subject, String result) callback method

Example

Set<String> symbols = new HashSet<>();
//Future subscription
symbols.add("ESmain");
symbols.add("ES2306");

client.subscribeFuture(symbols);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription
client.cancelSubscribeFuture(symbols);

Corresponding Callback Interfaces

  • void futureChange(QuoteBasicData data)
  • void futureAskBidChange(QuoteBBOData data)

Example Response

Future quote data example:

{
    "symbol":"ESmain",
    "type":"BASIC",
    "timestamp":"1684766824130",
    "avgPrice":4206.476,
    "latestPrice":4202.5,
    "latestPriceTimestamp":"1684766824000",
    "latestTime":"05-22 09:47:04 -0500",
    "preClose":4204.75,
    "volume":"557570",
    "open":4189,
    "high":4221.75,
    "low":4186.5,
    "marketStatus":"Trading",
    "tradeTime":"1684766824000",
    "preSettlement":4204.75,
    "minTick":0.25,
    "mi":{
        "p":4202.25,
        "a":4206.476,
        "t":"1684766820000",
        "v":"96",
        "o":4202.25,
        "h":4202.5,
        "l":4202.0
    }
}

Future order book data example:

{
    "symbol":"ESmain",
    "type":"BBO",
    "timestamp":"1684766824130",
    "askPrice":4202.75,
    "askSize":"70",
    "askTimestamp":"1684766824129",
    "bidPrice":4202.5,
    "bidSize":"2",
    "bidTimestamp":"1684766824130"
}

Subscribe to Crypto Quotes

subscribeCc(Set<String> symbols)


Cancellation Method

cancelSubscribeCc(Set<String> symbols)

Description

Subscribe to real-time cryptocurrency quotes.
Updates are asynchronous. Implement ApiComposeCallback to receive QuoteBasicData and best bid/offer QuoteBBOData objects.

Input Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesList of cryptocurrency codes, format: e.g. ETH.USD, BTC.USD

Response

FieldTypeDescription
idstringLocally generated ID by SDK when making subscription request, incrementing sequentially. The request ID and subscription success result are returned in the subscribeEnd(int id, String subject, String result) callback method

Callback Interface

  • void ccChange(QuoteBasicData data)
  • void ccAskBidChange(QuoteBBOData data)

Example

Use the complete DefaultApiComposeCallback implementation from the "Subscribe to Stock Quotes" example on this page. Its ccChange and ccAskBidChange methods receive crypto basic-quote and best-bid/ask updates, respectively.

Perform subscription

public class WebSocketDemo {

//When actually subscribing, you need to fill in tigerId and privateKey, and implement the ApiComposeCallback interface. In this example, it is DefaultApiComposeCallback
  private static ClientConfig clientConfig = ClientConfig.DEFAULT_CONFIG;
  private static WebSocketClient client;
  static {
    //Path where the configuration files tiger_openapi_config.properties and tiger_openapi_token.properties exported from the developer information page are stored
    clientConfig.configFilePath = "your_config_directory_path";
    // clientConfig.secretKey = "xxxxxx";// institutional trader private key
    client = WebSocketClient.getInstance().clientConfig(clientConfig).apiComposeCallback(new DefaultApiComposeCallback());
  }

  public static void subscribe() throws InterruptedException {
    client.connect();

    Set<String> ccSymbols = new HashSet<>();
    ccSymbols.add("BTC.USD");
    ccSymbols.add("ETH.USD");

    //Subscribe to cryptocurrency
    client.subscribeCc(ccSymbols);

    //Query subscription details
    client.getSubscribedSymbols();

    //Wait to receive data
    TimeUnit.SECONDS.sleep(60);
  
    //Note: All subscription data will be cleared when actively disconnecting
    client.disconnect();
  }
}

Return Data

For all callback fields, refer to Quote Push Data.

⚠️

NOTE

Stock quote callback data has two types: basic quote QuoteBasicData and best bid/offer QuoteBBOData. The fields returned by these two types of data are different.

Quote data example:

{
	"symbol": "ETH.USD",
	"type": "BASIC",
	"timestamp": "1770041127619",
	"serverTimestamp": "1770041127816",
	"latestPrice": 2322.97,
	"latestPriceTimestamp": "1770041127619",
	"latestTime": "02-02 22:05:27 HKT",
	"preClose": 2313.05,
	"volumeDecimal": 27711.5,
	"amount": 6.246553826751E7,
	"open": 2314.18,
	"high": 2374.87,
	"low": 2156.8,
	"marketStatus": "TRADING"
}

Crypto order book data example:

{
	"symbol": "ETH.USD",
	"type": "BBO",
	"timestamp": "1770041127619",
	"askPrice": 2322.97,
	"askTimestamp": "1770041127605",
	"bidPrice": 2322.95,
	"bidSize": "1",
	"bidTimestamp": "1770041127605"
}

Subscribe to Market Depth

subscribeDepthQuote(Set<String> symbols)


Cancellation Method

cancelSubscribeDepthQuote(Set<String> symbols)

Description

Subscribe to market depth for US and Hong Kong stocks, US and Hong Kong options, and futures. US-market depth updates every 300ms, while Hong Kong-market depth updates every 2s; the futures interval follows server configuration. The actual number of levels depends on the market, market data access, and server configuration.
Updates are asynchronous. Implement ApiComposeCallback to receive QuoteDepthData objects.

Request Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesStock, option, future symbol list

Response

FieldTypeDescription
idstringID generated locally by the SDK when making a subscription request, incrementally sequential. Returns the request ID and subscription success result in the subscribeEnd(int id, String subject, String result) callback method

Example

Set<String> symbols = new HashSet<>();
// Market depth subscription
symbols.add("AAPL");
symbols.add("ESmain");
symbols.add("AAPL 20240209 180.0 CALL");

client.subscribeDepthQuote(symbols);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription
client.cancelSubscribeDepthQuote(symbols);

Callback Interface

  • void depthQuoteChange(QuoteDepthData data)

Return Data

Data structure as follows:

FieldTypeDescription
symbolstringStock symbol
timestamplongOrder book timestamp
askOrderBookAsk data
bidOrderBookBid data

OrderBook data structure as follows:

FieldTypeDescription
priceList<Double>Prices by level; entries correspond by index across the parallel arrays
volumeList<Long>Order volumes by level. The Java accessor type is List<Long>; protobuf JSON renders 64-bit integers as quoted decimal strings
orderCountList<Integer>Order counts by level (Hong Kong stocks only)
exchangeList<String>Option data sources by level (options only). A corresponding price or volume of 0 means that source's quote is invalid. See Option Exchanges
timeList<Long>Option exchange order timestamps by level (options only)

Callback Result Example

// US market
{
  "symbol": "AAPL",
  "timestamp": "1676993368405",
  "ask": {
    "price": [
      149.69,
      149.69,
      149.69,
      149.69,
      149.69,
      149.69,
      149.7,
      149.7,
      149.7,
      149.7,
      149.7,
      149.7,
      149.7,
      149.7,
      149.7,
      149.7,
      149.71,
      149.71,
      149.71,
      149.71,
      149.71,
      149.71,
      149.71,
      149.71,
      149.72,
      149.72,
      149.72,
      149.72,
      149.72,
      149.72,
      149.72,
      149.72,
      149.72,
      149.72,
      149.73,
      149.73,
      149.73,
      149.73,
      149.73,
      149.73
    ],
    "volume": [
      "100",
      "100",
      "23",
      "200",
      "100",
      "100",
      "200",
      "100",
      "100",
      "100",
      "82",
      "100",
      "100",
      "200",
      "25",
      "100",
      "185",
      "100",
      "100",
      "82",
      "87",
      "25",
      "100",
      "100",
      "100",
      "100",
      "76",
      "200",
      "100",
      "100",
      "16",
      "87",
      "100",
      "100",
      "100",
      "100",
      "200",
      "100",
      "76",
      "100"
    ]
  },
  "bid": {
    "price": [
      149.68,
      149.68,
      149.68,
      149.68,
      149.67,
      149.67,
      149.67,
      149.67,
      149.67,
      149.67,
      149.67,
      149.67,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.66,
      149.65,
      149.65,
      149.65,
      149.65,
      149.65,
      149.65,
      149.65,
      149.65,
      149.65,
      149.65,
      149.64,
      149.64,
      149.64,
      149.64,
      149.64
    ],
    "volume": [
      "84",
      "87",
      "100",
      "100",
      "100",
      "49",
      "100",
      "100",
      "87",
      "200",
      "100",
      "100",
      "100",
      "100",
      "100",
      "20",
      "1",
      "4",
      "1",
      "200",
      "100",
      "87",
      "25",
      "100",
      "200",
      "200",
      "100",
      "1",
      "25",
      "87",
      "100",
      "100",
      "100",
      "25",
      "100",
      "100",
      "100",
      "1",
      "87",
      "100"
    ]
  }
}

// HK Market
{
  "symbol": "00700",
  "timestamp": "1670465696884",
  "ask": {
    "price": [
      311.4,
      311.6,
      311.8,
      312.0,
      312.2,
      312.4,
      312.6,
      312.8,
      313.0,
      313.2
    ],
    "volume": [
      "15600",
      "5700",
      "16600",
      "33800",
      "61100",
      "14800",
      "28300",
      "28400",
      "61100",
      "39200"
    ],
    "orderCount": [
      16,
      13,
      19,
      79,
      39,
      29,
      66,
      56,
      160,
      27
    ]
  },
  "bid": {
    "price": [
      311.2,
      311.0,
      310.8,
      310.6,
      310.4,
      310.2,
      310.0,
      309.8,
      309.6,
      309.4
    ],
    "volume": [
      "2300",
      "8300",
      "18000",
      "8800",
      "7700",
      "8500",
      "26700",
      "11700",
      "13700",
      "22600"
    ],
    "orderCount": [
      10,
      15,
      18,
      9,
      6,
      11,
      17,
      30,
      10,
      5
    ]
  }
}

Subscribe to Trade Ticks

subscribeTradeTick(Set<String> symbols)


Cancel Method

cancelSubscribeTradeTick(Set<String> symbols)

Description

Subscribe to normal trade ticks. Trade ticks are pushed every 200ms in snapshot mode, with the latest 50 records in each push.
Updates are asynchronous. Implement ApiComposeCallback to receive TradeTick objects.

Supports US and Hong Kong stocks and futures.

Request Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesStock and futures code list

Response

FieldTypeDescription
idstringID generated locally by SDK subscription request, incrementally sequenced. Returns request ID and subscription success result in subscribeEnd(int id, String subject, String result) callback method

Subscription Example

Set<String> symbols = new HashSet<>();
//Trade tick stock subscription
symbols.add("AAPL");
symbols.add("00700");
symbols.add("ESmain");

client.subscribeTradeTick(symbols);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription
client.cancelSubscribeTradeTick(symbols);

Corresponding Callback Interface

  • void tradeTickChange(TradeTick data)

TradeTick data structure is as follows:

FieldTypeDescription
symbolstringStock symbol, futures symbol
secTypeSecTypeSTK/FUT
quoteLevelstringMarket data access level from which data comes (for US stocks, usQuoteBasic provides fewer trade ticks than usStockQuote); futures have no level distinction
timestamplongData timestamp
ticksList<Tick>Trade tick collection

ticks data structure is as follows:

FieldTypeDescription
snlongUpstream arrival order for reference only
volumelongTrade volume
tickTypestring
  • indicates neutral, + indicates active buy, - indicates active sell (futures trade ticks don't have this)
pricedoubleTrade price
timelongTrade timestamp
condstringJava SDK decoded trade condition for this tick; see Trade Tick Conditions. Futures ticks do not provide this field.
partCodestringExchange code for each trade (US stocks only)
partNamestringExchange name for each trade (US stocks only)

Callback Result Example

// US stock
{
  "symbol": "AAPL",
  "secType": "STK",
  "quoteLevel": "usQuoteBasic",
  "timestamp": 1676993925700,
  "ticks": [
    {
      "sn": 116202,
      "volume": 50,
      "tickType": "*",
      "price": 149.665,
      "time": 1676993924289,
      "cond": "US_REGULAR_SALE"
    },
    {
      "sn": 116203,
      "volume": 1,
      "tickType": "*",
      "price": 149.68,
      "time": 1676993924459,
      "cond": "US_REGULAR_SALE"
    },
    {
      "sn": 116204,
      "volume": 1,
      "tickType": "*",
      "price": 149.67,
      "time": 1676993925200,
      "cond": "US_REGULAR_SALE"
    },
    {
      "sn": 116205,
      "volume": 5,
      "tickType": "*",
      "price": 149.6652,
      "time": 1676993925410,
      "cond": "US_REGULAR_SALE"
    }
  ]
}

// Hong Kong Stock
{
  "symbol": "00700",
  "secType": "STK",
  "quoteLevel": "hkStockQuoteLv2",
  "timestamp": 1669345639970,
  "ticks": [
    {
      "sn": 35115,
      "volume": 300,
      "tickType": "+",
      "price": 269.2,
      "time": 1669345639496,
      "cond": "HK_AUTOMATCH_NORMAL"
    },
    {
      "sn": 35116,
      "volume": 200,
      "tickType": "+",
      "price": 269.2,
      "time": 1669345639610,
      "cond": "HK_AUTOMATCH_NORMAL"
    }
  ]
}

// Futures trade tick
{
  "symbol": "HSImain",
  "secType": "FUT",
  "timestamp": 1669345640575,
  "ticks": [
    {
      "sn": 261560,
      "volume": 1,
      "price": 17465.0,
      "time": 1669345639000
    },
    {
      "sn": 261561,
      "volume": 1,
      "price": 17465.0,
      "time": 1669345639000
    },
    {
      "sn": 261562,
      "volume": 1,
      "price": 17465.0,
      "time": 1669345639000
    },
    {
      "sn": 261563,
      "volume": 1,
      "price": 17465.0,
      "time": 1669345639000
    }
  ]
}

Subscribe to Full Trade Ticks

subscribeTradeTick(Set<String> symbols)


Cancel Method

cancelSubscribeTradeTick(Set<String> symbols)

Description

Subscribe to full stock trade ticks. This mode requires additional entitlement. Set ClientConfig.DEFAULT_CONFIG.useFullTick = true; before calling connect(); changing it after the connection is established does not alter that connection's authentication request.
Updates are asynchronous. Implement ApiComposeCallback to receive TickData objects.

Supports US and Hong Kong stocks.

Request Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesStock symbol list

Response

FieldTypeDescription
idstringID generated locally by SDK subscription request, incrementally sequenced. Returns request ID and subscription success result in subscribeEnd(int id, String subject, String result) callback method

Subscription Example

ClientConfig.DEFAULT_CONFIG.useFullTick = true;
client.connect();

Set<String> symbols = new HashSet<>();
//Trade tick stock subscription
symbols.add("AAPL");
symbols.add("00700");

client.subscribeTradeTick(symbols);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription
client.cancelSubscribeTradeTick(symbols);

Corresponding Callback Interface

  • void fullTickChange(TickData data)

TickData data structure is as follows:

FieldTypeDescription
symbolstringStock symbol
timestamplongData timestamp
ticksList<Tick>Full trade tick collection
sourcestringQuote source, such as NLS or BOATS

ticks data structure is as follows:

FieldTypeDescription
snlongSequence number
timelongTrade timestamp
pricefloatTrade price
volumeintTrade volume
typestring
  • indicates neutral, + indicates active buy, - indicates active sell
condstringRaw one-character trade condition for this full tick; an empty string means a regular sale. See Trade Tick Conditions.
partCodestringExchange code for each trade (US stocks only), may be null

Callback Result Example

{
  "symbol": "AAPL",
  "ticks": [
    {"sn": "69745", "time": "1712585464248", "price": 168.96, "volume": 26, "type": "+", "partCode": "t"},
    {"sn": "69746", "time": "1712585464248", "price": 168.96, "volume": 22, "type": "+", "partCode": "t"}
  ],
  "timestamp": "1712585464415",
  "source": "NLS"
}

Subscribe to Minute Bars

subscribeKline(Set<String> symbols)


Cancel Method

cancelSubscribeKline(Set<String> symbols)

Description

Subscribe to one-minute candlestick bars (K-line data) for stocks. The same minute may receive multiple callbacks; update the current minute by timestamp.
Updates are asynchronous. Implement ApiComposeCallback to receive KlineData objects.

Supports US and Hong Kong stocks.

Request Parameters

ParameterTypeRequiredDescription
symbolsSet<String>YesStock symbol list

Response

FieldTypeDescription
idstringID generated locally by SDK subscription request, incrementally sequenced. Returns request ID and subscription success result in subscribeEnd(int id, String subject, String result) callback method

Subscription Example

Set<String> symbols = new HashSet<>();
// Minute K-line data subscription
symbols.add("AAPL");
symbols.add("00700");

client.subscribeKline(symbols);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription
client.cancelSubscribeKline(symbols);

Corresponding Callback Interface

  • void klineChange(KlineData data)

KlineData data structure is as follows:

FieldTypeDescription
timelongBar timestamp in milliseconds
openfloatOpen price
highfloatHigh price
lowfloatLow price
closefloatClose price
avgfloatAverage price
volumelongVolume
countintTrade count
symbolstringStock symbol
amountdoubleTurnover amount
serverTimestamplongServer timestamp in milliseconds

Callback Result Example

{
  "time": "1712584560000",
  "open": 168.9779,
  "high": 169.0015,
  "low": 168.9752,
  "close": 169.0,
  "avg": 168.778,
  "volume": "3664",
  "count": 114,
  "symbol": "AAPL",
  "amount": 617820.6508,
  "serverTimestamp": "1712584569746"
}

Subscribe to Stock Popular Trading Rankings

subscribeStockTop(Market market, Set<Indicator> indicators)


Cancel Method

cancelSubscribeStockTop(Market market, Set<Indicator> indicators)

Description

Subscribe to stock rankings. The server runs the ranking push task every 30 seconds. Ranking size is configurable and defaults to 10.
Updates are asynchronous. Implement ApiComposeCallback to receive StockTopData objects. Results for each indicator are sorted by value in descending order.

Supports US and Hong Kong stocks. The callback type is StockTopData. The server filters the response to the subscribed indicators; pass null to subscribe to all indicators.

Request Parameters

ParameterTypeRequiredDescription
marketMarketYesMarket, supports US, HK
indicatorsSet<Indicator>NoStock ranking indicators, defaults to all indicators, refer to StockRankingIndicator enum values (changeRate: daily change rate, changeRate5Min: 5-minute change rate, turnoverRate: turnover rate, amount: daily turnover amount, volume: daily volume, amplitude: daily amplitude)

Response

FieldTypeDescription
idstringID generated locally by SDK subscription request, incrementally sequenced. Returns request ID and subscription success result in subscribeEnd(int id, String subject, String result) callback method

Subscription Example

Market market = Market.US;
Set<Indicator> indicators = new HashSet<>();
indicators.add(StockRankingIndicator.Amplitude);
indicators.add(StockRankingIndicator.TurnoverRate);
//Subscribe to all indicators for the market
client.subscribeStockTop(market, null);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription of 'amplitude' and 'turnoverRate'
client.cancelSubscribeStockTop(market, indicators);
// Cancel all indicators' subscription
client.cancelSubscribeStockTop(market, null);

Corresponding Callback Interface

  • void stockTopPush(StockTopData data)

StockTopData data structure is as follows:

FieldTypeDescription
marketstringMarket: US/HK
timestamplongTimestamp
topDataList<TopData>Ranking data list for each indicator

TopData data structure is as follows:

FieldTypeDescription
targetNamestringIndicator name (changeRate, changeRate5Min, turnoverRate, amount, volume, amplitude)
itemList<StockItem>Ranking data list for this indicator dimension

StockItem data structure is as follows:

FieldTypeDescription
symbolstringSymbol
latestPricedoubleLatest price
targetValuedoubleCorresponding indicator value

Callback Result Example

{
    "market":"US",
    "timestamp":"1687271010482",
    "topData":[
        {
            "targetName":"changeRate",
            "item":[
                {
                    "symbol":"ICAD",
                    "latestPrice":1.63,
                    "targetValue":0.393162
                },
                {
                    "symbol":"DICE",
                    "latestPrice":46.54,
                    "targetValue":0.374889
                },
                {
                    "symbol":"VCIG",
                    "latestPrice":3.88,
                    "targetValue":0.371025
                },
                {
                    "symbol":"LYRA",
                    "latestPrice":3.75,
                    "targetValue":0.237624
                },
                {
                    "symbol":"CANO",
                    "latestPrice":1.4847,
                    "targetValue":0.18776
                }
                // ......
            ]
        },
        {
            "targetName":"turnoverRate",
            "item":[
                {
                    "symbol":"SBBA",
                    "latestPrice":24.8,
                    "targetValue":191.046512
                },
                {
                    "symbol":"VCIG",
                    "latestPrice":3.88,
                    "targetValue":13.82794
                },
                {
                    "symbol":"BOIL",
                    "latestPrice":3.225,
                    "targetValue":10.681214
                },
                {
                    "symbol":"GDV",
                    "latestPrice":20.86,
                    "targetValue":8.257162
                },
                {
                    "symbol":"NUWE",
                    "latestPrice":3.1611,
                    "targetValue":6.755784
                }
                // ......
            ]
        },
        {
            "targetName":"amount",
            "item":[
                {
                    "symbol":"TSLA",
                    "latestPrice":263.21,
                    "targetValue":10629393179.8
                },
                {
                    "symbol":"SPY",
                    "latestPrice":435.64,
                    "targetValue":5839415251.67
                },
                {
                    "symbol":"NVDA",
                    "latestPrice":428.3801,
                    "targetValue":5123997584.1
                },
                {
                    "symbol":"QQQ",
                    "latestPrice":364.72,
                    "targetValue":3979912590.29
                },
                {
                    "symbol":"BRK.A",
                    "latestPrice":509004,
                    "targetValue":2529965164.19
                }
                // ......
            ]
        },
        {
            "targetName":"volume",
            "item":[
                {
                    "symbol":"TSLA",
                    "latestPrice":263.21,
                    "targetValue":40190416
                },
                {
                    "symbol":"NKLA",
                    "latestPrice":1.2586,
                    "targetValue":33326008
                },
                {
                    "symbol":"FISV",
                    "latestPrice":114.23,
                    "targetValue":31689406
                },
                {
                    "symbol":"SQQQ",
                    "latestPrice":19.93,
                    "targetValue":31339556
                },
                {
                    "symbol":"PLTR",
                    "latestPrice":15.98,
                    "targetValue":30249797
                }
                // ......
            ]
        },
        {
            "targetName":"amplitude",
            "item":[
                {
                    "symbol":"ICAD",
                    "latestPrice":1.63,
                    "targetValue":0.333333
                },
                {
                    "symbol":"VCIG",
                    "latestPrice":3.88,
                    "targetValue":0.293286
                },
                {
                    "symbol":"GRCL",
                    "latestPrice":3.8285,
                    "targetValue":0.281059
                },
                {
                    "symbol":"ZJYL",
                    "latestPrice":10.2165,
                    "targetValue":0.278427
                },
                {
                    "symbol":"NUWE",
                    "latestPrice":3.1611,
                    "targetValue":0.262799
                }
                // ......
            ]
        },
        {
            "targetName":"changeRate5Min",
            "item":[
                {
                    "symbol":"ICAD",
                    "latestPrice":1.63,
                    "targetValue":0.077419
                },
                {
                    "symbol":"EUDA",
                    "latestPrice":1.3,
                    "targetValue":0.072
                },
                {
                    "symbol":"WEL",
                    "latestPrice":10.75,
                    "targetValue":0.070233
                },
                {
                    "symbol":"TYGO",
                    "latestPrice":17.255,
                    "targetValue":0.068901
                },
                {
                    "symbol":"SSU",
                    "latestPrice":3.2512,
                    "targetValue":0.065967
                }
                // ......
            ]
        }
    ]
}

Subscribe to Option Popular Trading Rankings

subscribeOptionTop(Market market, Set<Indicator> indicators)


Cancel Method

cancelSubscribeOptionTop(Market market, Set<Indicator> indicators)

Description

Subscribe to option rankings. The server runs the ranking push task every 30 seconds. Ranking size is configurable and defaults to 10.
Updates are asynchronous. Implement ApiComposeCallback to receive OptionTopData objects.

Supports US options. The server filters the response to the subscribed indicators; pass null to subscribe to all indicators.

Request Parameters

ParameterTypeRequiredDescription
marketMarketYesMarket, supports US
indicatorsSet<Indicator>NoOption ranking indicators; defaults to all indicators. See the OptionRankingIndicator values (bigOrder, volume, amount, openInt)

Response

FieldTypeDescription
idstringID generated locally by SDK subscription request, incrementally sequenced. Returns request ID and subscription success result in subscribeEnd(int id, String subject, String result) callback method

Subscription Example

Market market = Market.US;
Set<Indicator> indicators = new HashSet<>();
indicators.add(OptionRankingIndicator.Amount);
indicators.add(OptionRankingIndicator.OpenInt);
//Subscribe to all indicators for the market
client.subscribeOptionTop(market, null);

//Wait to receive the data
TimeUnit.SECONDS.sleep(120);
// Cancel subscription of 'amount' and 'openInt'
client.cancelSubscribeOptionTop(market, indicators);
// Cancel all indicators' subscription
client.cancelSubscribeOptionTop(market, null);

Corresponding Callback Interface

  • void optionTopPush(OptionTopData data)

OptionTopData data structure is as follows:

FieldTypeDescription
marketstringMarket: US
timestamplongTimestamp
topDataList<TopData>Ranking data list for each indicator

TopData data structure is as follows:

FieldTypeDescription
targetNamestringIndicator name (bigOrder, volume, amount, openInt)
bigOrderList<BigOrder>Big order indicator (bigOrder) data list
itemList<OptionItem>Ranking data list for this indicator dimension

BigOrder data structure is as follows:

FieldTypeDescription
symbolstringStock, ETF symbol
expirystringExpiry date, format: yyyyMMdd
strikestringStrike price
rightstringCALL/PUT
dirstringTrade direction: BUY/SELL/NONE
volumedoubleTrade volume
pricedoubleTrade price
amountdoubleTrade amount
tradeTimelongTrade timestamp

OptionItem data structure is as follows:

FieldTypeDescription
symbolstringStock, ETF symbol
expirystringExpiry date, format: yyyyMMdd
strikestringStrike price
rightstringCALL/PUT
totalAmountdoubleTrade amount
totalVolumedoubleTrade volume
totalOpenIntdoubleOpen interest
volumeToOpenIntdoubleVolume/Open interest
latestPricedoubleLatest price
updateTimelongIndicator data update timestamp

Callback Result Example

{
    "market":"US",
    "timestamp":"1687277160445",
    "topData":[
        {
            "targetName":"volume",
            "item":[
                {
                    "symbol":"SPY",
                    "expiry":"20230620",
                    "strike":"435.0",
                    "right":"PUT",
                    "totalAmount":5394115,
                    "totalVolume":212478,
                    "totalOpenInt":16377,
                    "volumeToOpenInt":0.012467,
                    "latestPrice":0.25,
                    "updateTime":"1687277254390"
                },
                {
                    "symbol":"SPY",
                    "expiry":"20230620",
                    "strike":"436.0",
                    "right":"PUT",
                    "totalAmount":7754077,
                    "totalVolume":194423,
                    "totalOpenInt":13403,
                    "volumeToOpenInt":0.011408,
                    "latestPrice":0.58,
                    "updateTime":"1687277213603"
                },
                {
                    "symbol":"SPY",
                    "expiry":"20230620",
                    "strike":"437.0",
                    "right":"PUT",
                    "totalAmount":10420625,
                    "totalVolume":182078,
                    "totalOpenInt":13973,
                    "volumeToOpenInt":0.010683,
                    "latestPrice":1.17,
                    "updateTime":"1687277213602"
                },
                {
                    "symbol":"SPY",
                    "expiry":"20230620",
                    "strike":"438.0",
                    "right":"CALL",
                    "totalAmount":4482482,
                    "totalVolume":181899,
                    "totalOpenInt":961,
                    "volumeToOpenInt":0.010673,
                    "latestPrice":0.09,
                    "updateTime":"1687277213603"
                },
                {
                    "symbol":"SPY",
                    "expiry":"20230620",
                    "strike":"436.0",
                    "right":"CALL",
                    "totalAmount":7331667,
                    "totalVolume":150604,
                    "totalOpenInt":238,
                    "volumeToOpenInt":0.008837,
                    "latestPrice":0.66,
                    "updateTime":"1687277208599"
                }
                // ......
            ]
        },
        {
            "targetName":"amount",
            "item":[
                {
                    "symbol":"TSLA",
                    "expiry":"20230721",
                    "strike":"5.0",
                    "right":"CALL",
                    "totalAmount":34061561,
                    "totalVolume":1812,
                    "totalOpenInt":18,
                    "volumeToOpenInt":0.00023,
                    "latestPrice":259.99,
                    "updateTime":"1687276953360"
                },
                {
                    "symbol":"TSLA",
                    "expiry":"20230721",
                    "strike":"500.0",
                    "right":"PUT",
                    "totalAmount":30877216,
                    "totalVolume":1960,
                    "volumeToOpenInt":0.000248,
                    "latestPrice":234.97,
                    "updateTime":"1687276953360"
                },
                {
                    "symbol":"TSLA",
                    "expiry":"20230623",
                    "strike":"265.0",
                    "right":"CALL",
                    "totalAmount":27928028,
                    "totalVolume":66361,
                    "totalOpenInt":12928,
                    "volumeToOpenInt":0.008405,
                    "latestPrice":6.5,
                    "updateTime":"1687277264395"
                },
                {
                    "symbol":"SPY",
                    "expiry":"20230721",
                    "strike":"420.0",
                    "right":"CALL",
                    "totalAmount":21629503,
                    "totalVolume":11105,
                    "totalOpenInt":46931,
                    "volumeToOpenInt":0.000652,
                    "latestPrice":19.27,
                    "updateTime":"1687273142271"
                },
                {
                    "symbol":"TSLA",
                    "expiry":"20230623",
                    "strike":"270.0",
                    "right":"CALL",
                    "totalAmount":17657903,
                    "totalVolume":61012,
                    "totalOpenInt":14302,
                    "volumeToOpenInt":0.007728,
                    "latestPrice":4.52,
                    "updateTime":"1687277254390"
                }
                // ......
            ]
        },
        {
            "targetName":"openInt",
            "item":[
                {
                    "symbol":"AMC",
                    "expiry":"20230721",
                    "strike":"10.0",
                    "right":"CALL",
                    "totalAmount":4933,
                    "totalVolume":750,
                    "totalOpenInt":340843,
                    "volumeToOpenInt":0.00022,
                    "latestPrice":0.1,
                    "updateTime":"1687276788220"
                },
                {
                    "symbol":"AMC",
                    "expiry":"20230721",
                    "strike":"10.0",
                    "right":"PUT",
                    "totalVolume":1,
                    "totalOpenInt":321814,
                    "latestPrice":6.2,
                    "updateTime":"1687276853278"
                },
                {
                    "symbol":"AMC",
                    "expiry":"20230721",
                    "strike":"4.0",
                    "right":"PUT",
                    "totalAmount":117982,
                    "totalVolume":2748,
                    "totalOpenInt":242101,
                    "volumeToOpenInt":0.000806,
                    "latestPrice":0.81,
                    "updateTime":"1687277034280"
                },
                {
                    "symbol":"ATVI",
                    "expiry":"20240119",
                    "strike":"85.0",
                    "right":"PUT",
                    "totalAmount":3500,
                    "totalVolume":26,
                    "totalOpenInt":230702,
                    "volumeToOpenInt":0.000016,
                    "latestPrice":7,
                    "updateTime":"1687274092822"
                },
                {
                    "symbol":"EEM",
                    "expiry":"20231215",
                    "strike":"47.0",
                    "right":"CALL",
                    "totalAmount":310,
                    "totalVolume":15,
                    "totalOpenInt":183054,
                    "volumeToOpenInt":0.000003,
                    "latestPrice":0.18,
                    "updateTime":"1687269619956"
                }
                // ......
            ]
        },
        {
            "targetName":"bigOrder",
            "bigOrder":[
                {
                    "symbol":"AMC",
                    "expiry":"20230818",
                    "strike":"10.0",
                    "right":"PUT",
                    "dir":"Buy",
                    "volume":1000,
                    "price":6.94,
                    "amount":694000,
                    "tradeTime":"1687276860753"
                },
                {
                    "symbol":"GLPI",
                    "expiry":"20230818",
                    "strike":"50.0",
                    "right":"CALL",
                    "dir":"Sell",
                    "volume":1094,
                    "price":1.2,
                    "amount":131280,
                    "tradeTime":"1687276744519"
                },
                {
                    "symbol":"AMD",
                    "expiry":"20230818",
                    "strike":"140.0",
                    "right":"CALL",
                    "dir":"Buy",
                    "volume":1700,
                    "price":3.25,
                    "amount":552500,
                    "tradeTime":"1687276467421"
                },
                {
                    "symbol":"AAPL",
                    "expiry":"20230915",
                    "strike":"185.0",
                    "right":"PUT",
                    "dir":"Sell",
                    "volume":1500,
                    "price":6.65,
                    "amount":997500,
                    "tradeTime":"1687276413267"
                },
                {
                    "symbol":"BABA",
                    "expiry":"20240119",
                    "strike":"75.0",
                    "right":"PUT",
                    "dir":"Sell",
                    "volume":1500,
                    "price":4.8,
                    "amount":720000,
                    "tradeTime":"1687276036749"
                }
                // ......
            ]
        }
    ]
}

Query Subscribed Symbols

getSubscribedSymbols()

Description

Query subscribed symbol information

Each limit is determined dynamically by the user's market data access and server configuration; do not assume a fixed value. Real-time quotes, market depth, trade ticks, and K-line data expose their corresponding limit and usage fields. Market-level subscriptions such as rankings are listed in subscribedMarketQuote; this field does not establish that they share a symbol quota.

Request Parameters

None

Subscription Example

client.getSubscribedSymbols();

Corresponding Callback Interface

public void getSubscribedSymbolEnd(SubscribedSymbol subscribedSymbol) {
    System.out.println(JSONObject.toJSONString(subscribedSymbol));
}

Callback data structure is as follows:

FieldTypeDescription
limitintMaximum limit for subscribed market data symbols (stocks, options, futures)
usedintNumber of subscribed market data symbols (stocks, options, futures) used
subscribedSymbolsarraySubscribed market data symbols (stocks, options, futures)
askBidLimitintMaximum limit for subscribed depth market data stocks
askBidUsedintNumber of subscribed depth market data stocks used
subscribedAskBidSymbolsarraySubscribed depth market data stock symbols
tradeTickLimitintMaximum limit for subscribed trade tick stocks
tradeTickUsedintNumber of subscribed trade tick stocks used
subscribedTradeTickSymbolsarraySubscribed trade tick stock symbols
klineLimitintMaximum number of minute-bar symbols
klineUsedintNumber of subscribed minute-bar symbols
subscribedKlineSymbolsarraySubscribed minute-bar symbols
subscribedMarketQuotearraySubscribed market-level quote categories, such as rankings

Callback Result Example

{
    "askBidLimit":10,
    "askBidUsed":0,
    "limit":20,
    "klineLimit":20,
    "klineUsed":1,
    "subscribedAskBidSymbols":[

    ],
    "subscribedSymbols":[

    ],
    "subscribedKlineSymbols":[
        "AAPL"
    ],
    "subscribedMarketQuote":[
        "US_StockTop"
    ],
    "subscribedTradeTickSymbols":[
        "PDD",
        "AMD",
        "SPY",
        "01810"
    ],
    "tradeTickLimit":20,
    "tradeTickUsed":4,
    "used":0
}


Did this page help you?