Class: RTCBX::Candles
- Defined in:
- lib/rtcbx/candles.rb,
lib/rtcbx/candles/candle.rb
Defined Under Namespace
Classes: Candle
Constant Summary
Constants inherited from RTCBX
Instance Attribute Summary collapse
-
#bucket_lock ⇒ Object
readonly
Returns the value of attribute bucket_lock.
-
#bucket_thread ⇒ Object
readonly
Returns the value of attribute bucket_thread.
-
#buckets ⇒ Object
readonly
Returns the value of attribute buckets.
-
#candle_thread ⇒ Object
readonly
Returns the value of attribute candle_thread.
-
#candles ⇒ Object
readonly
Returns the value of attribute candles.
-
#current_bucket ⇒ Object
readonly
Returns the value of attribute current_bucket.
-
#first_bucket ⇒ Object
readonly
Returns the value of attribute first_bucket.
-
#history_queue ⇒ Object
readonly
Returns the value of attribute history_queue.
-
#initial_time ⇒ Object
readonly
Returns the value of attribute initial_time.
-
#start_minute ⇒ Object
readonly
Returns the value of attribute start_minute.
-
#update_thread ⇒ Object
readonly
Returns the value of attribute update_thread.
Attributes inherited from RTCBX
#api_key, #api_passphrase, #api_secret, #client, #last_pong, #message_callbacks, #product_id, #queue, #start, #websocket, #websocket_thread
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Candles
constructor
A new instance of Candles.
- #start! ⇒ Object
Methods inherited from RTCBX
Constructor Details
#initialize(options = {}, &block) ⇒ Candles
20 21 22 23 |
# File 'lib/rtcbx/candles.rb', line 20 def initialize( = {}, &block) super(, &block) @buckets_lock = Mutex.new end |
Instance Attribute Details
#bucket_lock ⇒ Object (readonly)
Returns the value of attribute bucket_lock.
17 18 19 |
# File 'lib/rtcbx/candles.rb', line 17 def bucket_lock @bucket_lock end |
#bucket_thread ⇒ Object (readonly)
Returns the value of attribute bucket_thread.
9 10 11 |
# File 'lib/rtcbx/candles.rb', line 9 def bucket_thread @bucket_thread end |
#buckets ⇒ Object (readonly)
Returns the value of attribute buckets.
6 7 8 |
# File 'lib/rtcbx/candles.rb', line 6 def buckets @buckets end |
#candle_thread ⇒ Object (readonly)
Returns the value of attribute candle_thread.
10 11 12 |
# File 'lib/rtcbx/candles.rb', line 10 def candle_thread @candle_thread end |
#candles ⇒ Object (readonly)
Returns the value of attribute candles.
13 14 15 |
# File 'lib/rtcbx/candles.rb', line 13 def candles @candles end |
#current_bucket ⇒ Object (readonly)
Returns the value of attribute current_bucket.
11 12 13 |
# File 'lib/rtcbx/candles.rb', line 11 def current_bucket @current_bucket end |
#first_bucket ⇒ Object (readonly)
Returns the value of attribute first_bucket.
16 17 18 |
# File 'lib/rtcbx/candles.rb', line 16 def first_bucket @first_bucket end |
#history_queue ⇒ Object (readonly)
Returns the value of attribute history_queue.
7 8 9 |
# File 'lib/rtcbx/candles.rb', line 7 def history_queue @history_queue end |
#initial_time ⇒ Object (readonly)
Returns the value of attribute initial_time.
15 16 17 |
# File 'lib/rtcbx/candles.rb', line 15 def initial_time @initial_time end |
#start_minute ⇒ Object (readonly)
Returns the value of attribute start_minute.
12 13 14 |
# File 'lib/rtcbx/candles.rb', line 12 def start_minute @start_minute end |
#update_thread ⇒ Object (readonly)
Returns the value of attribute update_thread.
8 9 10 |
# File 'lib/rtcbx/candles.rb', line 8 def update_thread @update_thread end |
Instance Method Details
#start! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rtcbx/candles.rb', line 25 def start! super # # Calculate the first minute to start relying on just the websocket for # data. # @initial_time = Time.now @first_bucket = initial_time.to_i + (60 - initial_time.sec) @history_queue = Queue.new start_bucket_thread start_candle_thread end |