Class: MoexIssClient::Security

Inherits:
Object
  • Object
show all
Defined in:
lib/moex_iss_client/security.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(history) ⇒ Security

Returns a new instance of Security.



9
10
11
# File 'lib/moex_iss_client/security.rb', line 9

def initialize(history)
  @history = HistoryValidator.new.validate(history)
end

Instance Attribute Details

#historyObject (readonly)

Returns the value of attribute history.



7
8
9
# File 'lib/moex_iss_client/security.rb', line 7

def history
  @history
end

Instance Method Details

#attribute(attr) ⇒ Object



25
26
27
# File 'lib/moex_iss_client/security.rb', line 25

def attribute(attr)
  last_data_sample[attr.to_s.upcase]
end

#last_priceObject



13
14
15
# File 'lib/moex_iss_client/security.rb', line 13

def last_price
  last_data_sample['CLOSE']
end

#sec_idObject



21
22
23
# File 'lib/moex_iss_client/security.rb', line 21

def sec_id
  last_data_sample['SECID']
end

#shortnameObject



17
18
19
# File 'lib/moex_iss_client/security.rb', line 17

def shortname
  last_data_sample['SHORTNAME']
end