C# SDK
The Tiger OpenAPI C# SDK provides market data, trading, account management, and real-time streaming. These pages follow the SDK 1.2.3 source.
- Target framework: .NET 10.0
- Recommended: Visual Studio 2022
- Source repository: openapi-cs-sdk
- NuGet package: TigerBrokers.OpenAPI
Documentation
Invocation model
The uppercase members of QuoteApiService and TradeApiService are server operation-name constants, not callable methods. Except for five option-exercise convenience methods, HTTP APIs are invoked by putting an operation, request model, and exact response type in TigerRequest<TResponse>, then calling QuoteClient.ExecuteAsync or TradeClient.ExecuteAsync.
Installation
dotnet add package TigerBrokers.OpenAPIOr search for TigerBrokers.OpenAPI in the Visual Studio NuGet Package Manager.
Configuration
Option 1: Properties file
TigerConfig config = new TigerConfig()
{
ConfigFilePath = "your_config_directory_path"
};File format:
tiger_id=your_developer_id
private_key=your_rsa_private_key
default_account=your_trading_accountOption 2: Code
TigerConfig config = new TigerConfig()
{
TigerId = "your_tiger_id",
PrivateKey = "your_rsa_private_key",
DefaultAccount = "your_trading_account",
Language = Language.en_US,
TimeZone = CustomTimeZone.HK_ZONE
};Config options
| Field | Description | Required | Default |
|---|---|---|---|
| TigerId | Developer ID | Yes | - |
| PrivateKey | RSA private key | Yes | - |
| DefaultAccount | Trading account | No | - |
| Language | Language (zh_CN/en_US) | No | zh_CN |
| TimeZone | Time zone | No | HK_ZONE |
| ConfigFilePath | Path to properties file | No | - |
Quick Start
using TigerOpenAPI.Common;
using TigerOpenAPI.Common.Enum;
using TigerOpenAPI.Config;
using TigerOpenAPI.Model;
using TigerOpenAPI.Quote;
using TigerOpenAPI.Quote.Response;
using TigerOpenAPI.Quote.Model;
// Create config
TigerConfig config = new TigerConfig()
{
ConfigFilePath = "your_config_directory_path",
Language = Language.en_US
};
// Create quote client
QuoteClient quoteClient = new QuoteClient(config);
// Get market state
TigerRequest<MarketStateResponse> request = new TigerRequest<MarketStateResponse>()
{
ApiMethodName = QuoteApiService.MARKET_STATE,
ModelValue = new QuoteMarketModel() { Market = Market.US }
};
MarketStateResponse? response = await quoteClient.ExecuteAsync(request);
Console.WriteLine(response?.Data);Updated 12 days ago
Did this page help you?
