Sha256: 73668612d08cab90cc8de8a18504859158eb607607cc6bdb346e48c03636f916

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

module IB
  class Bag
    def included_in? account
      # iterate over combo-legs 
      # and return the bag if all con_id's are present in the account.contracts-map
      self if combo_legs.map do |c_l|
        account.locate_contract c_l.con_id
      end.count == combo_legs.count
    end

    # returns an array of portfolio-values 
    #
    def portfolio_value account
      combo_legs.map do | c_l |
        account.portfolio_values.detect{|x| x.contract.con_id ==  c_l.con_id}
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ib-extensions-1.3.1 lib/ib/models/bag.rb
ib-extensions-1.3 lib/ib/models/bag.rb