app/controllers/iro/positions_controller.rb in iron_warbler-2.0.7.19 vs app/controllers/iro/positions_controller.rb in iron_warbler-2.0.7.20
- old
+ new
@@ -1,8 +1,7 @@
class Iro::PositionsController < Iro::ApplicationController
-
before_action :set_lists
def new
@position = Iro::Position.new purse_id: params[:purse_id]
authorize! :new, @posision
@@ -30,12 +29,25 @@
end
def edit
@position = Iro::Position.find params[:id]
authorize! :edit, @position
+ end
- @strategies_list = Iro::Strategy.for_ticker( @position.ticker ).list
+ def roll
+ @position = Iro::Position.find params[:id]
+ authorize! :roll, @position
+
+ stock = @position.stock
+
+ @positions = [
+ Iro::Position.new({ stock: stock, begin_inner_price: 5.21, inner_strike: 91, expires_on: '2024-04-05', gain_loss_amount: -1.25 }),
+ Iro::Position.new({ stock: stock, begin_inner_price: 5.77, inner_strike: 90, expires_on: '2024-04-05', gain_loss_amount: -0.7 }),
+ Iro::Position.new({ stock: stock, begin_inner_price: 6.4, inner_strike: 89, expires_on: '2024-04-05', gain_loss_amount: -0.03 }),
+ Iro::Position.new({ stock: stock, begin_inner_price: 6.85, inner_strike: 88, expires_on: '2024-04-05', gain_loss_amount: 0.6 }),
+ Iro::Position.new({ stock: stock, begin_inner_price: 7.07, inner_strike: 87, expires_on: '2024-04-05', gain_loss_amount: 1.22 }),
+ ]
end
def update
@position = Iro::Position.find params[:id]
authorize! :update, @position
@@ -53,10 +65,10 @@
## private
##
private
def set_lists
- @strategies_list = Iro::Strategy.list
- @tickers_list = Iro::Stock.tickers_list
+ @strategies_list = Iro::Strategy.list(params[:long_or_short])
+ @stocks_list = Iro::Stock.list
end
end