Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGenericForeignScraper ¶
func NewGenericForeignScraper() *genericScraper
Types ¶
type CoinMarketCapListing ¶
type CoinMarketCapListing struct {
Data []struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
CmcRank int `json:"cmc_rank"`
NumMarketPairs int `json:"num_market_pairs"`
CirculatingSupply float64 `json:"circulating_supply"`
TotalSupply float64 `json:"total_supply"`
MaxSupply float64 `json:"max_supply"`
LastUpdated string `json:"last_updated"`
DateAdded string `json:"date_added"`
Tags []string `json:"tags"`
Platform interface{} `json:"platform"`
Quote map[string]Quote `json:"quote"`
} `json:"data"`
Status struct {
Timestamp time.Time `json:"timestamp"`
ErrorCode int `json:"error_code"`
ErrorMessage string `json:"error_message"`
Elapsed int `json:"elapsed"`
CreditCount int `json:"credit_count"`
} `json:"status"`
}
type CoinMarketCapScraper ¶
type CoinMarketCapScraper struct {
// contains filtered or unexported fields
}
func NewCoinMarketCapScraper ¶
func NewCoinMarketCapScraper(datastore models.Datastore) *CoinMarketCapScraper
func (*CoinMarketCapScraper) Close ¶
func (scraper *CoinMarketCapScraper) Close() error
// closes all connected Scrapers. Must only be called from mainLoop func (scraper *CoinMarketCapScraper) cleanup(err error) {
scraper.foreignScrapper.errorLock.Lock()
defer scraper.foreignScrapper.errorLock.Unlock()
scraper.foreignScrapper.tickerRate.Stop()
scraper.foreignScrapper.tickerState.Stop()
if err != nil {
scraper.foreignScrapper.error = err
}
scraper.foreignScrapper.closed = true
close(scraper.foreignScrapper.shutdownDone) // signal that shutdown is complete
}
Close closes any existing API connections
func (*CoinMarketCapScraper) GetQuoteChannel ¶
func (scraper *CoinMarketCapScraper) GetQuoteChannel() chan *models.ForeignQuotation
func (*CoinMarketCapScraper) UpdateQuotation ¶
func (scraper *CoinMarketCapScraper) UpdateQuotation() error
Update retrieves new coin information from the CoinMarketCap API and stores it to influx
type CoingeckoCoin ¶
type CoingeckoScraper ¶
type CoingeckoScraper struct {
// contains filtered or unexported fields
}
func NewCoingeckoScraper ¶
func NewCoingeckoScraper(datastore models.Datastore) *CoingeckoScraper
func (*CoingeckoScraper) Close ¶
func (scraper *CoingeckoScraper) Close() error
// closes all connected Scrapers. Must only be called from mainLoop func (scraper *CoingeckoScraper) cleanup(err error) {
scraper.foreignScrapper.errorLock.Lock()
defer scraper.foreignScrapper.errorLock.Unlock()
scraper.foreignScrapper.tickerRate.Stop()
scraper.foreignScrapper.tickerState.Stop()
if err != nil {
scraper.foreignScrapper.error = err
}
scraper.foreignScrapper.closed = true
close(scraper.foreignScrapper.shutdownDone) // signal that shutdown is complete
}
Close closes any existing API connections
func (*CoingeckoScraper) GetQuoteChannel ¶
func (scraper *CoingeckoScraper) GetQuoteChannel() chan *models.ForeignQuotation
func (*CoingeckoScraper) UpdateQuotation ¶
func (scraper *CoingeckoScraper) UpdateQuotation() error
Update retrieves new coin information from the coingecko API and stores it to influx
type ForeignScraper ¶
type ForeignScraper struct {
// contains filtered or unexported fields
}
type ForeignScrapperer ¶
type ForeignScrapperer interface {
UpdateQuotation() error
GetQuoteChannel() chan *models.ForeignQuotation
}
type Quote ¶
type Quote struct {
Price float64 `json:"price"`
Volume24H float64 `json:"volume_24h"`
PercentChange1H float64 `json:"percent_change_1h"`
PercentChange24H float64 `json:"percent_change_24h"`
PercentChange7D float64 `json:"percent_change_7d"`
MarketCap float64 `json:"market_cap"`
LastUpdated string `json:"last_updated"`
}
Click to show internal directories.
Click to hide internal directories.