Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultKISProxyCachePolicy ¶ added in v0.15.0
func DefaultKISProxyCachePolicy(req KISProxyCacheRequest) (time.Duration, bool)
DefaultKISProxyCachePolicy caches public KIS quotation/reference endpoints and excludes trading, order, and auth-style endpoints.
Types ¶
type AuthTokenRequest ¶
type AuthTokenRequest struct {
Broker string `json:"broker"`
Credentials broker.Credentials `json:"credentials"`
Sandbox bool `json:"sandbox"`
}
AuthTokenRequest represents an auth token request
type BrokerWithExtras ¶
BrokerWithExtras is a test-oriented interface for server handlers.
type KISProxyCacheOptions ¶ added in v0.15.0
type KISProxyCacheOptions struct {
Policy KISProxyCachePolicy
MaxEntries int
StaleRetention time.Duration
}
KISProxyCacheOptions configures the in-process KIS proxy cache.
type KISProxyCachePolicy ¶ added in v0.15.0
type KISProxyCachePolicy func(KISProxyCacheRequest) (time.Duration, bool)
KISProxyCachePolicy decides whether a KIS proxy request should be cached and returns its soft TTL when cacheable.
type KISProxyCacheRequest ¶ added in v0.15.0
type KISProxyCacheRequest struct {
Method string
Path string
TRID string
AccountID string
Params map[string]string
}
KISProxyCacheRequest describes a normalized KIS proxy request for cache policy decisions. Params is a copy and can be inspected or modified by policy code.
type Response ¶
type Response struct {
OK bool `json:"ok"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Broker string `json:"broker,omitempty"`
}
Response represents a standard API response
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server
func New ¶
New creates a new server instance. This constructor wires built-in brokers from config (currently KIS, Kiwoom).
func NewWithBrokers ¶
func NewWithBrokers(host string, port int, accounts []config.AccountConfig, brokers map[string]broker.Broker) *Server
NewWithBrokers creates a server with externally provided brokers. This constructor is used by the public pkg/server package for OSS extensibility.
func NewWithBrokersOptions ¶ added in v0.15.0
func NewWithBrokersOptions( host string, port int, accounts []config.AccountConfig, brokers map[string]broker.Broker, opts ServerOptions, ) *Server
func NewWithLogger ¶ added in v0.13.0
NewWithLogger creates a new server instance with a custom logger.
type ServerOptions ¶ added in v0.15.0
type ServerOptions struct {
Logger *slog.Logger
KISProxyCache KISProxyCacheOptions
}