Class: Bitcoin::Ssymbol

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin/ssymbol.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#baseCurrencyObject

Returns the value of attribute baseCurrency.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def baseCurrency
  @baseCurrency
end

#feeCurrencyObject

Returns the value of attribute feeCurrency.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def feeCurrency
  @feeCurrency
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def id
  @id
end

#provideLiquidityRateObject

Returns the value of attribute provideLiquidityRate.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def provideLiquidityRate
  @provideLiquidityRate
end

#quantityIncrementObject

Returns the value of attribute quantityIncrement.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def quantityIncrement
  @quantityIncrement
end

#quoteCurrencyObject

Returns the value of attribute quoteCurrency.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def quoteCurrency
  @quoteCurrency
end

#takeLiquidityRateObject

Returns the value of attribute takeLiquidityRate.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def takeLiquidityRate
  @takeLiquidityRate
end

#tickSizeObject

Returns the value of attribute tickSize.



3
4
5
# File 'lib/bitcoin/ssymbol.rb', line 3

def tickSize
  @tickSize
end

Class Method Details

.allObject



29
30
31
32
33
34
# File 'lib/bitcoin/ssymbol.rb', line 29

def self.all
  data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/symbol"))
  data.map{ |ssymbol|
    Bitcoin::Ssymbol.new_from_object(ssymbol)
  }
end

.new_from_object(data) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bitcoin/ssymbol.rb', line 16

def self.new_from_object(data)
  s = Bitcoin::Ssymbol.new
  s.id = data['id']
  s.baseCurrency = data['baseCurrency']
  s.quoteCurrency = data['quoteCurrency']
  s.quantityIncrement = data['quantityIncrement']
  s.tickSize = data['tickSize']
  s.takeLiquidityRate = data['takeLiquidityRate']
  s.provideLiquidityRate = data['provideLiquidityRate']
  s.feeCurrency = data['feeCurrency']
  s
end

.new_from_symbol_name(symbol_name) ⇒ Object



36
37
38
39
# File 'lib/bitcoin/ssymbol.rb', line 36

def self.new_from_symbol_name(symbol_name)
  data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/symbol/#{symbol_name}"))
  Bitcoin::Ssymbol.new_from_object(data)
end

Instance Method Details

#display_detailsObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/bitcoin/ssymbol.rb', line 5

def display_details
  puts <<-DOC
  ID: #{@id}
  Base Currency: #{@baseCurrency} || Quote Currency: #{@quoteCurrency}
  Quantity Increment: #{@quantityIncrement} || Tick Size: #{@tickSize}
  Take Liquidity Rate: #{@takeLiquidityRate} || Provide Liquidity Rate: #{@provideLiquidityRate}
  Fee Currency: #{@feeCurrency}

  DOC
end