Class: JIJI::PeriodicallyRate
- Inherits:
-
Object
- Object
- JIJI::PeriodicallyRate
- Includes:
- Dao::TimedData, Util::Model
- Defined in:
- lib/jiji/models.rb
Overview
一定期間のレート
bid,ask,sell_swap,buy_swapは四本値(JIJI::PeriodicallyValue)で保持される。
Instance Attribute Summary collapse
-
#ask ⇒ Object
readonly
Returns the value of attribute ask.
-
#bid ⇒ Object
readonly
Returns the value of attribute bid.
-
#buy_swap ⇒ Object
readonly
Returns the value of attribute buy_swap.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#sell_swap ⇒ Object
readonly
Returns the value of attribute sell_swap.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
Instance Method Summary collapse
- #<<(rate) ⇒ Object
-
#initialize(list = []) ⇒ PeriodicallyRate
constructor
A new instance of PeriodicallyRate.
- #time ⇒ Object
- #time=(t) ⇒ Object
-
#values ⇒ Object
値を配列で取得する.
-
#values=(values) ⇒ Object
値を配列で設定する.
Methods included from Util::Model
Constructor Details
#initialize(list = []) ⇒ PeriodicallyRate
Returns a new instance of PeriodicallyRate.
90 91 92 93 94 95 96 97 98 |
# File 'lib/jiji/models.rb', line 90 def initialize( list=[] ) @bid = PeriodicallyValue.new @ask = PeriodicallyValue.new @sell_swap = PeriodicallyValue.new @buy_swap = PeriodicallyValue.new list.each { |item| self << item } end |
Instance Attribute Details
#ask ⇒ Object (readonly)
Returns the value of attribute ask.
127 128 129 |
# File 'lib/jiji/models.rb', line 127 def ask @ask end |
#bid ⇒ Object (readonly)
Returns the value of attribute bid.
127 128 129 |
# File 'lib/jiji/models.rb', line 127 def bid @bid end |
#buy_swap ⇒ Object (readonly)
Returns the value of attribute buy_swap.
127 128 129 |
# File 'lib/jiji/models.rb', line 127 def buy_swap @buy_swap end |
#end_time ⇒ Object
Returns the value of attribute end_time.
129 130 131 |
# File 'lib/jiji/models.rb', line 129 def end_time @end_time end |
#sell_swap ⇒ Object (readonly)
Returns the value of attribute sell_swap.
127 128 129 |
# File 'lib/jiji/models.rb', line 127 def sell_swap @sell_swap end |
#start_time ⇒ Object
Returns the value of attribute start_time.
128 129 130 |
# File 'lib/jiji/models.rb', line 128 def start_time @start_time end |
Instance Method Details
#<<(rate) ⇒ Object
99 100 101 102 103 104 105 106 |
# File 'lib/jiji/models.rb', line 99 def <<( rate ) @bid << rate.bid @ask << rate.ask @sell_swap << rate.sell_swap @buy_swap << rate.buy_swap @start_time = rate.time unless @start_time @end_time = rate.time end |
#time ⇒ Object
121 122 123 |
# File 'lib/jiji/models.rb', line 121 def time @end_time end |
#time=(t) ⇒ Object
124 125 126 |
# File 'lib/jiji/models.rb', line 124 def time=(t) @end_time = t end |
#values ⇒ Object
値を配列で取得する
108 109 110 111 |
# File 'lib/jiji/models.rb', line 108 def values bid.values + ask.values + sell_swap.values + buy_swap.values \ + [@start_time.to_i, @end_time.to_i] end |
#values=(values) ⇒ Object
値を配列で設定する
113 114 115 116 117 118 119 120 |
# File 'lib/jiji/models.rb', line 113 def values=(values) @bid.values = values[0..3] @ask.values = values[4..7] @sell_swap.values = values[8..11] @buy_swap.values = values[12..15] @start_time = Time.at(values[16].to_i) @end_time = Time.at(values[17].to_i) end |