Sha256: d79fde4fc79faaa12917c324b754000e1a01048e62f5e58693fe07171458163e
Contents?: true
Size: 702 Bytes
Versions: 8
Compression:
Stored size: 702 Bytes
Contents
# frozen_string_literal: true require 'oj' module EodFacade class Options < ::EodFacade::Base class << self def call(symbol) underlying = EodServices::Contract.underlying_symbol(symbol) expiry = EodServices::Contract.contract_expiry(symbol) unless expiry raise ArgumentError, "Invalid expiration date for option #{symbol}" end data = make_request(url_path(underlying), params(expiry)) Oj.load(data) end private def params(expiry) { from: expiry.to_s, to: expiry.to_s } end def url_path(underlying) "/options/#{underlying}" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems