ish_manager 0.1.8.404 → 0.1.8.405
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/ish_manager/iro.scss +63 -14
- data/app/controllers/ish_manager/iro_purses_controller.rb +10 -13
- data/app/views/ish_manager/iro_positions/_form.haml +7 -2
- data/app/views/ish_manager/iro_positions/edit.haml +1 -1
- data/app/views/ish_manager/iro_purses/show.haml +47 -29
- data/app/views/ish_manager/iro_strategies/_form.haml +9 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70242298b4fbef9e7055284f6e8a603aa20e5ce5782c82cd2461bd69717e7a4f
|
4
|
+
data.tar.gz: 8f9d6291f35c98cafc912b3f331421d74ab8048f699ddc52b198b2f2fffc00d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66421a7174df41ff783faafc109ef30f61ccbe0035cfdb91ad9ac8c16f0f3c7dfaf59af82b74854cf849b881762a88cb2a93e5a4df4d56299f180476127778cd
|
7
|
+
data.tar.gz: 488f4c3488c0e389c070a12979083e39c026579773c164dc6134fa3f0a48b472a1ec1f14dc8c906ec95a8127694cbec58cb90db999fc82f75c8641711e6d0638
|
@@ -1,19 +1,59 @@
|
|
1
1
|
|
2
|
-
.iro-purses-
|
3
|
-
font-size:
|
2
|
+
.iro-purses-show {
|
3
|
+
font-size: 14px;
|
4
4
|
|
5
5
|
table {
|
6
|
+
.id {
|
7
|
+
width: 20px;
|
8
|
+
}
|
9
|
+
.strategy {
|
10
|
+
width: 30px;
|
11
|
+
}
|
12
|
+
|
13
|
+
thead {
|
14
|
+
position: relative;
|
15
|
+
height: 50px;
|
16
|
+
|
17
|
+
|
18
|
+
.id,
|
19
|
+
.ticker,
|
20
|
+
.days-left,
|
21
|
+
.to-close,
|
22
|
+
.must-roll {
|
23
|
+
top: 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
.price {
|
27
|
+
background: cyan;
|
28
|
+
}
|
29
|
+
|
30
|
+
td > div {
|
31
|
+
// border: 1px solid green;
|
32
|
+
|
33
|
+
position: absolute;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
6
37
|
|
7
38
|
td {
|
8
39
|
padding: 0 .5em;
|
9
40
|
}
|
10
41
|
|
11
42
|
tbody {
|
43
|
+
.begin-delta {
|
44
|
+
min-width: 20px;
|
45
|
+
}
|
12
46
|
.must-roll,
|
13
47
|
.next-symbol {
|
14
48
|
text-align: center;
|
15
49
|
}
|
16
50
|
|
51
|
+
.must-roll,
|
52
|
+
.should-roll,
|
53
|
+
.next-symbol {
|
54
|
+
background: #eee;
|
55
|
+
}
|
56
|
+
|
17
57
|
.net,
|
18
58
|
.netp {
|
19
59
|
font-weight: bold;
|
@@ -28,22 +68,31 @@
|
|
28
68
|
}
|
29
69
|
|
30
70
|
|
31
|
-
|
32
|
-
.must-roll,
|
33
|
-
.should-roll,
|
34
|
-
.next-symbol {
|
35
|
-
background: #eee;
|
36
|
-
}
|
37
|
-
|
38
71
|
.q {
|
39
72
|
font-weight: bold;
|
40
73
|
}
|
41
74
|
|
42
|
-
.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
75
|
+
.strategies {
|
76
|
+
|
77
|
+
display: flex;
|
78
|
+
flex-wrap: wrap;
|
47
79
|
}
|
48
80
|
|
49
81
|
}
|
82
|
+
.iro-strategies-edit,
|
83
|
+
.iro-strategies-new {
|
84
|
+
display: flex;
|
85
|
+
flex-direction: column;
|
86
|
+
align-items: flex-start;
|
87
|
+
}
|
88
|
+
.iro-strategies--form {
|
89
|
+
border: 1px solid blue;
|
90
|
+
border-radius: 0.5em;
|
91
|
+
padding: 0.5em;
|
92
|
+
margin-right: .5em;
|
93
|
+
|
94
|
+
.field {
|
95
|
+
display: flex;
|
96
|
+
justify-content: space-between;
|
97
|
+
}
|
98
|
+
}
|
@@ -6,23 +6,20 @@ class ::IshManager::IroPursesController < IshManager::ApplicationController
|
|
6
6
|
def show
|
7
7
|
@purse = Iro::Purse.find_or_create_by({ user_id: current_user.id })
|
8
8
|
authorize! :my, @purse
|
9
|
-
|
10
|
-
@positions.map &:refresh
|
9
|
+
|
11
10
|
@strategies = Iro::CoveredCallStrategy.where({
|
12
11
|
iro_purse_id: Iro::Purse.find_by( user_id: current_user.id ).id,
|
13
12
|
})
|
13
|
+
|
14
|
+
underlyings = Tda::Stock.get_quotes( @strategies.map(&:ticker).compact.uniq.join(",") )
|
15
|
+
# json_puts! underlyings, 'out'
|
16
|
+
underlyings.each do |ticker, v|
|
17
|
+
Iro::CoveredCallStrategy.where( ticker: ticker ).update( current_underlying_strike: v[:mark] )
|
18
|
+
end
|
19
|
+
|
20
|
+
@positions = @purse.positions.order({ expires_on: :asc, strike: :asc })
|
21
|
+
@positions.active.map &:refresh
|
14
22
|
end
|
15
23
|
|
16
24
|
end
|
17
25
|
|
18
|
-
=begin
|
19
|
-
@strategy = {
|
20
|
-
buffer_above_water: 0.49, # be this much $ above current price, in next position
|
21
|
-
next_max_delta: 0.25, # of next position
|
22
|
-
next_min_price: 16,
|
23
|
-
threshold_delta: 0.14, # should roll at this delta
|
24
|
-
threshold_netp: 0.69, # should roll at the net %
|
25
|
-
target_profilt: 0.19, # unused
|
26
|
-
current_underlying_strike: 16.6,
|
27
|
-
}
|
28
|
-
=end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
.iro-positions--form
|
5
5
|
= form_for position, as: :position, url: url do |f|
|
6
|
-
.
|
6
|
+
.a
|
7
7
|
.field Position ##{position.id}
|
8
8
|
.field
|
9
9
|
= f.label :strategy
|
@@ -19,9 +19,14 @@
|
|
19
19
|
.field
|
20
20
|
= f.label :expires_on
|
21
21
|
= f.text_field :expires_on
|
22
|
+
|
23
|
+
.field
|
24
|
+
= f.label :quantity
|
25
|
+
= f.number_field :quantity
|
26
|
+
|
22
27
|
.field
|
23
28
|
= f.label :status
|
24
|
-
= f.select :status, options_for_select( Iro::Position.
|
29
|
+
= f.select :status, options_for_select( Iro::Position.states_list, selected: position.status ), {}, class: 'select2'
|
25
30
|
|
26
31
|
.field
|
27
32
|
= f.label :opened_price
|
@@ -1,41 +1,58 @@
|
|
1
1
|
|
2
|
-
.iro-purses-
|
3
|
-
.
|
4
|
-
|
2
|
+
.iro-purses-show.padded
|
3
|
+
.max-width
|
4
|
+
.header
|
5
|
+
%h4.title Purse value: $#{@purse.current_value}
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
|
8
|
+
%h5.collapse-expand#strategies Strategies #{link_to '[+]', new_iro_strategy_path}
|
9
|
+
.strategies.items
|
8
10
|
- @strategies.each do |strat|
|
9
|
-
.strategy
|
10
|
-
|
11
|
-
|
11
|
+
-# .strategy.item
|
12
|
+
-# = link_to '[~]', edit_iro_strategy_path( strat )
|
13
|
+
-# <pre>#{JSON.pretty_generate( strat.display_attrs )}</pre>
|
14
|
+
.strategy.item= render 'ish_manager/iro_strategies/form', strategy: strat
|
12
15
|
|
13
16
|
|
17
|
+
%h5.collapse-expand#positions
|
18
|
+
Positions (#{@positions.length})
|
19
|
+
= link_to '[+]', new_iro_position_path
|
14
20
|
.positions
|
15
|
-
|
16
|
-
Positions (#{@positions.length})
|
17
|
-
= link_to '[+]', new_iro_position_path
|
21
|
+
|
18
22
|
|
19
23
|
%table.bordered
|
20
24
|
%thead
|
21
25
|
%tr
|
22
|
-
%td
|
23
|
-
|
24
|
-
%td
|
26
|
+
%td
|
27
|
+
.id id
|
28
|
+
%td
|
29
|
+
.strategy Strategy
|
30
|
+
%td
|
31
|
+
.ticker Ticker
|
25
32
|
%td Kind/Type
|
26
33
|
%td Strike
|
27
34
|
%td ExpiresOn
|
28
|
-
%td
|
29
|
-
|
30
|
-
%td
|
31
|
-
|
32
|
-
%td
|
33
|
-
|
35
|
+
%td
|
36
|
+
.days-left Days Left
|
37
|
+
%td
|
38
|
+
.q Q
|
39
|
+
%td
|
40
|
+
.begin-on Begin On
|
41
|
+
%td
|
42
|
+
.price Price
|
43
|
+
%td
|
44
|
+
.to-open To Open
|
45
|
+
%td
|
46
|
+
.begin-delta #{"\u0394"}
|
47
|
+
%td
|
48
|
+
.to-close Current $ <br />(To Close)
|
34
49
|
%td.net Net
|
35
50
|
%td.netp % Net
|
36
|
-
%td
|
37
|
-
%td
|
38
|
-
|
51
|
+
%td #{"\u0394"}
|
52
|
+
%td
|
53
|
+
.days-at-open Days@Open
|
54
|
+
%td
|
55
|
+
.must-roll Must roll?
|
39
56
|
%td.should-roll Should roll?
|
40
57
|
%td.next-symbol Next Symbol
|
41
58
|
%td.next-outcome Next Outcome
|
@@ -43,19 +60,20 @@
|
|
43
60
|
%tbody
|
44
61
|
- @positions.each do |p|
|
45
62
|
%tr
|
46
|
-
%td
|
63
|
+
%td.id
|
47
64
|
= p.id
|
48
65
|
= link_to '[~]', edit_iro_position_path(p)
|
49
|
-
%td= p.strategy
|
66
|
+
%td.strategy= link_to p.strategy, edit_iro_strategy_path(p.strategy)
|
50
67
|
%td= p.ticker
|
51
68
|
%td= p.type == "Iro::CoveredCall" ? "CALL" : "other"
|
52
69
|
%td= p.strike
|
53
70
|
%td= p.expires_on.strftime('%b %d')
|
54
|
-
%td= (p.expires_on.to_date - Time.now.to_date).to_i
|
71
|
+
%td.days-left= (p.expires_on.to_date - Time.now.to_date).to_i
|
55
72
|
%td.q= p.quantity
|
56
|
-
%td= pp_date p.opened_on
|
57
|
-
%td= p.opened_price
|
58
|
-
%td=
|
73
|
+
%td.begin-on= pp_date p.opened_on
|
74
|
+
%td.price= p.opened_price
|
75
|
+
%td.to-open= pp_amount( p.opened_price * 100 * p.quantity )
|
76
|
+
%td.begin-delta= sprintf('%.2f', p.opened_delta ) rescue nil
|
59
77
|
%td= pp_money p.current_price
|
60
78
|
%td.net= pp_money ( p.opened_price - p.current_price ) * 100 - 1.3
|
61
79
|
%td.netp= pp_percent ( p.opened_price - p.current_price ) / p.opened_price
|
@@ -2,6 +2,15 @@
|
|
2
2
|
- url = strategy.new_record? ? iro_strategies_path : iro_strategy_path(strategy)
|
3
3
|
.iro-strategies--form
|
4
4
|
= form_for strategy, url: url, as: :iro_strategy do |f|
|
5
|
+
.field
|
6
|
+
= "#{strategy.id}." if strategy.id
|
7
|
+
= f.label :slug
|
8
|
+
= f.text_field :slug
|
9
|
+
.actions
|
10
|
+
= f.submit 'Submit', :data => { :confirm => 'Are you sure?' }
|
11
|
+
.field
|
12
|
+
= f.label :ticker
|
13
|
+
= f.text_field :ticker
|
5
14
|
.field
|
6
15
|
= f.label :buffer_above_water
|
7
16
|
= f.number_field :buffer_above_water, placeholder: "0.49", step: 0.01
|
@@ -17,12 +26,7 @@
|
|
17
26
|
.field
|
18
27
|
= f.label :threshold_netp
|
19
28
|
= f.number_field :threshold_netp, placeholder: "0.69", step: 0.01
|
20
|
-
.field
|
21
|
-
= f.label :target_profit
|
22
|
-
= f.number_field :target_profit, placeholder: "0.19", step: 0.01
|
23
29
|
.field
|
24
30
|
= f.label :current_underlying_strike
|
25
31
|
= f.number_field :current_underlying_strike, placeholder: "16.66", step: 0.01
|
26
32
|
|
27
|
-
.actions
|
28
|
-
= f.submit 'Submit'
|