Decided its time to create a ruby interface for the BTCMarkets.net API.
Currently it only supports querying data. API may change if we support trading.
# Assuming you are installing 0.0.1
gem build nl-btcmarkets.gemspec
gem install nl-btcmarkets-0.0.1.gem
gem install nl-btcmarkets
source 'https://rubygems.org'
gem 'httparty'
gem 'nl-btcmarkets'
The following environment variables need to be set up
- btcm_access_key
- btcm_access_secret
require 'nl-btcmarkets'
b = BTCMarkets.new
puts b.get_market_BTC_AUD_tick # Get the spot quote
puts b.get_market_BTC_AUD_orderbook # Get orderbook
puts b.get_account_balance # Get account balance
require 'nl-btcmarkets'
require 'json'
b = BTCMarkets.new
JSON.parse(b.get_account_balance).each{|bal|
if bal['balance'] > 0 then
if bal['currency'] == 'AUD' or bal['currency'] == 'USD'
puts "Balance: #{bal['currency']}$#{(bal['balance'].to_f / 100000000).to_s} / Trading Balance: #{bal['currency']}$#{(bal['pendingFunds'].to_f / 100000000).to_s}"
end
end
}
- This is an early stage pre-release. Use at your own risk.
- Pull Requests are appreciated