Class: Finnhub::Stock_Exchange

Inherits:
Object
  • Object
show all
Defined in:
lib/Stock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject (readonly)

Returns the value of attribute code.



9
10
11
# File 'lib/Stock.rb', line 9

def code
  @code
end

#hashObject (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