cryptoasset

package
v0.0.0-...-a0fbff0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cryptoasset contains the calculus for bitcoin variation day by day

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStartDateAfterEndDate is the error returned when the start date is after the end date
	ErrStartDateAfterEndDate = errors.New("start date after end date")
)

Functions

This section is empty.

Types

type BitcoinPrice

type BitcoinPrice struct {
	Date  string  `json:"date"`
	Price float64 `json:"price"`
}

BitcoinPrice represents the price of a bitcoin on a given date.

type BitcoinPriceGetter

type BitcoinPriceGetter interface {
	GetBitcoinPrice(date string) (btprice BitcoinPrice, err error)
}

BitcoinPriceGetter is the interface that wraps the GetBitcoinPrice method.

type Variation

type Variation struct {
	Date      string  `json:"date"`
	Variation float64 `json:"variation"`
}

Variation represents a single day variation of an asset

func GetBitcoinVariation

func GetBitcoinVariation(startDate, endDate string) (btcVars []Variation, err error)

GetBitcoinVariation returns the bitcoin variation on a given period. The expected format is YYYY-MM-DD.

Jump to

Keyboard shortcuts

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