Class: Polygonio::Rest::Reference::Tickers

Inherits:
PolygonRestHandler show all
Defined in:
lib/polygonio/rest/api/reference/tickers.rb

Defined Under Namespace

Classes: NewsResponse, Ticker, TickerDetailsResponse, TickerResponse, TickerTypesResponse, TickersParameters

Instance Attribute Summary

Attributes inherited from PolygonRestHandler

#client

Instance Method Summary collapse

Methods inherited from PolygonRestHandler

#initialize

Constructor Details

This class inherits a constructor from Polygonio::Rest::PolygonRestHandler

Instance Method Details

#details(symbol) ⇒ Object



95
96
97
98
99
# File 'lib/polygonio/rest/api/reference/tickers.rb', line 95

def details(symbol)
  symbol = Types::String[symbol]
  res = client.request.get("/v1/meta/symbols/#{symbol}/company")
  TickerDetailsResponse[res.body]
end

#list(params = {}) ⇒ Object



46
47
48
49
50
# File 'lib/polygonio/rest/api/reference/tickers.rb', line 46

def list(params = {})
  params = TickersParameters[params]
  res = client.request.get("/v2/reference/tickers", params.to_h)
  TickerResponse[res.body]
end

#news(symbol, page = 1, perpage = 50) ⇒ Object



112
113
114
115
116
117
118
119
120
# File 'lib/polygonio/rest/api/reference/tickers.rb', line 112

def news(symbol, page = 1, perpage = 50)
  symbol = Types::String[symbol]
  page = Types::Integer[page]
  perpage = Types::Integer[perpage]
  opts = { page: page, perpage: perpage }

  res = client.request.get("/v1/meta/symbols/#{symbol}/news", opts)
  Types::Array.of(NewsResponse)[res.body]
end

#typesObject



60
61
62
63
# File 'lib/polygonio/rest/api/reference/tickers.rb', line 60

def types
  res = client.request.get("/v2/reference/types")
  TickerTypesResponse[res.body]
end