Class: Bitstampede::Client
- Inherits:
-
Object
- Object
- Bitstampede::Client
- Defined in:
- lib/bitstampede/client.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
- #balance ⇒ Object
- #buy!(amount, price) ⇒ Object
- #cancel(id) ⇒ Object
-
#initialize(key = nil, secret = nil) ⇒ Client
constructor
A new instance of Client.
- #orders ⇒ Object
- #sell!(amount, price) ⇒ Object
Constructor Details
#initialize(key = nil, secret = nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/bitstampede/client.rb', line 10 def initialize(key = nil, secret = nil) @key = key @secret = secret end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
7 8 9 |
# File 'lib/bitstampede/client.rb', line 7 def key @key end |
#secret ⇒ Object
Returns the value of attribute secret.
8 9 10 |
# File 'lib/bitstampede/client.rb', line 8 def secret @secret end |
Instance Method Details
#balance ⇒ Object
15 16 17 |
# File 'lib/bitstampede/client.rb', line 15 def balance mapper.map_balance(net.post("balance")) end |
#buy!(amount, price) ⇒ Object
23 24 25 |
# File 'lib/bitstampede/client.rb', line 23 def buy!(amount, price) trade!("buy", amount, price) end |
#cancel(id) ⇒ Object
31 32 33 34 35 |
# File 'lib/bitstampede/client.rb', line 31 def cancel(id) wrapping_standard_error do mapper.map_cancel(net.post("cancel_order", { id: id.to_s })) end end |
#orders ⇒ Object
19 20 21 |
# File 'lib/bitstampede/client.rb', line 19 def orders mapper.map_orders(net.post("open_orders")) end |
#sell!(amount, price) ⇒ Object
27 28 29 |
# File 'lib/bitstampede/client.rb', line 27 def sell!(amount, price) trade!("sell", amount, price) end |