server

package
v0.0.0-...-8d88297 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR   = 7
	SUCCESS = 0
)
View Source
const DefaultBindAddress = "localhost:8888"

Variables

This section is empty.

Functions

func Fail

func Fail(c *gin.Context)

func FailWithDetailed

func FailWithDetailed(data interface{}, message string, c *gin.Context)

func FailWithMessage

func FailWithMessage(message string, c *gin.Context)

func GetOutboundIP

func GetOutboundIP() (net.IP, error)

func Ok

func Ok(c *gin.Context)

func OkWithData

func OkWithData(data interface{}, c *gin.Context)

func OkWithDetailed

func OkWithDetailed(data interface{}, message string, c *gin.Context)

func OkWithMessage

func OkWithMessage(message string, c *gin.Context)

func PingUntil

func PingUntil(ctx context.Context, interval time.Duration, baseURL string, callback func())

func Result

func Result(code int, data interface{}, msg string, c *gin.Context)

Types

type Bots

type Bots struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	DataType    string `json:"dataType"`
	DataVersion string `json:"dataVersion"`
	DataDesc    string `json:"dataDesc"`
}

type Coin

type Coin struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Base  string `json:"base"`
	Quote string `json:"quote"`
}

type Request

type Request struct {
	Code  string `json:"code"`
	Price int    `json:"price"`
	Size  int    `json:"size"`
}

type Response

type Response struct {
	Code int         `json:"code"`
	Data interface{} `json:"data"`
	Msg  string      `json:"msg"`
}

type Server

type Server struct {
	Config        *bbgo.Config
	Environ       *bbgo.Environment
	Trader        *bbgo.Trader
	Setup         *Setup
	OpenInBrowser bool
	// contains filtered or unexported fields
}

func (*Server) Run

func (s *Server) Run(ctx context.Context, bindArgs ...string) error

func (*Server) RunWithListener

func (s *Server) RunWithListener(ctx context.Context, l net.Listener) error

type Setup

type Setup struct {
	// Context is the trader context
	Context context.Context

	// Cancel is the trader context cancel function you want to cancel
	Cancel context.CancelFunc

	// Token is used for setup api authentication
	Token string

	BeforeRestart func()
}

Jump to

Keyboard shortcuts

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