service

package
v0.43.4 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot interface {
	Start() error
	Stop()
	GetTraderDetails() string
}

Bot is the generic bot interface.

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse is used when something went wrong.

type PricingEngine

type PricingEngine interface {
	GetPrice(pricecfg ppconfig.PriceConfig) (pi ppservice.PriceResponse, err error)
}

PricingEngine is the source of price information from the price proxy.

type Service

type Service struct {
	*httprouter.Router
	// contains filtered or unexported fields
}

Service is the HTTP service.

func NewService

func NewService(config config.Config, pe PricingEngine, ws *wallets.Handler) (s *Service, err error)

NewService creates a new service instance (with optional mocks for test purposes).

func (*Service) Start

func (s *Service) Start() error

Start starts the HTTP server, and returns the server's exit error (if any).

func (*Service) Status

func (s *Service) Status(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

Status is an endpoint to show the service is up (always returns succeeded=true).

func (*Service) Stop

func (s *Service) Stop()

Stop stops the HTTP service.

func (*Service) TradersSettlement added in v0.36.0

func (s *Service) TradersSettlement(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

TradersSettlement is an endpoint to show details of all active traders.

type SimpleResponse

type SimpleResponse struct {
	Success bool `json:"success"`
}

SimpleResponse is used to show if a request succeeded or not, without giving any more detail.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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