.NET
Overview
Overview of SSI FastConnect .NET SDK — REST API and WebSocket streaming
.NET SDK for SSI securities trading platform. Supports REST API and WebSocket streaming, using async/await throughout.
Requirements: .NET 8.0+
Source code: github.com/SSI-Securities-Inc/ssi-sdk-dotnet
Package: SSIDeveloper.FastConnect.Sdk (NuGet)
Installation
dotnet add package SSIDeveloper.FastConnect.SdkClient Architecture
The SDK uses a modular architecture with 4 specialized clients:
| Client | Description | Requires |
|---|---|---|
AuthClient | Authentication & token management | Config |
DataClient | Market data (OHLC, indexes, securities) | AuthClient (no OTP needed) |
TradingClient | Trading + portfolio + account | AuthClient (OTP required) |
StreamClient | Realtime streaming via WebSocket | AuthClient (OTP required) |
Initialization flow:
Config → AuthClient → AuthenticateAsync(otp) → DataClient / TradingClient / StreamClientAuthClient is the root client — manages the REST client and tokens, and implements IDisposable. DataClient, TradingClient, and StreamClient all receive AuthClient as a parameter and share the same HTTP connection. All API methods are async and return Task/Task<T>.
Services provided by each client:
| Client | Service | Access | Description |
|---|---|---|---|
AuthClient | TokenManager | auth.TokenManager | Authentication, OTP, token refresh |
DataClient | MarketDataService | data.MarketData | OHLC, indexes, securities |
TradingClient | TradingService | trading.Trading | Place/modify/cancel orders, max buy/sell, conditional orders (FCO) |
TradingClient | AccountService | trading.Account | Account information |
TradingClient | PortfolioService | trading.Portfolio | Balances, positions, order book, PPMMR |
StreamClient | StreamingService | stream.Streaming | Subscribe/unsubscribe realtime data |
Quick Start
Market data only (no OTP needed)
using SsiSdk;
var config = new Config("YOUR_CLIENT_ID")
{
ApiKey = "YOUR_API_KEY",
ApiSecret = "YOUR_API_SECRET",
};
using var auth = new AuthClient(config);
await auth.AuthenticateAsync();
var data = new DataClient(auth);
var ohlc = await data.MarketData.GetOhlc1MinuteAsync("SSI");
Console.WriteLine($"Candles: {ohlc.Count}");Trading (OTP required)
using SsiSdk;
var config = new Config("YOUR_CLIENT_ID")
{
ApiKey = "YOUR_API_KEY",
ApiSecret = "YOUR_API_SECRET",
PrivateKey = "YOUR_PRIVATE_KEY",
};
using var auth = new AuthClient(config);
await auth.AuthenticateAsync("YOUR_OTP");
var trading = new TradingClient(auth);
var accounts = await trading.Account.GetAccountInfoAsync();
Console.WriteLine($"Accounts: {accounts.Count}");
var result = await trading.Trading.PlaceLimitOrderAsync("YOUR_ACCOUNT_NO", "SSI", OrderSide.Buy, 100, 66000);
Console.WriteLine($"Order ID: {result.OrderId}, Status: {result.Status}");Realtime streaming (OTP required)
using SsiSdk;
using SsiSdk.Models;
var config = new Config("YOUR_CLIENT_ID")
{
ApiKey = "YOUR_API_KEY",
ApiSecret = "YOUR_API_SECRET",
PrivateKey = "YOUR_PRIVATE_KEY",
};
using var auth = new AuthClient(config);
await auth.AuthenticateAsync("YOUR_OTP");
using var stream = new StreamClient(auth);
stream.Streaming.SetOnData(msg =>
{
if (msg is TradeMessage trade)
Console.WriteLine($"[TRADE] {trade.Symbol} | {trade.Price} | {trade.Quantity}");
});
await stream.ConnectAsync();
await stream.Streaming.SubscribeSymbolTradeAsync(["SSI"]);
await stream.WaitAsync();Use Case Mapping
| Use case | Client | Authentication |
|---|---|---|
| Market data (OHLC, indexes, securities) | DataClient | No OTP needed |
| Place/modify/cancel orders, account, portfolio | TradingClient | OTP required |
| Realtime WebSocket streaming | StreamClient | OTP required |
Documentation Navigation
- Installation & Configuration: environment, NuGet package,
Config. - Client Classes:
AuthClient,DataClient,TradingClient,StreamClient— initialization and usage. - Service Classes: detailed API methods for each service. It includes batch orders, real-time index data and the Trading WebSocket.
- Configuration: full
Configreference, including the batch limit, retry, rate limit andTradingWsOptions. - Error Handling: the exception tree (including Smart OTP, rate limit,
DuplicateRequestException,TradingWsError) and handling patterns. - Enums: constants like
OrderSide,OrderType,Board, ... - Models: response data models, batch order models and streaming message types.