iron_warbler 2.0.7.24 → 2.0.7.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/iron_warbler/Card.scss +6 -0
  3. data/app/assets/stylesheets/iron_warbler/positions.scss +1 -1
  4. data/app/assets/stylesheets/iron_warbler/positions_gameui.scss +8 -0
  5. data/app/assets/stylesheets/iron_warbler/purses_gameui.scss +2 -4
  6. data/app/assets/stylesheets/iron_warbler/purses_summary.scss +31 -19
  7. data/app/controllers/iro/application_controller.rb +6 -0
  8. data/app/controllers/iro/positions_controller.rb +186 -137
  9. data/app/controllers/iro/purses_controller.rb +3 -1
  10. data/app/controllers/iro/stocks_controller.rb +2 -2
  11. data/app/models/iro/option.rb +41 -148
  12. data/app/models/iro/option_black_scholes.rb +149 -0
  13. data/app/models/iro/position.rb +156 -205
  14. data/app/models/iro/purse.rb +34 -4
  15. data/app/models/iro/strategy.rb +49 -47
  16. data/app/views/iro/_main_header.haml +4 -2
  17. data/app/views/iro/options/_show_mini.haml +8 -0
  18. data/app/views/iro/positions/_form.haml +8 -3
  19. data/app/views/iro/positions/_formpart_4data.haml +41 -38
  20. data/app/views/iro/positions/_gameui_covered_call.haml +1 -1
  21. data/app/views/iro/positions/_gameui_long_debit_call_spread.haml +5 -5
  22. data/app/views/iro/positions/_gameui_long_debit_call_spread.haml-trash +42 -0
  23. data/app/views/iro/positions/_gameui_short_debit_put_spread.haml +1 -0
  24. data/app/views/iro/positions/_gameui_short_debit_put_spread.haml-trash +40 -0
  25. data/app/views/iro/positions/_header.haml +2 -0
  26. data/app/views/iro/positions/_header_long_debit_call_spread.haml +43 -25
  27. data/app/views/iro/positions/_prepare_long_debit_call_spread.haml +6 -5
  28. data/app/views/iro/positions/_prepare_short_debit_put_spread.haml +2 -1
  29. data/app/views/iro/positions/_table.haml +25 -26
  30. data/app/views/iro/positions/prepare.haml +6 -4
  31. data/app/views/iro/positions/prepare2.haml +22 -0
  32. data/app/views/iro/purses/_form_extra_fields.haml +8 -4
  33. data/app/views/iro/purses/_header.haml +19 -5
  34. data/app/views/iro/purses/_summary.haml +69 -62
  35. data/app/views/iro/purses/show.haml +1 -1
  36. data/app/views/iro/strategies/_form.haml +26 -19
  37. data/app/views/iro/strategies/_show.haml +6 -4
  38. data/config/routes.rb +10 -7
  39. metadata +8 -2
  40. data/app/views/iro/positions/_gameui_short_debit_put_spread.haml +0 -40
@@ -17,12 +17,11 @@
17
17
  Strategy
18
18
  %th.q Q
19
19
  %th.strikes
20
- -# .a outer_strike, inner_strike
21
20
  Strike
22
21
  %th.begin_price
23
- .a Begin outer price, delta
22
+ .a Begin price, delta
24
23
  %th.max-loss Max Loss
25
- %th.max-gain Max Gain
24
+ -# %th.max-gain Max Gain
26
25
  %th
27
26
  .end_price End Price, delta
28
27
  %th
@@ -64,9 +63,8 @@
64
63
  = link_to '[~]', edit_position_path(position)
65
64
  = link_to '[dup]', duplicate_position_path(position)
66
65
  .d-flex
67
- = link_to '[re]', refresh_position_path(pos)
68
- - if true # position.next_reasons.present? && position.rollp > 0.5
69
- = link_to '[roll]', prepare_to_roll_position_path(pos)
66
+ = link_to '[sync]', sync_position_path(pos)
67
+ = link_to '[roll]', prepare_to_roll_position_path(pos)
70
68
 
71
69
  %td.ticker
72
70
  = position.stock.ticker
@@ -88,32 +86,32 @@
88
86
  <b>#{position.quantity}</b>
89
87
  %td.strikes
90
88
  .long-or-short-item
91
- .outer-strike= pp_amount position.outer_strike
92
- .inner-strike= pp_amount position.inner_strike
89
+ .outer-strike= pp_amount position.outer.strike
90
+ .inner-strike= pp_amount position.inner.strike
93
91
 
