Class: Finnhub::Forex_Exchange

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, name:) ⇒ Forex_Exchange

Returns a new instance of Forex_Exchange.



3
4
5
6
# File 'lib/Forex.rb', line 3

def initialize(client:, name:)
  @client = client
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/Forex.rb', line 8

def name
  @name
end

Instance Method Details

#symbol(**args) ⇒ Object



19
20
21
# File 'lib/Forex.rb', line 19

def symbol(**args)
  Finnhub::Forex_Symbol.new(client: @client, exchange: @name, **args)
end

#symbols(plain: false) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/Forex.rb', line 10

def symbols(plain: false)
  output = @client.request("/forex/symbol?exchange=#{@name}")
  return output if plain

  output.map do |o|
    Finnhub::Forex_Symbol.new(client: @client, exchange: @name, **o)
  end
end