finnhub

package
v0.0.0-...-055ce89 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Contains wrappers for the Finnhub API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candles

type Candles struct {
	Symbol    string
	Open      []float32
	High      []float32
	Low       []float32
	Close     []float32
	Volume    []float32
	Timestamp []int64
}

type FinnhubClient

type FinnhubClient struct {
	*finnhub.DefaultApiService
	// contains filtered or unexported fields
}

func NewFinnhubClient

func NewFinnhubClient(apiKey string) *FinnhubClient

func (*FinnhubClient) CloseRealtimeStream

func (c *FinnhubClient) CloseRealtimeStream(stop chan int)

func (*FinnhubClient) GetCandles

func (c *FinnhubClient) GetCandles(symbol string, resolution string, from int64, to int64) (Candles, error)

func (*FinnhubClient) GetQuote

func (c *FinnhubClient) GetQuote(symbol string) (Quote, error)

func (*FinnhubClient) OpenRealtimeStream

func (c *FinnhubClient) OpenRealtimeStream(symbols []string) (*websocket.Conn, error)

func (*FinnhubClient) ReceiveRealtimeData

func (c *FinnhubClient) ReceiveRealtimeData(w *websocket.Conn) (chan Trade, chan int)

type Quote

type Quote struct {
	Symbol        string
	Price         float32
	Change        float32
	PercentChange float32
	DayHigh       float32
	DayLow        float32
	PreviousOpen  float32
	PreviousClose float32
}

type Trade

type Trade struct {
	Symbol    string  `json:"s"`
	Price     float32 `json:"p"`
	Volume    float32 `json:"v"`
	Timestamp int64   `json:"t"`
}

type WebsocketResponse

type WebsocketResponse struct {
	Type string  `json:"type"`
	Data []Trade `json:"data"`
}

Jump to

Keyboard shortcuts

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