Liking cljdoc? Tell your friends :D

coinbase-pro-clj

Build Status Clojars Project

A Clojure wrapper for the Coinbase Pro API (formerly GDAX). The point of this library is to make it convenient to harness the power of Clojure for creating cryptocurrency trading bots and similar applications that utilize the Coinbase Pro exchange. Results are given in edn, and authentication is handled by the library.

Installation

Add the dependency to your project or build file:

[coinbase-pro-clj "0.2.0-SNAPSHOT"]

Quick Start

Read on for a quick start or jump to the detailed documentation.

First, require it in the REPL:

(require '[coinbase-pro-clj.core :as cp])

Or in your application:

(ns my-app.core
  (:require [coinbase-pro-clj.core :as cp]))

Each function takes in a client, which requires a :url and optional authentication values. The authentication values are only required for authenticated endpoints. These can be obtained by logging into Coinbase Pro and creating them in the API settings section. URL vars are provided by the library for convenience.

(def client {:url cp/rest-url ; Other values include websocket-url, sandbox-rest-url, and sanbox-websocket-url.
             :key "Coinbase Pro key"
             :secret "Coinbase Pro secret"
             :passphrase "Coinbase Pro passphrase"})

From here you can call any of the functions (provided your client has a valid key, secret, and passphrase for authenticated endpoints). Here are a few examples:

;; Public endpoints
(cp/get-products client)

(cp/get-ticker client "BTC-USD")

;; Private endpoints (require authentication values in client)
(cp/get-orders client)

(cp/place-order client {:side "buy"
                        :product_id "BTC-USD"
                        :price 5000
                        :size 1})

See the documentation for a list of all endpoint functions with links the the Coinbase Pro API docs and code examples for each.

Contributing

If you notice anything that is unclear or incorrect in this readme or the docs, feel free to create a pull request, or you can open an issue for me to correct it. If you would like a feature added or notice a bug, please open an issue. Thanks for contributing. =)

License

Copyright © 2018 Brandon Ringe

Distributed under the MIT License

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close