Class: SatoshiRuby::Satoshi

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/satoshi_ruby.rb

Constant Summary collapse

URL =
'https://api.vaultofsatoshi.com'

Instance Method Summary collapse

Constructor Details

#initialize(api_key, api_sign) ⇒ Satoshi

Returns a new instance of Satoshi.



14
15
16
17
# File 'lib/satoshi_ruby.rb', line 14

def initialize api_key, api_sign
	@api_key = api_key
	@api_sign = api_sign
end

Instance Method Details

#accountObject



31
32
33
34
# File 'lib/satoshi_ruby.rb', line 31

def 
	end_point = '/info/account'
	action end_point, nil
end

#balance(cur = '') ⇒ Object



36
37
38
39
40
# File 'lib/satoshi_ruby.rb', line 36

def balance cur = ''
	end_point = '/info/balance'
	data = {currency: cur.to_s}
	action end_point, data
end

#cancel(order_id) ⇒ Object



88
89
90
91
92
# File 'lib/satoshi_ruby.rb', line 88

def cancel order_id
	end_point = '/trade/cancel'
	data = {order_id: order_id}
	action end_point, data
end

#currency(cur = '') ⇒ Object



25
26
27
28
29
# File 'lib/satoshi_ruby.rb', line 25

def currency cur = ''
	end_point = '/info/currency'
	data = {currency: cur.to_s}
	action end_point, data
end

#order_details(order_id) ⇒ Object



75
76
77
78
79
# File 'lib/satoshi_ruby.rb', line 75

def order_details order_id
	end_point = '/info/order_detail'
	data = {order_id: order_id}
	action end_point, data
end

#orderbook(order_currency, payment_currency, group_orders, count) ⇒ Object



61
62
63
64
65
66
# File 'lib/satoshi_ruby.rb', line 61

def orderbook order_currency, payment_currency, group_orders, count
	end_point = '/info/orderbook'
	data = {order_currency: order_currency, payment_currency: payment_currency, group_orders: group_orders,
		count: count}
	action end_point, data
end

#orders(count = 100, after = '', open_only = '') ⇒ Object



68
69
70
71
72
73
# File 'lib/satoshi_ruby.rb', line 68

def orders count = 100, after = '', open_only = ''
	end_point = '/info/orders'
	data = {count: count, after: after}
	data = open_only.empty? ? data : data.merge({open_only: open_only})
	action end_point, data
end

#place(type, order_currency, units, payment_currency, price) ⇒ Object



81
82
83
84
85
86
# File 'lib/satoshi_ruby.rb', line 81

def place type, order_currency, units, payment_currency, price
	end_point = '/trade/place'
	data = {type: type, order_currency: order_currency, units: units, payment_currency: payment_currency,
		price: price}
	action end_point, data
end

#quote(type, order_currency, units, payment_currency, price) ⇒ Object



54
55
56
57
58
59
# File 'lib/satoshi_ruby.rb', line 54

def quote type, order_currency, units, payment_currency, price
	end_point = '/info/quote'
	data = {type: type, order_currency: order_currency, units: units, payment_currency: payment_currency,
		price: price}
	action end_point, data
end

#ticker(order_currency, payment_currency) ⇒ Object



48
49
50
51
52
# File 'lib/satoshi_ruby.rb', line 48

def ticker order_currency, payment_currency
	end_point = '/info/ticker'
	data = {order_currency: order_currency, payment_currency: payment_currency}
	action end_point, data
end

#wallet_address(cur = '') ⇒ Object



19
20
21
22
23
# File 'lib/satoshi_ruby.rb', line 19

def wallet_address cur = ''
	end_point = '/info/wallet_address'
	data = {currency: cur.to_s}
	action end_point, data
end

#wallet_history(cur, count = 100, after = '') ⇒ Object



42
43
44
45
46
# File 'lib/satoshi_ruby.rb', line 42

def wallet_history cur, count = 100, after = ''
	end_point = '/info/wallet_history'
	data = {currency: cur.to_s, count: count, after: after}
	action end_point, data
end