datasources

package
v0.0.0-...-d465f1b Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasDatasource

func HasDatasource(id uint64) bool

HasDatasource return boolean response for a given datasource ID

Types

type CryptoCompare

type CryptoCompare struct {
	ID       uint64
	Provider string
	Base     string
	Quote    string
	// contains filtered or unexported fields
}

CryptoCompare structure with historical prices map (used as cache for historical calls)

func (*CryptoCompare) Description

func (ds *CryptoCompare) Description() string

Description returns string description of pair

func (*CryptoCompare) HistoricalValue

func (ds *CryptoCompare) HistoricalValue(timestamp uint64) (uint64, error)

HistoricalValue returns the historical value of an asset priced in satoshis at a given timestamp

func (*CryptoCompare) Id

func (ds *CryptoCompare) Id() uint64

Id receiver function returns ID

func (*CryptoCompare) Interval

func (ds *CryptoCompare) Interval() uint64

Interval returns the time interval between published data in seconds

func (*CryptoCompare) Name

func (ds *CryptoCompare) Name() string

Name receiver function returns Base name of pair traded against BTC

func (*CryptoCompare) Value

func (ds *CryptoCompare) Value() (uint64, error)

Value returns the current value of asset priced in satoshis

type Datasource

type Datasource interface {
	Id() uint64
	Name() string
	Description() string
	Value() (uint64, error)
	HistoricalValue(uint64) (uint64, error)
	Interval() uint64
}

Datasource interface

func GetAllDatasources

func GetAllDatasources() []Datasource

GetAllDatasources returns all available datasources

func GetDatasource

func GetDatasource(id uint64) (Datasource, error)

GetDatasource returns one datasource by ID

type MinAPICryptoCompareBTCResponse

type MinAPICryptoCompareBTCResponse struct {
	Value float64 `json:"BTC"`
}

MinAPICryptoCompareBTCResponse for current price from Crypto Compare

type MinAPICryptoCompareHistoricalBTCResponse

type MinAPICryptoCompareHistoricalBTCResponse struct {
	Response   string `json:"Response"`
	HasWarning bool   `json:"HasWarning"`
	Type       int    `json:"Type"`
	Data       struct {
		Aggregated bool   `json:"Aggregated"`
		TimeFrom   int    `json:"TimeFrom"`
		TimeTo     int    `json:"TimeTo"`
		Data       []data `json:"Data"`
	} `json:"Data"`
}

MinAPICryptoCompareHistoricalBTCResponse nested struct for historical prices from Crypto Compare

Jump to

Keyboard shortcuts

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