iron_warbler 2.0.7.22 → 2.0.7.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/iron_warbler/application.css +12 -0
- data/app/assets/stylesheets/iron_warbler/positions.scss +2 -0
- data/app/assets/stylesheets/iron_warbler/positions_gameui.scss +11 -0
- data/app/assets/stylesheets/iron_warbler/purses_gameui.scss +6 -2
- data/app/assets/stylesheets/iron_warbler/purses_summary.scss +98 -0
- data/app/assets/stylesheets/iron_warbler/utils.scss +4 -0
- data/app/controllers/iro/alerts_controller.rb +2 -0
- data/app/controllers/iro/application_controller.rb +13 -0
- data/app/controllers/iro/positions_controller.rb +197 -23
- data/app/controllers/iro/purses_controller.rb +60 -6
- data/app/controllers/iro/stocks_controller.rb +30 -18
- data/app/controllers/iro/strategies_controller.rb +12 -1
- data/app/models/iro/alert.rb +1 -0
- data/app/models/iro/option.rb +1 -0
- data/app/models/iro/position.rb +124 -56
- data/app/models/iro/purse.rb +15 -4
- data/app/models/iro/stock.rb +3 -0
- data/app/models/iro/strategy.rb +122 -27
- data/app/models/tda/option.rb +3 -3
- data/app/views/iro/_main_header.haml +28 -17
- data/app/views/iro/application/home.haml +6 -1
- data/app/views/iro/positions/_form.haml +1 -2
- data/app/views/iro/positions/_gameui_covered_call.haml +10 -13
- data/app/views/iro/positions/_gameui_covered_call.haml-bk +8 -0
- data/app/views/iro/positions/_gameui_long_debit_call_spread.haml +5 -4
- data/app/views/iro/positions/_gameui_short_debit_put_spread.haml +5 -4
- data/app/views/iro/positions/_header.haml +2 -2
- data/app/views/iro/positions/_header_covered_call.haml +7 -1
- data/app/views/iro/positions/_header_long_debit_call_spread.haml +19 -1
- data/app/views/iro/positions/_prepare_covered_call.haml +25 -0
- data/app/views/iro/positions/_prepare_long_debit_call_spread.haml +23 -0
- data/app/views/iro/positions/_prepare_short_debit_put_spread.haml +23 -0
- data/app/views/iro/positions/_table.haml +33 -24
- data/app/views/iro/positions/prepare.haml +24 -0
- data/app/views/iro/positions/roll-cc.haml-bk +40 -0
- data/app/views/iro/positions/roll.haml-trash +42 -0
- data/app/views/iro/purses/_form.haml +9 -0
- data/app/views/iro/purses/_form_extra_fields.haml +25 -13
- data/app/views/iro/purses/_header.haml +15 -16
- data/app/views/iro/purses/_summary.haml +69 -0
- data/app/views/iro/purses/gameui.haml +12 -7
- data/app/views/iro/purses/index.haml +3 -1
- data/app/views/iro/purses/show.haml +5 -1
- data/app/views/iro/stocks/_form.haml +5 -0
- data/app/views/iro/stocks/_grid_is_long.haml +2 -2
- data/app/views/iro/stocks/_grid_is_short.haml +2 -2
- data/app/views/iro/stocks/index.haml +3 -2
- data/app/views/iro/strategies/_form.haml +12 -6
- data/app/views/iro/strategies/_show.haml +3 -3
- data/app/views/iro/strategies/_table.haml +15 -6
- data/app/views/iro/strategies/show.haml +14 -0
- data/app/views/layouts/iro/application.haml +4 -0
- data/config/routes.rb +6 -2
- metadata +12 -4
- data/app/views/iro/positions/roll.haml +0 -83
- data/app/views/iro/positions/trash/_header_short_debit_put_spread.haml +0 -9
@@ -8,6 +8,9 @@
|
|
8
8
|
.field
|
9
9
|
%label Kind
|
10
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'
|
11
14
|
.field
|
12
15
|
%label slug
|
13
16
|
= f.text_field :slug
|
@@ -19,15 +22,18 @@
|
|
19
22
|
.field
|
20
23
|
= f.label :buffer_above_water
|
21
24
|
= f.number_field :buffer_above_water, placeholder: "0.49", step: 0.01
|
25
|
+
-# .field
|
26
|
+
-# = f.label :next_max_outer_delta
|
27
|
+
-# = f.number_field :next_max_outer_delta, placeholder: "0.25", step: 0.01
|
22
28
|
.field
|
23
|
-
= f.label :
|
24
|
-
= f.number_field :
|
29
|
+
= f.label :next_inner_delta
|
30
|
+
= f.number_field :next_inner_delta, placeholder: "0.25", step: 0.01
|
25
31
|
.field
|
26
|
-
= f.label :
|
27
|
-
= f.number_field :
|
32
|
+
= f.label :next_inner_strike
|
33
|
+
= f.number_field :next_inner_strike, placeholder: "20.0", step: 0.01
|
28
34
|
.field
|
29
|
-
= f.label :
|
30
|
-
= f.number_field :
|
35
|
+
= f.label :next_spread_amount
|
36
|
+
= f.number_field :next_spread_amount, placeholder: "20", step: 0.1
|
31
37
|
.field
|
32
38
|
= f.label :threshold_delta
|
33
39
|
= f.number_field :threshold_delta, placeholder: "0.14", step: 0.01
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
%li <b>buffer_above_water:</b> #{strategy.buffer_above_water}
|
12
12
|
|
13
|
-
%li <b>
|
14
|
-
%li <b>
|
15
|
-
%li <b>
|
13
|
+
%li <b>next_inner_delta:</b> #{strategy.next_inner_delta}
|
14
|
+
-# %li <b>next_outer_delta:</b> #{strategy.next_max_outer_delta}
|
15
|
+
%li <b>next_inner_strike:</b> #{strategy.next_inner_strike}
|
16
16
|
|
17
17
|
%li <b>threshold_delta:</b> #{strategy.threshold_delta}
|
18
18
|
%li <b>threshold_netp:</b> #{strategy.threshold_netp}
|
@@ -9,16 +9,25 @@
|
|
9
9
|
%th.actions
|
10
10
|
%th kind
|
11
11
|
%th slug
|
12
|
-
%th
|
12
|
+
%th next_inner_delta
|
13
|
+
%th.actions
|
13
14
|
%tbody
|
14
15
|
- strategies.each do |sss|
|
15
16
|
%tr
|
16
|
-
%td.actions
|
17
|
-
|
18
|
-
|
17
|
+
%td.actions
|
18
|
+
.d-flex
|
19
|
+
= link_to '[~]', edit_strategy_path(sss)
|
20
|
+
= button_to 'x', strategy_path(sss), method: :delete, data: { confirm: 'Are you sure?' }
|
19
21
|
%td= sss.kind
|
20
|
-
%td= sss.slug
|
21
|
-
%td= sss.
|
22
|
+
%td= link_to sss.slug, strategy_path(sss)
|
23
|
+
%td= sss.next_inner_delta
|
24
|
+
%td
|
25
|
+
= form_tag propose_position_path do
|
26
|
+
= hidden_field_tag :strategy_id, sss.id
|
27
|
+
.d-flex
|
28
|
+
%label new position for
|
29
|
+
= select_tag :purse_id, options_for_select(@purses_list), class: 'select2'
|
30
|
+
= submit_tag 'Go'
|
22
31
|
|
23
32
|
.h-50px
|
24
33
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
.strategies-show.maxwidth
|
3
|
+
.header
|
4
|
+
%h5.title Strategy #{@strategy}
|
5
|
+
%ul
|
6
|
+
-# %li Purse #{@strategy.purses}
|
7
|
+
-# %li= link_to 'Next position', strategy_next_position_path(@strategy)
|
8
|
+
|
9
|
+
.row
|
10
|
+
.col-md-6
|
11
|
+
= render '/iro/strategies/form', strategy: @strategy
|
12
|
+
.col-md-6
|
13
|
+
%h5 Next Position:
|
14
|
+
|
data/config/routes.rb
CHANGED
@@ -9,8 +9,10 @@ Iro::Engine.routes.draw do
|
|
9
9
|
|
10
10
|
resources :option_watches
|
11
11
|
|
12
|
-
get 'positions/:id
|
13
|
-
post 'positions
|
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
|
14
16
|
get 'positions/:id/refresh', to: 'positions#refresh', as: :refresh_position
|
15
17
|
resources :positions
|
16
18
|
resources :profiles
|
@@ -19,7 +21,9 @@ Iro::Engine.routes.draw do
|
|
19
21
|
get 'purses/:id', to: 'purses#show', as: :purse, defaults: { template: 'show' }
|
20
22
|
resources :purses
|
21
23
|
|
24
|
+
get 'stocks/refresh', to: 'stocks#refresh', as: :refresh_stocks
|
22
25
|
resources :stocks
|
26
|
+
|
23
27
|
resources :strategies
|
24
28
|
|
25
29
|
namespace :api do
|
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.
|
4
|
+
version: 2.0.7.23
|
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-
|
11
|
+
date: 2024-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: business_time
|
@@ -204,8 +204,10 @@ files:
|
|
204
204
|
- app/assets/javascript/iron_warbler/gameui.js
|
205
205
|
- app/assets/stylesheets/iron_warbler/application.css
|
206
206
|
- app/assets/stylesheets/iron_warbler/positions.scss
|
207
|
+
- app/assets/stylesheets/iron_warbler/positions_gameui.scss
|
207
208
|
- app/assets/stylesheets/iron_warbler/purses_gameui.scss
|
208
209
|
- app/assets/stylesheets/iron_warbler/purses_gameui.scss-bk
|
210
|
+
- app/assets/stylesheets/iron_warbler/purses_summary.scss
|
209
211
|
- app/assets/stylesheets/iron_warbler/utils.scss
|
210
212
|
- app/controllers/iro/alerts_controller.rb
|
211
213
|
- app/controllers/iro/api/stocks_controller.rb
|
@@ -251,15 +253,20 @@ files:
|
|
251
253
|
- app/views/iro/positions/_header_covered_call.haml
|
252
254
|
- app/views/iro/positions/_header_long_debit_call_spread.haml
|
253
255
|
- app/views/iro/positions/_header_short_debit_put_spread.haml
|
256
|
+
- app/views/iro/positions/_prepare_covered_call.haml
|
257
|
+
- app/views/iro/positions/_prepare_long_debit_call_spread.haml
|
258
|
+
- app/views/iro/positions/_prepare_short_debit_put_spread.haml
|
254
259
|
- app/views/iro/positions/_reasons.haml
|
255
260
|
- app/views/iro/positions/_table.haml
|
256
261
|
- app/views/iro/positions/edit.haml
|
257
262
|
- app/views/iro/positions/new.haml
|
258
|
-
- app/views/iro/positions/
|
259
|
-
- app/views/iro/positions/
|
263
|
+
- app/views/iro/positions/prepare.haml
|
264
|
+
- app/views/iro/positions/roll-cc.haml-bk
|
265
|
+
- app/views/iro/positions/roll.haml-trash
|
260
266
|
- app/views/iro/purses/_form.haml
|
261
267
|
- app/views/iro/purses/_form_extra_fields.haml
|
262
268
|
- app/views/iro/purses/_header.haml
|
269
|
+
- app/views/iro/purses/_summary.haml
|
263
270
|
- app/views/iro/purses/edit.haml
|
264
271
|
- app/views/iro/purses/gameui.haml
|
265
272
|
- app/views/iro/purses/gameui.haml-bk
|
@@ -277,6 +284,7 @@ files:
|
|
277
284
|
- app/views/iro/strategies/edit.haml
|
278
285
|
- app/views/iro/strategies/index.haml
|
279
286
|
- app/views/iro/strategies/new.haml
|
287
|
+
- app/views/iro/strategies/show.haml
|
280
288
|
- app/views/layouts/iro/application.haml
|
281
289
|
- config/initializers/assets.rb
|
282
290
|
- config/routes.rb
|
@@ -1,83 +0,0 @@
|
|
1
|
-
|
2
|
-
- u = @purse.unit # 50 ## pixels per dollar
|
3
|
-
- strategy = @position.strategy
|
4
|
-
|
5
|
-
.purses-gameui.padded
|
6
|
-
= render '/iro/purses/header', purse: @position.purse
|
7
|
-
|
8
|
-
.a
|
9
|
-
- position = @position
|
10
|
-
- stock = position.stock
|
11
|
-
%h4= stock
|
12
|
-
|
13
|
-
.header
|
14
|
-
= position.quantity
|
15
|
-
= stock
|
16
|
-
= position.expires_on.to_datetime.strftime("%b %d")
|
17
|
-
= link_to '[roll]', roll_position_path(position)
|
18
|
-
= link_to '[~]', edit_position_path(position)
|
19
|
-
|
20
|
-
- nearest_strike = stock.last.round
|
21
|
-
.StockCoordinatesW
|
22
|
-
|
23
|
-
.StockCoordinates
|
24
|
-
.grid-mark.mark0
|
25
|
-
.label= nearest_strike
|
26
|
-
- (1...@n_dollars).each_with_index do |idx|
|
27
|
-
.grid-mark{ class: "mark#{idx}", style: "left: -#{idx * u}px" }
|
28
|
-
.label
|
29
|
-
= nearest_strike + idx
|
30
|
-
.grid-mark{ class: "mark-#{idx}", style: "left: #{idx * u}px" }
|
31
|
-
.label
|
32
|
-
= nearest_strike - idx
|
33
|
-
.Origin{ style: "left: #{ ( nearest_strike - stock.last )* u}px" }
|
34
|
-
.label
|
35
|
-
Last:
|
36
|
-
= stock.last
|
37
|
-
|
38
|
-
|
39
|
-
.PositionW{ style: "width: #{ position.begin_inner_price * u}px; left: #{ (stock.last - position.inner_strike - position.begin_inner_price) * u}px" }
|
40
|
-
|
41
|
-
.Position
|
42
|
-
- if position.net_amount >= 0
|
43
|
-
.Net.NetPositive{ style: "width: #{ (position.net_amount / 100) * u }px; right: 0" }
|
44
|
-
.label
|
45
|
-
net
|
46
|
-
= pp_amount position.net_amount
|
47
|
-
- else
|
48
|
-
.Net.NetNegative{ style: "width: #{ (-1 * position.net_amount / 100) * u }px; left: 100%" }
|
49
|
-
.label
|
50
|
-
net
|
51
|
-
= pp_amount position.net_amount
|
52
|
-
.c
|
53
|
-
|
54
|
-
- @positions.each do |position|
|
55
|
-
.reviewing
|
56
|
-
- stock = position.stock
|
57
|
-
- nearest_strike = stock.last.round
|
58
|
-
.StockCoordinatesW
|
59
|
-
.StockCoordinates
|
60
|
-
.grid-mark.mark0
|
61
|
-
.label= nearest_strike
|
62
|
-
- (1...@n_dollars).each_with_index do |idx|
|
63
|
-
.grid-mark{ class: "mark#{idx}", style: "left: -#{idx * u}px" }
|
64
|
-
.label
|
65
|
-
= nearest_strike + idx
|
66
|
-
.grid-mark{ class: "mark-#{idx}", style: "left: #{idx * u}px" }
|
67
|
-
.label
|
68
|
-
= nearest_strike - idx
|
69
|
-
.Origin{ style: "left: #{ ( nearest_strike - stock.last )* u}px" }
|
70
|
-
.label
|
71
|
-
Last:
|
72
|
-
= stock.last
|
73
|
-
- amnt = position.gain_loss_amount
|
74
|
-
- border = amnt >= 0 ? "#{amnt * u}px solid green" : "#{amnt * -1 * u}px solid red"
|
75
|
-
.PositionW{ style: "width: #{ position.begin_inner_price * u}px; left: #{ (stock.last - position.inner_strike - position.begin_inner_price) * u}px; border: #{border}; border-bottom-width: 2px" }
|
76
|
-
.Position
|
77
|
-
.c
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
%br
|
83
|
-
%br
|
@@ -1,9 +0,0 @@
|
|
1
|
-
|
2
|
-
.maxwidth
|
3
|
-
%ul.m-0.p-0
|
4
|
-
%li <b>outer,inner_strike:</b> #{pp_amount pos.outer_strike} -> #{pp_amount pos.inner_strike}
|
5
|
-
%li
|
6
|
-
<b>begin_outer,inner_price:</b> #{pp_amount pos.begin_outer_price} -> #{pp_amount pos.begin_inner_price}
|
7
|
-
|
8
|
-
<b>max gain:</b> #{pp_amount pos.max_gain}
|
9
|
-
%li <b>Net:</b> #{pp_amount pos.net_amount} <i>#{pp_percent pos.net_percent}</i>
|