crypto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package crypto package with common coin interface for all crypto related API

Index

Constants

View Source
const (
	DEFAULT_CURRENCY           = "USD"
	DEFAULT_CRYPTO_CURRENCY_ID = "all"
	DEFAULT_LIMIT              = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Coin

type Coin struct {
	Name      string
	Symbol    string
	Price     float64
	Currency  string
	Volume24  float64
	Maxsupply float64
}

Coin struct

type Coinmarketcap

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

Coinmarketcap impliments the Crypto interface Coinmarketcap struct

func NewCoinmarketcap

func NewCoinmarketcap() *Coinmarketcap

NewCoinmarketcap creates new intance It returns the new instance of Coinmarketcap

func (Coinmarketcap) GetAllCoinData

func (c Coinmarketcap) GetAllCoinData(currency string, limit int) ([]Coin, error)

GetAllCoinData returns coins in currency (such as: USD or CAD) and limit

func (Coinmarketcap) GetCoinData

func (c Coinmarketcap) GetCoinData(cryptoCurrency string, currency string) ([]Coin, error)

GetCoinData returns coin by crypocurrency (such as: BTC ETH and currency (such as: USD or CAD)

func (Coinmarketcap) GetCoinDataByUSD

func (c Coinmarketcap) GetCoinDataByUSD(cryptoCurrency string) ([]Coin, error)

GetCoinDataByUSD returns coin by crypocurrency in default currency: USD

func (*Coinmarketcap) SetBaseURL

func (c *Coinmarketcap) SetBaseURL(baseURL string)

SetBaseURL sets baseURL

type Crypto

type Crypto interface {
	GetCoinData(cryptoCurrency string, currency string) ([]Coin, error)
	GetCoinDataByCurrency(currency string, limit int) ([]Coin, error)
}

Crypto interface

Jump to

Keyboard shortcuts

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