The ticker updates data from all its sources every 10 seconds, reports the fastest source to respond.
type BitcoinDataSource interface {
GetUSD() float64 // BTC to USD
GetEUR() float64 // BTC to EUR
Update() error // update values
}
type CurrencyDataSource interface {
GetEURUSD() float64 // EUR to USD
Update() error // update values
}
To add a source, implement one of the interface
Bitcoin:
https://api.coindesk.com/v1/bpi/currentprice.json
https://blockchain.info/ticker
Currency: