Sha256: c2b92f72e00687451b57282941ba17e14d87b0efe3099b68a83169735e342682

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

class ::IshManager::IroPursesController < IshManager::ApplicationController

  before_action :set_lists

  def show
    @purse = Iro::Purse.find_or_create_by({ user_id: current_user.id })
    authorize! :my, @purse

    @strategies = Iro::CoveredCallStrategy.where({
      iro_purse_id: Iro::Purse.find_by( user_id: current_user.id ).id,
    })

    underlyings = Tda::Stock.get_quotes( @strategies.map(&:ticker).compact.uniq.join(",") )
    # json_puts! underlyings, 'out'
    underlyings.each do |ticker, v|
      Iro::CoveredCallStrategy.where( ticker: ticker ).update( current_underlying_strike: v[:mark] )
    end

    @positions = @purse.positions.order({ expires_on: :asc, strike: :asc })
    # @positions.map &:refresh ## @TODO remove, it only sets current_delta, current_price
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ish_manager-0.1.8.407 app/controllers/ish_manager/iro_purses_controller.rb