forex

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID      string
	Streams map[string]struct{}
	WS      *websocket.Client
	// contains filtered or unexported fields
}

Client for forex api instance

func New

func New(id string, url string, streams []string) (*Client, error)

New Forex client

func (*Client) Close

func (c *Client) Close() error

Close websocket connection

func (*Client) Connect

func (c *Client) Connect(listener func(*PriceResponse)) error

Connect to Forex websocket endpoint

func (*Client) Subscribe

func (c *Client) Subscribe(market string) error

Subscribe to Forex markets

func (*Client) Unsubscribe

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

Unsubscribe to Forex markets

type PriceResponse

type PriceResponse struct {
	Market    string
	Price     string
	CreatedAt float64
	UpdatedAt float64
}

PriceResponse from websocket

Jump to

Keyboard shortcuts

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