The BTC-E Ruby API Library :ru:
Installation
gem install btce-api
Usage
$ ./balance.rb
=============================
RUR: 2001.000004
USD: 0.000061
LTC: 32.242009
BTC: 0.000141
=============================
At: 2013-04-21 16:34:50 +0400
That was made with these lines:
require 'btce'
api = Btce::Api.new(KEY, SECRET)
puts '============================='
puts 'RUR: %f' % api.balance.amount(Btce::RUR)
puts 'USD: %f' % api.balance.amount(Btce::USD)
puts 'LTC: %f' % api.balance.amount(Btce::LTC)
puts 'BTC: %f' % api.balance.amount(Btce::BTC)
puts '============================='
puts 'At: %s' % Time.at(api.stats.server_time)
Check other examples in the examples/ folder, this library has the 100% private API coverage.
FYI
- Public API is coming soon;
- API methods will throw an exception if server reports an error, please catch that;
- Don't forget to update keys with your own, otherwise examples won't work;
- Please feel free to report/fix any bugs;
- Check out the LICENSE.
Documentation
API is synced wih https://btc-e.com/api/documentation
- GetInfo - Api::get_info, also there are helpers:
- (unofficial)
Api::update
, drops info cache (next 3 methods are cached); - (unofficial)
Api::balance
, returns aTypes::Balance
hash; - (unofficial)
Api::rights
, returns aTypes::Rights
hash; - (unofficial)
Api::stats
, returns aTypes::Stats
hash.
- (unofficial)
- TransHistory - Api::trans_history
- options:
from, count, from_id, end_id, order, since, end
- returns a
Types::Transaction
set.
- options:
- TradeHistory - Api::trade_history
- options:
from, count, from_id, end_id, order, since, end, pair
- returns a
Types::Trade
set.
- options:
- OrderList - Api::order_list
- options:
from, count, from_id, end_id, order, since, end, pair, active
- returns a
Types::Order
set.
- options:
- Trade - Api::trade
- parameters:
pair, type, rate, amount
- returns a
Types::PlacedOrder
object.
- parameters:
- CancelOrder - Api::cancel_order
- parameter:
order_id
- returns
order_id
of the cancelled order.
- parameter:
- Types::Response
- models response from server, used in
Btce::Bus
- models response from server, used in
- Types::Balance
amount(currency)
, where currency is likeBtce::USD
- Types::Rights
info?
trade?
withdraw?
- Types::Stats
transaction_count
, returns your overall transaction count;open_orders
, returns your overall open orders count;server_time
- subj.
- Types::Transaction
- has methods
id, type, amount, currency, desc, status, timestamp
- has methods
- Types::Trade
- has methods
id, pair, type, amount, rate, order_id, is_your_order, timestamp
- has methods
- Types::Order
- has methods
id, pair, type, amount, rate, timestamp_created, status
- + one bonus
active?
which returnstrue
if order is active.
- has methods
- Types::PlacedOrder
- has methods
received, remains, order_id
- + one bonus
cancel
which cancels the order itself.
- has methods
Donate
- Bitcoin: 1KRagCPzzLYvNVzZSXUZN4f2hCRZibtiXa
- Litecoin: LLN2L8fsATuxNtQdiKeyK8ceqNuAVNexFf