module QuestradeClient::Market

Constants

CANDLESTICK_INTERVALS

Public Instance Methods

candles(id, interval) click to toggle source

Retrieves historical market data in the form of OHLC candlesticks for a specified symbol. This call is limited to returning 2,000 candlesticks in a single response.

Docs: www.questrade.com/api/documentation/rest-operations/market-calls/markets-candles-id

@return [Array] List of market data FIXME: REQUIRES start and end time @param id [Integer] the id of the symbol to retrieve candlestick data for @param interval [Symbol] the candlestick interval to use, see allowable values in CANDLESTICK_INTERVALS @example

client.candles(9292, :oneday)
# File lib/questrade_client/market.rb, line 82
def candles(id, interval)
  fail "Interval #{interval} is unsupported" unless CANDLESTICK_INTERVALS.includes?(interval)
  get("/markets/candles/#{id}?interval=#{CANDLESTICK_INTERVALS[interval]}")['quotes']
end
markets() click to toggle source

Retrieves information about supported markets.

Docs: www.questrade.com/api/documentation/rest-operations/market-calls/markets

@return [Array] List of market data @example

client.markets
# File lib/questrade_client/market.rb, line 29
def markets
  get('/markets')['markets']
end
quoteoptions() click to toggle source

Retrieves a single Level 1 market data quote and Greek data for one or more option symbols.

Docs: www.questrade.com/api/documentation/rest-operations/market-calls/markets-quotes-options

FIXME - implement (docs are WRONG, it's a POST, not a GET)

# File lib/questrade_client/market.rb, line 57
def quoteoptions()
  fail "Not yet implemented"
end
quotes(args) click to toggle source

Retrieves a single Level 1 market data quote for one or more symbols.

Docs: www.questrade.com/api/documentation/rest-operations/market-calls/markets-quotes-id

@return [Array] List of market data @param args [Int|Array] The ID of the symbol, or a list of symbol ids @example

client.quotes(9292)
client.quotes([9292,8081])
# File lib/questrade_client/market.rb, line 42
def quotes(args)
  if args.is_a?(Integer)
    get("/markets/quotes/#{args}")['quotes']
  elsif args.is_a?(Array)
    get("/markets/quotes?ids=#{args.join(',')}")['quotes']
  else
    fail "Malformed argument: #{args}"
  end
end
quotestrategies() click to toggle source

Retrieve a calculated L1 market data quote for a single or many multi-leg strategies

Docs: www.questrade.com/api/documentation/rest-operations/market-calls/markets-quotes-strategies

FIXME - implement (docs are WRONG, it's a POST, not a GET)

# File lib/questrade_client/market.rb, line 66
def quotestrategies()
  fail "Not yet implemented"
end