Class: Finnhub::Stock_Exchange
- Inherits:
-
Object
- Object
- Finnhub::Stock_Exchange
- Defined in:
- lib/Stock.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#initialize(client:, code:, hash:) ⇒ Stock_Exchange
constructor
A new instance of Stock_Exchange.
- #symbol(**args) ⇒ Object
- #symbols(plain: false) ⇒ Object
Constructor Details
#initialize(client:, code:, hash:) ⇒ Stock_Exchange
3 4 5 6 7 |
# File 'lib/Stock.rb', line 3 def initialize(client:, code:, hash:) @client = client @hash = hash @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
9 10 11 |
# File 'lib/Stock.rb', line 9 def code @code end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
9 10 11 |
# File 'lib/Stock.rb', line 9 def hash @hash end |
Instance Method Details
#symbol(**args) ⇒ Object
20 21 22 |
# File 'lib/Stock.rb', line 20 def symbol(**args) Finnhub::Stock.new(client: @client, exchange: @code, **args) end |
#symbols(plain: false) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/Stock.rb', line 11 def symbols(plain: false) output = @client.request("/stock/symbol?exchange=#{@code}") return output if plain output.map do |o| Finnhub::Stock.new(client: @client, exchange: @code, **o) end end |