Class: Finnhub::Stock
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Analysis
#pattern, #support_resistance, #technical_indicators
Constructor Details
#initialize(client:, symbol:) ⇒ Stock
Returns a new instance of Stock.
5
6
7
8
|
# File 'lib/Stock.rb', line 5
def initialize(client:, symbol:)
@client = client
@symbol = symbol
end
|
Instance Attribute Details
#symbol ⇒ Object
Returns the value of attribute symbol.
10
11
12
|
# File 'lib/Stock.rb', line 10
def symbol
@symbol
end
|
Instance Method Details
#ceo_compensation ⇒ Object
16
17
18
|
# File 'lib/Stock.rb', line 16
def ceo_compensation
@client.request("/stock/ceo-compensation?symbol=#{@symbol}")
end
|
#earnings ⇒ Object
39
40
41
|
# File 'lib/Stock.rb', line 39
def earnings
@client.request("/stock/earnings?symbol=#{@symbol}")
end
|
#news ⇒ Object
43
44
45
|
# File 'lib/Stock.rb', line 43
def news
@client.request("/news/#{@symbol}")
end
|
#option_chain ⇒ Object
28
29
30
|
# File 'lib/Stock.rb', line 28
def option_chain
@client.request("/stock/option-chain?symbol=#{@symbol}")
end
|
#peers(plain: false) ⇒ Object
32
33
34
35
36
37
|
# File 'lib/Stock.rb', line 32
def peers(plain: false)
output = @client.request("/stock/peers?symbol=#{@symbol}")
return output if plain
output.map{|o| Finnhub::Stock.new(client: @client, symbol: o)}
end
|
#price_target ⇒ Object
24
25
26
|
# File 'lib/Stock.rb', line 24
def price_target
@client.request("/stock/price-target?symbol=#{@symbol}")
end
|
#profile ⇒ Object
12
13
14
|
# File 'lib/Stock.rb', line 12
def profile
@client.request("/stock/profile?symbol=#{@symbol}")
end
|
#recommendation ⇒ Object
20
21
22
|
# File 'lib/Stock.rb', line 20
def recommendation
@client.request("/stock/recommendation?symbol=#{@symbol}")
end
|
#sentiment ⇒ Object
47
48
49
|
# File 'lib/Stock.rb', line 47
def sentiment
@client.request("/news-sentiment?symbol=#{@symbol}")
end
|
#timeseries(**args) ⇒ Object
51
52
53
|
# File 'lib/Stock.rb', line 51
def timeseries(**args)
Finnhub::Timeseries.new(client: @client, stock: self, **args)
end
|