Quadrigacx
Ruby wrapper for the QuadrigaCX API.
Installation
Add this line to your application's Gemfile:
gem 'quadrigacx'
And then execute:
$ bundle
Or install it yourself as:
$ gem install quadrigacx
Usage
require 'quadrigacx'
QuadrigaCX.configure do |config|
config.client_id = 'your-client-id'
config.api_key = 'your-api-key'
config.api_secret = 'your-api-secret'
end
client = QuadrigaCX::Client.new
Public Methods
Ticker
Return trading information.
ticker = client.ticker
Order Book
List all open orders.
order_book = client.order_book
order_book_ungrouped = client.order_book(group: 0)
Transactions
Return descending JSON list of recent trades.
transactions = client.transactions
Private Methods
Balance
List all account balances.
balance = client.balance
Limit Buy
Place a limit buy order. Returns JSON describing the order.
order = client.limit_buy(price: 200, amount: 1)
Limit Sell
Place a limit sell order. Returns JSON describing the order.
order = client.limit_sell(price: 200, amount: 1)
Market Buy
Place a market order. Returns JSON describing the order.
order = client.market_buy(amount: 5.00)
Market Sell
Place a market order. Returns JSON describing the order.
order = client.market_sell(amount: 0.01)
Cancel Order
Cancel an order.
client.cancel_order(id: order.id)
Open Orders
Return a JSON list of open orders.
response = client.open_orders
Lookup Order
Returns a JSON list of details about 1 or more orders.
response = client.lookup_order(id: order.id)
Withdraw Coins
Withdraw coins (i.e., bitcoin).
response = client.withdraw(QuadrigaCX::Coin::BITCOIN, amount: 1, address: '1FAs1ywa3pqS6S5mvypXjCtHAzwCkymNUX')
Deposit Address
Return a deposit address (i.e., bitcoin).
response = client.deposit_address(QuadrigaCX::Coin::BITCOIN)
User Transactions
Return a list of user transactions.
response = client.user_transactions
Contributing
- Fork it ( https://github.com/[my-github-username]/quadrigacx/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request