📦 SQA::Stream¶
🔨 Instance Methods¶
#ticker()¶
Returns the value of attribute ticker.
Source Location
#window_size()¶
Returns the value of attribute window_size.
Source Location
#strategies()¶
Returns the value of attribute strategies.
Source Location
#data_buffer()¶
Returns the value of attribute data_buffer.
Source Location
#indicator_cache()¶
Returns the value of attribute indicator_cache.
Source Location
#initialize(ticker:, window_size: = 100, strategies: = [])¶
Returns
Type: Stream
a new instance of Stream
Source Location
#add_strategy(strategy)¶
Add a strategy to the stream processor
Source Location
#on_signal(&block)¶
Register callback for trading signals
Example: stream.on_signal do |signal, data| puts "#{signal.upcase} at $#{data[:price]}" end
Source Location
#on_update(&block)¶
Register callback for price updates
Example: stream.on_update do |data| puts "Price updated: $#{data[:price]}" end
Source Location
#update(price:, volume: = nil, high: = nil, low: = nil, timestamp: = Time.now)¶
Update stream with new market data
Required fields: price Optional fields: volume, high, low, timestamp
Source Location
#current_price()¶
Get current price
Source Location
#recent_prices(count = nil)¶
Get recent prices
Source Location
#recent_volumes(count = nil)¶
Get recent volumes
Source Location
#indicator(name, **options)¶
Calculate or retrieve cached indicator
Example: rsi = stream.indicator(:rsi, period: 14) sma = stream.indicator(:sma, period: 20)
Source Location
#current_signal()¶
Get current trading signal from last strategy execution
Source Location
#stats()¶
Get statistics about the stream
Source Location
#reset()¶
Reset the stream (clear all data)
Source Location
📝 Attributes¶
👁️ ticker read-only¶
Returns the value of attribute ticker.
👁️ window_size read-only¶
Returns the value of attribute window_size.
👁️ strategies read-only¶
Returns the value of attribute strategies.
👁️ data_buffer read-only¶
Returns the value of attribute data_buffer.
👁️ indicator_cache read-only¶
Returns the value of attribute indicator_cache.