cmd

package
v0.0.0-...-38aab54 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cmd implements methods for getting latest rates for crypto-currencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(array []string, x string) bool

Contains checks if item exist in array.

func GetCoinConvertURL

func GetCoinConvertURL(coin, fiat string) (string, error)

GetCoinConvertURL returns REST JSON API URL of convertation specified coin into fiat.

func GetCoinRate

func GetCoinRate(code, fiat string, result *[]CryptoCurrency, wg *sync.WaitGroup, mutex *sync.Mutex)

GetCoinRate returns rate of specified coin.

func GetCoinURL

func GetCoinURL(coin string) (string, error)

GetCoinURL returns REST JSON API URL of specified currency rate.

func PrettyShow

func PrettyShow(result []CryptoCurrency, fiat string)

PrettyShow prints rates coins color, depending on their rates.

func Run

func Run()

Run executes algorithm.

Types

type CoinChange

type CoinChange struct {
	Hour string `json:"hour"`
	Day  string `json:"day"`
}

CoinChange parses json response from third party REST JSON API.

type CoinConvert

type CoinConvert struct {
	Currency string      `json:"currency"`
	Result   interface{} `json:"result"`
	Coin     string      `json:"coin"`
}

CoinConvert pareses json response from third party REST JSON API.

type CryptoCurrency

type CryptoCurrency struct {
	Name   string
	Price  string     `json:"price"`
	Change CoinChange `json:"change"`
}

CryptoCurrency for third party REST JSON API.

Jump to

Keyboard shortcuts

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