CoinFalcon Ruby Library

The CoinFalcon Ruby Library provides convenient access to the CoinFalcon API from applications written in the Ruby language.

Installation

Add this line to your application's Gemfile:

gem 'coin_falcon'

And then execute:

$ bundle

Or install it yourself as:

$ gem install coin_falcon

Usage

The client needs to be configured with your account's key and secret which is available in your CoinFalcon Dashboard:

API Client

require 'coin_falcon'

client = CoinFalcon::Client.new(key, secret)

It is also possible to set up an API endpoint and version:

client = CoinFalcon::Client.new(key, secret, endpoint, version)

Defaults:

ENDPOINT = 'https://coinfalcon.com'
VERSION = 1

Accounts

Get a list of your trading accounts.

client.accounts

Create order

client.create_order(market: 'ETH-BTC', operation_type: :limit_order, order_type: :buy, size: 1, price: 0.01)

Cancel order

client.cancel_order(order_id)

List orders

client.my_orders

List trades

client.my_trades(market: 'ETH-BTC')

Deposit address

client.deposit_address('btc')

Deposit history

client.deposit_history

Deposit details

client.deposit_details(deposit_id)

Create withdrawal

client.create_withdrawal(currency: :btc, address: 'your_address_here', amount: 0.1)

Withdrawal details

client.withdrawal_details(withdrawal_id)

Withdrawal history

client.withdrawal_history(params)

Cancel withdrawal

client.cancel_withdrawal(withdrawal_id)

List market's trades

client.trades('ETH-BTC')

List orderbook

client.orderbook('ETH-BTC')
client.orderbook('ETH-BTC', level: 3)

Websocket Client

require 'coin_falcon'

websocket_client = CoinFalcon::WebsocketClient.new(key, secret)

It is also possible to set up an endpoint:

websocket_client = CoinFalcon::WebsocketClient.new(key, secret, endpoint)

Defaults:

ENDPOINT = 'wss://ws.coinfalcon.com'

Set up channels

websocket_client.channels << { channel: 'TickerChannel' } << { channel: 'OrderbookChannel', market: 'ETH-BTC' }

Run feed

websocket_client.feed

It is also possible to send a block

websocket_client.feed { |msg| puts msg }

Contributing

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

License

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