Class: Bittrex::Api
- Inherits:
-
Object
- Object
- Bittrex::Api
- Defined in:
- lib/api.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #balance(currency) ⇒ Object
- #balances ⇒ Object
- #buy(market, quantity, rate = nil) ⇒ Object
- #cancel(order_id) ⇒ Object
-
#initialize(api_key, api_secret) ⇒ Api
constructor
A new instance of Api.
- #market_history(market, count = 10) ⇒ Object
- #open_orders(market = '') ⇒ Object
- #order_history(market = nil, count = 5) ⇒ Object
- #orderbook(market, type, depth = 50) ⇒ Object
- #sell(market, quantity, rate = nil) ⇒ Object
- #summaries ⇒ Object
- #ticker(market) ⇒ Object
Constructor Details
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
3 4 5 |
# File 'lib/api.rb', line 3 def request @request end |
Instance Method Details
#balance(currency) ⇒ Object
53 54 55 |
# File 'lib/api.rb', line 53 def balance(currency) request.get "/account/getbalance", "currency=#{currency}" end |
#balances ⇒ Object
49 50 51 |
# File 'lib/api.rb', line 49 def balances request.get "/account/getbalances" end |
#buy(market, quantity, rate = nil) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/api.rb', line 25 def buy(market, quantity, rate = nil) if rate request.get "/market/buylimit", "market=#{market}&quantity=#{quantity}&rate=#{rate}" else request.get "/market/buymarket", "market=#{market}&quantity=#{quantity}" end end |
#cancel(order_id) ⇒ Object
41 42 43 |
# File 'lib/api.rb', line 41 def cancel(order_id) request.get "/market/cancel", "uuid=#{order_id}" end |
#market_history(market, count = 10) ⇒ Object
21 22 23 |
# File 'lib/api.rb', line 21 def market_history(market, count = 10) request.get "/public/getmarkethistory", "market=#{market}&count=#{count}" end |
#open_orders(market = '') ⇒ Object
45 46 47 |
# File 'lib/api.rb', line 45 def open_orders(market = '') request.get "/market/getopenorders", "market=#{market}" end |
#order_history(market = nil, count = 5) ⇒ Object
57 58 59 60 |
# File 'lib/api.rb', line 57 def order_history(market = nil, count = 5) params = market ? "market=#{market}&count=#{count}" : "count=#{count}" request.get "/account/getorderhistory", params end |
#orderbook(market, type, depth = 50) ⇒ Object
17 18 19 |
# File 'lib/api.rb', line 17 def orderbook(market, type, depth = 50) request.get "/public/getorderbook", "market=#{market}&type=#{type}&depth=#{depth}" end |
#sell(market, quantity, rate = nil) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/api.rb', line 33 def sell(market, quantity, rate = nil) if rate request.get "/market/selllimit", "market=#{market}&quantity=#{quantity}&rate=#{rate}" else request.get "/market/sellmarket", "market=#{market}&quantity=#{quantity}" end end |
#summaries ⇒ Object
13 14 15 |
# File 'lib/api.rb', line 13 def summaries request.get "/public/getmarketsummaries" end |
#ticker(market) ⇒ Object
9 10 11 |
# File 'lib/api.rb', line 9 def ticker(market) request.get "/public/getticker", "market=#{market}" end |