6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/ish_manager/iro_purses_controller.rb', line 6
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(",") )
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.active.map &:refresh
end
|