An object-oriented client for the GDAX REST API. Heavily inspired by the Stripe Ruby client
order = GDAX::Order.buy(product_id: 'BTC-USD', price: 100, size: 0.5)
# => #<GDAX::Order { id: 'cb6a1d6d-2c78-4da5-9961-14795d0d4379' ... }>
order.cancel
# => #<GDAX::Response { ... }>
account = GDAX::Account.list.first
# => #<GDAX::Account { ... }>
account.history
# => #<GDAX::Collection(AccountHistory) [ ... ]>
# without fetching Account first
GDAX::Account.new(id: '...').history
# => #<GDAX::Collection(AccountHistory) [ ... ]>
orders = GDAX::Orders.list
# => #<GDAX::Collection(Order) [ ... ]>
next_page = orders.next
# => #<GDAX::Collection(Order) [ ... ]>
GDAX::Withdrawal.crypto(address: '...', currency: 'BTC', amount: 10)
# => #<GDAX::Response { ... }>
-
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
)
GDAX.api_key # default: ENV['GDAX_API_KEY']
GDAX.api_secret # default: ENV['GDAX_API_SECRET']
GDAX.api_passphrase # default: ENV['GDAX_API_PASSPHRASE']
GDAX.api_base # default: 'https://api.gdax.com'
GDAX.use_server_time # default: false
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
Coming soon
Ruby 2.1+
bundle install gdax