crypto

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrencyList

func CurrencyList(currencies container.GSlice[Currency]) string

CurrencyList formats a list of Currency into a string.

func NewClient

func NewClient(appID AppID) *genfuncs.Result[*Client]

NewClient creates a new Client using given AppID.

func PeriodList

func PeriodList(periods container.GSlice[Period]) string

PeriodList formats a list of Period into a string.

Types

type AppID

type AppID string

AppID API key

func DefaultAppID

func DefaultAppID() AppID

DefaultAppID returns AppID based on NOMICS_APP_ID env variable.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client used to access services.

func MightSkipIntegrationTest

func MightSkipIntegrationTest(t *testing.T) *Client

MightSkipIntegrationTest determines if integraation tests should run.

type Currency

type Currency string

Currency name, BTC, ETH etc.

func (Currency) String

func (c Currency) String() string

String implements fmt.Stringer for Currency.

type CurrencyService

type CurrencyService interface {
	Tickers(currencies container.GSlice[Currency], periods container.GSlice[Period]) *genfuncs.Result[container.GMap[Currency, *TickerInfo]]
}

CurrencyService provides services to do with cryptocurrencies

type DateTime

type DateTime string

DateTime format used - ISO8601.

type NomicsCurrencyService

type NomicsCurrencyService struct {
	// contains filtered or unexported fields
}

NomicsCurrencyService is a CurrencyService implemented using Nomics API.

func NewNomicsCurrencyService

func NewNomicsCurrencyService(client *Client) *NomicsCurrencyService

NewNomicsCurrencyService creates a Nomics based CurrencyService.

func (NomicsCurrencyService) Tickers

Tickers returns TickerInfo for the Currency list and Period list provides.

type Period

type Period string

Period for which information can be requested.

type TickerInfo

type TickerInfo struct {
	Currency  Currency        `json:"currency"`
	Price     decimal.Decimal `json:"price"`
	Timestamp DateTime        `json:"price_timestamp"`
}

TickerInfo contains a Price for a Currency at a given Timestamp.

Jump to

Keyboard shortcuts

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