94
92
  %td.begin_price
95
93
  .long-or-short-item
96
94
  .begin-outer-price
97
- = pp_amount position.begin_outer_price
98
- <b>D</b> #{pp_delta position.begin_outer_delta}
95
+ = pp_amount position.outer.begin_price
96
+ &nbsp;<b>D</b>&nbsp; #{pp_delta position.outer.begin_delta}
99
97
  .begin-inner-price
100
- = pp_amount position.begin_inner_price
101
- <b>D</b> #{pp_delta position.begin_inner_delta}
98
+ = pp_amount position.inner.begin_price
99
+ &nbsp;<b>D</b>&nbsp; #{pp_delta position.inner.begin_delta}
102
100
  %td
103
101
  .max-loss= pp_amount position.max_loss * pos.q * 100, precision: 0
104
- %td
105
- .max-gain= pp_amount position.max_gain * pos.q * 100, precision: 0
106
- .max-gainp
107
- -# = pp_percent( -1 * position.max_gain / position.max_loss ) rescue '-' # undef. for covered calls
102
+ -# %td
103
+ -# .max-gain= pp_amount position.max_gain * pos.q * 100, precision: 0
104
+ -# .max-gainp
105
+ -# -# = pp_percent( -1 * position.max_gain / position.max_loss ) rescue '-' # undef. for covered calls
108
106
 
109
- %td.end_price
107
+ %td.end
110
108
  .long-or-short-item
111
109
  .end-outer-price
112
- = pp_amount position.end_outer_price
113
- <b>D</b> #{pp_delta position.end_outer_delta}
110
+ = pp_amount position.outer.end_price
111
+ &nbsp;<b>D</b>&nbsp; #{pp_delta position.outer.end_delta}
114
112
  .end-inner-price
115
- = pp_amount position.end_inner_price
116
- <b>D</b> #{pp_delta position.end_inner_delta}
113
+ = pp_amount position.inner.end_price
114
+ &nbsp;<b>D</b>&nbsp; #{pp_delta position.inner.end_delta}
117
115
  %td.net
118
116
  .a= pp_amount position.net_amount * pos.q * 100, precision: 0 rescue '@TODO'
119
117
  .a <i>#{pp_percent position.net_amount / position.max_gain rescue '@TODO'}</i>
@@ -128,12 +126,13 @@
128
126
  - if position.next_reasons.present?
129
127
  %i.fa.fa-expand.collapse-expand{ id: "pos-reasons-#{position.id}" } reasons
130
128
  = render '/iro/positions/reasons', reasons: position.next_reasons
131
- .a= position.next_symbol
132
- .a= position.next_delta
129
+ .a= position.autonxt
133
130
  .a
134
- = pp_amount position.next_mark
135
- \=>
136
- = pp_amount position.next_outcome * 100 * position.quantity rescue nil
131
+ - if pos.autonxt
132
+ = link_to '[autonxt]', prepare2_position_path(pos.autonxt)
133
+ = pp_amount pos.autonxt.prev_gain_loss_amount
134
+ -# \=>
135
+ -# = pp_amount position.next_outcome * 100 * position.quantity rescue nil
137
136
 
138
137
 
139
138
 
@@ -14,10 +14,12 @@
14
14
 
15
15
  = render "/iro/positions/gameui_#{pos.strategy.kind}", position: pos
16
16
 
17
- - @positions.each_with_index do |pos, idx|
18
- .reviewing
19
- = render "/iro/positions/header_#{pos.strategy.kind}", pos: pos, collapse_key: 'roll'
20
- = render "/iro/positions/prepare_#{pos.strategy.kind}", pos: pos
17
+ %div{ class: pos.long_or_short }
18
+ .long-or-short-item{ style: "border-left: 0" }
19
+ - @positions.each_with_index do |pos, idx|
20
+ .reviewing
21
+ = render "/iro/positions/header_#{pos.strategy.kind}", pos: pos, collapse_key: 'roll'
22
+ = render "/iro/positions/prepare_#{pos.strategy.kind}", pos: pos
21
23
 
22
24
 
23
25
 
