Class: Alpharb::Client

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

Constant Summary collapse

API_ENDPOINT =
'https://www.alphavantage.co'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token = nil) ⇒ Client

Returns a new instance of Client.



7
8
9
# File 'lib/alpharb/client.rb', line 7

def initialize(token = nil)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



5
6
7
# File 'lib/alpharb/client.rb', line 5

def token
  @token
end

Instance Method Details

#quote(symbol) ⇒ Object



15
16
17
# File 'lib/alpharb/client.rb', line 15

def quote(symbol)
  request params: { function: 'GLOBAL_QUOTE', symbol: symbol }
end

#search(keywords) ⇒ Object



11
12
13
# File 'lib/alpharb/client.rb', line 11

def search(keywords)
  request params: { function: 'SYMBOL_SEARCH', keywords: keywords }
end