Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nolim1t/btcmarkets-gem
BTCMarkets Ruby Gem for querying Market API data (Trading coming soon)
https://github.com/nolim1t/btcmarkets-gem
api-client bitcoin btcmarkets exchanges trading
Last synced: 2 days ago
JSON representation
BTCMarkets Ruby Gem for querying Market API data (Trading coming soon)
- Host: GitHub
- URL: https://github.com/nolim1t/btcmarkets-gem
- Owner: nolim1t
- Created: 2016-01-21T04:28:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-17T08:56:25.000Z (over 6 years ago)
- Last Synced: 2024-10-20T20:30:16.930Z (28 days ago)
- Topics: api-client, bitcoin, btcmarkets, exchanges, trading
- Language: Ruby
- Homepage: https://rubygems.org/gems/nl-btcmarkets
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BTC Markets Ruby Gem
[![Gem Version](https://badge.fury.io/rb/nl-btcmarkets.svg)](https://badge.fury.io/rb/nl-btcmarkets)## About / Why
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.
## Building
```bash
# Assuming you are installing 0.0.1
gem build nl-btcmarkets.gemspec
gem install nl-btcmarkets-0.0.1.gem
```## installing
```bash
gem install nl-btcmarkets
```### Or add the following to your Gemfile
```text
source 'https://rubygems.org'gem 'httparty'
gem 'nl-btcmarkets'
```## Usage
### Environment Variables
The following environment variables need to be set up
* btcm_access_key
* btcm_access_secret### Sample Code
```ruby
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
puts b.post_order_open( {"currency":"AUD","instrument":"BTC","limit":10,"since":0})
```#### Get Account Balance if not 0
```ruby
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
}
```## Disclaimer
* This is an early stage pre-release. Use at your own risk.
* Pull Requests are appreciated