Giter Club home page Giter Club logo

go-coinbase's Introduction

Coinbase Golang API Library

Build Status GoDoc Codecov

The library was tested against coinbase.com APIv2

Installation

go get github.com/Zauberstuhl/go-coinbase

# or use gopkg for specific versions
go get gopkg.in/Zauberstuhl/go-coinbase.v1.0.0

Supported API Calls

  • Wallet Endpoints
  • Users
  • Accounts
  • Addresses
  • Transactions
  • Buys
  • Sells
  • Deposits
  • Withdrawals
  • Payment methods
  • Data Endpoints
  • Currencies
  • Exchange rates
  • Prices
  • Time

Example

import "github.com/Zauberstuhl/go-coinbase"

c := coinbase.APIClient{
  Key: "123",
  Secret: "123456",
}

acc, err := c.Accounts()
if err != nil {
  fmt.Println(err)
  return
}

for _, acc := range acc.Data {
  fmt.Printf("ID: %s\nName: %s\nType: %s\nAmount: %f\nCurrency: %s\n",
    acc.Id, acc.Name, acc.Type,
    acc.Balance.Amount, acc.Balance.Currency)
}

# sample output
ID: 1234-12-1234-1232
Name: Test Wallet
Type: BTC
Amount: 0.0
Currency: EUR
[...]

Unit Tests

Run all available unit tests via:

go test

Most of the tests require a internet connection!

go-coinbase's People

Contributors

aleksandrshepelev avatar egrueter-dev avatar zauberstuhl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-coinbase's Issues

Transaction Buy and Sell fields

Hello.
In Coinbase API you can see, that method https://developers.coinbase.com/api/v2#show-a-transaction returns json with filed "buy" if the type of transaction is buying something. But if type of transaction is selling or another type from list on API documentation, you can't unmarshal response correctly.
So we need to add additional fields in APITransactionsData struct and add json tags for them.

type APITransactionsData struct {
	.......
	To               APIResource
	Buy              APIResource `json:"buy,omitempty"`
	Sell             APIResource `json:"sell,omitempty"`
	Instant_exchange bool
	.........
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.