base

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArgQuery = 1
	ArgBody  = 2
)

Variables

View Source
var (
	IndsCache = make([]map[string]interface{}, 0)
)

Functions

func ArrKLines

func ArrKLines(klines []*banexg.Kline) [][]float64

func CalcInd

func CalcInd(name string, kline [][]float64, params []float64) (interface{}, error)

func ErrHandler

func ErrHandler(c *fiber.Ctx, err error) error

func GetExg

func GetExg(name, market, ctType string, load bool) (banexg.BanExchange, *errs.Error)

func InitExg

func InitExg(exchange banexg.BanExchange) *errs.Error

func RegApiKline

func RegApiKline(api fiber.Router)

func RegApiWebsocket

func RegApiWebsocket(api fiber.Router)

func RunReceiver

func RunReceiver()

func SetKlineSub

func SetKlineSub(client *WsClient, isSub, lock bool, keys ...string)

func VerifyArg

func VerifyArg(c *fiber.Ctx, out interface{}, from int) error

Types

type AdvInd

type AdvInd struct {
	*DrawInd
	Calc func(kline [][]float64, params []float64) (interface{}, error)
}

type BadField

type BadField struct {
	Field string
	Tag   string
	Value interface{}
}

type BadFields

type BadFields struct {
	Items []*BadField
}

func Validate

func Validate(data interface{}) *BadFields

func (*BadFields) Error

func (f *BadFields) Error() string

type DrawInd

type DrawInd struct {
	Name       string
	Title      string
	IsMain     bool
	CalcParams []float64 // 参数
	Figures    []*Figure
	FigureTpl  string // 客户端会使用此模板动态生成Figures
	FigureType string // 默认空,客户端默认line
	// contains filtered or unexported fields
}

func (*DrawInd) Calc

func (d *DrawInd) Calc(kline [][]float64, params []float64) []map[string]float64

func (*DrawInd) ToMap

func (d *DrawInd) ToMap() map[string]interface{}

type Figure

type Figure struct {
	Key       string  `json:"key"`   // tr
	Title     string  `json:"title"` // TR:
	Type      string  `json:"type"`  // tag/line
	BaseValue float64 `json:"baseValue"`
}

type WsClient

type WsClient struct {
	Conn *websocket.Conn
	Subs map[string]bool
	// contains filtered or unexported fields
}

func NewWsClient

func NewWsClient(c *websocket.Conn) *WsClient

func (*WsClient) Close

func (c *WsClient) Close(lock bool)

func (*WsClient) HandleForever

func (c *WsClient) HandleForever()

func (*WsClient) Subscribe

func (c *WsClient) Subscribe(msg map[string]interface{})

func (*WsClient) UnSubscribe

func (c *WsClient) UnSubscribe(msg map[string]interface{})

func (*WsClient) WriteMsg

func (c *WsClient) WriteMsg(msg map[string]interface{})

Jump to

Keyboard shortcuts

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