ZaifWrapper

This is an unofficial Ruby wrapper for the Zaif exchange REST APIs.

Installation

Add this line to your application's Gemfile:

gem 'zaif_wrapper'

And then execute:

$ bundle

Or install it yourself as:

$ gem install zaif_wrapper

REST Client

Require zaif_wrapper:

require 'zaif_wrapper'

Public Client

# If you only plan on touching public API endpoints.
client = ZaifWrapper::Client::ZaifPublicApi.new

Create various requests:

client.currencies('btc') # => [{ "name": "btc", "is_token": false }]
client.currency_pairs('btc_jpy')
client.last_price('btc_jpy')
client.ticker('btc_jpy')
client.trades('btc_jpy')
client.depth('btc_jpy')

Private Client

# If you only plan on touching Future API endpoints.
client = ZaifWrapper::Client::ZaifPrivateApi.new(api_key, api_secret)
client.get_info
client.get_info2
client.get_personal_info
client.get_id_info
client.trade_history
client.active_orders
client.trade({
  currency_pair: 'btc_jpy',
  action: 'bid',
  price: 1000000,
  amount: 0.0001
})
client.cancel_order({
  order_id: 1
})
client.withdraw({
  currency: 'btc',
  address: 'abcabcabcabc',
  amount: 0.3  
})
client.deposit_history({
  currency: 'jpy'
})
client.withdraw_history({
  currency: 'jpy'
})

Future Client

# If you only plan on touching Future API endpoints.
client = ZaifWrapper::Client::ZaifFutureApi.new

Leverage Client

# If you only plan on touching Leverage API endpoints.
client = ZaifWrapper::Client::ZaifLeverageApi.new

WebSocket Client

# If you only plan on connecting WebSocket API endpoints.
client = ZaifWrapper::Client::ZaifStreamApi.new
client.stream('btc_jpy')

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cobafan/zaifWrapper.

License

The gem is available as open source under the terms of the MIT License.

If This library is useful to you feel free to donate zaif with twitter chip.