Module: Tradier::API::Markets

Includes:
Utils
Included in:
Client
Defined in:
lib/tradier/api/markets.rb

Instance Method Summary collapse

Instance Method Details

#calendar(options = {}) ⇒ Tradier::Calendar

Obtain the market calendar

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



73
74
75
# File 'lib/tradier/api/markets.rb', line 73

def calendar(options={})
  object_from_response(Tradier::Calendar, :get, '/markets/calendar', options)
end

#chains(symbol, options = {}) ⇒ Array<Tradier::OptionQuote> Also known as: chain

Obtain an option chain.

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



28
29
30
31
# File 'lib/tradier/api/markets.rb', line 28

def chains(symbol, options={})
  options.merge!('symbol' => symbol)
  object_from_response(Tradier::API::Utils::OptionQuote, :get, '/markets/options/chains', options).body
end

#clock(options = {}) ⇒ Tradier::Clock

Obtain the market clock

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



63
64
65
# File 'lib/tradier/api/markets.rb', line 63

def clock(options={})
  object_from_response(Tradier::Clock, :get, '/markets/clock', options)
end

#expirations(symbol) ⇒ Array<Date>

Obtain an underlier's expiration dates.

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



41
42
43
# File 'lib/tradier/api/markets.rb', line 41

def expirations(symbol)
  object_from_response(Tradier::API::Utils::Expiration, :get, '/markets/options/expirations', :symbol => symbol).body
end

#history(symbol, options = {}) ⇒ Array<Tradier::Event>

Get historical pricing for a given symbol.

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



96
97
98
99
# File 'lib/tradier/api/markets.rb', line 96

def history(symbol, options={})
  options.merge!('symbol' => symbol)
  object_from_response(Tradier::API::Utils::History, :get, '/markets/history', options).body
end

#quotes(symbols, options = {}) ⇒ Array<Tradier::Quote> Also known as: quote

Obtain quotes.

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



15
16
17
18
# File 'lib/tradier/api/markets.rb', line 15

def quotes(symbols, options={})
  options.merge!('symbols' => normalized_symbols(symbols))
  object_from_response(Tradier::API::Utils::Quote, :get, '/markets/quotes', options).body
end

#strikes(symbol, expiration) ⇒ Array<String>

Obtain an underlier's expiration strikes for an expiration date.

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



53
54
55
# File 'lib/tradier/api/markets.rb', line 53

def strikes(symbol, expiration)
  object_from_response(Tradier::API::Utils::Strike, :get, '/markets/options/strikes', :symbol => symbol, :expiration => expiration).body
end

#timesales(symbol, options = {}) ⇒ Array<Tradier::Timesales>

Get time and sales for a given symbol.

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



84
85
86
87
# File 'lib/tradier/api/markets.rb', line 84

def timesales(symbol, options={})
  options.merge!('symbol' => symbol)
  object_from_response(Tradier::API::Utils::Timesales, :get, '/markets/timesales', options).body
end