Sha256: 63e23c62505802a02563917e7c0d815a77dc2df48fb45573bea07499cd9ceeb3
Contents?: true
Size: 964 Bytes
Versions: 25
Compression:
Stored size: 964 Bytes
Contents
# frozen_string_literal: true module EodServices class InstrumentType class <<self def etf?(symbol) call(symbol) == EodModels::InstrumentType::ETF end def stock?(symbol) call(symbol) == EodModels::InstrumentType::STOCK end def option?(symbol) # call(symbol) == EodModels::InstrumentType::OPTION !!EodFacade::Options.call(symbol) rescue ArgumentError false end private def call(symbol) fundamentals = EodFacade::Fundamentals.call(symbol) if fundamentals['General']['Type'] == 'ETF' EodModels::InstrumentType::ETF elsif fundamentals['General']['Type'] == 'Common Stock' EodModels::InstrumentType::STOCK elsif EodFacade::Options.call(symbol) EodModels::InstrumentType::OPTION else raise ArgumentError, "Invalid intrument type for #{symbol}" end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems