Go

Enums & Constants

Enum types and constants in Go SDK

Enums are organized by package:

import (
    "github.com/SSI-Securities-Inc/ssi-sdk-go/v3/account"
    "github.com/SSI-Securities-Inc/ssi-sdk-go/v3/market"
    "github.com/SSI-Securities-Inc/ssi-sdk-go/v3/stream"
    "github.com/SSI-Securities-Inc/ssi-sdk-go/v3/trading"
)

An unknown value sent by the server is kept as its raw string; the SDK does not fail on it. Use the *FromValue helpers below to check whether a value is known.

OrderSide

Package: trading

ValueCodeDescription
OrderSideBuy"B"Buy
OrderSideSell"S"Sell

OrderType

Package: trading

ValueCodeDescription
OrderTypeLO"LO"Limit Order
OrderTypeMTL"MTL"Market To Limit
OrderTypeMP"MP"Market Price
OrderTypeATO"ATO"At The Open
OrderTypeATC"ATC"At The Close
OrderTypeMOK"MOK"Match Or Kill
OrderTypeMAK"MAK"Match And Kill
OrderTypePLO"PLO"Post Lunch Order

OrderStatus

Package: trading

ValueCodeDescription
OrderStatusPending"PD"Pending
OrderStatusPendingApproval"WA"Waiting for approval
OrderStatusReady"RS"Ready
OrderStatusSent"SD"Sent
OrderStatusQueued"QU"Queued
OrderStatusFilled"FF"Fully filled
OrderStatusPartialFilled"PF"Partially filled
OrderStatusPartialCancelled"FFPC"Partially filled + cancelled remainder
OrderStatusPendingModify"WM"Pending modification
OrderStatusPendingCancel"WC"Pending cancellation
OrderStatusCancelled"CL"Cancelled
OrderStatusRejected"RJ"Rejected
OrderStatusExpired"EX"Expired
OrderStatusPreSession"IAV"Pre-session
OrderStatusSOI"SOI"Reported by the order engines (named after its code; the SDK gives no further meaning)
OrderStatusPAS"PAS"Reported by the order engines (named after its code)
OrderStatusCPL"CPL"Reported by the order engines (named after its code)
OrderStatusRequested"RQ"Request received (FCO engine)
OrderStatusError"ERR"Error reported by the engine

Board

Package: market

ValueCodeDescription
BoardHOSE"HOSE"HOSE exchange
BoardHNX"HNX"HNX exchange
BoardUPCOM"UPCOM"UPCOM exchange
BoardDerivatives"DERIVATIVES"Derivatives. Appears in stream and master data only; REST market-data calls accept HOSE / HNX / UPCOM

market.BoardFromValue(raw) returns (Board, bool).

Timeframe

Package: market

ValueCodeDescription
TimeframeMinute1"1m"1 minute
TimeframeMinute3"3m"3 minutes
TimeframeMinute5"5m"5 minutes
TimeframeMinute15"15m"15 minutes
TimeframeHour1"1h"1 hour
TimeframeDay1"1d"1 day
TimeframeWeek1"1w"1 week
TimeframeMonth1"1M"1 month

Note. 1w and 1M are defined in the SDK, but the server rejects them (code 400210, ErrTimeframeNotSupported). The timeframes the server accepts (market.AllowedTimeframes) are 1m, 3m, 5m, 15m, 1h and 1d.

AccountType

Package: account

ValueCodeDescription
AccountTypeEquity"Cash"Cash (equity) account
AccountTypeEquityMargin"Margin"Margin account
AccountTypeDerivative"Derivative"Derivative account

Account.AccountType is *account.AccountType: nil when the server did not send it, and an unknown value is kept as its raw string. account.AccountTypeFromValue(raw) returns (AccountType, bool).

FCOType

Conditional order type (Flexible Conditional Order).

Package: trading

ValueCodeDescription
FCOTypeGTD"gtd"Good Till Date
FCOTypeStop"stop"Stop Market
FCOTypeStopLimit"stop_limit"Stop Limit
FCOTypeTrailingStop"trailing_stop"Trailing Stop Market
FCOTypeTrailingStopLimit"trailing_stop_limit"Trailing Stop Limit
FCOTypeOCO"oco"One Cancels the Other
FCOTypeBullBear"bullbear"Bull Bear order

FCOOperator

Comparison operator used to trigger Stop / Stop Limit orders.

Package: trading

ValueCodeDescription
FCOOperatorGreater"greater"Greater than (>)
FCOOperatorGreaterOrEqual"greater_or_equal"Greater than or equal (>=)
FCOOperatorLesser"lesser"Less than (<)
FCOOperatorLesserOrEqual"lesser_or_equal"Less than or equal (<=)
FCOOperatorEqual"equal"Equal (=)

The server may send the operator as a number. trading.ParseFCOOperator(raw) accepts the name or the number 0-4 (0 greater_or_equal, 1 equal, 2 greater, 3 lesser, 4 lesser_or_equal) and returns a FCOOperator.

FCOStatus

Processing status of a conditional order.

Package: trading

ValueCodeDescription
FCOStatusInit"INIT"Newly created
FCOStatusWait"WAIT"Waiting to trigger
FCOStatusTri"TRI"Triggered
FCOStatusTrit"TRIT"Triggered successfully
FCOStatusTer"TER"Terminated
FCOStatusFis"FIS"Finished
FCOStatusWc"WC"Pending cancel
FCOStatusExp"EXP"Expired
FCOStatusErr"ERR"Error

Parsing helpers

Each returns (T, bool); matching is case-insensitive and an unknown value gives false.

HelperPackageReturns
OrderSideFromValuetradingOrderSide
OrderTypeFromValuetradingOrderType
OrderStatusFromValuetradingOrderStatus
FCOTypeFromValuetradingFCOType
FCOOperatorFromValuetradingFCOOperator
FCOStatusFromValuetradingFCOStatus
BoardFromValuemarketBoard
AccountTypeFromValueaccountAccountType

Stream enums

Package: stream

TypeValues
StreamingMethodStreamingMethodSubscribe ("subscribe"), StreamingMethodUnsubscribe ("unsubscribe"), StreamingMethodPingPong ("ping_pong"), StreamingMethodListSubscription ("list_subscription")
StreamingChannelStreamingChannelData ("DATA"), StreamingChannelHeartbeat ("HEARTBEAT"), StreamingChannelTrading ("TRADING")
StreamingTypeStreamingTypeOrder ("orderEvent"), StreamingTypeOrderMatch ("orderMatchEvent"), StreamingTypePortfolio ("clientPortfolioEvent")
DataTopic (prefix)DataTopicQuote ("quote."), DataTopicTrade ("trade."), DataTopicOddLot ("oddlot."), DataTopicMarket ("market."), DataTopicRoom ("room."), DataTopicPut ("put."), DataTopicIndexSummary ("indexsummary.")
DataTypeDataTypeQuote, DataTypeTrade, DataTypeOddLot, DataTypeMarket, DataTypeRoom, DataTypePut, DataTypeIndexSummary (the topic name without the dot)
Topicstream.TopicMarketFlag ("market.flag"), also ssisdk.TopicMarketFlag

FCO events arrive on the same channel as order events (order.<account>) with eventType fcoEvent; there is no separate FCO subscribe method (see Trading streaming).

Stream intervals

Type market.Timeframe, valid only on trade and trade.index topics (see Index streaming):

ValueCodeDescription
stream.IntervalTick"tick"Every tick
stream.IntervalMinute1"1m"1-minute candle
stream.IntervalMinute5"5m"5-minute candle
stream.StreamIntervalAll"*"Used internally for SubscribeIndex / SubscribeBoard (@*). Unconfirmed against a live server

Any other interval gives a *ValidationError.

Constants

Package: ssisdk (root). Durations are integer milliseconds.

ConstantValueMeaning
DefaultSize / DefaultPage1000 / 1Default page size and page number of the paged market-data calls
MaxBatchOrders20Default batch limit, see Config.MaxBatchOrders
MaxClientRequestIDLength20Longest ClientRequestID
HTTPStatusConflict409Maps to DuplicateRequestError
TokenExpirySkewMs30000A token expiring within this window counts as expired
SmartOTPPendingStatus / SmartOTPPendingCode202 / 401114Smart OTP approval pending
SmartOTPTerminalCodes401113, 401115, 401116Smart OTP rejected / not found / foreign transaction
RefreshReauthCodes401101-401104, 401106-401108A refresh was refused, a new OTP is needed
RateLimitMaxRetries3Retries of a rate-limited read request
RateLimitDefaultWaitMs1000First wait (doubles each retry)
RateLimitMaxWaitMs30000A longer wait returns *RateLimitError instead
WSReconnectMaxDelayMs60000Cap of the stream reconnect backoff
WSRateLimitBackoffMs30000Minimum wait after a 429 on connect
WSTokenRefreshLeadMs60000The stream reconnects about this long before the token expires
WSServerMaxConnections10Sockets allowed per client (more gives 429)
WSMaxFrameBytes4000Largest request frame; the SDK splits longer requests (server limit is 4096)
TopicMarketFlag"market.flag"Session flag topic
TradingWSPath"/ws/v3/trading"Path of the Trading WebSocket

Synthetic routes used internally by the stream parser: @ack, @error, @list_subscription, @id.

Server error codes are named constants of type ServerErrorCode; see Error Handling.

Package Summary

PackageImportContains
trading.../ssi-sdk-go/v3/tradingOrderSide, OrderType, OrderStatus, FCOType, FCOOperator, FCOStatus, the *FromValue helpers, ParseFCOOperator
market.../ssi-sdk-go/v3/marketBoard, Timeframe, AllowedTimeframes, BoardFromValue
account.../ssi-sdk-go/v3/accountAccountType, AccountTypeFromValue
stream.../ssi-sdk-go/v3/streamStreamingMethod, StreamingChannel, StreamingType, DataTopic, DataType, Interval*
ssisdk (root).../ssi-sdk-go/v3Protocol constants, ServerErrorCode

On this page