news

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL = "wss://api.binance.com/sapi/wss"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(apiKey, secretKey string) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) Subscribe

func (c *Client) Subscribe(topic string, handler func(WsNewsEvent)) error

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(topic string) error

type WsNewsEvent

type WsNewsEvent struct {
	CatalogId   int64  `json:"catalogId"`
	CatalogName string `json:"catalogName"`
	PublishDate int64  `json:"publishDate"`
	Title       string `json:"title"`
	Body        string `json:"body"`
	Disclaimer  string `json:"disclaimer"`
}

WsNewsEvent represents a news event from the WebSocket

type WsRequest

type WsRequest struct {
	Command string `json:"command"`
	Value   string `json:"value"`
}

WsRequest represents a request to the WebSocket

type WsResponse

type WsResponse struct {
	Type  string `json:"type"`
	Topic string `json:"topic"`
	Data  string `json:"data"` // Data is a JSON string containing WsNewsEvent
}

WsResponse represents a generic response from the WebSocket

Jump to

Keyboard shortcuts

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