quotes

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorJsonizable

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

ErrorJsonizable is an error that can be JSON-serialized as the Error() string.

func (*ErrorJsonizable) Error

func (e *ErrorJsonizable) Error() string

func (*ErrorJsonizable) MarshalJSON

func (e *ErrorJsonizable) MarshalJSON() ([]byte, error)

func (*ErrorJsonizable) Unwrap

func (e *ErrorJsonizable) Unwrap() error

type Result

type Result struct {
	Isin      string               `json:"isin,omitempty"`
	Source    string               `json:"source,omitempty"`
	Instance  int                  `json:"instance"`
	URL       string               `json:"url,omitempty"`
	Price     float32              `json:"price,omitempty"`
	Currency  string               `json:"currency,omitempty"`
	Date      *time.Time           `json:"date,omitempty"` // need a pointer to omit zero date
	TimeStart time.Time            `json:"time_start"`
	TimeEnd   time.Time            `json:"time_end"`
	Err       error                `json:"error,omitempty"`
	Status    taskengine.EventType `json:"status"`
}

Result contains the result informations of the retrieved quote.

Result.Date field is a pointer in order to omit zero dates. see https://stackoverflow.com/questions/32643815/json-omitempty-with-time-time-field

func Get

func Get(availableSources quotegetter.Sources, items []*SourceIsins, mode taskengine.Mode, wProgress io.Writer) ([]*Result, error)

Get retrieves the quotes specified by the SourceIsins object. The mode parameters specified the taskengine mode of execution.

type SourceIsins

type SourceIsins struct {
	Source  string   `json:"source,omitempty"`
	Workers int      `json:"workers,omitempty"`
	Proxy   string   `json:"proxy,omitempty"`
	Isins   []string `json:"isins,omitempty"`
}

SourceIsins struct represents the isins to get from a specific source

type Stat

type Stat struct {
	NumSuccess  int
	NumError    int
	NumCanceled int
}

func (*Stat) Update

func (s *Stat) Update(status taskengine.EventType)

type Stats

type Stats struct {
	TimeStart time.Time
	TimeEnd   time.Time
	Task      map[string]*Stat
	Worker    map[string]*Stat
}

func NewStats

func NewStats(results []*Result) *Stats

func (*Stats) Elapsed

func (stats *Stats) Elapsed() time.Duration

func (*Stats) Fprintln

func (stats *Stats) Fprintln(w io.Writer)

func (*Stats) TaskSummary

func (stats *Stats) TaskSummary() *Stat

func (*Stats) Tasks

func (stats *Stats) Tasks() int

func (*Stats) WorkerSummary

func (stats *Stats) WorkerSummary() *Stat

func (*Stats) Workers

func (stats *Stats) Workers() int

Jump to

Keyboard shortcuts

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