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

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



77
78
79
# File 'lib/tradier/api/markets.rb', line 77

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.

Parameters:

  • symbol (String)

    The underlier's symbol.

Returns:

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

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



67
68
69
# File 'lib/tradier/api/markets.rb', line 67

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

#etbArray<Tradier::Security>

Retrieve the Easy-To-Borrow list.

Returns:

Raises:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



148
149
150
# File 'lib/tradier/api/markets.rb', line 148

def etb
  object_from_response(Tradier::API::Utils::Security, :get, '/markets/etb').body
end

#expirations(symbol, options) ⇒ Array<Date>, Array<Tradier::Expiration>

Obtain an underlier's expiration dates.

Options Hash (options):

  • :strikes (Boolean)

    Indicate whether or not to include strikes alongside the expiration dates.

Parameters:

  • symbol (String)

    The underlier's symbol.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



44
45
46
47
# File 'lib/tradier/api/markets.rb', line 44

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

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

Get historical pricing for a given symbol.

Parameters:

  • symbol (String)

    The symbol.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



100
101
102
103
# File 'lib/tradier/api/markets.rb', line 100

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

#lookup(q, options) ⇒ Array<Tradier::Security>

Lookup a symbol.

Options Hash (options):

  • :indexes (Boolean)

    Indicate whether or not to include indexes in results.

Parameters:

  • q (String)

    The company/index name to search for.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



138
139
140
141
# File 'lib/tradier/api/markets.rb', line 138

def lookup(q, options={})
  options.merge!('q' => q)
  object_from_response(Tradier::API::Utils::Security, :get, '/markets/lookup', options).body
end

#markets_session(options = {}) ⇒ Tradier::EventSession

Create a streaming session

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



111
112
113
# File 'lib/tradier/api/markets.rb', line 111

def markets_session(options={})
  object_from_response(Tradier::EventSession, :post, '/markets/events/session', options)
end

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

Obtain quotes.

Parameters:

  • symbols (String)

    A comma delimited list of symbols.

Returns:

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

#search(q, options) ⇒ Array<Tradier::Security>

Search for a stock symbol using a keyword lookup.

Options Hash (options):

  • :indexes (Boolean)

    Indicate whether or not to include indexes in results.

Parameters:

  • q (String)

    The company/index name to search for.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



124
125
126
127
# File 'lib/tradier/api/markets.rb', line 124

def search(q, options={})
  options.merge!('q' => q)
  object_from_response(Tradier::API::Utils::Security, :get, '/markets/search', options).body
end

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

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

Parameters:

  • symbol (String)

    The underlier symbol.

  • expiration (String)

    The expiration date.

Returns:

  • (Array<String>)

    An array of strike prices.

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



57
58
59
# File 'lib/tradier/api/markets.rb', line 57

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.

Parameters:

  • symbol (String)

    The symbol.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



88
89
90
91
# File 'lib/tradier/api/markets.rb', line 88

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