Class: Ish::Ameritrade::Api
- Inherits:
-
Object
- Object
- Ish::Ameritrade::Api
- Includes:
- HTTParty
- Defined in:
- lib/ish/ameritrade.rb
Class Method Summary collapse
Class Method Details
.get_option_chain(opts) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ish/ameritrade.rb', line 70 def self.get_option_chain opts # validate input i| apikey symbol contractType strike fromDate toDate |.each do |s| if !opts[s] raise Ish::InputError.new("invalid input, missing #{s}") end end path = '/v1/marketdata/chains' out = self.get path, { query: opts } out end |
.get_quote(opts) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ish/ameritrade.rb', line 56 def self.get_quote opts # validate input i| symbol |.each do |s| if !opts[s] raise Ish::InputError.new("invalid input, missing #{s}") end end path = "/v1/marketdata/#{opts[:symbol]}/quotes" out = self.get path, { query: { apikey: ::TD_AME[:apiKey] } } out = out.parsed_response[out.parsed_response.keys[0]].symbolize_keys out end |