Class: Btce::TradeAPI
- Inherits:
-
API
- Object
- API
- Btce::TradeAPI
show all
- Defined in:
- lib/btce.rb
Constant Summary
collapse
- OPERATIONS =
%w(getInfo
TransHistory
TradeHistory
OrderList
Trade
CancelOrder)
Constants inherited
from API
API::BTCE_DOMAIN, API::CURRENCIES, API::CURRENCY_PAIRS, API::KEY, API::MAX_DIGITS
Class Method Summary
collapse
Methods inherited from API
get_https, get_json
Class Method Details
.nonce ⇒ Object
251
252
253
|
# File 'lib/btce.rb', line 251
def nonce
Time.now.to_i
end
|
.sign(params) ⇒ Object
230
231
232
233
234
235
236
237
238
|
# File 'lib/btce.rb', line 230
def sign(params)
hmac = OpenSSL::HMAC.new(API::KEY['secret'],
OpenSSL::Digest::SHA512.new)
params = params
.collect {|k,v| "#{k}=#{v}"}
.join('&')
signed = hmac.update params
end
|
.trade_api_call(method, extra) ⇒ Object
240
241
242
243
244
245
246
247
248
249
|
# File 'lib/btce.rb', line 240
def trade_api_call(method, )
params = {"method" => method, "nonce" => nonce}
if ! .empty?
.each do |a|
params[a.to_s] = a
end
end
signed = sign params
get_json "https://#{API::BTCE_DOMAIN}/tapi", params, signed
end
|