Documentation
¶
Overview ¶
Package server provides a ready-to-use HTTP API server that can be wired with any github.com/smallfish06/krsec/pkg/broker.Broker implementation.
Use New to create a server with externally supplied broker instances, then call Server.Run to start listening. The server exposes REST endpoints for quotes, orders, accounts, instruments, and an auto-generated OpenAPI spec.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunFromConfigFile ¶ added in v0.7.0
RunFromConfigFile loads a config.yaml and starts the server. This is the simplest way to embed krsec in another project.
Types ¶
type Account ¶
type Account struct {
ID string
Name string
Broker string
Sandbox bool
Credentials broker.Credentials
}
Account describes an externally supplied account/broker binding.
type Options ¶
type Options struct {
Host string
Port int
Accounts []Account
Brokers map[string]broker.Broker // account_id -> broker implementation
}
Options configures the public API server. External users can provide their own broker implementations through Brokers.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the internal HTTP server and exposes a stable public API.