Skip to content

A library for interacting with the btc-e.com API in Ruby.

License

Notifications You must be signed in to change notification settings

borodadada/ruby-btce

 
 

Repository files navigation

Btce Module

This is a library in Ruby to easily acces the data provided by the btc-e.com API. It was originally being used on BTC-Charts.com, among other places. It is available under a BSD-style license.

Show us some love! 1Lq87gJFDYT5MbCa1rA4LLzttYE9Fw3oQw

Installation

The library is available as a rubygem.

gem install btce

Basic Usage

Populate the file btce-api-key.yml along the same lines as the example.

The only thing that 99% of the people using the library will want to do with it:

require 'btce'
ticker = Btce::Ticker.new "btc_usd"

This should return something resembling:

#<Btce::Ticker:0x00000000d5d9a0 @operation="ticker",
                                @pair="btc_usd",
                                @json={"ticker"=>{"high"=>127,
                                                  "low"=>87.301,
                                                  "avg"=>107.1505,
                                                  "vol"=>4240695.81634,
                                                  "vol_cur"=>39298.55663,
                                                  "last"=>115,
                                                  "buy"=>115,
                                                  "sell"=>114.499,
                                                  "server_time"=>1366406293}}>

You can then acces the fields with the predefined methods of the Ticker class.

API Class

This is the parent class for both the PublicAPI class and the TradeAPI class.

BTCE_DOMAIN

This is the domain of the server, defaulting to the string btc-e.com.

CURRENCIES

This is a list of the short strings for all of the currencies currently supported on btc-e.com.

CURRENCY_PAIRS

This is a list of all of the supported currency pairs on btc-e.com.

MAX_DIGITS

This indicates how many digits past the decimal place are commonly displayed to humans for a given currency pair.

Class Methods

get_https

get_json

PublicAPI Class

OPERATIONS

Class Methods

get_pair_operation_json

get_pair_fee_json

get_pair_ticker_json

get_pair_trades_json

get_pair_depth_json

get_<PAIR>_fee_json

get_<PAIR>_ticker_json

get_<PAIR>_trades_json

get_<PAIR>_depth_json

PublicOperation Class

Fee Class

Instance Methods

trade

Ticker Class

Instance Methods

high

low

avg, average

vol, volume

vol_cur

last

buy

sell

server_time

Trade Class

Instance Methods

date

price

amount

tid

price_currency

item

trade_type

Trades Class

Depth Class

TradeAPI Class

This class wraps the Trade API calls for BTCE. Parameters are passed to the method as a hashmap. More information on parameters can be found on the API docs here https://btc-e.com/api/documentation

Class Methods

sign

This method is used to sign the request with the user’s private API key from btc-e.com.

trade_api_call

This is the generic method call to the Trade API. It takes a method from the Trade API, and extra information that is needed for the specific method.

get_info

Returns the user’s balance, API privileges associated with the current key, number of transactions and open orders, as well as server time

trade_history

Returns the user’s trade history

trans_history

Returns the user’s transaction history

trade

Initiates a trade on the user’s account

order_list

Returns a list of active orders

cancel_order

Cancels the user’s order

About

A library for interacting with the btc-e.com API in Ruby.

Resources

License

Stars

Watchers

Forks

Packages

No packages published