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
- Host: GitHub
- URL: https://github.com/arempe93/gdax-ruby
- Owner: arempe93
- License: mit
- Created: 2017-11-30T23:09:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-02T16:21:54.000Z (over 8 years ago)
- Last Synced: 2025-07-07T05:15:13.626Z (11 months ago)
- Topics: bitcoin, coinbase, gdax, rubygem
- Language: Ruby
- Homepage:
- Size: 32.2 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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
```