utils

package
v0.0.0-...-13762cf Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCAGR

func GetCAGR[V TradesGetter](trades []V) float64

func GetTimeRange

func GetTimeRange(r *http.Request) (time.Time, time.Time, error)

func GetXIRR

func GetXIRR[V TradesGetter](trades []V) float64

func MomentBinarySearch

func MomentBinarySearch[V TimeGetter](timestamps []V, target time.Time) int

func ReadCSV

func ReadCSV(tradeFiles []string) ([][]string, error)

func ReadDir

func ReadDir(dir string) ([]string, error)

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, status int, payload interface{})

Types

type TimeGetter

type TimeGetter interface {
	GetTime() time.Time
}

type TradesGetter

type TradesGetter interface {
	GetTime() time.Time
	GetPrice() float64
}

Jump to

Keyboard shortcuts

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