An open API service indexing awesome lists of open source software.

https://github.com/arempe93/gdax-ruby

An object-oriented Ruby client for the GDAX REST API
https://github.com/arempe93/gdax-ruby

bitcoin coinbase gdax rubygem

Last synced: 11 months ago
JSON representation

An object-oriented Ruby client for the GDAX REST API

Awesome Lists containing this project

README

          

GDAX Ruby
=========

An object-oriented client for the GDAX REST API. Heavily inspired by the [Stripe Ruby client](https://github.com/stripe/stripe-ruby)

## Examples

#### Place an order, then cancel it

```ruby
order = GDAX::Order.buy(product_id: 'BTC-USD', price: 100, size: 0.5)
# => #

order.cancel
# => #
```

#### Get account history

```ruby
account = GDAX::Account.list.first
# => #

account.history
# => #

# without fetching Account first

GDAX::Account.new(id: '...').history
# => #
```

#### Page through orders

```ruby
orders = GDAX::Orders.list
# => #

next_page = orders.next
# => #
```

#### Make a withdrawal

```ruby
GDAX::Withdrawal.crypto(address: '...', currency: 'BTC', amount: 10)
# => #
```

## Conventions

* Both objects and collections can be updated from the server by calling `reload`

* Attributes can be accessed by key syntax (`[:id]`) or dot syntax (`.id`)

## Configuration

#### Required (for authenticated apis)

```ruby
GDAX.api_key # default: ENV['GDAX_API_KEY']
GDAX.api_secret # default: ENV['GDAX_API_SECRET']
GDAX.api_passphrase # default: ENV['GDAX_API_PASSPHRASE']
```

#### Optional

```ruby
GDAX.api_base # default: 'https://api.gdax.com'
GDAX.use_server_time # default: false
```

## Handling Errors

Errors from the GDAX API will be of type `GDAX::APIError`, and will contain `response`. Timeout and network issues will be of type `GDAX::ConnectionError`.

All handled errors are of class `GDAX::Error`

### Documentation

Coming soon

### Requirements

Ruby 2.1+

### Installation

```
bundle install gdax
```