Class: JIJI::Rates
- Inherits:
-
Hash
- Object
- Hash
- JIJI::Rates
- Includes:
- Util::Model
- Defined in:
- lib/jiji/models.rb
Overview
レートの集合
Instance Attribute Summary collapse
-
#pair_infos ⇒ Object
readonly
通貨ペアの情報(取引数量など).
-
#time ⇒ Object
readonly
現在時刻.
Instance Method Summary collapse
-
#initialize(pair_infos, list, time = Time.now) ⇒ Rates
constructor
A new instance of Rates.
Methods included from Util::Model
Constructor Details
#initialize(pair_infos, list, time = Time.now) ⇒ Rates
Returns a new instance of Rates.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jiji/models.rb', line 12 def initialize( pair_infos, list, time=Time.now ) super() @pair_infos = pair_infos.inject({}){ |r,pair| code = JIJI::Util.convert_currency_pair_code(pair[0]) r[code] = pair[1] r } @time = time list.each_pair { |k,info| self[k] = Rate.new( info.bid.to_f, info.ask.to_f, info.sell_swap.to_f, info.buy_swap.to_f, time) } end |
Instance Attribute Details
#pair_infos ⇒ Object (readonly)
通貨ペアの情報(取引数量など)
26 27 28 |
# File 'lib/jiji/models.rb', line 26 def pair_infos @pair_infos end |
#time ⇒ Object (readonly)
現在時刻
28 29 30 |
# File 'lib/jiji/models.rb', line 28 def time @time end |