iron_warbler 2.0.7.45 → 2.0.7.46
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.
- checksums.yaml +4 -4
- data/app/controllers/iro/api_controller.rb +9 -4
- data/app/controllers/iro/positions_controller.rb +67 -11
- data/app/controllers/iro/purses_controller.rb +7 -4
- data/app/controllers/iro/stocks_controller.rb +5 -1
- data/app/controllers/iro/strategies_controller.rb +1 -0
- data/app/models/tda/option.rb +4 -4
- data/app/views/iro/positions/_form.haml +20 -11
- data/app/views/iro/positions/_gameui_long_credit_put_spread.haml +3 -0
- data/app/views/iro/positions/_new.haml +1 -0
- data/app/views/iro/positions/_table.haml +4 -5
- data/app/views/iro/purses/_header.haml +10 -2
- data/app/views/iro/stocks/_show_card.haml +4 -0
- data/app/views/iro/strategies/_form.haml +72 -0
- data/app/views/iro/strategies/_form_spread.haml +14 -9
- data/app/views/iro/strategies/_header.haml +3 -2
- data/app/views/iro/strategies/_show.haml +2 -2
- data/app/views/iro/strategies/_table.haml +8 -6
- data/app/views/iro/strategies/edit.haml +9 -1
- data/app/views/iro/strategies/index.haml +4 -3
- data/app/views/iro/strategies/new.haml +5 -1
- data/app/views/iro/strategies/show.haml +3 -1
- data/config/routes.rb +3 -3
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d12cbdde8ab8b82ca08c2a009f4e464a9a8f1f2dad5f14f8bab8c68d46f3afb
|
|
4
|
+
data.tar.gz: 2b37b10d1aef00cedd8a25f237c1023fb1862ebddcac074bdce1b6f47142324e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 336486a80b29e5980463900544ecef849964c83aa5598c2fd88e71cf94af89a306d19d5f2c18b40b4d745bf02e51ecb0f754b7d42e1488a36d6d38411254a317
|
|
7
|
+
data.tar.gz: f733705fab7b7cdc24e2a3a387e667d85029a1981f39af70d6ebc4ed8ff764d178ce648be68a922198316449d25b936f57f4336231d7685b6b41a08a3d5789e5
|
|
@@ -43,10 +43,15 @@ class Iro::ApiController < ActionController::Base
|
|
|
43
43
|
private
|
|
44
44
|
|
|
45
45
|
def decode_jwt
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
# puts! current_user, '#decode_jwt'
|
|
47
|
+
if current_user
|
|
48
|
+
;
|
|
49
|
+
else
|
|
50
|
+
out = JWT.decode params[:jwt_token], nil, false
|
|
51
|
+
email = out[0]['email']
|
|
52
|
+
user = User.find_by({ email: email })
|
|
53
|
+
sign_in user
|
|
54
|
+
end
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
def set_stock
|
|
@@ -59,23 +59,26 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
59
59
|
# end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
## 2025-10-14
|
|
63
|
+
## long_credit_put_spread
|
|
62
64
|
def prepare
|
|
63
65
|
@position = Iro::Position.find params[:id]
|
|
64
66
|
authorize! :roll, @position
|
|
67
|
+
@n_dollars = 100 ## used in the view, but the name is unclear
|
|
65
68
|
|
|
66
69
|
@prev = @position
|
|
67
70
|
@purse = @position.purse
|
|
68
71
|
@stock = @position.stock
|
|
69
|
-
@n_dollars = 100
|
|
70
72
|
|
|
71
73
|
## dealing with too many strikes in the chain
|
|
74
|
+
=begin
|
|
72
75
|
while true
|
|
73
|
-
@nn = ( @position.purse.n_next_positions/2 ).ceil
|
|
76
|
+
@nn = ( @position.purse.n_next_positions/2 ).ceil ## @nn == @nn_next_positions
|
|
74
77
|
upper = Tda::Option.get_quote({
|
|
75
|
-
contractType:
|
|
76
|
-
strike:
|
|
78
|
+
contractType: @position.inner.put_call,
|
|
79
|
+
strike: @prev.inner.strike + @nn*@stock.options_price_increment,
|
|
77
80
|
expirationDate: @prev.next_expires_on,
|
|
78
|
-
ticker:
|
|
81
|
+
ticker: @stock.ticker,
|
|
79
82
|
})
|
|
80
83
|
if !upper.symbol
|
|
81
84
|
puts! 'too high'
|
|
@@ -101,6 +104,7 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
101
104
|
end
|
|
102
105
|
break
|
|
103
106
|
end
|
|
107
|
+
=end
|
|
104
108
|
|
|
105
109
|
self.send("_prepare_#{@position.strategy.kind}")
|
|
106
110
|
end
|
|
@@ -187,12 +191,12 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
187
191
|
@positions = []
|
|
188
192
|
(-@nn..@nn).each do |idx|
|
|
189
193
|
next_ = Iro::Position.new({
|
|
190
|
-
stock:
|
|
194
|
+
stock: @stock,
|
|
191
195
|
inner_strike: @prev.inner.strike - idx*@stock.options_price_increment,
|
|
192
|
-
expires_on:
|
|
193
|
-
purse:
|
|
194
|
-
strategy:
|
|
195
|
-
quantity:
|
|
196
|
+
expires_on: @prev.next_expires_on,
|
|
197
|
+
purse: @position.purse,
|
|
198
|
+
strategy: @position.strategy,
|
|
199
|
+
quantity: @position.quantity,
|
|
196
200
|
})
|
|
197
201
|
next_.sync
|
|
198
202
|
next_.begin_inner_price = next_.end_inner_price
|
|
@@ -202,6 +206,58 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
202
206
|
end
|
|
203
207
|
end
|
|
204
208
|
|
|
209
|
+
## 2025-10-14 _TODO: move to a model?
|
|
210
|
+
## _TODO: what does this do, exactly?
|
|
211
|
+
def _prepare_long_credit_put_spread
|
|
212
|
+
## get quotes for next expires_at
|
|
213
|
+
# quotes = Tda::Option.get_quotes({ contractType: @position.put_call
|
|
214
|
+
@positions = []
|
|
215
|
+
(-@nn..@nn).each do |idx|
|
|
216
|
+
next_ = Iro::Position.find_or_create_by({
|
|
217
|
+
expires_on: @prev.next_expires_on,
|
|
218
|
+
inner_strike: @prev.inner.strike - idx*@stock.options_price_increment,
|
|
219
|
+
outer_strike: @prev.outer.strike - idx*@stock.options_price_increment,
|
|
220
|
+
prev_id: @prev.id,
|
|
221
|
+
purse: @position.purse,
|
|
222
|
+
quantity: @position.quantity,
|
|
223
|
+
status: 'prepare',
|
|
224
|
+
stock: @stock,
|
|
225
|
+
strategy: @position.strategy,
|
|
226
|
+
})
|
|
227
|
+
pos = next_
|
|
228
|
+
next_.inner ||= Iro::Option.new({
|
|
229
|
+
# begin_price: pos[:begin_inner_price],
|
|
230
|
+
# begin_delta: pos[:begin_inner_delta],
|
|
231
|
+
expires_on: pos[:expires_on],
|
|
232
|
+
inner: pos,
|
|
233
|
+
put_call: pos.put_call,
|
|
234
|
+
stock_id: pos[:stock_id],
|
|
235
|
+
strike: pos[:inner_strike],
|
|
236
|
+
})
|
|
237
|
+
next_.outer ||= Iro::Option.new({
|
|
238
|
+
# begin_price: pos[:begin_inner_price],
|
|
239
|
+
# begin_delta: pos[:begin_inner_delta],
|
|
240
|
+
expires_on: pos[:expires_on],
|
|
241
|
+
outer: pos,
|
|
242
|
+
put_call: pos.put_call,
|
|
243
|
+
stock_id: pos[:stock_id],
|
|
244
|
+
strike: pos[:outer_strike],
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
next_.sync
|
|
248
|
+
next_.inner.begin_price = next_.inner.end_price
|
|
249
|
+
next_.inner.begin_delta = next_.inner.end_delta
|
|
250
|
+
|
|
251
|
+
next_.outer.begin_price = next_.outer.end_price
|
|
252
|
+
next_.outer.begin_delta = next_.outer.end_delta
|
|
253
|
+
|
|
254
|
+
next_.next_gain_loss_amount = @prev.outer.end_price - @prev.inner.end_price
|
|
255
|
+
next_.next_gain_loss_amount += next_.inner.begin_price - next_.outer.begin_price
|
|
256
|
+
next_.save
|
|
257
|
+
@positions.push next_
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
205
261
|
def _prepare_long_debit_call_spread
|
|
206
262
|
@positions = []
|
|
207
263
|
(-@nn..@nn).each do |idx|
|
|
@@ -300,7 +356,7 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
300
356
|
params[:position].permit( :begin_on,
|
|
301
357
|
:expires_on,
|
|
302
358
|
:long_or_short,
|
|
303
|
-
:purse_id,
|
|
359
|
+
:purse_id, :put_call,
|
|
304
360
|
:quantity,
|
|
305
361
|
:status, :stock_id, :strategy_id,
|
|
306
362
|
)
|
|
@@ -31,14 +31,17 @@ class Iro::PursesController < Iro::ApplicationController
|
|
|
31
31
|
authorize! :index, Iro::Purse
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
## table or gameui
|
|
34
35
|
def show
|
|
35
36
|
@purse = Iro::Purse.find(params[:id])
|
|
37
|
+
params[:template] = params[:template].presence || 'show'
|
|
36
38
|
authorize! :show, @purse
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
@positions = @purse.positions
|
|
41
|
+
if params[:view_status] && 'all' != params[:view_status]
|
|
42
|
+
@positions = @positions.where( status: params[:view_status] )
|
|
43
|
+
end
|
|
44
|
+
@positions = @positions.includes( :strategy
|
|
42
45
|
).order( expires_on: :asc, ticker: :desc, long_or_short: :asc, inner_strike: :asc )
|
|
43
46
|
|
|
44
47
|
|
|
@@ -47,8 +47,12 @@ class Iro::StocksController < Iro::ApplicationController
|
|
|
47
47
|
authorize! :refresh, Iro::Stock
|
|
48
48
|
tickers = Iro::Stock.all.map { |s| s.ticker }.join(',')
|
|
49
49
|
outs = Tda::Stock.get_quotes tickers
|
|
50
|
+
puts! outs, 'got all tickers'
|
|
51
|
+
|
|
50
52
|
outs.map do |out|
|
|
51
|
-
|
|
53
|
+
puts! out, 'a ticker'
|
|
54
|
+
|
|
55
|
+
Iro::Stock.where( ticker: out[:symbol] ).update_all( last: out[:last] )
|
|
52
56
|
end
|
|
53
57
|
flash_notice 'refreshed stocks'
|
|
54
58
|
redirect_to request.referrer
|
data/app/models/tda/option.rb
CHANGED
|
@@ -26,7 +26,7 @@ class Tda::Option
|
|
|
26
26
|
##
|
|
27
27
|
def self.get_chains params
|
|
28
28
|
filename = "./data/schwab/#{Time.now.to_date.to_s}-#{params[:ticker]}-chains.json"
|
|
29
|
-
if !params[:force] && File.exists?(
|
|
29
|
+
if !params[:force] && File.exists?(filename)
|
|
30
30
|
return JSON.parse File.read filename
|
|
31
31
|
|
|
32
32
|
else
|
|
@@ -141,7 +141,7 @@ class Tda::Option
|
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
query = { }.merge opts
|
|
144
|
-
puts! query, '
|
|
144
|
+
puts! query, 'zp1 - query'
|
|
145
145
|
|
|
146
146
|
headers = {
|
|
147
147
|
accept: 'application/json',
|
|
@@ -150,13 +150,13 @@ class Tda::Option
|
|
|
150
150
|
|
|
151
151
|
path = "/chains"
|
|
152
152
|
out = self.get path, {
|
|
153
|
-
# basic_auth: { username: SCHWAB_DATA[:key], password: SCHWAB_DATA[:secret] },
|
|
154
153
|
headers: headers,
|
|
155
154
|
query: query,
|
|
156
155
|
}
|
|
157
|
-
puts! out, '
|
|
156
|
+
puts! out, 'zp1 - got a chain'
|
|
158
157
|
timestamp = DateTime.parse out.headers['date']
|
|
159
158
|
out = out.parsed_response.deep_symbolize_keys
|
|
159
|
+
puts! out, 'zp1 - out'
|
|
160
160
|
|
|
161
161
|
|
|
162
162
|
tmp_sym = "#{opts[:contractType].to_s.downcase}ExpDateMap".to_sym
|
|
@@ -10,26 +10,35 @@
|
|
|
10
10
|
.field
|
|
11
11
|
%label Purse
|
|
12
12
|
= f.select :purse_id, options_for_select( @purses_list, selected: position.purse_id )
|
|
13
|
-
|
|
13
|
+
.field
|
|
14
14
|
%label Status
|
|
15
15
|
= f.select :status, options_for_select( Iro::Position::STATUSES, selected: position.status )
|
|
16
16
|
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
.d-flex
|
|
18
|
+
.field
|
|
19
|
+
%label Stock
|
|
20
|
+
= f.select :stock_id, options_for_select( @stocks_list, selected: position.stock_id )
|
|
21
|
+
.field
|
|
22
|
+
%label put_call
|
|
23
|
+
= f.select :put_call, options_for_select([nil, 'PUT', 'CALL'], selected: position.put_call)
|
|
24
|
+
= position.put_call
|
|
20
25
|
|
|
21
26
|
-# .field
|
|
22
27
|
-# %label long or short?
|
|
23
28
|
-# = f.select :long_or_short, options_for_select([nil, Iro::Strategy::LONG, Iro::Strategy::SHORT], selected: long_or_short )
|
|
24
29
|
|
|
25
|
-
%label Strategy
|
|
26
|
-
= f.select :strategy_id, options_for_select( @strategies_list, selected: position.strategy_id )
|
|
27
|
-
|
|
28
30
|
.field
|
|
29
|
-
%label
|
|
30
|
-
= f.select :
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
%label Strategy
|
|
32
|
+
= f.select :strategy_id, options_for_select( @strategies_list, selected: position.strategy_id )
|
|
33
|
+
|
|
34
|
+
.d-flex
|
|
35
|
+
.field
|
|
36
|
+
%label Expires on
|
|
37
|
+
= f.select :expires_on, options_for_select( Iro::Option.expirations_list, selected: position.expires_on.to_date )
|
|
38
|
+
-# = position.expires_on
|
|
39
|
+
.field
|
|
40
|
+
%label Quantity
|
|
41
|
+
= f.text_field :quantity
|
|
33
42
|
|
|
34
43
|
%br
|
|
35
44
|
= render 'formpart_4data', f: f, position: position
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
|
|
2
|
+
%h5 Positions (#{@purse.positions.length})
|
|
2
3
|
.positions--table
|
|
3
|
-
|
|
4
|
-
%h5 Positions (#{positions.length})
|
|
5
4
|
%table.bordered
|
|
6
5
|
%thead
|
|
7
6
|
%tr
|
|
8
|
-
%th
|
|
7
|
+
%th.actions
|
|
9
8
|
%th.ticker
|
|
10
9
|
.a Stock
|
|
11
10
|
%th
|
|
@@ -19,11 +18,11 @@
|
|
|
19
18
|
%th.strikes
|
|
20
19
|
Strike
|
|
21
20
|
%th.begin_price
|
|
22
|
-
.a Begin
|
|
21
|
+
.a Begin $, D
|
|
23
22
|
%th.max-loss Max Loss
|
|
24
23
|
-# %th.max-gain Max Gain
|
|
25
24
|
%th
|
|
26
|
-
.end_price End
|
|
25
|
+
.end_price End $, D
|
|
27
26
|
%th
|
|
28
27
|
.net Net Amount (%)
|
|
29
28
|
%th
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
-# (#{purse.positions.length})
|
|
8
8
|
|
|
9
9
|
= link_to '[~]', edit_purse_path(purse)
|
|
10
|
-
= link_to '[table]', purse_path(purse)
|
|
11
|
-
= link_to '[gameUI]',
|
|
10
|
+
= link_to '[table]', purse_path(purse, template: 'show', view_status: params[:view_status] )
|
|
11
|
+
= link_to '[gameUI]', purse_path(purse, template: 'gameui', view_status: params[:view_status] )
|
|
12
12
|
|
|
13
13
|
%ul
|
|
14
14
|
%li <b>Total:</b> #{pp_amount purse.balance}
|
|
@@ -18,9 +18,17 @@
|
|
|
18
18
|
= render '/iro/positions/new', purse: purse
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
|
|
21
22
|
- if true # params[:template] == 'gameui'
|
|
22
23
|
.mini-inputs
|
|
23
24
|
= form_for purse, html: { class: 'd-flex' } do |f|
|
|
24
25
|
= render '/iro/purses/form_extra_fields', f: f
|
|
25
26
|
= f.submit '>'
|
|
26
27
|
%br
|
|
28
|
+
|
|
29
|
+
.d-flex
|
|
30
|
+
%h5 view_status
|
|
31
|
+
= form_tag purse_path( @purse ), method: :get do
|
|
32
|
+
= select_tag :view_status, options_for_select([ :all, :active, :proposed, :pending ], selected: params[:view_status] )
|
|
33
|
+
= hidden_field_tag :template, params[:template]
|
|
34
|
+
= submit_tag '>'
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
-##
|
|
2
|
+
-## 2025-10-11 old, obsolete.
|
|
3
|
+
-##
|
|
4
|
+
|
|
5
|
+
.Card.strategies--form
|
|
6
|
+
= form_for strategy do |f|
|
|
7
|
+
.actions
|
|
8
|
+
= f.submit
|
|
9
|
+
|
|
10
|
+
.row
|
|
11
|
+
.col-md-6
|
|
12
|
+
.field
|
|
13
|
+
%label Kind:
|
|
14
|
+
= strategy.kind
|
|
15
|
+
= hidden_field_tag 'strategy[kind]', params[:kind] if params[:kind]
|
|
16
|
+
.field
|
|
17
|
+
%label stock
|
|
18
|
+
= f.select :stock_id, options_for_select(@stocks_list, selected: strategy.stock_id), class: 'select2'
|
|
19
|
+
.field
|
|
20
|
+
%label long or short?
|
|
21
|
+
= f.select :long_or_short, options_for_select([nil, Iro::Strategy::LONG, Iro::Strategy::SHORT], selected: strategy.long_or_short)
|
|
22
|
+
.field
|
|
23
|
+
%label credit or debit?
|
|
24
|
+
= f.select :credit_or_debit, options_for_select([nil, Iro::Strategy::CREDIT, Iro::Strategy::DEBIT], selected: strategy.credit_or_debit)
|
|
25
|
+
.field
|
|
26
|
+
%label call or put?
|
|
27
|
+
.comment This is selected automatically
|
|
28
|
+
-# = f.select :call_or_put, options_for_select([nil, 'CALL', 'PUT'], selected: strategy.credit_or_debit)
|
|
29
|
+
|
|
30
|
+
-# .col-md-6
|
|
31
|
+
-# .field
|
|
32
|
+
-# %label slug
|
|
33
|
+
-# = f.text_field :slug
|
|
34
|
+
%hr
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
.field
|
|
38
|
+
%label Buffer above water
|
|
39
|
+
= f.number_field :buffer_above_water, placeholder: "0.49", step: 0.01
|
|
40
|
+
.field
|
|
41
|
+
= f.label :threshold_dte
|
|
42
|
+
= f.number_field :threshold_dte, placeholder: "1"
|
|
43
|
+
-# .field
|
|
44
|
+
-# = f.label :next_max_outer_delta
|
|
45
|
+
-# = f.number_field :next_max_outer_delta, placeholder: "0.25", step: 0.01
|
|
46
|
+
.field
|
|
47
|
+
= f.label :threshold_pos_delta
|
|
48
|
+
= f.number_field :threshold_pos_delta, placeholder: "0.14", step: 0.001
|
|
49
|
+
.field
|
|
50
|
+
= f.label :threshold_netp
|
|
51
|
+
= f.number_field :threshold_netp, placeholder: "0.69", step: 0.001
|
|
52
|
+
|
|
53
|
+
%hr
|
|
54
|
+
|
|
55
|
+
.field
|
|
56
|
+
= f.label :next_inner_delta
|
|
57
|
+
= f.number_field :next_inner_delta, placeholder: "0.25", step: 0.001
|
|
58
|
+
.field
|
|
59
|
+
= f.label :next_inner_strike
|
|
60
|
+
= f.number_field :next_inner_strike, placeholder: "20.0", step: 0.01
|
|
61
|
+
.comment Literally the min (max) dollar amount of next strike
|
|
62
|
+
.field
|
|
63
|
+
= f.label :next_spread_amount
|
|
64
|
+
= f.number_field :next_spread_amount, placeholder: "20", step: 0.1
|
|
65
|
+
.field
|
|
66
|
+
%label next buffer dollars above water
|
|
67
|
+
= f.number_field :next_buffer_above_water, placeholder: "80", step: 0.01
|
|
68
|
+
|
|
69
|
+
.actions
|
|
70
|
+
= f.submit
|
|
71
|
+
|
|
72
|
+
|
|
@@ -8,20 +8,24 @@
|
|
|
8
8
|
.col-md-6
|
|
9
9
|
.field
|
|
10
10
|
%label Kind:
|
|
11
|
-
= strategy.kind
|
|
12
|
-
= hidden_field_tag 'strategy[kind]', params[:kind] if params[:kind]
|
|
11
|
+
= f.select :kind, options_for_select(Iro::Strategy::KINDS, selected: strategy.kind || params[:kind] )
|
|
13
12
|
.field
|
|
14
13
|
%label stock
|
|
15
14
|
= f.select :stock_id, options_for_select(@stocks_list, selected: strategy.stock_id), class: 'select2'
|
|
16
15
|
.field
|
|
17
16
|
%label long or short?
|
|
18
17
|
= f.select :long_or_short, options_for_select([nil, Iro::Strategy::LONG, Iro::Strategy::SHORT], selected: strategy.long_or_short)
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
-## 2025-10-11 unnecessary: always credit.
|
|
19
|
+
-# .field
|
|
20
|
+
-# %label credit or debit?
|
|
21
|
+
-# = f.select :credit_or_debit, options_for_select([nil, Iro::Strategy::CREDIT, Iro::Strategy::DEBIT], selected: strategy.credit_or_debit)
|
|
22
|
+
|
|
23
|
+
-# selected automatically
|
|
22
24
|
.field
|
|
23
25
|
%label call or put?
|
|
24
|
-
.
|
|
26
|
+
.a
|
|
27
|
+
%b= strategy.put_call
|
|
28
|
+
.comment This is selected automatically
|
|
25
29
|
-# = f.select :call_or_put, options_for_select([nil, 'CALL', 'PUT'], selected: strategy.credit_or_debit)
|
|
26
30
|
|
|
27
31
|
-# .col-md-6
|
|
@@ -32,8 +36,8 @@
|
|
|
32
36
|
|
|
33
37
|
|
|
34
38
|
.field
|
|
35
|
-
%label
|
|
36
|
-
= f.number_field :
|
|
39
|
+
%label Buffer dollars above water
|
|
40
|
+
= f.number_field :buffer_above_water, placeholder: "0.49", step: 0.01
|
|
37
41
|
.field
|
|
38
42
|
= f.label :threshold_dte
|
|
39
43
|
= f.number_field :threshold_dte, placeholder: "1"
|
|
@@ -42,7 +46,8 @@
|
|
|
42
46
|
-# = f.number_field :next_max_outer_delta, placeholder: "0.25", step: 0.01
|
|
43
47
|
.field
|
|
44
48
|
= f.label :threshold_delta
|
|
45
|
-
|
|
49
|
+
.comment that's a best-case scenario roll
|
|
50
|
+
= f.number_field :threshold_pos_delta, placeholder: "0.14", step: 0.001
|
|
46
51
|
.field
|
|
47
52
|
= f.label :threshold_netp
|
|
48
53
|
= f.number_field :threshold_netp, placeholder: "0.69", step: 0.001
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
.inline-search
|
|
4
4
|
= form_tag strategies_path, method: :get do
|
|
5
5
|
= text_field_tag :q
|
|
6
|
-
= link_to '[+spread]', new_spread_strategy_path
|
|
7
|
-
= link_to '[+wheel]', new_wheel_strategy_path
|
|
6
|
+
-# = link_to '[+spread]', new_spread_strategy_path
|
|
7
|
+
-# = link_to '[+wheel]', new_wheel_strategy_path
|
|
8
|
+
|
|
8
9
|
|
|
9
10
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
-# %li <b>ticker:</b> #{strategy.ticker}
|
|
9
9
|
-# %li <b>slug:</b> #{strategy.slug}
|
|
10
10
|
|
|
11
|
-
%li <b>
|
|
12
|
-
%li <b>
|
|
11
|
+
%li <b>buffer_above_water:</b> #{strategy.buffer_above_water}
|
|
12
|
+
%li <b>threshold_pos_delta:</b> #{strategy.threshold_pos_delta}
|
|
13
13
|
%li <b>threshold_netp:</b> #{strategy.threshold_netp}
|
|
14
14
|
|
|
15
15
|
%hr
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
%thead
|
|
8
8
|
%tr
|
|
9
9
|
%th.actions
|
|
10
|
-
%th kind
|
|
11
|
-
%th slug
|
|
12
10
|
%th stock
|
|
13
|
-
|
|
11
|
+
%th kind
|
|
12
|
+
%th long or short
|
|
13
|
+
%th put_call
|
|
14
14
|
%th next_inner_delta
|
|
15
|
+
%th slug
|
|
15
16
|
%th.actions
|
|
16
17
|
%tbody
|
|
17
18
|
- strategies.each do |sss|
|
|
@@ -20,11 +21,12 @@
|
|
|
20
21
|
.d-flex
|
|
21
22
|
= link_to '[~]', edit_strategy_path(sss)
|
|
22
23
|
= button_to 'x', strategy_path(sss), method: :delete, data: { confirm: 'Are you sure?' }
|
|
23
|
-
%td= sss.kind
|
|
24
|
-
%td= link_to sss.slug, strategy_path(sss)
|
|
25
24
|
%td.stock= sss.stock
|
|
26
|
-
|
|
25
|
+
%td= sss.kind
|
|
26
|
+
%td.long-or-short= sss.long_or_short
|
|
27
|
+
%td.put-call= sss.put_call
|
|
27
28
|
%td= sss.next_inner_delta
|
|
29
|
+
%td= link_to sss.slug, strategy_path(sss)
|
|
28
30
|
%td
|
|
29
31
|
= form_tag propose_position_path do
|
|
30
32
|
= hidden_field_tag :strategy_id, sss.id
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
.strategies-edit.maxwidth
|
|
3
|
-
|
|
3
|
+
.row
|
|
4
|
+
.col-md-9
|
|
5
|
+
- if @strategy.kind == Iro::Strategy::KIND_LONG_CREDIT_PUT_SPREAD
|
|
6
|
+
.Card= render "form_spread", strategy: @strategy
|
|
7
|
+
- else
|
|
8
|
+
%b _TODO: review strategies/edit, incorporate strategies other than KIND_LONG_CREDIT_PUT_SPREAD
|
|
9
|
+
|
|
10
|
+
.col-md-3= render 'iro/stocks/show_card', stock: @strategy.stock
|
|
11
|
+
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
.maxwidth
|
|
3
3
|
.header
|
|
4
4
|
%h5.title
|
|
5
|
-
Strategies
|
|
6
|
-
= link_to '[+spread]', iro.new_spread_strategy_path
|
|
7
|
-
= link_to '[+wheel]', iro.new_wheel_strategy_path
|
|
5
|
+
Strategies
|
|
6
|
+
-# = link_to '[+spread]', iro.new_spread_strategy_path
|
|
7
|
+
-# = link_to '[+wheel]', iro.new_wheel_strategy_path
|
|
8
|
+
= link_to '[+put-spread]', iro.new_strategy_path( kind: Iro::Strategy::KIND_LONG_CREDIT_PUT_SPREAD )
|
|
8
9
|
|
|
9
10
|
= render '/iro/strategies/table', strategies: @strategies
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
.maxwidth
|
|
3
|
-
|
|
3
|
+
- if params[:kind] == Iro::Strategy::KIND_LONG_CREDIT_PUT_SPREAD
|
|
4
|
+
= render "form_spread", strategy: @strategy
|
|
5
|
+
- else
|
|
6
|
+
%b review strategies/new, incorporate strategies other than KIND_LONG_CREDIT_PUT_SPREAD
|
|
7
|
+
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
.strategies-show.maxwidth
|
|
3
3
|
.header
|
|
4
|
-
%h5.title
|
|
4
|
+
%h5.title
|
|
5
|
+
Strategy `#{@strategy}`
|
|
6
|
+
= link_to '[~]', edit_strategy_path(@strategy)
|
|
5
7
|
%ul
|
|
6
8
|
-# %li Purse #{@strategy.purses}
|
|
7
9
|
-# %li= link_to 'Next position', strategy_next_position_path(@strategy)
|
data/config/routes.rb
CHANGED
|
@@ -23,7 +23,7 @@ Iro::Engine.routes.draw do
|
|
|
23
23
|
resources :profiles
|
|
24
24
|
|
|
25
25
|
get 'purses/:id/gameui', to: 'purses#show', as: :purse_gameui, defaults: { template: 'gameui' }
|
|
26
|
-
get 'purses/:id',
|
|
26
|
+
get 'purses/:id', to: 'purses#show', as: :purse # , defaults: { template: 'show' }
|
|
27
27
|
resources :purses
|
|
28
28
|
|
|
29
29
|
get 'schwab/sync', to: 'application#schwab_sync', as: :schwab_sync
|
|
@@ -31,8 +31,8 @@ Iro::Engine.routes.draw do
|
|
|
31
31
|
get 'stocks/sync', to: 'stocks#sync', as: :sync_stocks
|
|
32
32
|
resources :stocks
|
|
33
33
|
|
|
34
|
-
get 'strategies/new-spread', to: 'strategies#new', as: :new_spread_strategy, defaults: { kind: 'spread' }
|
|
35
|
-
get 'strategies/new-wheel', to: 'strategies#new', as: :new_wheel_strategy, defaults: { kind: 'wheel' }
|
|
34
|
+
# get 'strategies/new-spread', to: 'strategies#new', as: :new_spread_strategy, defaults: { kind: 'spread' }
|
|
35
|
+
# get 'strategies/new-wheel', to: 'strategies#new', as: :new_wheel_strategy, defaults: { kind: 'wheel' }
|
|
36
36
|
resources :strategies
|
|
37
37
|
|
|
38
38
|
get 'api/oauth2-redirect.html', to: 'api#oauth2_redirect'
|
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.46
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Pudeyev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: business_time
|
|
@@ -259,6 +259,7 @@ files:
|
|
|
259
259
|
- app/views/iro/positions/_form.haml
|
|
260
260
|
- app/views/iro/positions/_formpart_4data.haml
|
|
261
261
|
- app/views/iro/positions/_gameui_covered_call.haml
|
|
262
|
+
- app/views/iro/positions/_gameui_long_credit_put_spread.haml
|
|
262
263
|
- app/views/iro/positions/_gameui_spread.haml
|
|
263
264
|
- app/views/iro/positions/_header.haml
|
|
264
265
|
- app/views/iro/positions/_header_covered_call.haml
|
|
@@ -297,9 +298,11 @@ files:
|
|
|
297
298
|
- app/views/iro/stocks/_form.haml
|
|
298
299
|
- app/views/iro/stocks/_grid_long.haml
|
|
299
300
|
- app/views/iro/stocks/_grid_short.haml
|
|
301
|
+
- app/views/iro/stocks/_show_card.haml
|
|
300
302
|
- app/views/iro/stocks/edit.haml
|
|
301
303
|
- app/views/iro/stocks/index.haml
|
|
302
304
|
- app/views/iro/stocks/show.haml
|
|
305
|
+
- app/views/iro/strategies/_form.haml
|
|
303
306
|
- app/views/iro/strategies/_form_spread.haml
|
|
304
307
|
- app/views/iro/strategies/_form_wheel.haml
|
|
305
308
|
- app/views/iro/strategies/_header.haml
|