models

package
v0.0.0-...-51e8eb1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyParams = json.RawMessage("{}")

Functions

func Float32Pointer

func Float32Pointer(value float32) *float32

func Float64Pointer

func Float64Pointer(value float64) *float64

func Int32Pointer

func Int32Pointer(value int32) *int32

func Int64Pointer

func Int64Pointer(value int64) *int64

func IntPointer

func IntPointer(value int) *int

func StringPointer

func StringPointer(value string) *string

Types

type Authentication

type Authentication struct {
	AccessToken  string
	RefreshToken string
}

type Event

type Event struct {
	Channel string          `json:"channel"`
	Data    json.RawMessage `json:"data"`
}

Event is wrapper of received event

type ObjectStream

type ObjectStream struct {
	// contains filtered or unexported fields
}

ObjectStream is a jsonrpc2.ObjectStream that uses a WebSocket to send and receive JSON-RPC 2.0 objects.

func NewObjectStream

func NewObjectStream(conn *websocket.Conn) ObjectStream

NewObjectStream creates a new jsonrpc2.ObjectStream for sending and receiving JSON-RPC 2.0 objects over a WebSocket.

func (ObjectStream) Close

func (t ObjectStream) Close() error

Close implements jsonrpc2.ObjectStream.

func (ObjectStream) ReadObject

func (t ObjectStream) ReadObject(v interface{}) error

ReadObject implements jsonrpc2.ObjectStream.

func (ObjectStream) WriteObject

func (t ObjectStream) WriteObject(obj interface{}) error

WriteObject implements jsonrpc2.ObjectStream.

type Order

type Order struct {
	Advanced            string          `json:"advanced,omitempty"`
	Amount              decimal.Decimal `json:"amount"`
	API                 bool            `json:"api"`
	TimeInForce         string          `json:"time_in_force"`
	ReduceOnly          bool            `json:"reduce_only"`
	ProfitLoss          float64         `json:"profit_loss"`
	Price               Price           `json:"price"`
	PostOnly            bool            `json:"post_only"`
	StopPrice           float64         `json:"stop_price,omitempty"`
	Triggered           bool            `json:"triggered,omitempty"`
	OrderType           string          `json:"order_type"`
	OrderState          string          `json:"order_state"`
	OrderID             string          `json:"order_id"`
	MaxShow             float64         `json:"max_show"`
	LastUpdateTimestamp int64           `json:"last_update_timestamp"`
	Label               string          `json:"label"`
	IsLiquidation       bool            `json:"is_liquidation"`
	InstrumentName      string          `json:"instrument_name"`
	FilledAmount        decimal.Decimal `json:"filled_amount"`
	Direction           string          `json:"direction"`
	CreationTimestamp   int64           `json:"creation_timestamp"`
	Commission          float64         `json:"commission"`
	AveragePrice        decimal.Decimal `json:"average_price"`
	Implv               float64         `json:"implv,omitempty"`
	Usd                 float64         `json:"usd,omitempty"`
}

type Price

type Price float64

func (*Price) ToFloat64

func (p *Price) ToFloat64() float64

func (*Price) UnmarshalJSON

func (p *Price) UnmarshalJSON(data []byte) (err error)

type PrivateParams

type PrivateParams interface {
	SetToken(token string)
}

privateParams is interface for methods require access_token

type Token

type Token struct {
	AccessToken string `json:"access_token"`
}

Token is used to embedded in params for private methods

func (*Token) SetToken

func (t *Token) SetToken(token string)

Jump to

Keyboard shortcuts

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