@@ -0,0 +1,22 @@
1
+
2
+ - pos = @position
3
+
4
+ -## long call spread
5
+ %ul
6
+ %li
7
+ buy to close
8
+ = pos.autoprev.inner
9
+ %li
10
+ sell to close
11
+ = pos.autoprev.outer
12
+ %li
13
+ buy to open
14
+ = pos.outer
15
+ %li
16
+ sell to open
17
+ = pos.inner
18
+ %li
19
+ Query
20
+ %pre= JSON.pretty_generate( @query )
21
+
22
+ = button_to 'Place Order', prepare3_position_path(@position), data: { confirm: 'Are you sure?' }
@@ -4,12 +4,18 @@
4
4
  = f.number_field :unit
5
5
  px/usd
6
6
  &nbsp;&nbsp;
7
-
8
7
  %label height
9
8
  = f.number_field :height
10
- px
9
+ px/q
10
+ &nbsp;&nbsp;
11
+
12
+ %label summary_unit
13
+ = f.number_field :summary_unit, step: 0.000001, style: "width: 120px"
14
+ px/usd
11
15
  &nbsp;&nbsp;
12
16
 
17
+
18
+
13
19
  %label mark_every_n_usd
14
20
  = f.number_field :mark_every_n_usd, step: 0.01
15
21
  &nbsp;&nbsp;
@@ -18,8 +24,6 @@
18
24
  = f.number_field :n_next_positions
19
25
  &nbsp;&nbsp;
20
26
 
21
- %label summary_scale
22
- = f.number_field :summary_scale, step: 0.0001, style: "width: 120px"
23
27
 
24
28
  &nbsp;&nbsp;
25
29
 
@@ -5,13 +5,27 @@
5
5
  %h5.title
6
6
  Purse `#{purse.slug}`
7
7
  = link_to '[~]', edit_purse_path(purse)
