Quick Start
Prerequisites
- .NET 10 SDK and the
TigerBrokers.OpenAPINuGet package. - A Tiger OpenAPI application, Tiger ID, RSA private key, and token. Trading also requires an account and the relevant market permissions.
- Market data visibility depends on region, account, exchange, and enabled market data access. Use delayed quote operations without real-time market data access.
The configuration exported from the Developer Center takes precedence. You can also use the shared configuration template. For an account that requires a local token file, use the shared token template. Copy the applicable template, remove the .example suffix, replace the placeholders, and never commit credentials. The current C# SDK does not load secret_key from properties; supply institution credentials through the SDK's supported code or request models.
dotnet add package TigerBrokers.OpenAPIusing TigerOpenAPI.Common;
using TigerOpenAPI.Common.Enum;
using TigerOpenAPI.Config;
using TigerOpenAPI.Model;
using TigerOpenAPI.Quote;
using TigerOpenAPI.Quote.Model;
using TigerOpenAPI.Quote.Response;
TigerConfig config = new()
{
ConfigFilePath = "your_config_directory_path",
Language = Language.en_US,
TimeZone = CustomTimeZone.HK_ZONE,
AutoGrabPermission = false
};
QuoteClient quoteClient = new(config);
TigerRequest<MarketStateResponse> request = new()
{
ApiMethodName = QuoteApiService.MARKET_STATE,
ModelValue = new QuoteMarketModel { Market = Market.US }
};
MarketStateResponse? response = await quoteClient.ExecuteAsync(request);
if (response is null || !response.IsSuccess())
throw new InvalidOperationException(response?.Message ?? "empty response");
Console.WriteLine(response.Data);The exact asynchronous signature is Task<T?> ExecuteAsync<T>(TigerRequest<T> request) where T : TigerResponse; the synchronous variant is T? Execute<T>(TigerRequest<T> request). Handle both non-success Code values and null.
Updated about 1 month ago
Did this page help you?
