spotandmargin

package
v0.0.0-...-cf1c484 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: GPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	HostWebsocketURL = "wss://api.gateio.ws/ws/v4/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Time    int64    `json:"time"`
	ID      int64    `json:"id"`
	Channel string   `json:"channel"`
	Event   string   `json:"event"`
	Payload []string `json:"payload"`
	Auth    authCmd  `json:"auth"`
}

Необходим для удобного создания подписок

type Configuration

type Configuration struct {
	Addr      string `json:"addr"`
	ApiKey    string `json:"api_key"`
	SecretKey string `json:"secret_key"`
	DebugMode bool   `json:"debug_mode"`
}

type GateWS

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

func New

func New(config *Configuration) *GateWS

func (*GateWS) Emit

func (b *GateWS) Emit(event interface{}, arguments ...interface{}) *emission.Emitter

Emit emits an event

func (*GateWS) GetPair

func (b *GateWS) GetPair(args ...string) string

func (*GateWS) Off

func (b *GateWS) Off(event interface{}, listener interface{}) *emission.Emitter

Off removes a listener for an event

func (*GateWS) On

func (b *GateWS) On(event interface{}, listener interface{}) *emission.Emitter

On adds a listener to a specific event

func (*GateWS) Send

func (b *GateWS) Send(msg string) (err error)

func (*GateWS) SendCmd

func (b *GateWS) SendCmd(cmd Cmd)

отправка команды на сервер в отдельной функции для того, чтобы при переподключении быстро подписаться на все предыдущие каналы

func (*GateWS) Start

func (b *GateWS) Start() error

подключение к серверу и постоянное чтение приходящих ответов

func (*GateWS) Subscribe

func (b *GateWS) Subscribe(channel string, coins []string)

func (*GateWS) Subscribe1

func (b *GateWS) Subscribe1(channel string)

func (*GateWS) Subscribe2

func (b *GateWS) Subscribe2(channel string, coins []string)

type Tickers

type Tickers struct {
	Time    int           `json:"time"`
	Channel string        `json:"channel"`
	Event   string        `json:"event"`
	Result  resultTickers `json:"result"`
}

https://www.gate.io/docs/developers/apiv4/#retrieve-ticker-information

type WalletBalance

type WalletBalance struct {
	Time    int                   `json:"time"`
	Channel string                `json:"channel"`
	Event   string                `json:"event"`
	Result  []resultWalletBalance `json:"result"`
}

https://www.gate.io/docs/developers/apiv4/ws/en/#client-subscription-9

Jump to

Keyboard shortcuts

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