coindesk

package module
v0.0.0-...-2f4a2c1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 License: MIT Imports: 9 Imported by: 0

README

Coindesk

CoinDesk Travis Branch OpenCode

coindesk is a Go package to access Coindesk API

Documentation:

GoDoc

Installations & Usage

Installation

go get github.com/gostudent/coindesk

Usage
package main

import (
	"fmt"
	"github.com/gostudent/coindesk"
)

func main() {
	priceUsd := coindesk.GetPrice()
	fmt.Println(priceUsd)

	priceInr := coindesk.GetPrice("INR")
	fmt.Println(priceInr)

	USD, GBP, EUR := coindesk.CurrentPrice()
	fmt.Println(USD, GBP, EUR)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentPrice

func CurrentPrice() (float64, float64, float64)

CurrentPrice fetches current Price of Bitcoin from coindesk API. It returns the Price in USD, GBP and EUR.

func GetPrice

func GetPrice(s ...string) float64

GetPrice fetches the latest Bitcoin Price from coindesk API in given currency. s is the ISO code of the currency. Defaults to USD. Supported Currencies - https://api.coindesk.com/v1/bpi/supported-currencies.json

func Yesterday

func Yesterday() float64

Yesterday returns yesterday's Price

Types

type Price

type Price struct {
	Date  time.Time
	Price float64
}

func HistoryPrice

func HistoryPrice(startDate string, endDate string) []Price

HistoryPrice takes in startDate and endDate as input It returns an array of Price struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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