C# SDK
Tiger Brokers OpenAPI C# SDK for market data, trading, account management, and real-time push notifications.
- Requires .NET 10.0, C# 13.0
- Recommended: Visual Studio 2022
- Source repository: openapi-cs-sdk
- NuGet package: TigerBrokers.OpenAPI
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 = "/path/to/tiger_openapi_config.properties"
};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 | Timezone | No | HK_ZONE |
| ConfigFilePath | Path to properties file | No | - |
Quick Start
using TigerOpenAPI.Common;
using TigerOpenAPI.Quote;
using TigerOpenAPI.Quote.Response;
using TigerOpenAPI.Quote.Model;
// Create config
TigerConfig config = new TigerConfig()
{
ConfigFilePath = "/path/to/tiger_openapi_config.properties",
Language = Language.en_US
};
// Create quote client
QuoteClient quoteClient = new QuoteClient(config);
// Get market status
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);Updated 4 days ago
