Class: Vertpig::Market

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/vertpig/market.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#extract_timestamp

Constructor Details

#initialize(attrs = {}) ⇒ Market

Returns a new instance of Market.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vertpig/market.rb', line 9

def initialize(attrs = {})
  @name = attrs['MarketName']
  @currency = attrs['MarketCurrency']
  @base = attrs['BaseCurrency']
  @currency_name = attrs['MarketCurrencyLong']
  @base_name = attrs['BaseCurrencyLong']
  @minimum_trade = attrs['MinTradeSize']
  @active = attrs['IsActive']
  @created_at = extract_timestamp(attrs['Created'])
  @raw = attrs
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def active
  @active
end

#baseObject (readonly)

Returns the value of attribute base.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def base
  @base
end

#base_nameObject (readonly)

Returns the value of attribute base_name.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def base_name
  @base_name
end

#created_atObject (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def currency
  @currency
end

#currency_nameObject (readonly)

Returns the value of attribute currency_name.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def currency_name
  @currency_name
end

#minimum_tradeObject (readonly)

Returns the value of attribute minimum_trade.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def minimum_trade
  @minimum_trade
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw.



7
8
9
# File 'lib/vertpig/market.rb', line 7

def raw
  @raw
end

Class Method Details

.allObject



21
22
23
# File 'lib/vertpig/market.rb', line 21

def self.all
  client.get('public/getmarkets').map{|data| new(data) }
end