coinbase

package module
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 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 := Get("SHIB-EUR")
fmt.Printf("%.7f\n", response.Amount)

Output

0.0000253

Go Reference

Documentation

Index

Constants

View Source
const (
	COINBASE_API_URL = "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)

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)

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

Source Files

Jump to

Keyboard shortcuts

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