Overview
Overview of SSI FastConnect Go SDK — REST API and WebSocket streaming
Go SDK for SSI securities trading platform. Supports REST API and WebSocket streaming.
Requirements: Go 1.22+
Version: 3.3.2 (ssisdk.Version)
Source code: github.com/SSI-Securities-Inc/ssi-sdk-go
Installation
go get github.com/SSI-Securities-Inc/ssi-sdk-go/v3Client Architecture
The SDK uses a modular architecture with 4 specialized clients:
| Client | Description | Requires |
|---|---|---|
Auth | Authentication & token management | Config |
Data | Market data (OHLC, indexes, securities) | Auth (no OTP needed) |
Trading | Trading + portfolio + account | Auth (OTP required) |
Stream | Realtime streaming via WebSocket | Auth (OTP required) |
Initialization flow:
Config → Auth → Authenticate(otp) → Data / Trading / StreamAuth is the root client — manages REST client and tokens. Data, Trading, and Stream all receive *Auth as a parameter and share the same HTTP connection.
Services provided by each client:
| Client | Service | Access | Description |
|---|---|---|---|
Auth | TokenManager | auth.TokenManager | Authentication, OTP, token refresh |
Data | MarketDataService | data.MarketData | OHLC, indexes, securities, master data, corporate actions |
Trading | TradingService | t.Trading | Place/modify/cancel orders, batch place/cancel, max buy/sell, conditional orders (FCO) |
Trading | AccountService | t.Account | Account information |
Trading | PortfolioService | t.Portfolio | Balances, positions, order book, PPMMR |
Stream | StreamingService | s.Streaming | Subscribe/unsubscribe realtime data (symbols, indexes, session flags) and order events |
Besides these 4 clients, the tradingws package has a Trading WebSocket client for placing orders and querying over WebSocket. It sits outside the facades, see Trading WebSocket.
Examples in these docs use placeholders (
YOUR_...) and read the OTP from an environment variable. Never hard-code OTPs, keys or account numbers in source code.
Quick Start
Market data only (no OTP needed)
package main
import (
"fmt"
"log"
"github.com/SSI-Securities-Inc/ssi-sdk-go/v3/ssi"
)
func main() {
config := ssi.NewConfig("YOUR_CLIENT_ID")
config.APIKey = "YOUR_API_KEY"
config.APISecret = "YOUR_API_SECRET"
auth := ssi.NewAuth(config)
defer auth.Close()
if _, err := auth.Authenticate(""); err != nil {
log.Fatal(err)
}
data := ssi.NewData(auth)
ohlc, err := data.MarketData.GetOHLC1Minute("SSI")
if err != nil {
log.Fatal(err)
}
fmt.Println(ohlc)
}Trading (OTP required)
package main
import (
"fmt"
"log"
"os"
"github.com/SSI-Securities-Inc/ssi-sdk-go/v3/ssi"
"github.com/SSI-Securities-Inc/ssi-sdk-go/v3/trading"
)
func main() {
config := ssi.NewConfig("YOUR_CLIENT_ID")
config.APIKey = "YOUR_API_KEY"
config.APISecret = "YOUR_API_SECRET"
config.PrivateKey = "YOUR_PRIVATE_KEY"
auth := ssi.NewAuth(config)
defer auth.Close()
if _, err := auth.Authenticate(os.Getenv("SSI_OTP")); err != nil { // YOUR_OTP
log.Fatal(err)
}
t := ssi.NewTrading(auth)
accounts, err := t.Account.GetAccountInfo()
if err != nil {
log.Fatal(err)
}
fmt.Println(accounts)
// This is a real order: only run it on an environment and account you are allowed to trade on.
result, err := t.Trading.PlaceLimitOrder("YOUR_ACCOUNT_NO", "SSI", trading.OrderSideBuy, 100, 66000)
if err != nil {
log.Fatal(err)
}
fmt.Println(result)
}Realtime streaming (OTP required)
package main
import (
"fmt"
"log"
"os"
"github.com/SSI-Securities-Inc/ssi-sdk-go/v3/ssi"
"github.com/SSI-Securities-Inc/ssi-sdk-go/v3/stream"
)
func main() {
config := ssi.NewConfig("YOUR_CLIENT_ID")
config.APIKey = "YOUR_API_KEY"
config.APISecret = "YOUR_API_SECRET"
config.PrivateKey = "YOUR_PRIVATE_KEY"
auth := ssi.NewAuth(config)
defer auth.Close()
if _, err := auth.Authenticate(os.Getenv("SSI_OTP")); err != nil { // YOUR_OTP
log.Fatal(err)
}
s := ssi.NewStream(auth)
defer s.Disconnect()
s.Streaming.SetOnData(func(msg interface{}) {
switch m := msg.(type) {
case *stream.TradeMessage:
fmt.Printf("[TRADE] %s | %.0f | %d\n", m.Symbol, m.Price, m.Quantity)
}
})
if err := s.Connect(); err != nil {
log.Fatal(err)
}
s.Streaming.SubscribeSymbolTrade([]string{"SSI"}, nil)
s.Wait(nil)
}Use Case Mapping
| Use case | Client | Authentication |
|---|---|---|
| Market data (OHLC, indexes, securities) | Data | No OTP needed |
| Place/modify/cancel orders, account, portfolio | Trading | OTP required |
| Realtime WebSocket streaming | Stream | OTP required |
| Orders / queries over WebSocket | tradingws.TradingWS | OTP required |
Documentation Navigation
- Installation & Configuration: environment, packages,
Config. - Client Classes:
Auth,Data,Trading,Stream— initialization and usage. - Service Classes: detailed API methods for each service, including batch orders, index streaming and the Trading WebSocket.
- Configuration: full
Configparameter reference. - Error Handling: error types and handling patterns.
- Enums: constants like
OrderSide,OrderType,Board, ... - Models: response data models and streaming message types.