Sha256: 2e1c82ed8a53b716c5f314ad22e2e274976b0d40cb1a34fe206aa5c4f2525693

Contents?: true

Size: 531 Bytes

Versions: 2

Compression:

Stored size: 531 Bytes

Contents

# frozen_string_literal: true

module Capwatch
  class FundCalculator

    attr_accessor :fund

    def initialize(fund)
      @fund = fund
    end

    def assign_quantity
      fund.coins.each do |coin|
        coin.quantity = fund.positions[coin.symbol]
      end
    end

    def assign_prices
      fund.coins.each do |coin|
        fund.provider.update_coin(coin)
      end
    end

    def distribution
      fund.coins.each do |coin|
        coin.distribution = coin.value_btc / fund.value_btc
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capwatch-0.2.3 lib/capwatch/fund_calculator.rb
capwatch-0.2.0 lib/capwatch/fund_calculator.rb