forex

package
v0.0.0-...-ced929d Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusConnected    = "connected"
	StatusAuthSuccess  = "auth_success"
	StatusAuthRequired = "auth_required"
	StatusSuccess      = "success"
	StatusError        = "error"
)
View Source
const (
	WsUrl          = "wss://socket.polygon.io/forex"
	MaxWsFrameSize = 1024 * 1024 * 4 // 4mb
)

Variables

View Source
var (
	ErrNilHandler  = errors.New("nil handler")
	ErrFrameTooBig = errors.New("frame too big")
)

Functions

This section is empty.

Types

type Exchange

type Exchange struct {
	Num  int64
	Name string
}

type StatusCodeError

type StatusCodeError struct {
	Code int
}

func (StatusCodeError) Error

func (s StatusCodeError) Error() string

type WS

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

func OpenWS

func OpenWS(url, auth string) (*WS, error)

func (*WS) Close

func (ws *WS) Close() error

func (*WS) SubscribeAggregates

func (ws *WS) SubscribeAggregates(ticker string, handler WsAggregateHandler) (*WsAggregateSubscription, error)

func (*WS) SubscribeQuotes

func (ws *WS) SubscribeQuotes(ticker string, handler WsQuoteHandler) (*WsQuoteSubscription, error)

type WsAggregate

type WsAggregate struct {
	Open   float64 `json:"o"`  // The open price for this aggregate window.
	High   float64 `json:"h"`  // The high price for this aggregate window.
	Low    float64 `json:"l"`  // The low price for this aggregate window.
	Close  float64 `json:"ws"` // The close price for this aggregate window.
	Volume int64   `json:"v"`  // The volume of trades during this aggregate window.
	Start  int64   `json:"s"`  // The start time for this aggregate window in Unix Milliseconds.
	End    int64   `json:"e"`  // The end time for this aggregate window in Unix Milliseconds.
}

type WsAggregateHandler

type WsAggregateHandler func(q WsAggregate)

type WsAggregateSubscription

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

func (*WsAggregateSubscription) Name

func (s *WsAggregateSubscription) Name() string

func (*WsAggregateSubscription) Unsubscribe

func (s *WsAggregateSubscription) Unsubscribe()

type WsPair

type WsPair struct {
	Pair string
	// contains filtered or unexported fields
}

type WsQuote

type WsQuote struct {
	Exchange  int64
	Ask       float64 `json:"a"` // The ask price.
	Bid       float64 `json:"b"` // The bid price.
	Timestamp int64   `json:"t"` // The Timestamp in Unix MS.
}

type WsQuoteHandler

type WsQuoteHandler func(q WsQuote)

type WsQuoteSubscription

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

func (*WsQuoteSubscription) Name

func (s *WsQuoteSubscription) Name() string

func (*WsQuoteSubscription) Unsubscribe

func (s *WsQuoteSubscription) Unsubscribe()

type WsStatus

type WsStatus struct {
	Status  string
	Message string
}

Jump to

Keyboard shortcuts

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