command

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBufferTooSmall = codec.ErrBufferTooSmall

ErrBufferTooSmall is returned when the provided buffer is too small for encoding or decoding. It is the same error value as codec.ErrBufferTooSmall so identity comparisons work across packages.

Functions

func AppendCommandJSON

func AppendCommandJSON(dst []byte, cmdType CommandType, buf []byte) []byte

AppendCommandJSON decodes buf for cmdType and appends the typed JSON object.

Types

type CancelAll

type CancelAll struct {
	AccountID int
	SymbolID  int
}

func NewCancelAllFromBytes

func NewCancelAllFromBytes(buf []byte) (CancelAll, error)

func (CancelAll) AppendJSON

func (c CancelAll) AppendJSON(dst []byte) []byte

func (CancelAll) CommandType

func (c CancelAll) CommandType() CommandType

func (CancelAll) Encode

func (c CancelAll) Encode(buf []byte) error

func (CancelAll) GetBufferLength

func (c CancelAll) GetBufferLength() int

type CancelOrder

type CancelOrder struct {
	AccountID     int
	ClientOrderID int
}

func NewCancelOrderFromBytes

func NewCancelOrderFromBytes(buf []byte) (CancelOrder, error)

func (CancelOrder) AppendJSON

func (c CancelOrder) AppendJSON(dst []byte) []byte

func (CancelOrder) CommandType

func (c CancelOrder) CommandType() CommandType

func (CancelOrder) Encode

func (c CancelOrder) Encode(buf []byte) error

func (CancelOrder) GetBufferLength

func (c CancelOrder) GetBufferLength() int

type CommandType

type CommandType int
const (
	// Order Commands
	CommandTypeUnknown CommandType = iota
	CommandTypeOrderRiskCheck
	CommandTypeOrderSubmit
	CommandTypeOrderCancel
	CommandTypeCancelAll

	// Account Commands
	CommandTypeQryBalanceSnapshot

	// Data Commands
	CommandTypeReqDepthSnapshot
	CommandTypeReqHistoricalKline
)

func (CommandType) String

func (t CommandType) String() string

type QryBalanceSnapshot

type QryBalanceSnapshot struct {
	AccountID int
}

func NewQryBalanceSnapshotFromBytes

func NewQryBalanceSnapshotFromBytes(buf []byte) (QryBalanceSnapshot, error)

func (QryBalanceSnapshot) AppendJSON

func (q QryBalanceSnapshot) AppendJSON(dst []byte) []byte

func (QryBalanceSnapshot) CommandType

func (q QryBalanceSnapshot) CommandType() CommandType

func (QryBalanceSnapshot) Encode

func (q QryBalanceSnapshot) Encode(buf []byte) error

func (QryBalanceSnapshot) GetBufferLength

func (q QryBalanceSnapshot) GetBufferLength() int

type ReqDepthSnapshot

type ReqDepthSnapshot struct {
	SymbolID int
}

func NewReqDepthSnapshotFromBytes

func NewReqDepthSnapshotFromBytes(buf []byte) (ReqDepthSnapshot, error)

func (ReqDepthSnapshot) AppendJSON

func (r ReqDepthSnapshot) AppendJSON(dst []byte) []byte

func (ReqDepthSnapshot) CommandType

func (r ReqDepthSnapshot) CommandType() CommandType

func (ReqDepthSnapshot) Encode

func (r ReqDepthSnapshot) Encode(buf []byte) error

func (ReqDepthSnapshot) GetBufferLength

func (r ReqDepthSnapshot) GetBufferLength() int

type ReqHistoricalKline

type ReqHistoricalKline struct {
	SymbolID  int
	Interval  common.Interval
	StartTime uint64
	EndTime   uint64
	Limit     int
}

ReqHistoricalKline requests historical candlesticks via the data engine. StartTime/EndTime are nanoseconds; 0 means omit that bound. Limit is the max number of bars (venue-capped); 0 uses the venue default.

func NewReqHistoricalKlineFromBytes

func NewReqHistoricalKlineFromBytes(buf []byte) (ReqHistoricalKline, error)

func (ReqHistoricalKline) AppendJSON

func (r ReqHistoricalKline) AppendJSON(dst []byte) []byte

func (ReqHistoricalKline) CommandType

func (r ReqHistoricalKline) CommandType() CommandType

func (ReqHistoricalKline) Encode

func (r ReqHistoricalKline) Encode(buf []byte) error

func (ReqHistoricalKline) GetBufferLength

func (r ReqHistoricalKline) GetBufferLength() int

type RiskCheck

type RiskCheck struct {
	ClientOrderID int
	AccountID     int
	SymbolID      int
	Side          common.Side
	OrderType     common.OrderType
	TimeInForce   common.TimeInForce
	Price         float64
	Quantity      float64
	Timestamp     uint64 // unix nanoseconds, set by the submitter
}

func NewRiskCheckFromBytes

func NewRiskCheckFromBytes(buf []byte) (RiskCheck, error)

func (RiskCheck) AppendJSON

func (r RiskCheck) AppendJSON(dst []byte) []byte

func (RiskCheck) CommandType

func (r RiskCheck) CommandType() CommandType

func (RiskCheck) Encode

func (r RiskCheck) Encode(buf []byte) error

func (RiskCheck) GetBufferLength

func (r RiskCheck) GetBufferLength() int

type SubmitOrder

type SubmitOrder struct {
	ClientOrderID int
	AccountID     int
	SymbolID      int
	Side          common.Side
	OrderType     common.OrderType
	TimeInForce   common.TimeInForce
	Price         float64
	Quantity      float64
}

func NewSubmitOrderFromBytes

func NewSubmitOrderFromBytes(buf []byte) (SubmitOrder, error)

func (SubmitOrder) AppendJSON

func (s SubmitOrder) AppendJSON(dst []byte) []byte

func (SubmitOrder) CommandType

func (s SubmitOrder) CommandType() CommandType

func (SubmitOrder) Encode

func (s SubmitOrder) Encode(buf []byte) error

func (SubmitOrder) GetBufferLength

func (s SubmitOrder) GetBufferLength() int

Jump to

Keyboard shortcuts

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