Sha256: 545ea5c3aa275791bc0f418ef732b856842ed48662ef8e482c041e960767a067

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

module EodServices
  class InstrumentType
    class <<self
      def etf?(symbol)
        fundamentals = EodFacade::Fundamentals.call(symbol)
        !!(fundamentals.dig('General', 'Type') == 'ETF')
      rescue ArgumentError
        false
      end

      def stock?(symbol)
        fundamentals = EodFacade::Fundamentals.call(symbol)
        !!(fundamentals.dig('General', 'Type') == 'Common Stock')
      rescue ArgumentError
        false
      end

      def option?(symbol)
        !!EodFacade::Options.call(symbol)
      rescue ArgumentError
        false
      end

      def bond?(symbol)
        !!EodFacade::BondFundamentals.call(symbol)
      rescue ArgumentError
        false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sensei_eod_utils-0.0.53 lib/eod_services/instrument_type.rb