module Btc38
Constants
- VERSION
Attributes
configuration[RW]
Public Class Methods
balances()
click to toggle source
# File lib/btc38.rb, line 38 def self.balances post 'getMyBalance' end
cancel_order(mk_type, order_id, coinname)
click to toggle source
# File lib/btc38.rb, line 46 def self.cancel_order(mk_type, order_id, coinname) post 'cancelOrder', mk_type: mk_type, order_id: order_id, coinname: coinname end
depth(c, mk_type)
click to toggle source
# File lib/btc38.rb, line 30 def self.depth(c, mk_type) get 'depth', c: c, mk_type: mk_type end
order_list(mk_type, coinname)
click to toggle source
# File lib/btc38.rb, line 50 def self.order_list(mk_type, coinname) post 'getOrderList', mk_type: mk_type, coinname: coinname end
setup() { |configuration| ... }
click to toggle source
# File lib/btc38.rb, line 11 def self.setup @configuration ||= Configuration.new yield( configuration ) end
submit_order(type, mk_type, price, amount, coinname)
click to toggle source
# File lib/btc38.rb, line 42 def self.submit_order(type, mk_type, price, amount, coinname) post 'submitOrder', type: type, mk_type: mk_type, price: price, amount: amount, coinname: coinname end
ticker(c='all', mk_type='cny')
click to toggle source
# File lib/btc38.rb, line 26 def self.ticker(c='all', mk_type='cny') get 'ticker', c: c, mk_type: mk_type end
trade_list(mk_type, coinname)
click to toggle source
# File lib/btc38.rb, line 54 def self.trade_list(mk_type, coinname) post 'getMyTradeList', mk_type: mk_type, coinname: coinname end
trades(c, mk_type, options = {})
click to toggle source
# File lib/btc38.rb, line 34 def self.trades(c, mk_type, options = {}) get 'trades', options.merge({c: c, mk_type: mk_type}) end
Protected Class Methods
create_sign()
click to toggle source
# File lib/btc38.rb, line 73 def self.create_sign time = Time.now.to_i mdt = "#{configuration.key}_#{configuration.uid}_#{configuration.secret}_#{time}" {key: configuration.key, time: time, md5: Digest::MD5.hexdigest(mdt)} end
get( command, params = {} )
click to toggle source
# File lib/btc38.rb, line 64 def self.get( command, params = {} ) params[:command] = command resource[ "v1/#{command}.php" ].get params: params, "User-Agent" => "curl/7.35.0" end
post( command, params = {} )
click to toggle source
# File lib/btc38.rb, line 69 def self.post( command, params = {} ) resource[ "v1/#{command}.php" ].post params.merge(create_sign), { "User-Agent" => "curl/7.35.0" } end
resource()
click to toggle source
# File lib/btc38.rb, line 60 def self.resource @@resouce ||= RestClient::Resource.new( 'http://api.btc38.com' ) end