Giter Site home page Giter Site logo

coinbase-go-client-v3's Introduction

Coinbase Go Client V3

Notes

Coinbase is going to release a golang V3 client but I didn't want to wait so I wrote my own... it should work. Let me know. It's working for me =).

Dependencies

make install

Generate Mocks

make generate

Installation

If using Go modules (Go version >= 1.19) simply import as needed.

go get github.com/happilymarrieddad/coinbase-go-client-v3

Setup

import (
    "fmt"
    "context"
    "net/http"

    coinbasegoclientv3 "github.com/happilymarrieddad/coinbase-go-client-v3"
)

func main() {
    ctx := context.Background()
    httpClient = &http.Client{
        Timeout: time.Second * 30,
    }

    client, _ = coinbasegoclientv3.NewClient(
        httpClient, "", 
        os.Getenv("COINBASE_TEST_API_KEY"), 
        os.Getenv("COINBASE_TEST_API_SECRET"),
    )
    client.HostURL = "some other URI if you want" // at the moment there is no sandbox but in case there ever is...
    ...

    productCandles, _ := client.GetProductCandles(
        ctx, "some-product-id",
        fmt.Sprintf("%d", time.Now().Add(time.Hour*-12).Unix()),
        fmt.Sprintf("%d", time.Now().Unix()),
        coinbasegoclientv3.FiveMinuteGranularity,
    )
    // Do something with productCandles
}

Take a look at the tests for more examples

Tests

make test.integ
make test.unit

Notes about tests

WARNING!!! Running the INTEG tests as they are at the moment run against the REAL coinbase API. Do not run them unless you have thoroughly gone through the tests, know how they work and are okay with live tests!!!!

Build examples

//go:build integ
// +build integ

coinbase-go-client-v3's People

Watchers

Nick Kotenberg avatar

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.