quote

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v1.0.6

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

func NewAPI added in v1.0.6

func NewAPI(store store.Store) *API

func (*API) GetQuote added in v1.0.6

func (a *API) GetQuote(ctx context.Context, code string, opts ...OptionFunc) (*Quote, error)

func (*API) GetQuoteList added in v1.0.6

func (a *API) GetQuoteList(ctx context.Context, symbols []string, opts ...OptionFunc) (*List, error)

func (*API) GetSymbolList added in v1.0.6

func (a *API) GetSymbolList(ctx context.Context) (*SymbolList, error)

type History

type History struct {
	Begin  HistoryData   `json:"begin,omitempty"`
	End    HistoryData   `json:"end,omitempty"`
	Change HistoryChange `json:"change,omitempty"`
}

func (*History) IsValid

func (h *History) IsValid() bool

func (*History) SetBegin

func (h *History) SetBegin(dt time.Time, price float64)

func (*History) SetEnd

func (h *History) SetEnd(dt time.Time, price float64)

type HistoryChange

type HistoryChange struct {
	ByRatio  string `json:"byRatio"`
	ByAmount string `json:"byAmount"`
}

type HistoryData

type HistoryData struct {
	Date  string `json:"date,omitempty"`
	Price string `json:"price,omitempty"`
}

type List

type List struct {
	Count int     `json:"count"`
	Items []Quote `json:"items"`
}

func (List) ToJSON

func (ql List) ToJSON() string

type Option

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

type OptionFunc

type OptionFunc func(qf *fetcher)

func WithPeriod

func WithPeriod(p Period) OptionFunc

type Period

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

func NewPeriod

func NewPeriod(begin, end time.Time) Period

type Quote

type Quote struct {
	Symbol  string  `json:"symbol"`
	Name    string  `json:"name"`
	Price   string  `json:"price"`
	History History `json:"history,omitempty"`
	Error   string  `json:"error,omitempty"`
}

func (*Quote) SetError

func (q *Quote) SetError(err error)

func (*Quote) ToJSON

func (q *Quote) ToJSON() string

type Symbol

type Symbol struct {
	ID   int    `json:"id"`
	Code string `json:"code"`
	Name string `json:"name"`
	Icon string `json:"icon"`
}

type SymbolList

type SymbolList struct {
	Count int      `json:"count"`
	Items []Symbol `json:"items"`
}

func (*SymbolList) FromDTO

func (s *SymbolList) FromDTO(d *symbolListResponse) *SymbolList

Jump to

Keyboard shortcuts

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