Documentation ¶
Index ¶
Constants ¶
View Source
const LayoutUnixTimestamp string = "unix"
date layout for unix timestamp: convert to time using time.Unix
Variables ¶
View Source
var ( ErrNoResultFound = errors.New("no result found") ErrIsinMismatch = errors.New("isin mismatch") ErrEmptyInfoURL = errors.New("parse search returned an empty info URL") ErrInfoRequestIsNil = errors.New("info request is nil") ErrPriceNotFound = errors.New("price not found") ErrDateNotFound = errors.New("date not found") )
Errors
Functions ¶
func NewQuoteGetter ¶
func NewQuoteGetter(scr Scraper) quotegetter.QuoteGetter
NewQuoteGetter trasforms a Scraper to a quotegetter.QuoteGetter interface
Types ¶
type Error ¶
type Error struct { *ParseInfoResult // contains filtered or unexported fields }
Error is
type ErrorType ¶
type ErrorType int
ErrorType is ...
type ParseInfoResult ¶
type ParseInfoResult struct { IsinStr string PriceStr string CurrencyStr string DateStr string DateLayout string }
ParseInfoResult is ...
type Scraper ¶
type Scraper interface { Source() string Client() *http.Client GetSearch(ctx context.Context, isin string) (*http.Request, error) ParseSearch(doc *goquery.Document, isin string) (string, error) GetInfo(ctx context.Context, isin, url string) (*http.Request, error) ParseInfo(doc *goquery.Document, isin string) (*ParseInfoResult, error) }
Scraper interface. An object implementing the Scraper interface can be used to satisfy the QuoteGetter interface also.
The GetQuote function of the QuoteGetter is made up by the GetSearch, ParseSearch, GetInfo and ParseInfo function.
Click to show internal directories.
Click to hide internal directories.