coinbase

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

README

whats-this

You can use this to retrieve the current price for an crypto currency

I used this in another project and thought it will make sense to publish this as an own package

How to use it

import "https://github.com/mnlwldr/coinbase"

Usage

response, err := coinbase.Get("SHIB-EUR")
if err != nil {
	log.Println(err)
}
fmt.Printf("%.7f\n", response.Amount)

Output

0.0000253

Go Reference

Documentation

Index

Constants

View Source
const (
	ApiUrl = "https://api.coinbase.com/v2/prices"
	TYPE   = "spot"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Amount   float64
	Base     string
	Currency string
}

func Get

func Get(coin string) (Response, error)

Get the coin abbreviation is passed as parameter "coin". The coin abbreviation is a currency pair. For example: "SHIB-EUR" or "BTC-USD"

func GetWithDate

func GetWithDate(coin, date string) (Response, error)

GetWithDate The coin abbreviation is passed as parameter "coin". The coin abbreviation is a currency pair. For example: "SHIB-EUR" or "BTC-USD" The date must be in the format YYYY-MM-DD

Jump to

Keyboard shortcuts

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