Class: Bter::Trade

Inherits:
Object
  • Object
show all
Includes:
Request
Defined in:
lib/bter/trading.rb

Constant Summary collapse

METHODS =
['getfunds', 'orderlist', 'getorder', 'cancelorder', 'mytrades']

Constants included from Request

Request::PUBLIC_URL, Request::TRADE_URL

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/bter/trading.rb', line 7

def key
  @key
end

#secretObject

Returns the value of attribute secret.



7
8
9
# File 'lib/bter/trading.rb', line 7

def secret
  @secret
end

Instance Method Details

#buy(pair, amount, rate = nil) ⇒ Object

abstract the trade to buy and sell



22
23
24
25
# File 'lib/bter/trading.rb', line 22

def buy(pair, amount, rate=nil)
  rate ||= get_rate(pair)
  trade({:pair => pair, :type => "BUY", :rate => rate, :amount => amount})
end

#logging(log) ⇒ Object

soon to be removed



40
41
42
# File 'lib/bter/trading.rb', line 40

def logging(log)
  raise "Logger is no longer available , please remove it"
end

#sell(pair, amount, rate = nil) ⇒ Object



27
28
29
30
# File 'lib/bter/trading.rb', line 27

def sell(pair, amount, rate=nil)
  rate ||= get_rate(pair)
  trade({:pair => pair, :type => "SELL", :rate => rate, :amount => amount})
end