Sha256: cd6ebccba564cc00c7aaa8f135b1c45ee116a492c57c0d3017f3b95e19ee2f19

Contents?: true

Size: 810 Bytes

Versions: 1

Compression:

Stored size: 810 Bytes

Contents

module Alphavantage
  class Fundamental
    FUNCTIONS = {
      overview: 'OVERVIEW',
      earnings: 'EARNINGS',
      income_statement: 'INCOME_STATEMENT',
      balance_sheet: 'BALANCE_SHEET',
      cash_flow: 'CASH_FLOW'
    }

    def initialize(symbol:)
      @symbol = symbol
    end

    def overview
      response(FUNCTIONS[__method__])
    end

    def earnings
      response(FUNCTIONS[__method__]).annual_earnings
    end

    def income_statement
      response(FUNCTIONS[__method__]).annual_reports
    end

    def balance_sheet
      response(FUNCTIONS[__method__]).annual_reports
    end

    def cash_flow
      response(FUNCTIONS[__method__]).annual_reports
    end

    private

    def response(function)
      Client.get(params: { function: function, symbol: @symbol })
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alphavantage-1.2.0 lib/alphavantage/fundamental.rb