Class: Market

Inherits:
Base
  • Object
show all
Defined in:
lib/blocksdk_ruby/market.rb

Instance Attribute Summary

Attributes inherited from Base

#api_token

Instance Method Summary collapse

Methods inherited from Base

#initialize, #request

Constructor Details

This class inherits a constructor from Base

Instance Method Details

#getAsset(request = {}) ⇒ Object



12
13
14
# File 'lib/blocksdk_ruby/market.rb', line 12

def getAsset(request = {})
	return request("GET","/market/assets/" + (request['asset_id']).to_s)
end

#getAssets(request = {}) ⇒ Object



8
9
10
# File 'lib/blocksdk_ruby/market.rb', line 8

def getAssets(request = {})
	return request("GET","/market/assets")
end

#getExchangeOhlcvHistory(request = {}) ⇒ Object



28
29
30
# File 'lib/blocksdk_ruby/market.rb', line 28

def getExchangeOhlcvHistory(request = {})
	return request("GET","/market/ohlcv/" + (request['exchage_id']).to_s + "/history/" + (request['symbol']).to_s,request)
end

#getExchangeOhlcvLast(request = {}) ⇒ Object



24
25
26
# File 'lib/blocksdk_ruby/market.rb', line 24

def getExchangeOhlcvLast(request = {})
	return request("GET","/market/ohlcv/" + (request['exchage_id']).to_s + "/latest",request)
end

#getExchangeRates(request = {}) ⇒ Object



60
61
62
63
64
65
66
67
# File 'lib/blocksdk_ruby/market.rb', line 60

def getExchangeRates(request = {})
	request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]

	return request("GET","/market/rates/" +    (request['exchage_id']).to_s + "/" + (request['from']).to_s,{
		"to" => request['to'],
		"from_amount" => request['from_amount']
	})
end

#getExchanges(request = {}) ⇒ Object



4
5
6
# File 'lib/blocksdk_ruby/market.rb', line 4

def getExchanges(request = {})
	return request("GET","/market/exchanges")
end

#getExchangeTrades(request = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/blocksdk_ruby/market.rb', line 50

def getExchangeTrades(request = {})
	request["from"].to_s.empty? ? request['from'] = nil : request['from']
	request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]

	return request("GET","/market/trades/" +    (request['exchage_id']).to_s+ "",{
		"from" => request['from'],
		"to" => request['to']
	})
end

#getOhlcvHistory(request = {}) ⇒ Object



20
21
22
# File 'lib/blocksdk_ruby/market.rb', line 20

def getOhlcvHistory(request = {})
	return request("GET","/market/ohlcv/history/" + (request['symbol']).to_s,request)
end

#getOhlcvLast(request = {}) ⇒ Object



16
17
18
# File 'lib/blocksdk_ruby/market.rb', line 16

def getOhlcvLast(request = {})
	return request("GET","/market/ohlcv/latest",request)
end

#getRates(request = {}) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/blocksdk_ruby/market.rb', line 42

def getRates(request = {})

	return request("GET","/market/rates/" + (request['from']).to_s+ "",{
		"to" => request['to'],
		"from_amount" => request['from_amount']
	})
end

#getTrades(request = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/blocksdk_ruby/market.rb', line 32

def getTrades(request = {})
	request["from"].to_s.empty? ? request['from'] = nil : request['from']
	request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]

	return request("GET","/market/trades",{
		"from" => request['from'],
		"to" => request['to']
	})
end