iron_warbler 2.0.7.48 → 2.0.7.50
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/assets/stylesheets/iron_warbler/application.css +0 -9
- data/app/assets/stylesheets/iron_warbler/positions.scss +4 -0
- data/app/assets/stylesheets/iron_warbler/positions_gameui.scss +2 -2
- data/app/assets/stylesheets/iron_warbler/purses.scss +2 -1
- data/app/assets/stylesheets/iron_warbler/purses_gameui.scss +63 -21
- data/app/assets/stylesheets/iron_warbler/purses_summary.scss +113 -79
- data/app/assets/stylesheets/iron_warbler/utils.scss +5 -4
- data/app/controllers/iro/application_controller.rb +0 -2
- data/app/controllers/iro/positions_controller.rb +88 -24
- data/app/controllers/iro/purses_controller.rb +53 -53
- data/app/controllers/iro/stocks_controller.rb +1 -1
- data/app/views/iro/_main_header.haml +8 -9
- data/app/views/iro/positions/_form_spread.haml +5 -3
- data/app/views/iro/positions/_gameui_long_credit_put_spread.haml +10 -7
- data/app/views/iro/positions/_gameui_short_credit_call_spread.haml +10 -6
- data/app/views/iro/positions/_header.haml +1 -0
- data/app/views/iro/positions/_header_long_credit_put_spread.haml +11 -7
- data/app/views/iro/positions/_header_short_credit_call_spread.haml +10 -8
- data/app/views/iro/positions/_new.haml +2 -2
- data/app/views/iro/positions/_prepare_header_short_credit_call_spread.haml +4 -3
- data/app/views/iro/positions/_prepare_long_credit_put_spread.haml +4 -2
- data/app/views/iro/positions/_prepare_short_credit_call_spread.haml +4 -2
- data/app/views/iro/positions/_reasons.haml +1 -1
- data/app/views/iro/positions/_table_tr_covered_call.haml +1 -1
- data/app/views/iro/positions/_table_tr_long_credit_put_spread.haml +17 -11
- data/app/views/iro/positions/index.haml +5 -0
- data/app/views/iro/positions/place2.haml +27 -0
- data/app/views/iro/positions/prepare.haml +1 -1
- data/app/views/iro/positions/prepare2.haml +24 -18
- data/app/views/iro/purses/_form_extra_fields.haml +21 -16
- data/app/views/iro/purses/_header.haml +49 -36
- data/app/views/iro/purses/_summary.haml +60 -27
- data/app/views/iro/purses/_summary2.haml +77 -0
- data/app/views/iro/purses/gameui.haml +4 -7
- data/app/views/iro/purses/show.haml +1 -7
- data/app/views/iro/stocks/_form.haml +3 -0
- data/app/views/iro/stocks/index.haml +1 -1
- data/app/views/iro/strategies/_form_spread.haml +12 -11
- data/app/views/iro/strategies/_list.haml +4 -0
- data/app/views/iro/strategies/_show.haml +4 -3
- data/app/views/iro/strategies/_table.haml +8 -4
- data/app/views/iro/strategies/edit.haml +2 -0
- data/app/views/layouts/iro/application.haml +1 -2
- data/config/routes.rb +6 -1
- metadata +6 -4
- data/app/views/iro/strategies/_form.haml-bk +0 -72
- /data/app/views/iro/positions/{_gameui_spread.haml → _gameui_spread.haml-bk} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34e2545b7c9088e737b36b2436c475bd820e1e0f00c507f84166eca1c616421e
|
|
4
|
+
data.tar.gz: 1e0bb92359a9ebc0c3a0e9cd4dc252e48da5097096f94855a88c2a0dfd41fd10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e0ea3ed8e276d87f870f295c61cf5c2119fe9b375d7f12f8b2090a1f161300883361f530d4855949cb2677f4a26d5a43f419efb52bf517d221d6182be2c2f0a
|
|
7
|
+
data.tar.gz: 5236754132aeee57af308c4c86e73fdb4a39de56770a47a0c125444fcc7f437ca544a525fabc0158c064690eb2b4cb478d8167a627f68298015534ae62f96c78
|
|
@@ -8,13 +8,25 @@
|
|
|
8
8
|
|
|
9
9
|
.purses-gameui {
|
|
10
10
|
|
|
11
|
+
.divider-expiry {
|
|
12
|
+
height: 5px;
|
|
13
|
+
width: 100%;
|
|
14
|
+
background: red;
|
|
15
|
+
}
|
|
16
|
+
.divider-ticker {
|
|
17
|
+
height: 2px;
|
|
18
|
+
width: 100%;
|
|
19
|
+
background: red;
|
|
20
|
+
margin-bottom: 20px;
|
|
21
|
+
}
|
|
22
|
+
|
|
11
23
|
.Origin::before {
|
|
12
24
|
position: absolute;
|
|
13
25
|
top: -1em;
|
|
14
26
|
content: "";
|
|
15
27
|
margin-left: -1em;
|
|
16
28
|
border: 1em solid transparent;
|
|
17
|
-
border-top: 1em solid
|
|
29
|
+
border-top: 1em solid #666;
|
|
18
30
|
}
|
|
19
31
|
.Origin {
|
|
20
32
|
position: absolute;
|
|
@@ -23,13 +35,18 @@
|
|
|
23
35
|
height: 100%;
|
|
24
36
|
width: 100%;
|
|
25
37
|
|
|
26
|
-
> .label {
|
|
27
|
-
|
|
38
|
+
> .origin-label {
|
|
39
|
+
// border: 1px solid cyan;
|
|
40
|
+
|
|
41
|
+
width: 200px;
|
|
28
42
|
|
|
29
43
|
position: absolute;
|
|
30
44
|
top: -1.5em;
|
|
31
45
|
left: 1.2em;
|
|
32
46
|
z-index: 2;
|
|
47
|
+
|
|
48
|
+
color: #666;
|
|
49
|
+
|
|
33
50
|
}
|
|
34
51
|
}
|
|
35
52
|
.PositionW.covered_call {
|
|
@@ -69,8 +86,8 @@
|
|
|
69
86
|
right: 0;
|
|
70
87
|
bottom: 0;
|
|
71
88
|
border: 2px dotted green;
|
|
72
|
-
background: rgba(
|
|
73
|
-
height:
|
|
89
|
+
background: rgba(50,55,55, 0.5);
|
|
90
|
+
height: 25%;
|
|
74
91
|
}
|
|
75
92
|
.PositionW.is-short .MaxGain {
|
|
76
93
|
right: auto;
|
|
@@ -90,6 +107,7 @@
|
|
|
90
107
|
|
|
91
108
|
// background: var(--iro-color-bg2);
|
|
92
109
|
// border: 1px solid red;
|
|
110
|
+
margin-top: 1em;
|
|
93
111
|
margin-bottom: 2em;
|
|
94
112
|
|
|
95
113
|
position: relative;
|
|
@@ -108,40 +126,64 @@
|
|
|
108
126
|
.Last {
|
|
109
127
|
border-left: 2px dotted red;
|
|
110
128
|
}
|
|
111
|
-
.label {
|
|
112
|
-
width: 200px;
|
|
113
|
-
color: gray;
|
|
114
|
-
// border: 1px solid cyan;
|
|
115
|
-
}
|
|
116
129
|
|
|
117
130
|
.marker {
|
|
118
131
|
position: absolute;
|
|
119
132
|
height: 100%;
|
|
120
133
|
}
|
|
121
134
|
|
|
122
|
-
.PositionW.is-short
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
.PositionW.is-short {
|
|
136
|
+
.NetNegative {
|
|
137
|
+
left: 0;
|
|
138
|
+
}
|
|
139
|
+
.NetPositive {
|
|
140
|
+
right: 0;
|
|
141
|
+
}
|
|
142
|
+
.Net .label {
|
|
143
|
+
text-align: right;
|
|
144
|
+
left: 0;
|
|
145
|
+
.labelC {
|
|
146
|
+
right: 0.5em;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
.PositionW.is-long {
|
|
151
|
+
.NetNegative {
|
|
152
|
+
right: 0;
|
|
153
|
+
}
|
|
154
|
+
.NetPositive {
|
|
155
|
+
left: 100%;
|
|
156
|
+
}
|
|
157
|
+
.Net .label {
|
|
158
|
+
text-align: left;
|
|
159
|
+
right: 0;
|
|
160
|
+
.labelC {
|
|
161
|
+
left: 0.5em;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
126
164
|
}
|
|
127
165
|
.Net {
|
|
128
166
|
position: absolute;
|
|
129
|
-
|
|
130
|
-
// z-index: 3;
|
|
131
|
-
height: 90%;
|
|
167
|
+
height: 70%;
|
|
132
168
|
|
|
133
169
|
.label {
|
|
134
170
|
color: white;
|
|
135
171
|
text-shadow: 1px 1px black;
|
|
172
|
+
width: 0;
|
|
173
|
+
position: absolute;
|
|
174
|
+
|
|
175
|
+
.labelC {
|
|
176
|
+
width: 200px;
|
|
177
|
+
position: absolute;
|
|
178
|
+
}
|
|
136
179
|
}
|
|
137
180
|
}
|
|
138
|
-
.NetPositive {
|
|
139
|
-
border: 2px dashed #339966;
|
|
140
|
-
background: rgba(32,64,96, 0.5);
|
|
141
|
-
}
|
|
142
181
|
.NetNegative {
|
|
143
182
|
background: rgba(255,0,0, 0.75);
|
|
144
183
|
}
|
|
184
|
+
.NetPositive {
|
|
185
|
+
background: rgba(32,164,96, 0.5);
|
|
186
|
+
}
|
|
145
187
|
|
|
146
188
|
.grid-mark {
|
|
147
189
|
// border: 1px solid red;
|
|
@@ -1,110 +1,144 @@
|
|
|
1
1
|
|
|
2
|
-
.
|
|
3
|
-
position: relative;
|
|
4
|
-
background: rgba(255,255,255, 0.75);
|
|
5
|
-
height: 400px;
|
|
6
|
-
width: 100%;
|
|
7
|
-
z-index: 5;
|
|
8
|
-
}
|
|
9
|
-
.PurseSummary {
|
|
10
|
-
position: absolute;
|
|
11
|
-
top: 200px;
|
|
12
|
-
|
|
2
|
+
.summaries {
|
|
13
3
|
display: flex;
|
|
4
|
+
}
|
|
5
|
+
.purses--summary2 {
|
|
6
|
+
// border: 1px solid yellow;
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
label {
|
|
9
|
+
position: absolute;
|
|
10
|
+
}
|
|
18
11
|
|
|
19
12
|
.legendW {
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
height: 100px;
|
|
14
|
+
margin-left: 60px;
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
.PurseSummaryW {
|
|
20
|
+
margin-left: 1em;
|
|
21
|
+
width: 500px;
|
|
22
|
+
z-index: 11;
|
|
23
|
+
height: 400px;
|
|
24
|
+
position: relative;
|
|
25
|
+
background: rgba(255,255,255, 0.75);
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
}
|
|
28
|
+
.PurseSummary {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 50%;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 0;
|
|
33
|
+
border-bottom: 1px solid black;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/* shared */
|
|
37
|
+
.summary-long, .summary-short {
|
|
38
|
+
// border: 1px solid blue;
|
|
39
|
+
position: absolute;
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
* summary amount and delta
|
|
39
|
-
**/
|
|
40
|
-
.summary-amount {
|
|
41
|
-
position: relative;
|
|
42
|
-
width: 100px;
|
|
43
|
-
margin-right: 2em;
|
|
41
|
+
display: flex;
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
background: rgba(0,0,0, 0.5);
|
|
48
|
-
}
|
|
43
|
+
width: 100%;
|
|
44
|
+
// height: 300px;
|
|
49
45
|
|
|
50
|
-
.
|
|
46
|
+
.deltaW {
|
|
47
|
+
border: 2px solid black;
|
|
48
|
+
height: 0;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
51
|
position: absolute;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
top: 50%;
|
|
53
|
+
left: 110px;
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
border:
|
|
57
|
-
width:
|
|
58
|
-
}
|
|
59
|
-
.begin {
|
|
60
|
-
width: 1em;
|
|
55
|
+
.delta {
|
|
56
|
+
// border: 2px dashed green;
|
|
57
|
+
width: 20px;
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
|
|
62
|
+
.begin {
|
|
63
|
+
width: 100%;
|
|
64
|
+
background: rgba(0,0,0, 0.25);
|
|
65
|
+
}
|
|
66
|
+
.end {
|
|
67
|
+
width: 50%;
|
|
68
|
+
// background: rgba(0,0,0, 0.75);
|
|
69
|
+
}
|
|
67
70
|
|
|
68
|
-
background: rgba(255,0,0, 0.5);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
/* shared */
|
|
75
|
+
.plot {
|
|
76
|
+
background: rgba(255,153,0, 0.5);
|
|
73
77
|
|
|
78
|
+
position: relative;
|
|
74
79
|
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
.gain {
|
|
78
|
-
}
|
|
79
|
-
.max-gl {
|
|
80
|
-
position: absolute;
|
|
81
|
-
width: 100%;
|
|
80
|
+
width: 100px;
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
.max-gl {
|
|
83
|
+
width: 100%;
|
|
84
|
+
position: absolute;
|
|
85
|
+
background: rgba(255,255,0, 0.5);
|
|
86
|
+
}
|
|
87
|
+
.net-gl {
|
|
88
|
+
position: absolute;
|
|
89
|
+
width: 90%;
|
|
90
|
+
}
|
|
91
|
+
.gain {
|
|
92
|
+
background: rgba(0,0,0, 0.70);
|
|
93
|
+
}
|
|
94
|
+
.loss {
|
|
95
|
+
background: rgba(255,0,0, 0.5);
|
|
96
|
+
}
|
|
85
97
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
98
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
.max-gl.short {
|
|
92
|
-
display: flex;
|
|
93
|
-
flex-direction: column-reverse;
|
|
94
|
-
}
|
|
95
|
-
.long {
|
|
96
|
-
position: absolute;
|
|
99
|
+
|
|
100
|
+
.summary-long {
|
|
97
101
|
top: 0;
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
.legendW {
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
}
|
|
106
|
+
.plot {
|
|
107
|
+
bottom: 0;
|
|
108
|
+
.gain {
|
|
109
|
+
bottom: 0;
|
|
110
|
+
}
|
|
111
|
+
.max-gl {
|
|
112
|
+
bottom: 0;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
102
115
|
}
|
|
103
|
-
.short {
|
|
104
|
-
background: rgba(255,153,0, 0.5);
|
|
105
|
-
border: 1px solid orange;
|
|
106
116
|
|
|
107
|
-
|
|
117
|
+
.summary-short {
|
|
108
118
|
bottom: 0;
|
|
119
|
+
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: flex-end;
|
|
122
|
+
|
|
123
|
+
.deltaW {
|
|
124
|
+
left: 140px;
|
|
125
|
+
}
|
|
126
|
+
label {
|
|
127
|
+
bottom: 0;
|
|
128
|
+
}
|
|
129
|
+
.legendW {
|
|
130
|
+
flex-direction: column-reverse;
|
|
131
|
+
}
|
|
132
|
+
.plot {
|
|
133
|
+
background: rgba(255,153,0, 0.5);
|
|
134
|
+
width: 100px;
|
|
135
|
+
|
|
136
|
+
.gain {
|
|
137
|
+
top: 0;
|
|
138
|
+
}
|
|
139
|
+
.loss {
|
|
140
|
+
bottom: 0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
109
143
|
}
|
|
110
|
-
}
|
|
144
|
+
}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
/* M */
|
|
71
71
|
|
|
72
72
|
.mini-inputs {
|
|
73
|
-
background: rgba(255,255,255, 0.25);
|
|
73
|
+
// background: rgba(255,255,255, 0.25);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
.modal-absolute {
|
|
@@ -83,15 +83,16 @@
|
|
|
83
83
|
position: absolute;
|
|
84
84
|
|
|
85
85
|
min-width: 200px;
|
|
86
|
-
width: 400px;
|
|
86
|
+
// width: 400px;
|
|
87
87
|
|
|
88
88
|
min-height: 200px;
|
|
89
|
-
height: 300px;
|
|
89
|
+
// height: 300px;
|
|
90
|
+
|
|
90
91
|
/* overflow: auto; */
|
|
91
92
|
|
|
92
93
|
background: white;
|
|
93
94
|
|
|
94
|
-
z-index:
|
|
95
|
+
z-index: 200;
|
|
95
96
|
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
|
|
2
2
|
class Iro::PositionsController < Iro::ApplicationController
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
def check
|
|
5
|
+
@position = Iro::Position.find params[:id]
|
|
6
|
+
authorize! :check, @position
|
|
7
|
+
outs = Tda::Order.check_status @position.schwab_order_id
|
|
8
|
+
@position.update({ schwab_status: outs[:status] })
|
|
9
|
+
puts! outs, 'outs'
|
|
10
|
+
redirect_to request.referrer
|
|
11
|
+
end
|
|
4
12
|
|
|
5
13
|
def create
|
|
6
14
|
@position = Iro::Position.new pos_params
|
|
7
15
|
authorize! :create, @position
|
|
8
16
|
|
|
9
|
-
@position.inner_strike = params[:inner][:strike]
|
|
10
|
-
@position.outer_strike = params[:outer][:strike]
|
|
17
|
+
# @position.inner_strike = params[:inner][:strike]
|
|
18
|
+
# @position.outer_strike = params[:outer][:strike]
|
|
11
19
|
|
|
12
20
|
o_attrs = {
|
|
13
21
|
expires_on: @position.expires_on,
|
|
14
|
-
put_call:
|
|
15
|
-
stock_id:
|
|
22
|
+
put_call: @position.put_call, # I need this. _vp_ 2024-04-26
|
|
23
|
+
stock_id: @position.stock_id,
|
|
16
24
|
}
|
|
17
|
-
@position.inner = Iro::Option.
|
|
18
|
-
@position.inner.
|
|
19
|
-
@position.inner.
|
|
25
|
+
@position.inner = Iro::Option.create!({ strike: params[:position][:inner_strike] }.merge( o_attrs ))
|
|
26
|
+
@position.inner.sync
|
|
27
|
+
@position.inner.begin_price = @position.inner.end_price
|
|
28
|
+
@position.inner.begin_delta = @position.inner.end_delta
|
|
20
29
|
if [ Iro::Strategy::KIND_LONG_CREDIT_PUT_SPREAD, Iro::Strategy::KIND_SHORT_CREDIT_CALL_SPREAD ].include?( @position.strategy.kind )
|
|
21
|
-
@position.outer = Iro::Option.
|
|
22
|
-
@position.outer.
|
|
23
|
-
@position.outer.
|
|
30
|
+
@position.outer = Iro::Option.create!({ strike: params[:position][:outer_strike] }.merge( o_attrs ))
|
|
31
|
+
@position.outer.sync
|
|
32
|
+
@position.outer.begin_price = @position.outer.end_price
|
|
33
|
+
@position.outer.begin_delta = @position.outer.end_delta
|
|
24
34
|
end
|
|
25
35
|
|
|
26
36
|
if @position.save
|
|
@@ -53,6 +63,7 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
53
63
|
def edit
|
|
54
64
|
@position = Iro::Position.find params[:id]
|
|
55
65
|
authorize! :edit, @position
|
|
66
|
+
set_position_lists
|
|
56
67
|
end
|
|
57
68
|
|
|
58
69
|
def eval
|
|
@@ -64,10 +75,15 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
64
75
|
@position.calc_nxt
|
|
65
76
|
end
|
|
66
77
|
|
|
67
|
-
flash[:notice] = '
|
|
78
|
+
flash[:notice] = 'called position.calc_rollp , maybe position.calc_nxt .'
|
|
68
79
|
redirect_to request.referrer
|
|
69
80
|
end
|
|
70
81
|
|
|
82
|
+
def index
|
|
83
|
+
authorize! :index, Iro::Position
|
|
84
|
+
@positions = Iro::Position.active
|
|
85
|
+
end
|
|
86
|
+
|
|
71
87
|
## only callable from _new.haml, with position partially pre-filled
|
|
72
88
|
def new
|
|
73
89
|
authorize! :new, Iro::Position
|
|
@@ -81,6 +97,40 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
81
97
|
# outer: Iro::Option.new,
|
|
82
98
|
stock_id: strategy.stock_id,
|
|
83
99
|
}) )
|
|
100
|
+
|
|
101
|
+
set_position_lists
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
## only credit-spread
|
|
105
|
+
def reprice
|
|
106
|
+
@position = Iro::Position.find params[:id]
|
|
107
|
+
authorize! :roll, @position
|
|
108
|
+
@position.update({ pending_price: params[:pending_price] })
|
|
109
|
+
|
|
110
|
+
Tda::Order.cancel_order!( @position.schwab_order_id )
|
|
111
|
+
outs = Tda::Order.place_order!( Tda::Order.credit_spread_q @position )
|
|
112
|
+
|
|
113
|
+
flag = @position.update({
|
|
114
|
+
schwab_order_id: outs[:schwab_order_id],
|
|
115
|
+
schwab_status: outs[:schwab_status],
|
|
116
|
+
status: Iro::Position::STATUS_PENDING,
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
flash_notice flag
|
|
120
|
+
# redirect_to controller: :purses, action: :show, template: 'show', view_status: 'pending', id: @position.purse_id
|
|
121
|
+
redirect_to request.referrer
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
## place2 = credit-spread
|
|
125
|
+
def place2
|
|
126
|
+
@position = Iro::Position.find params[:id]
|
|
127
|
+
authorize! :roll, @position
|
|
128
|
+
@position.inner.sync
|
|
129
|
+
@position.inner.update({ begin_price: @position.inner.end_price })
|
|
130
|
+
@position.outer.sync
|
|
131
|
+
@position.outer.update({ begin_price: @position.outer.end_price })
|
|
132
|
+
@position.update({ pending_price: @position.place2_price })
|
|
133
|
+
@query = Tda::Order.credit_spread_q @position
|
|
84
134
|
end
|
|
85
135
|
|
|
86
136
|
## 2025-10-14 long_credit_put_spread
|
|
@@ -102,9 +152,6 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
102
152
|
self.send("_prepare_#{@position.strategy.kind}")
|
|
103
153
|
end
|
|
104
154
|
|
|
105
|
-
## 2026-02-26 continue...
|
|
106
|
-
## short credit call spread
|
|
107
|
-
## covered call
|
|
108
155
|
def prepare2
|
|
109
156
|
@position = Iro::Position.find params[:id]
|
|
110
157
|
authorize! :roll, @position
|
|
@@ -119,13 +166,14 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
119
166
|
if @position.autoprev
|
|
120
167
|
;
|
|
121
168
|
else
|
|
122
|
-
throw '
|
|
169
|
+
throw 'Must pass prev_id here.'
|
|
123
170
|
end
|
|
124
171
|
end
|
|
125
172
|
|
|
126
173
|
@query = case @position.strategy.kind
|
|
127
|
-
when Iro::Strategy::
|
|
128
|
-
|
|
174
|
+
when Iro::Strategy::KIND_LONG_CREDIT_PUT_SPREAD,
|
|
175
|
+
Iro::Strategy::KIND_SHORT_CREDIT_CALL_SPREAD
|
|
176
|
+
Tda::Order.roll_credit_call_spread_q @position
|
|
129
177
|
when Iro::Strategy::KIND_COVERED_CALL
|
|
130
178
|
Tda::Order.roll_covered_call_q @position
|
|
131
179
|
else
|
|
@@ -133,15 +181,33 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
133
181
|
end
|
|
134
182
|
end
|
|
135
183
|
|
|
184
|
+
## credit-spread
|
|
185
|
+
def place3
|
|
186
|
+
@position = Iro::Position.find params[:id]
|
|
187
|
+
@position.update({ pending_price: params[:pending_price] })
|
|
188
|
+
authorize! :place_order, @position
|
|
189
|
+
outs = Tda::Order.place_order!( Tda::Order.credit_spread_q @position )
|
|
190
|
+
|
|
191
|
+
flag = @position.update({
|
|
192
|
+
schwab_order_id: outs[:schwab_order_id],
|
|
193
|
+
schwab_status: outs[:schwab_status],
|
|
194
|
+
status: Iro::Position::STATUS_PENDING,
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
flash_notice flag
|
|
198
|
+
redirect_to controller: :purses, action: :show, template: 'show', view_status: 'pending', id: @position.purse_id
|
|
199
|
+
end
|
|
200
|
+
|
|
136
201
|
## 2026-02-26 continue...
|
|
137
202
|
## short credit call spread
|
|
138
203
|
def prepare3
|
|
139
204
|
@position = Iro::Position.find params[:id]
|
|
140
205
|
authorize! :place_order, @position
|
|
141
|
-
|
|
206
|
+
outs = Tda::Order.place_order!( Tda::Order.roll_credit_call_spread_q @position )
|
|
142
207
|
|
|
143
208
|
flag = @position.update({
|
|
144
|
-
schwab_order_id:
|
|
209
|
+
schwab_order_id: outs[:schwab_order_id],
|
|
210
|
+
schwab_status: outs[:schwab_status],
|
|
145
211
|
status: Iro::Position::STATUS_PENDING,
|
|
146
212
|
})
|
|
147
213
|
|
|
@@ -411,11 +477,9 @@ class Iro::PositionsController < Iro::ApplicationController
|
|
|
411
477
|
)
|
|
412
478
|
end
|
|
413
479
|
|
|
414
|
-
def
|
|
415
|
-
super
|
|
416
|
-
@purses_list = Iro::Purse.list
|
|
417
|
-
@strategies_list = Iro::Strategy.list(params[:long_or_short])
|
|
480
|
+
def set_position_lists
|
|
418
481
|
@stocks_list = Iro::Stock.list
|
|
482
|
+
@strategies_list = ( @position.purse.strategies.list + [[ @position.strategy.to_s, @position.strategy.id.to_s ]] ).uniq
|
|
419
483
|
end
|
|
420
484
|
|
|
421
485
|
end
|