quotegetter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultClient

func DefaultClient(proxy string) (*http.Client, error)

DefaultClient xxx

func DoHTTPRequest

func DoHTTPRequest(client *http.Client, req *http.Request) (*http.Response, error)

DoHTTPRequest executes the http request.

func NormalizeCurrency

func NormalizeCurrency(currency string) string

NormalizeCurrency return the standard ISO4217 representation of the known currency

Types

type NewQuoteGetterFunc added in v0.2.0

type NewQuoteGetterFunc func(string, *http.Client) QuoteGetter

NewQuoteGetterFunc creates a new QuoteGetter from Name and http.Client.

type QuoteGetter

type QuoteGetter interface {
	Source() string
	Client() *http.Client
	GetQuote(ctx context.Context, isin, url string) (*Result, error)
}

QuoteGetter interface

type Result

type Result struct {
	URL      string
	Price    float32
	Currency string
	Date     time.Time
}

Result represents the info returned by the GetQuote function in case of success

type Sources added in v0.3.0

type Sources map[string]NewQuoteGetterFunc

Sources maps the source name to the corrisponing NewQuoteGetterFunc.

func (Sources) Exists added in v0.3.0

func (sources Sources) Exists(name string) bool

Exists returns if the source exists.

func (Sources) Names added in v0.3.0

func (sources Sources) Names() []string

Names returns a list of the names of the QuoteGetters. Note the list is not sorted.

func (Sources) String added in v0.3.0

func (sources Sources) String() string

String returns the sorted comma separated list of the QuoteGetters names.

Directories

Path Synopsis
jsons

Jump to

Keyboard shortcuts

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