Market Data Subscriptions
Subscription calls return a uint request ID and callbacks confirm the final result asynchronously.
Complete Market Push Example
This console program selects Quote, Depth, Kline, Tick, or FullTick from the first command-line argument. For example: dotnet run -- FullTick. First place the SDK configuration files in .tigeropen under your user profile.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using TigerOpenAPI.Config;
using TigerOpenAPI.Push;
using TigerOpenAPI.Push.Model;
using TigerOpenAPI.Quote.Pb;
enum MarketPushMode { Quote, Depth, Kline, Tick, FullTick }
sealed class MarketPushCallback : IApiComposeCallback
{
private readonly ConcurrentDictionary<int, TaskCompletionSource<string>> pending = new();
private readonly TaskCompletionSource<string> globalFailure =
new(TaskCreationOptions.RunContinuationsAsynchronously);
public TaskCompletionSource<bool> Stopped { get; } =
new(TaskCreationOptions.RunContinuationsAsynchronously);
private void Complete(int id, string result)
{
TaskCompletionSource<string> completion = pending.GetOrAdd(
id, _ => new(TaskCreationOptions.RunContinuationsAsynchronously));
try
{
JObject parsed = JObject.Parse(result);
int? code = parsed.Value<int?>("code");
if (code == 0)
completion.TrySetResult(result);
else
completion.TrySetException(new InvalidOperationException(
$"Subscription command failed: {result}"));
}
catch (Exception error)
{
completion.TrySetException(new InvalidOperationException(
$"Invalid subscription result: {result}", error));
}
}
private void Fail(int id, string error) =>
pending.GetOrAdd(id, _ => new(TaskCreationOptions.RunContinuationsAsynchronously))
.TrySetException(new InvalidOperationException(error));
private void StopWithFailure(string error)
{
globalFailure.TrySetResult(error);
Stopped.TrySetResult(true);
}
public void ThrowIfFailed()
{
if (globalFailure.Task.IsCompletedSuccessfully)
throw new InvalidOperationException(globalFailure.Task.Result);
}
public async Task<string> WaitForResultAsync(uint requestId, TimeSpan timeout)
{
int id = unchecked((int)requestId);
TaskCompletionSource<string> completion = pending.GetOrAdd(
id, _ => new(TaskCreationOptions.RunContinuationsAsynchronously));
try
{
Task delay = Task.Delay(timeout);
Task winner = await Task.WhenAny(globalFailure.Task, completion.Task, delay);
if (winner == globalFailure.Task)
throw new InvalidOperationException(await globalFailure.Task);
if (winner == delay)
throw new TimeoutException($"Timed out waiting for request {requestId}.");
return await completion.Task;
}
finally
{
pending.TryRemove(id, out _);
}
}
public void QuoteChange(QuoteBasicData data) => Console.WriteLine($"QuoteChange: {data}");
public void QuoteAskBidChange(QuoteBBOData data) => Console.WriteLine($"QuoteAskBidChange: {data}");
public void DepthQuoteChange(QuoteDepthData data) => Console.WriteLine($"DepthQuoteChange: {data}");
public void KlineChange(KlineData data) => Console.WriteLine($"KlineChange: {data}");
public void TradeTickChange(TradeTick data) => Console.WriteLine($"TradeTickChange: {data.Symbol}, ticks={data.Ticks.Count}");
public void FullTickChange(TickData data) => Console.WriteLine($"FullTickChange: {data}");
public void SubscribeEnd(int id, string subject, string result) => Complete(id, result);
public void CancelSubscribeEnd(int id, string subject, string result) => Complete(id, result);
public void ConnectionAck() => Console.WriteLine("ConnectionAck");
public void ConnectionAck(int serverSendInterval, int serverReceiveInterval) => Console.WriteLine($"ConnectionAck: send={serverSendInterval}, receive={serverReceiveInterval}");
public void ConnectionClosed() => StopWithFailure("Connection closed.");
public void ConnectionKickout(int errorCode, string errorMsg) =>
StopWithFailure($"Connection kickout {errorCode}: {errorMsg}");
public void Error(string errorMsg) => StopWithFailure(errorMsg);
public void Error(int id, int errorCode, string errorMsg)
{
Fail(id, $"Error {errorCode}: {errorMsg}");
Stopped.TrySetResult(true);
}
public void HearBeat(string heartBeatContent) => Console.WriteLine($"HearBeat: {heartBeatContent}");
public void ServerHeartBeatTimeOut(string channelId) =>
StopWithFailure($"Server heartbeat timed out for channel {channelId}.");
public void OrderStatusChange(OrderStatusData data) { }
public void OrderTransactionChange(OrderTransactionData data) { }
public void PositionChange(PositionData data) { }
public void AssetChange(AssetData data) { }
public void OptionChange(QuoteBasicData data) { }
public void OptionAskBidChange(QuoteBBOData data) { }
public void FutureChange(QuoteBasicData data) { }
public void FutureAskBidChange(QuoteBBOData data) { }
public void StockTopPush(StockTopData data) { }
public void OptionTopPush(OptionTopData data) { }
public void GetSubscribedSymbolEnd(SubscribedSymbol subscribedSymbol) { }
}
static class Program
{
private static async Task WaitForCancelAsync(
MarketPushCallback callback, uint requestId)
{
string result = await callback.WaitForResultAsync(requestId, TimeSpan.FromSeconds(10));
Console.WriteLine($"CancelSubscribeEnd: id={unchecked((int)requestId)}, result={result}");
}
public static async Task Main(string[] args)
{
if (args.Length == 0 || !Enum.TryParse(args[0], true, out MarketPushMode mode))
{
Console.Error.WriteLine("Usage: dotnet run -- Quote|Depth|Kline|Tick|FullTick");
return;
}
var config = new TigerConfig
{
ConfigFilePath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".tigeropen"),
UseFullTick = mode == MarketPushMode.FullTick
};
var callback = new MarketPushCallback();
PushClient client = PushClient.GetInstance()
.Config(config)
.ApiComposeCallback(callback);
var symbols = new HashSet<string> { "AAPL" };
bool connected = false;
try
{
connected = await client.ConnectAsync();
if (!connected)
throw new InvalidOperationException("Market-push connection failed.");
Console.CancelKeyPress += (_, eventArgs) =>
{
eventArgs.Cancel = true;
callback.Stopped.TrySetResult(true);
};
uint requestId = mode switch
{
MarketPushMode.Quote => client.SubscribeQuote(symbols),
MarketPushMode.Depth => client.SubscribeDepthQuote(symbols),
MarketPushMode.Kline => client.SubscribeKline(symbols),
MarketPushMode.Tick or MarketPushMode.FullTick => client.SubscribeTradeTick(symbols),
_ => 0
};
if (requestId == 0)
throw new InvalidOperationException("The subscription request was not sent.");
string result = await callback.WaitForResultAsync(requestId, TimeSpan.FromSeconds(10));
Console.WriteLine($"SubscribeEnd: id={unchecked((int)requestId)}, result={result}");
Console.WriteLine("Press Ctrl+C to stop.");
await callback.Stopped.Task;
callback.ThrowIfFailed();
}
finally
{
try
{
if (client.IsConnected())
{
uint cancelRequestId = mode switch
{
MarketPushMode.Quote => client.CancelSubscribeQuote(symbols),
MarketPushMode.Depth => client.CancelSubscribeDepthQuote(symbols),
MarketPushMode.Kline => client.CancelSubscribeKline(symbols),
MarketPushMode.Tick or MarketPushMode.FullTick => client.CancelSubscribeTradeTick(symbols),
_ => 0
};
if (cancelRequestId != 0)
await WaitForCancelAsync(callback, cancelRequestId);
}
}
finally
{
client.Disconnect();
}
}
}
}ConnectAsync keeps retrying until the TCP connection succeeds. To stop the program before it connects, terminate the process. After it connects, Ctrl+C triggers unsubscription and disconnection. A closed connection, kickout, server-heartbeat timeout, or global error without a request ID records a global failure and ends the stop wait. WaitForResultAsync throws whether that failure arrives before or during a request wait. An ID-bearing error fails its matching request and ends the main wait. After the stop wait, ThrowIfFailed() checks for a global failure again so the program does not exit silently when no request is active. Cleanup sends the cancellation only while the client remains connected, and Disconnect() always executes whenever control reaches finally.
Subscribe and cancel methods return a uint request ID. The int id in SubscribeEnd, CancelSubscribeEnd, and the ID-bearing Error overload carries the same 32-bit request identifier. Compare its unchecked 32-bit bit pattern with unchecked((int)requestId), not its signed numeric value. Both callbacks and waiters use GetOrAdd, so a callback that arrives before WaitForResultAsync does not lose its result; ID-bearing errors are thrown from the waiter. A nonzero ID only means that the request was sent. The example parses the callback result JSON and completes successfully only when the result JSON code field is 0; otherwise it throws. Full-tick and ordinary tick modes both call SubscribeTradeTick. UseFullTick = true only needs to be set before connection to receive data through FullTickChange; ordinary mode receives TradeTickChange.
Subscribe to Stock Market Data
Operation
PushClient.SubscribeQuote. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeQuote(ISet<string> symbols)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
See the complete market push example and select Quote mode for connection, subscription, cancellation, and shutdown handling.
Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callbacks
QuoteChange(QuoteBasicData data) (BASIC; see the full field table) and QuoteAskBidChange(QuoteBBOData data) (BBO; see the full field table)
Protobuf JSON representation
Quote (BASIC):
{
"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.41,
"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
}
}Best Bid/Offer (BBO):
{
"symbol": "AAPL",
"type": "BBO",
"timestamp": "1676992715509",
"askPrice": 149.96,
"askSize": "200",
"askTimestamp": "1676992715367",
"bidPrice": 149.94,
"bidSize": "700",
"bidTimestamp": "1676992715367"
}For field types, optional fields, and nested Mi, see the QuoteChange field table; for BBO fields, see the QuoteAskBidChange field table.
Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeQuote. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeQuote(ISet<string>? symbols = null)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeQuote(new HashSet<string> { "AAPL" });Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe Trade Ticks
Operation
PushClient.SubscribeTradeTick. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeTradeTick(ISet<string> symbols)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
See the complete market push example and select Tick mode.
Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callback
TradeTickChange(TradeTick data). See the full field table.
JSON representation
{
"symbol": "AAPL",
"secType": "STK",
"quoteLevel": "usQuoteBasic",
"timestamp": 1676993925700,
"ticks": [
{
"sn": 116202,
"volume": 50,
"tickType": "*",
"price": 149.665,
"time": 1676993924289,
"cond": "US_REGULAR_SALE"
}
]
}The ordinary TradeTickChange callback returns decoded cond values; see Trade Tick Conditions. With full-tick mode, FullTickChange returns raw one-character conditions; see Trade Tick Conditions.
For field types, see the TradeTickChange field table.
Full Tick
Full-tick and ordinary tick modes use the same SubscribeTradeTick(ISet<string> symbols) and CancelSubscribeTradeTick(ISet<string>? symbols = null) methods. Set TigerConfig.UseFullTick = true before connecting; the data callback becomes FullTickChange(TickData data) (see the full field table), while the subscription completion callback remains SubscribeEnd(int id, string subject, string result). See the complete market push example and select FullTick mode.
Protobuf JSON representation
{
"symbol": "AAPL",
"timestamp": "1676993925700",
"source": "",
"ticks": [
{
"sn": "116202",
"time": "1676993924289",
"price": 149.665,
"volume": 50,
"type": "*",
"cond": "@",
"partCode": "Q"
}
]
}For field types, see the FullTickChange field table.
Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeTradeTick. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeTradeTick(ISet<string>? symbols = null)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeTradeTick(new HashSet<string> { "AAPL" });Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe to Option Market Data
Operation
PushClient.SubscribeOption. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeOption(ISet<string> symbols)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.SubscribeOption(new HashSet<string> { "AAPL 260821C00200000" });Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callbacks
OptionChange(QuoteBasicData data) (see the full field table) and OptionAskBidChange(QuoteBBOData data) (see the full field table)
Protobuf JSON representation
{
"symbol": "AAPL 20230317 150.0 CALL",
"type": "BASIC",
"timestamp": "1676994444927",
"latestPrice": 4.83,
"preClose": 6.21,
"volume": "3181",
"amount": 939117.01,
"open": 4.85,
"high": 5.6,
"low": 4.64,
"identifier": "AAPL 230317C00150000",
"openInt": "82677"
}Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeOption. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeOption(ISet<string>? symbols = null)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeOption(new HashSet<string> { "AAPL 260821C00200000" });Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe to Futures Market Data
Operation
PushClient.SubscribeFuture. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeFuture(ISet<string> symbols)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.SubscribeFuture(new HashSet<string> { "ES2609" });Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callbacks
FutureChange(QuoteBasicData data) (see the full field table) and FutureAskBidChange(QuoteBBOData data) (see the full field table)
Protobuf JSON representation
{
"symbol": "ESmain",
"type": "BASIC",
"timestamp": "1684766824130",
"avgPrice": 4206.476,
"latestPrice": 4202.5,
"preClose": 4204.75,
"volume": "557570",
"open": 4189,
"high": 4221.75,
"low": 4186.5,
"marketStatus": "Trading",
"preSettlement": 4204.75,
"minTick": 0.25
}Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeFuture. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeFuture(ISet<string>? symbols = null)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeFuture(new HashSet<string> { "ES2609" });Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe to Market Depth
Operation
PushClient.SubscribeDepthQuote. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeDepthQuote(ISet<string> symbols)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
See the complete market push example and select Depth mode.
Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callback
DepthQuoteChange(QuoteDepthData data). See the full field table.
Protobuf JSON representation
{
"symbol": "AAPL",
"timestamp": "1676993368405",
"ask": {
"price": [149.69, 149.70, 149.71],
"volume": ["100", "200", "185"]
},
"bid": {
"price": [149.68, 149.67, 149.66],
"volume": ["84", "100", "100"]
}
}For field types, see the DepthQuoteChange field table.
Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeDepthQuote. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeDepthQuote(ISet<string>? symbols = null)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeDepthQuote(new HashSet<string> { "AAPL" });Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe to Bars
Operation
PushClient.SubscribeKline. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeKline(ISet<string> symbols)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
See the complete market push example and select Kline mode.
Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callback
KlineChange(KlineData data). See the full field table.
Protobuf JSON representation
{
"symbol": "AAPL",
"time": "1712584560000",
"open": 168.9779,
"high": 169.0015,
"low": 168.9752,
"close": 169.0,
"avg": 168.778,
"volume": "3664",
"count": 114,
"amount": 617820.6508,
"serverTimestamp": "1712584569746"
}For field types, see the KlineChange field table.
Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeKline. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeKline(ISet<string>? symbols = null)Parameters
symbols must implement the generic ISet interface with string elements; null on cancellation means all symbols for that subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeKline(new HashSet<string> { "AAPL" });Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe to Whole-Market Data
Operation
PushClient.SubscribeMarketQuote. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeMarketQuote(Market market, QuoteSubject subject)Parameters
market and QuoteSubject are required; cancellation must match the subscription subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.SubscribeMarketQuote(Market.US, QuoteSubject.Quote);Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callbacks
The exact data callback depends on QuoteSubject: Quote maps to the QuoteChange / QuoteAskBidChange field tables; Option maps to the OptionChange / OptionAskBidChange field tables; Future maps to the FutureChange / FutureAskBidChange field tables; QuoteDepth maps to the DepthQuoteChange field table; TradeTick maps to the TradeTickChange field table or FullTickChange field table according to UseFullTick; Kline maps to the KlineChange field table; StockTop maps to the StockTopPush field table; and OptionTop maps to the OptionTopPush field table.
Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeMarketQuote. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeMarketQuote(Market market, QuoteSubject subject)Parameters
market and QuoteSubject are required; cancellation must match the subscription subject.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeMarketQuote(Market.US, QuoteSubject.Quote);Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe Stock Rankings
Operation
PushClient.SubscribeStockTop. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeStockTop(Market market, ISet<Indicator>? indicators = null)Parameters
market is required; indicators may be null and otherwise convert to indicator-name values.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.SubscribeStockTop(Market.US);Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callback
StockTopPush(StockTopData data). See the full field table.
Protobuf JSON representation
{
"market": "US",
"timestamp": "1687271010482",
"topData": [
{
"targetName": "changeRate",
"item": [
{"symbol": "ICAD", "latestPrice": 1.63, "targetValue": 0.393162}
]
},
{
"targetName": "volume",
"item": [
{"symbol": "TSLA", "latestPrice": 263.21, "targetValue": 40190416}
]
}
]
}Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeStockTop. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeStockTop(Market market, ISet<Indicator>? indicators = null)Parameters
market is required; indicators may be null and otherwise convert to indicator-name values.
Return
Return: uint request ID. Subscription and cancellation results arrive in the SubscribeEnd / CancelSubscribeEnd full field table.
Example
uint requestId = client.CancelSubscribeStockTop(Market.US);Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Subscribe to Option Market Data Rankings
Operation
PushClient.SubscribeOptionTop. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint SubscribeOptionTop(Market market, ISet<Indicator>? indicators = null)Parameters
market is required; indicators may be null and otherwise convert to indicator-name values.
Return
Return: uint request ID. Subscribe completion arrives in SubscribeEnd; cancellation completion arrives in CancelSubscribeEnd.
Example
uint requestId = client.SubscribeOptionTop(Market.US);Subscription completion callback
SubscribeEnd(int id, string subject, string result)
Data callback
OptionTopPush(OptionTopData data). See the full field table.
Protobuf JSON representation
{
"market": "US",
"timestamp": "1687277160445",
"topData": [
{
"targetName": "volume",
"item": [
{
"symbol": "SPY",
"expiry": "20230620",
"strike": "435.0",
"right": "PUT",
"totalVolume": 212478
}
]
}
]
}Related APIs
See Callbacks and the Streaming overview.
Cancel
Operation
PushClient.CancelSubscribeOptionTop. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint CancelSubscribeOptionTop(Market market, ISet<Indicator>? indicators = null)Parameters
market is required; indicators may be null and otherwise convert to indicator-name values.
Return
Return: uint request ID. Subscribe completion arrives in SubscribeEnd; cancellation completion arrives in CancelSubscribeEnd.
Example
uint requestId = client.CancelSubscribeOptionTop(Market.US);Cancellation completion callback
CancelSubscribeEnd(int id, string subject, string result)
Related APIs
See Callbacks and the Streaming overview.
Get Subscribed Symbols
Operation
PushClient.GetSubscribedSymbols. Subscription, cancellation, or subscription-state query command on an established channel. A successful write is not server confirmation.
Request
uint GetSubscribedSymbols()Parameters
No parameters; queries quote-symbol subscriptions on the current connection.
Return
Return: uint request ID. Completion arrives in the GetSubscribedSymbolEnd full field table, but that callback parameter has no ID, so the return value cannot correlate the query result. Issue only one such query at a time on a connection, or serialize queries in the application.
Example
uint requestId = client.GetSubscribedSymbols();
// GetSubscribedSymbolEnd returns only SubscribedSymbol, not requestId.Query completion callback
GetSubscribedSymbolEnd(SubscribedSymbol subscribedSymbol). See the full field table.
Related APIs
See Callbacks and the Streaming overview.
Updated about 1 month ago