8
- = link_to '[view]', purse_path(purse)
9
- = link_to '[gameUI]', gameui_purse_path(purse)
8
+ = link_to '[table]', purse_path(purse)
9
+ = link_to '[gameUI]', purse_gameui_path(purse)
10
10
  (#{purse.positions.length})
11
11
 
12
- = link_to '[+position]', new_position_path({ purse_id: purse.id })
13
- -# = link_to '[+long]', new_position_path({ purse_id: purse.id, long_or_short: Iro::Strategy::LONG })
14
- = link_to '[+short]', new_position_path({ purse_id: purse.id, long_or_short: Iro::Strategy::SHORT })
12
+ .d-flex
13
+
14
+ .Card.d-flex
15
+ = form_for Iro::Position.new(strategy: Iro::Strategy.new), url: new_position_path, method: :get do |f|
16
+ .a +Position
17
+ = hidden_field_tag 'position[purse_id]', purse.id
18
+ .field
19
+ = f.select :strategy_id, options_for_select(@strategies_list)
20
+ -# .field
21
+ -# = f.radio_button :long_or_short, :long
22
+ -# %label long
23
+ -# = f.radio_button :long_or_short, :short
24
+ -# %label short
25
+ = f.submit 'Go'
26
+ -# = link_to '[+position]', new_position_path({ purse_id: purse.id })
27
+ -# = link_to '[+short]', new_position_path({ purse_id: purse.id, long_or_short: Iro::Strategy::SHORT })
28
+
15
29
 
16
30
  - if true || params[:template] == 'gameui'
17
31
  .mini-inputs
@@ -1,69 +1,76 @@
1
1
 
2
2
  - u = @purse.unit
3
- - s_mult = @purse.summary_scale
3
+ - summary_unit = @purse.summary_unit
4
4
  - collapse_key ||= nil
5
5
 
6
- %i.fa.fa-expand.collapse-expand{ id: "pursesSummary_#{collapse_key}", style: "margin-left: -1em;" } Summary
7
- .PurseSummaryW
8
-
9
- .PurseSummary
10
- -## loss
11
- .summary-amount
12
- .max-gl.long.loss{ style: "height: #{@max_loss_long *-1*s_mult*u}px" }
13
- .max-gl.short.loss{ style: "height: #{@max_loss_short *-1*s_mult*u}px" }
14
- - if @loss_long
15
- .net-gl.loss.long.loss-long{ style: "height: #{@loss_long *-1*s_mult*u}px" }
16
- - if @loss_short
17
- .net-gl.loss.short.loss-short{ style: "height: #{@loss_short *-1*s_mult*u}px" }
18
-
19
- .summary-delta
20
- .begin.long{ style: "height: #{@begin_delta_long *s_mult*10000*u}px" }
21
- .begin.short{ style: "height: #{@begin_delta_short *s_mult*10000*u}px" }
22
- .end.long{ style: "height: #{@end_delta_long *s_mult*10000*u}px" }
23
- .end.short{ style: "height: #{@end_delta_short *s_mult*10000*u}px" }
24
-
25
- -## gain
26
- .summary-amount
27
- .max-gl.long.gain{ style: "height: #{@max_gain_long *s_mult*u}px" }
28
- .max-gl.short.gain{ style: "height: #{@max_gain_short *s_mult*u}px" }
29
- - if @gain_long
30
- .net-gl.gain.long.gain-long{ style: "height: #{@gain_long *s_mult*u}px" }
31
- - if @gain_short
32
- .net-gl.gain.short.gain-short{ style: "height: #{@gain_short *s_mult*u}px" }
33
-
34
-
35
-
36
-
37
-
38
-
39
- .legendW
40
- .legend
41
- %ul
42
- %li
43
- <b>exposure long:</b> #{pp_amount @max_loss_long *-1}
44
- <b>short:</b> #{pp_amount @max_loss_short *-1}
45
- %li
46
- <b>max loss long:</b> #{pp_amount [ @max_loss_long + @max_gain_short, 0].min }
47
- <b>short:</b> #{pp_amount [ @max_loss_short + @max_gain_long, 0].min }
48
- %li.gray
49
- <b>max gain long:</b> #{pp_amount @max_gain_long}
50
- <b>short:</b> #{pp_amount @max_gain_short}
51
-
52
- %li
53
- %hr
54
- <b>gain long:</b> #{pp_amount @gain_long}
55
- <b>short:</b> #{pp_amount @gain_short}
56
- %li
57
- <b>loss long:</b> #{pp_amount @loss_long}
58
- <b>short:</b> #{pp_amount @loss_short}
6
+ - if @purse.positions.present?
7
+ %i.fa.fa-expand.collapse-expand{ id: "pursesSummary_#{collapse_key}", style: "margin-left: -1em;" } Summary
8
+ .PurseSummaryW
9
+ .PurseSummary
10
+
11
+ .summary-amount
12
+ .max-gl.long.loss{ style: "height: #{@max_loss_long *-1*summary_unit*u}px" }
13
+ %label Long Loss
14
+ .delta
15
+ .begin.long{ style: "height: #{@purse.delta_to_plot_p( :begin, :long, :inner )}" }
16
+ .end.long{ style: "height: #{@purse.delta_to_plot_p( :end, :long, :inner )}" }
17
+
18
+ .max-gl.short.loss{ style: "height: #{@max_loss_short *-1*summary_unit*u}px" }
19
+ %label Short Loss
20
+ .delta
21
+ .begin.short{ style: "height: #{@purse.delta_to_plot_p( :begin, :short, :inner )}" }
22
+ .end.short{ style: "height: #{@purse.delta_to_plot_p( :end, :short, :inner )}" }
23
+
24
+ - if @loss_long
25
+ .net-gl.loss.long.loss-long{ style: "height: #{@loss_long *-1*summary_unit*u}px" }
26
+ - if @loss_short
27
+ .net-gl.loss.short.loss-short{ style: "height: #{@loss_short *-1*summary_unit*u}px" }
28
+
29
+ -# %label Gain
30
+ .summary-amount
31
+ .max-gl.long.gain{ style: "height: #{@max_gain_long *summary_unit*u}px" }
32
+ .max-gl.short.gain{ style: "height: #{@max_gain_short *summary_unit*u}px" }
33
+ - if @gain_long
34
+ .net-gl.gain.long.gain-long{ style: "height: #{@gain_long *summary_unit*u}px" }
35
+ - if @gain_short
36
+ .net-gl.gain.short.gain-short{ style: "height: #{@gain_short *summary_unit*u}px" }
37
+
38
+
39
+
40
+
41
+
42
+
43
+ .legendW
44
+ .legend
45
+ %ul
46
+ %li
47
+ <b>exposure long:</b> #{pp_amount @max_loss_long *-1}
48
+ <b>short:</b> #{pp_amount @max_loss_short *-1}
49
+ %li
50
+ <b>max loss long:</b> #{pp_amount [ @max_loss_long + @max_gain_short, 0].min }
51
+ <b>short:</b> #{pp_amount [ @max_loss_short + @max_gain_long, 0].min }
52
+ %li.gray
53
+ <b>max gain long:</b> #{pp_amount @max_gain_long}
54
+ <b>short:</b> #{pp_amount @max_gain_short}
55
+
56
+ %li
57
+ %hr
58
+ <b>gain long:</b> #{pp_amount @gain_long}
59
+ <b>short:</b> #{pp_amount @gain_short}
60
+ %li
61
+ <b>loss long:</b> #{pp_amount @loss_long}
62
+ <b>short:</b> #{pp_amount @loss_short}
63
+
64
+ %li
65
+ %hr
66
+ <b>Delta long begin:</b> #{pp_delta @purse.delta_wt_avg( :begin, :long, :inner )}
67
+ <b>end:</b> #{pp_delta @purse.delta_wt_avg( :end, :long, :inner )}
68
+ %li
69
+ <b>Delta short begin:</b> #{pp_delta @purse.delta_wt_avg( :begin, :short, :inner )}
70
+ <b>end:</b> #{pp_delta @purse.delta_wt_avg( :end, :short, :inner )}
59
71
 
60
- %li
61
72
  %hr
62
- <b>begin D long:</b> #{pp_delta @begin_delta_long}
63
- <b>short:</b> #{pp_delta @begin_delta_short}
64
- <b>net:</b> #{pp_delta @begin_delta_long - @begin_delta_short}
65
- %li
66
- <b>end D long:</b> #{pp_delta @end_delta_long}
67
- <b>short:</b> #{pp_delta @end_delta_short}
68
- <b>net:</b> #{pp_delta @end_delta_long - @end_delta_short}
73
+ %li
74
+ <b>Available amount:</b> #{@purse.available_amount}
75
+
69
76
 
@@ -5,4 +5,4 @@
5
5
  = render '/iro/purses/header', purse: @purse
6
6
  .col-md-6
7
7
  = render '/iro/purses/summary', purse: @purse, collapse_key: 'views-show'
8
- = render '/iro/positions/table', positions: @purse.positions
8
+ = render '/iro/positions/table', positions: @positions
@@ -4,45 +4,52 @@
4
4
  .actions
5
5
  = f.submit
6
6
 
7
-
8
- .field
9
- %label Kind
10
- = f.select :kind, options_for_select( Iro::Strategy::KINDS, selected: strategy.kind )
11
- .field
12
- %label stock
13
- = f.select :stock_id, options_for_select(@stocks_list, selected: strategy.stock_id), class: 'select2'
14
- .field
15
- %label slug
16
- = f.text_field :slug
17
- .field
18
- %label long or short?
19
- = f.select :long_or_short, options_for_select([nil, Iro::Strategy::LONG, Iro::Strategy::SHORT], selected: strategy.long_or_short)
7
+ .row
8
+ .col-md-6
9
+ .field
10
+ %label Kind
11
+ = f.select :kind, options_for_select( Iro::Strategy::KINDS, selected: strategy.kind )
12
+ .field
13
+ %label long or short?
14
+ = f.select :long_or_short, options_for_select([nil, Iro::Strategy::LONG, Iro::Strategy::SHORT], selected: strategy.long_or_short)
15
+ .field
16
+ %label stock
17
+ = f.select :stock_id, options_for_select(@stocks_list, selected: strategy.stock_id), class: 'select2'
18
+
19
+ .col-md-6
20
+ .field
21
+ %label slug
22
+ = f.text_field :slug
23
+ %hr
20
24
 
21
25
 
22
26
  .field
23
27
  = f.label :buffer_above_water
24
28
  = f.number_field :buffer_above_water, placeholder: "0.49", step: 0.01
29
+ .field
30
+ = f.label :min_dte
31
+ = f.number_field :min_dte, placeholder: "0"
25
32
  -# .field
26
33
  -# = f.label :next_max_outer_delta
27
34
  -# = f.number_field :next_max_outer_delta, placeholder: "0.25", step: 0.01
28
35
  .field
29
36
  = f.label :next_inner_delta
30
- = f.number_field :next_inner_delta, placeholder: "0.25", step: 0.01
37
+ = f.number_field :next_inner_delta, placeholder: "0.25", step: 0.001
31
38
  .field
32
39
  = f.label :next_inner_strike
33
40
  = f.number_field :next_inner_strike, placeholder: "20.0", step: 0.01
34
41
  .field
35
42
  = f.label :next_spread_amount
36
43
  = f.number_field :next_spread_amount, placeholder: "20", step: 0.1
44
+ .field
45
+ = f.label :next_buffer_above_water
46
+ = f.number_field :next_buffer_above_water, placeholder: "80", step: 0.01
37
47
  .field
38
48
  = f.label :threshold_delta
39
- = f.number_field :threshold_delta, placeholder: "0.14", step: 0.01
49
+ = f.number_field :threshold_delta, placeholder: "0.14", step: 0.001
40
50
  .field
41
51
  = f.label :threshold_netp
42
- = f.number_field :threshold_netp, placeholder: "0.69", step: 0.01
43
- -# .field
44
- -# = f.label :current_underlying_strike
45
- -# = f.number_field :current_underlying_strike, placeholder: "16.66", step: 0.01
52
+ = f.number_field :threshold_netp, placeholder: "0.69", step: 0.001
46
53
 
47
54
  .actions
48
55
  = f.submit
@@ -6,14 +6,16 @@
6
6
  = strategy
7
7
  %ul
8
8
  -# %li <b>ticker:</b> #{strategy.ticker}
9
- %li <b>slug:</b> #{strategy.slug}
9
+ -# %li <b>slug:</b> #{strategy.slug}
10
10
 
11
11
  %li <b>buffer_above_water:</b> #{strategy.buffer_above_water}
12
+ %li <b>threshold_delta:</b> #{strategy.threshold_delta}
13
+ %li <b>threshold_netp:</b> #{strategy.threshold_netp}
14
+
15
+ %hr
12
16
 
13
17
  %li <b>next_inner_delta:</b> #{strategy.next_inner_delta}
14
18
  -# %li <b>next_outer_delta:</b> #{strategy.next_max_outer_delta}
15
19
  %li <b>next_inner_strike:</b> #{strategy.next_inner_strike}
16
-
17
- %li <b>threshold_delta:</b> #{strategy.threshold_delta}
18
- %li <b>threshold_netp:</b> #{strategy.threshold_netp}
20
+ %li <b>next_spread_amount:</b> #{strategy.next_spread_amount}
19
21
 
data/config/routes.rb CHANGED
@@ -9,19 +9,22 @@ Iro::Engine.routes.draw do
9
9
 
10
10
  resources :option_watches
11
11
 
12
- get 'positions/duplicate/:id', to: 'positions#new', as: :duplicate_position
13
- post 'positions/propose', to: 'positions#propose', as: :propose_position
14
- get 'positions/:id/prepare', to: 'positions#prepare', as: :prepare_to_roll_position, defaults: { template: 'gameui' }
15
- post 'positions/:id/roll', to: 'positions#do_roll', as: :roll_position
16
- get 'positions/:id/refresh', to: 'positions#refresh', as: :refresh_position
12
+ match 'positions/:id/close', to: 'positions#close', as: :close_position, via: [ :get, :post ]
13
+ get 'positions/duplicate/:id', to: 'positions#new', as: :duplicate_position
14
+ post 'positions/propose', to: 'positions#propose', as: :propose_position
15
+ get 'positions/:id/prepare', to: 'positions#prepare', as: :prepare_to_roll_position, defaults: { template: 'gameui' }
16
+ match 'positions/:id/prepare2', to: 'positions#prepare2', as: :prepare2_position, defaults: { template: 'gameui' }, via: [ :get, :post ]
17
+ match 'positions/:id/prepare3', to: 'positions#prepare3', as: :prepare3_position, defaults: { template: 'gameui' }, via: [ :get, :post ]
18
+ post 'positions/:id/roll', to: 'positions#do_roll', as: :roll_position
19
+ get 'positions/:id/sync', to: 'positions#sync', as: :sync_position
17
20
  resources :positions
18
21
  resources :profiles
19
22
 
20
- get 'purses/:id/gameui', to: 'purses#show', as: :gameui_purse, defaults: { template: 'gameui' }
23
+ get 'purses/:id/gameui', to: 'purses#show', as: :purse_gameui, defaults: { template: 'gameui' }
21
24
  get 'purses/:id', to: 'purses#show', as: :purse, defaults: { template: 'show' }
22
25
  resources :purses
23
26
 
24
- get 'stocks/refresh', to: 'stocks#refresh', as: :refresh_stocks
27
+ get 'stocks/sync', to: 'stocks#sync', as: :sync_stocks
25
28
  resources :stocks
26
29
 
27
30
  resources :strategies
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_warbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7.24
4
+ version: 2.0.7.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-19 00:00:00.000000000 Z
11
+ date: 2024-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: business_time
@@ -217,6 +217,7 @@ files:
217
217
  - app/assets/config/iron_warbler_manifest.js
218
218
  - app/assets/javascript/iron_warbler/application.js
219
219
  - app/assets/javascript/iron_warbler/gameui.js
220
+ - app/assets/stylesheets/iron_warbler/Card.scss
220
221
  - app/assets/stylesheets/iron_warbler/application.css
221
222
  - app/assets/stylesheets/iron_warbler/positions.scss
222
223
  - app/assets/stylesheets/iron_warbler/positions_gameui.scss
@@ -242,6 +243,7 @@ files:
242
243
  - app/models/iro/datapoint.rb
243
244
  - app/models/iro/date.rb
244
245
  - app/models/iro/option.rb
246
+ - app/models/iro/option_black_scholes.rb
245
247
  - app/models/iro/position.rb
246
248
  - app/models/iro/price_item.rb
247
249
  - app/models/iro/purse.rb
@@ -256,12 +258,15 @@ files:
256
258
  - app/views/iro/alerts/index.haml
257
259
  - app/views/iro/api/stocks/show.jbuilder
258
260
  - app/views/iro/application/home.haml
261
+ - app/views/iro/options/_show_mini.haml
259
262
  - app/views/iro/positions/_form.haml
260
263
  - app/views/iro/positions/_formpart_4data.haml
261
264
  - app/views/iro/positions/_gameui_covered_call.haml
262
265
  - app/views/iro/positions/_gameui_covered_call.haml-bk
263
266
  - app/views/iro/positions/_gameui_long_debit_call_spread.haml
267
+ - app/views/iro/positions/_gameui_long_debit_call_spread.haml-trash
264
268
  - app/views/iro/positions/_gameui_short_debit_put_spread.haml
269
+ - app/views/iro/positions/_gameui_short_debit_put_spread.haml-trash
265
270
  - app/views/iro/positions/_header.haml
266
271
  - app/views/iro/positions/_header_covered_call.haml
267
272
  - app/views/iro/positions/_header_long_debit_call_spread.haml
@@ -274,6 +279,7 @@ files:
274
279
  - app/views/iro/positions/edit.haml
275
280
  - app/views/iro/positions/new.haml
276
281
  - app/views/iro/positions/prepare.haml
282
+ - app/views/iro/positions/prepare2.haml
277
283
  - app/views/iro/positions/roll-cc.haml-bk
278
284
  - app/views/iro/positions/roll.haml-trash
279
285
  - app/views/iro/purses/_form.haml
@@ -1,40 +0,0 @@
1
-
2
- - pos = position
3
- - stock = pos.stock
4
- - nearest_strike = stock.last.round
5
- - u = pos.purse.unit # pixels per dollar
6
-
7
-
8
- .collapse-expand.d-flex{ id: "gameui-pos-#{pos.id}" }
9
- [<>]
10
- .maxwidth= render "/iro/positions/header", pos: pos
11
- .a
12
- = render "/iro/positions/header_#{pos.strategy.kind}", pos: pos
13
- .StockCoordinatesW
14
- .StockCoordinates{ style: "height: #{pos.q() *u}px " }
15
- .grid= render "/iro/stocks/grid_#{pos.strategy.long_or_short}", stock: stock, position: pos
16
-
17
- .Origin{ style: "left: #{ ( nearest_strike - stock.last )* u}px" }
18
- .label Last: #{pp_amount stock.last}
19
- .c
20
-
21
- -## these are different
22
- - left = "#{ ( stock.last - pos.outer_strike ) * u}px"
23
- - width = "#{ ( pos.outer_strike - pos.inner_strike ) * u}px"
24
- .PositionW{ class: pos.strategy.kind, style: "left: #{left}; width: #{width}; " }
25
- .Position
26
- .MaxGain{ style: "width: #{pos.max_gain * u}px" }
27
- .RollGuide
28
-
29
- - if pos.net_amount >= 0
30
- .Net.NetPositive{ style: "width: #{ (pos.net_amount / 100) * u }px; right: 0" }
31
- .label
32
- net
33
- = pp_amount pos.net_amount
34
- - else
35
- .Net.NetNegative{ style: "width: #{ (-1 * pos.net_amount / 100) * u }px; left: 100%" }
36
- .label
37
- net
38
- = pp_amount pos.net_amount
39
- .c
40
-