server

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

func RunFromConfigFile(path string) error

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.

func New

func New(opts Options) *Server

New creates a server with externally supplied broker implementations.

func (*Server) App

func (s *Server) App() *fuego.Server

App returns the underlying Fuego server for embedding or custom route composition.

func (*Server) Run

func (s *Server) Run() error

Run starts the HTTP server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL