A thin wrapper around the CaVirtex API
See the CaVirtex API docs and source code for more information
require 'virtex'
@virtex = Virtex::Client.newbook = @virtex.orderbook('BTCCAD').orderbook
best_bid = book.bids.first
expect(best_bid[0]).to eq(631.481850000) # Price
expect(best_bid[1]).to eq(1.367900000) # Size
best_ask = asks.last
expect(best_ask[0]).to eq(634.974840000)
expect(best_ask[1]).to eq(9.727400000)trades = @virtex.tradebook('BTCCAD').trades
latest = trades.firstticker = @virtex.ticker("BTCCAD").ticker.BTCCADrequire 'virtex'
@virtex = Virtex::Client.new(ENV['VIRTEX_API_KEY'], ENV['VIRTEX_API_SECRET'])expect(@virtex.balance.balance.CAD).to eq(0.0385)transactions = @virtex.transactions("BTC").transactionsrecent_trades = @virtex.trades.tradesrecent_orders = @virtex.orders.orders# Place a new order to sell 0.1 BTC/CAD at 1000.00
new_order = @virtex.new_order!('sell', 0.1, 'BTCCAD', 1000.00).order@virtex.cancel_order! 543468withdrawal = @virtex.withdraw!(0.01, 'BTC', '1DWYffTxhXgBtbswMjNViw9nNCvx3Drpvn').resultIf you'd like to contribute code or modify this gem, you can run the test suite with:
gem install virtex --dev
bundle exec rspec- Fork this repo and make changes in your own copy
- Add a test if applicable and run the existing tests with
rspecto make sure they pass - Commit your changes and push to your fork
git push origin master - Create a new pull request and submit it back to me
Thanks to @Skizzk for providing an example of correctly authenticating with Virtex
Thanks to @barmstrong on whose coinbase gem I based this library