obol

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpClient = http.Client{
	Timeout: time.Second * 15,
}

HttpClient a usable client with hardcoded timeout

Functions

This section is empty.

Types

type CoinToCoinWithAmountResponse

type CoinToCoinWithAmountResponse struct {
	AveragePrice float64 `json:"average_price"`
	Amount       float64 `json:"amount"`
}

CoinToCoinWithAmountResponse is the response of a CoinToCoinWithAmount result

type ObolRequest

type ObolRequest struct {
	ObolURL string
}

func (*ObolRequest) GetCoin2CoinRates

func (o *ObolRequest) GetCoin2CoinRates(fromCoin string, toCoin string) (float64, error)

GetCoin2CoinRates is a function to return obol complex rates between 2 coins

func (*ObolRequest) GetCoin2CoinRatesWithAmount

func (o *ObolRequest) GetCoin2CoinRatesWithAmount(fromCoin string, toCoin string, amount string) (CoinToCoinWithAmountResponse, error)

GetCoin2CoinRatesWithAmount is a function to return obol complex rates between 2 coins with a hardcoded amount

func (*ObolRequest) GetCoin2FIATRate

func (o *ObolRequest) GetCoin2FIATRate(fromCoin string, toCoin string) (float64, error)

func (*ObolRequest) GetCoinRates

func (o *ObolRequest) GetCoinRates(coin string) ([]Rate, error)

GetCoinRates is a function to return obol simple rates for a coin

func (*ObolRequest) GetCoinRatesV2

func (o *ObolRequest) GetCoinRatesV2(coin string) (map[string]RateV2, error)

GetCoinRates is a function to return obol simple rates for a coin

type ObolService

type ObolService interface {
	GetCoinRatesV2(coin string) (map[string]RateV2, error)
	GetCoin2FIATRate(fromCoin string, toCoin string) (float64, error)
	GetCoinRates(coin string) ([]Rate, error)
	GetCoin2CoinRates(fromCoin string, toCoin string) (float64, error)
	GetCoin2CoinRatesWithAmount(fromCoin string, toCoin string, amount string) (CoinToCoinWithAmountResponse, error)
}

type Rate

type Rate struct {
	Code string  `json:"code"`
	Name string  `json:"name"`
	Rate float64 `json:"rate"`
}

type RateV2

type RateV2 struct {
	Name string  `json:"name"`
	Rate float64 `json:"rate"`
}

type Response

type Response struct {
	Data   interface{} `json:"data"`
	Status int         `json:"status"`
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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