Class: MoexIss::Client

Inherits:
Object
  • Object
show all
Includes:
Hendler, Request
Defined in:
lib/moex_iss/client.rb

Constant Summary collapse

STOCKS_ENDPOINT =
"engines/stock/markets/shares/boards/tqbr/securities"
STANDARD_PARAMS =
{
  "iss.json" => "extended",
  "iss.only" => "securities,marketdata",
  "iss.meta" => "off"
}

Constants included from Connection

MoexIss::Connection::BASE_URL

Instance Method Summary collapse

Methods included from Hendler

#handle_response

Methods included from Request

#get

Methods included from Connection

#connection

Instance Method Details

#stock(isin, from: nil, till: nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/moex_iss/client.rb', line 24

def stock(isin, from: nil, till: nil)
  return historical_data_of_the_stock(isin, from, till) if from || till

  endpoint = "#{STOCKS_ENDPOINT}/#{isin}.json"
  params = STANDARD_PARAMS

  raw_response = get(endpoint, params)

  MoexIss::Market::Stock.new(handle_response(raw_response))
end

#stocksObject



15
16
17
18
19
20
21
22
# File 'lib/moex_iss/client.rb', line 15

def stocks
  endpoint = "#{STOCKS_ENDPOINT}.json"
  params = STANDARD_PARAMS

  raw_response = get(endpoint, params)

  MoexIss::Market::Stocks.new(handle_response(raw_response))
end