ish_manager 0.1.8.450 → 0.1.8.451

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ish_manager/iro.js +54 -39
  3. data/app/assets/javascripts/ish_manager/iro0.js +68 -0
  4. data/app/assets/stylesheets/ish_manager/application.scss +1 -0
  5. data/app/assets/stylesheets/ish_manager/iro.scss +39 -9
  6. data/app/assets/stylesheets/ish_manager/iro1.scss +117 -0
  7. data/app/controllers/ish_manager/iro_option_gets_controller.rb +127 -0
  8. data/app/controllers/ish_manager/iro_positions_controller.rb +0 -9
  9. data/app/controllers/ish_manager/iro_purses_controller.rb +46 -4
  10. data/app/controllers/ish_manager/iro_watches_controller.rb +1 -0
  11. data/app/views/ish_manager/application/_main_header_admin.haml +2 -2
  12. data/app/views/ish_manager/email_templates/_acknowledgement_of_document_receipt.html.erb +23 -0
  13. data/app/views/ish_manager/email_templates/_marketing_ror_3.html.erb +25 -0
  14. data/app/views/ish_manager/email_templates/_marketing_ror_4.html.erb +25 -0
  15. data/app/views/ish_manager/email_templates/_marketing_ror_5.html.erb +17 -0
  16. data/app/views/ish_manager/email_templates/_rec_resume_shared_with_you.html.erb +39 -0
  17. data/app/views/ish_manager/email_templates/_support_ticket_created.html.erb +26 -0
  18. data/app/views/ish_manager/iro_option_gets/_form.haml +10 -0
  19. data/app/views/ish_manager/iro_positions/_form.haml +73 -37
  20. data/app/views/ish_manager/iro_purses/_form.haml +3 -0
  21. data/app/views/ish_manager/iro_purses/_header.haml +37 -0
  22. data/app/views/ish_manager/iro_purses/_show.haml +99 -0
  23. data/app/views/ish_manager/iro_purses/_show_gameui_0.haml +62 -0
  24. data/app/views/ish_manager/iro_purses/_show_gameui_1.haml +78 -0
  25. data/app/views/ish_manager/iro_purses/show.haml +3 -114
  26. data/app/views/ish_manager/iro_purses/show_gameui.haml +4 -163
  27. data/app/views/ish_manager/iro_watches/index.haml +10 -1
  28. data/app/views/ish_manager/iro_watches/max_pain.haml +21 -0
  29. data/config/routes.rb +8 -3
  30. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aae4da7ba3885ffd17336f35ea137c76c3175c1e22fad1d80692347238c6450e
4
- data.tar.gz: ff00d90a46a00ee7f778a0f7bbf7b8f3dd808f531a41405ae8a0fe4a8a1d1a62
3
+ metadata.gz: ba59c20a5d3690b618e806310714a938247c560185b157c23864de32b5fd0d56
4
+ data.tar.gz: a4b2b75980173a70c910334529756d7d0b665b179ef14331be373305d2007c19
5
5
  SHA512:
6
- metadata.gz: 8c2a0d24958ffce7046fedf256a1ca8af7664ecc3f2613c99a8b8ee54bceb3d429870e7225e237028600ea9534b5f2fe6406756e48971c9e255147839d51252f
7
- data.tar.gz: 84b403938f9da24ff7ad223bc22c7fecfbf9293e73dda2b34f5887a5c78021f064459dd9134ab4bf1d38edc93c5d8961ff06ad3bb02aebec9c413058a1c73ac1
6
+ metadata.gz: 406373e09e49ebf65537a4e610f28c335e0c382abbed7cb8b258a5de2d2046acfb5c46fd6ceffc0da33c5965cd5de031489c5368c2e8a0fb321c9157ac2611f8
7
+ data.tar.gz: bfe9e7d67f626cbd26154fdbd1e1080774ff757754d1c84fa9b8d57f09f1a47dfd31f4d8650fa109df16ceda727b8d1370afa4185deb0e28558c1cd7e1503932
@@ -1,59 +1,51 @@
1
1
 
2
2
  $(document).ready(function () {
3
3
 
4
- const origin = 23
5
- scale = 200 // pixels per dollar
4
+ const dollarWidth = $('.gameui-positions').data('ccDollarwidth')
5
+ const origin = $('.gameui-positions').data('ccOrigin')
6
+ const cUS = $(".gameui-positions").data('ccCus')
6
7
 
8
+ $(".step").css('height', `${dollarWidth * .75}px`)
9
+ $(".gameui").css('height', `${dollarWidth}px`)
10
+ $('.windW').css('left', `${dollarWidth * (origin - cUS)}px`)
11
+ $('.gameuiCUS').css('left', `${dollarWidth * (origin - cUS)}px`)
7
12
 
8
-
9
- $(".gameuiW").each( function (idx, w) {
13
+ $(".elephantW").each( function (idx, w) {
10
14
  // logg($(w).data(), 'data')
11
15
 
12
- let ans
13
-
14
16
  let ccStrike = $(w).data('ccStrike')
15
17
  let ccStartPrice = $(w).data('ccStartprice') // e.g. 0.88
16
18
  let ccCurrentPrice = $(w).data('ccCurrentprice')
17
- let cUS = $(w).data('ccCus')
18
-
19
- $(".c-u-s").each(function (idx, elem) {
20
- $(elem).html(cUS)
21
- })
22
-
23
- $(".windW").each(function (idx, elem) {
24
- ans = ( origin - cUS ) * scale
25
- $(elem).css('left', ans)
26
- })
27
-
28
- $($(w).find('.elephantW')).css('left', (origin - ccStrike)* scale )
29
- $(w).find('.elephantC > .amount').html( " $" + ccStrike )
30
- $(w).find('.riderStart > .amount').html( " $" + ccStartPrice )
31
- $(w).find('.riderStart').css('width', scale * ccStartPrice )
32
- $(w).find('.riderStart').css('left', -1 * scale * ccStartPrice )
33
- $(w).find('.riderStart2').css('width', scale * ccStartPrice )
34
-
35
- let currentAmount = ((ccStartPrice - ccCurrentPrice)*100).toPrecision(2)/100
36
- let ccCurrentGain = ccStartPrice - ccCurrentPrice
37
- $(w).find('.riderCurrent > .amount').html( " $" + currentAmount )
38
- ans = `${-1*ccCurrentGain*scale}px`
39
- $(w).find('.riderW').css('left', ans)
40
-
41
- if (ccCurrentGain > 0) {
42
- $(w).find('.riderCurrent').css('width', scale * ccCurrentGain )
19
+
20
+ let loss = ccCurrentPrice - ccStartPrice;
21
+
22
+ $(w).css('left', `${dollarWidth * (origin-ccStrike)}px` );
23
+ // $(w).find('.elephantW').css('width', `${dollarWidth * ccStartPrice}px` );
24
+ $(w).css('height', `${dollarWidth * ccStartPrice}px` );
25
+ $(w).find('.elephant ').css('left', `-${dollarWidth * (ccStartPrice)}px` );
26
+ $(w).find('.elephant ').css('width', `${dollarWidth * (ccStartPrice)}px` );
27
+ $(w).find('.elephant ').css('height', `${dollarWidth * (ccStartPrice)}px` );
28
+ $(w).find('.elephant ').css('border-radius', `${dollarWidth * (ccStartPrice)}px ${dollarWidth * (ccStartPrice)}px 0 0` );
29
+ $(w).find('.elephantC > .amount').html( " $" + ccStartPrice )
30
+ if (loss > 0) {
31
+ $(w).find('.elephantC ').css('left', `-${dollarWidth * (ccStartPrice - loss)}px` );
32
+ $(w).find('.elephantC ').css('width', `${dollarWidth * (ccStartPrice - loss)}px` );
33
+ $(w).find('.elephantC ').css('height', `${dollarWidth * (ccStartPrice - loss)}px` );
34
+ $(w).find('.elephantC ').css('border-radius', `${dollarWidth * (ccStartPrice - loss)}px ${dollarWidth * (ccStartPrice - loss)}px 0 0` );
35
+ $(w).find('.elephant').css('border-color', 'red');
36
+ $(w).find('.elephantC ').css('border-color', 'red');
43
37
  } else {
44
- $(w).find('.riderCurrent').css('display', 'none')
45
- $(w).find('.riderCurrent2').css('display', 'block')
46
- $(w).find('.riderCurrent2').css('width', -1 * scale * ccCurrentGain )
47
- $(w).find('.rider').addClass('riderF')
38
+ $(w).find('.elephantC ').css('left', `-${dollarWidth * (ccCurrentPrice)}px` );
39
+ $(w).find('.elephantC ').css('width', `${dollarWidth * (ccCurrentPrice)}px` );
40
+ $(w).find('.elephantC ').css('height', `${dollarWidth * (ccCurrentPrice)}px` );
41
+ $(w).find('.elephantC ').css('border-radius', `${dollarWidth * (ccCurrentPrice)}px ${dollarWidth * (ccCurrentPrice)}px 0 0` );
48
42
  }
49
43
  })
50
44
 
51
45
 
52
46
 
53
47
  $(".gameuiW.next-position").each( function (idx, w) {
54
- logg($(w).data(), 'next-position')
55
-
56
- let ans
48
+ // logg($(w).data(), 'next-position')
57
49
 
58
50
  let gainp = $(w).data('ccGainp')
59
51
  if (gainp > 0) {
@@ -65,4 +57,27 @@ $(document).ready(function () {
65
57
  }
66
58
  })
67
59
 
60
+ $(".recklessDefenseW").each( function(idx, w) {
61
+ let longStrike = $(w).data('ccLongstrike')
62
+ // logg(longStrike, 'longStrike')
63
+ let shortStrike = $(w).data('ccShortstrike')
64
+ let shortOpenedPrice = $(w).data('ccShortopenedprice')
65
+ let shortCurrentPrice = $(w).data('ccShortcurrentprice')
66
+ let longOpenedPrice = $(w).data('ccLongopenedprice')
67
+ let longCurrentPrice = $(w).data('ccLongcurrentprice')
68
+
69
+ $(w).css('left', `-${dollarWidth * ( origin - longStrike )}px` )
70
+ $(w).css('width', `${dollarWidth * (shortStrike - longStrike - shortOpenedPrice + longOpenedPrice )}px`)
71
+
72
+ let gainLoss = longCurrentPrice - longOpenedPrice + shortOpenedPrice - shortCurrentPrice
73
+ if (gainLoss > 0) {
74
+ $(w).find('.recklessDefenseC').css('left', `${dollarWidth * gainLoss}px`)
75
+ } else {
76
+ $(w).find('.recklessDefenseC').css('left', `${dollarWidth * gainLoss}px`)
77
+ $(w).css('border-color', 'red')
78
+ $(w).find('.recklessDefenseC').css('border-color', 'red')
79
+ }
80
+ })
81
+
82
+
68
83
  })
@@ -0,0 +1,68 @@
1
+
2
+ $(document).ready(function () {
3
+
4
+ const origin = 23
5
+ scale = 200 // pixels per dollar
6
+
7
+
8
+
9
+ $(".gameuiW").each( function (idx, w) {
10
+ // logg($(w).data(), 'data')
11
+
12
+ let ans
13
+
14
+ let ccStrike = $(w).data('ccStrike')
15
+ let ccStartPrice = $(w).data('ccStartprice') // e.g. 0.88
16
+ let ccCurrentPrice = $(w).data('ccCurrentprice')
17
+ let cUS = $(w).data('ccCus')
18
+
19
+ $(".c-u-s").each(function (idx, elem) {
20
+ $(elem).html(cUS)
21
+ })
22
+
23
+ $(".windW").each(function (idx, elem) {
24
+ ans = ( origin - cUS ) * scale
25
+ $(elem).css('left', ans)
26
+ })
27
+
28
+ $($(w).find('.elephantW')).css('left', (origin - ccStrike)* scale )
29
+ $(w).find('.elephantC > .amount').html( " $" + ccStrike )
30
+ $(w).find('.riderStart > .amount').html( " $" + ccStartPrice )
31
+ $(w).find('.riderStart').css('width', scale * ccStartPrice )
32
+ $(w).find('.riderStart').css('left', -1 * scale * ccStartPrice )
33
+ $(w).find('.riderStart2').css('width', scale * ccStartPrice )
34
+
35
+ let currentAmount = ((ccStartPrice - ccCurrentPrice)*100).toPrecision(2)/100
36
+ let ccCurrentGain = ccStartPrice - ccCurrentPrice
37
+ $(w).find('.riderCurrent > .amount').html( " $" + currentAmount )
38
+ ans = `${-1*ccCurrentGain*scale}px`
39
+ $(w).find('.riderW').css('left', ans)
40
+
41
+ if (ccCurrentGain > 0) {
42
+ $(w).find('.riderCurrent').css('width', scale * ccCurrentGain )
43
+ } else {
44
+ $(w).find('.riderCurrent').css('display', 'none')
45
+ $(w).find('.riderCurrent2').css('display', 'block')
46
+ $(w).find('.riderCurrent2').css('width', -1 * scale * ccCurrentGain )
47
+ $(w).find('.rider').addClass('riderF')
48
+ }
49
+ })
50
+
51
+
52
+
53
+ $(".gameuiW.next-position").each( function (idx, w) {
54
+ logg($(w).data(), 'next-position')
55
+
56
+ let ans
57
+
58
+ let gainp = $(w).data('ccGainp')
59
+ if (gainp > 0) {
60
+ $(w).find('.elephant').css('border-width', `${gainp*200 + 1}px` )
61
+ $(w).find('.elephantLoss').css('display', 'none')
62
+ } else {
63
+ gainp = -1 * gainp
64
+ $(w).find('.elephantLoss').css('border-width', `${gainp*200 + 1}px` )
65
+ }
66
+ })
67
+
68
+ })
@@ -13,6 +13,7 @@
13
13
  *
14
14
  *= require ish_manager/galleries
15
15
  *= require ish_manager/iro
16
+ *= require ish_manager/iro1
16
17
  *= require ish_manager/leads_leadsets
17
18
  *= require ish_manager/maps
18
19
  *= require ish_manager/markers
@@ -1,4 +1,14 @@
1
1
 
2
+ .iro-positions--form {
3
+ border: 1px dashed blue;
4
+ border-radius: 0.5em;
5
+ padding: 0.5em;
6
+
7
+ .field {
8
+ display: flex;
9
+ }
10
+ }
11
+
2
12
  .iro-purses--form {
3
13
  textarea {
4
14
  min-width: 500px;
@@ -8,6 +18,7 @@
8
18
 
9
19
  .iro-purses-show,
10
20
  .iro-purses-show-gameui,
21
+ .iro-purses-show-gameui-1,
11
22
  ._ {
12
23
  font-size: 14px;
13
24
 
@@ -31,6 +42,10 @@
31
42
  .price {
32
43
  background: cyan;
33
44
  }
45
+ .to-close {
46
+ background: #333;
47
+ color: white;
48
+ }
34
49
 
35
50
  td {
36
51
  // border: 1px solid red;
@@ -90,11 +105,10 @@
90
105
  font-weight: bold;
91
106
  }
92
107
 
93
- .strategies {
94
- display: flex;
95
- flex-wrap: wrap;
96
- }
97
-
108
+ }
109
+ .iro-strategies {
110
+ display: flex;
111
+ flex-wrap: wrap;
98
112
  }
99
113
  .iro-strategies-edit,
100
114
  .iro-strategies-new {
@@ -114,6 +128,21 @@
114
128
  }
115
129
  }
116
130
 
131
+ .iro-position-statuses-selector form {
132
+ display: flex;
133
+ margin: 1em 0 0 0;
134
+
135
+ .field {
136
+ border: 1px solid gray;
137
+ border-radius: .5em;
138
+ padding: 0 1em;
139
+ margin-right: 1em;
140
+
141
+ display: flex;
142
+ flex-direction: row-reverse;
143
+ }
144
+ }
145
+
117
146
 
118
147
 
119
148
 
@@ -124,7 +153,7 @@
124
153
  * GameUI in Purse
125
154
  * 2023-04-06 _vp_ Continue
126
155
  **/
127
- .gameuiW {
156
+ .iro-purses-show-gameui .gameuiW {
128
157
  border: 1px solid #ff9966;
129
158
  border-radius: 1em;
130
159
 
@@ -216,11 +245,12 @@
216
245
  .elephantC {
217
246
  // border: 10px solid black;
218
247
 
219
- z-index: 1;
248
+
220
249
  position: absolute;
221
250
  color: #333;
222
251
  background: #ddd;
223
252
  display: inline-block;
253
+ z-index: 2;
224
254
 
225
255
  .q {
226
256
  border: 2px solid #eee;
@@ -404,8 +434,8 @@
404
434
  position: relative;
405
435
  z-index: 2;
406
436
 
407
- background: #333;
408
- color: white;
437
+ background: yellow;
438
+ // color: white;
409
439
  display: inline-block
410
440
  }
411
441
 
@@ -0,0 +1,117 @@
1
+
2
+ .show-gameui-1 {
3
+ // background: red;
4
+ position: relative;
5
+
6
+ .gameuiCUSW {
7
+ position: absolute;
8
+ left: 50%;
9
+ top: 0;
10
+ .gameuiCUS {
11
+ position: absolute;
12
+ border-left: 2px dashed blue;
13
+ padding: 0 10px;
14
+ width: 100px;
15
+ }
16
+ }
17
+ .gameuiW {
18
+ // border: 1px solid red;
19
+
20
+ .gameui {
21
+ // border: 1px solid black;
22
+ position: relative;
23
+ border-bottom: 10px solid gray;
24
+
25
+ background: url('https://d15g8hc4183yn4.cloudfront.net/wp-content/uploads/2023/07/13184511/200x200-grid2.png');
26
+ background-position: 50% center;
27
+ width: 100%;
28
+
29
+ .gameuiC {
30
+ // border: 1px solid green;
31
+ border-bottom: 10px solid green;
32
+
33
+ width: 50%;
34
+ height: 100%;
35
+
36
+ position: absolute;
37
+ left: 50%;
38
+ bottom: -10px;
39
+
40
+ .elephantW {
41
+ border: 0px solid cyan;
42
+ width: 1px;
43
+ height: 100%;
44
+
45
+ position: absolute;
46
+ bottom: 0;
47
+
48
+ > .amount {
49
+ // border: 3px solid black;
50
+
51
+ position: absolute;
52
+ left: 0;
53
+ bottom: 0;
54
+ }
55
+ > .strike {
56
+ position: absolute;
57
+ height: 1.4 em;
58
+ bottom: 0;
59
+ background: yellow;
60
+
61
+ right: 0;
62
+ width: 69px;
63
+ border-right: 2px solid black;
64
+
65
+ padding: 0 5px;
66
+ }
67
+ .elephant {
68
+ border: 2px dashed green;
69
+ position: absolute;
70
+ bottom: 0;
71
+ }
72
+
73
+
74
+ .elephantC {
75
+ position: absolute;
76
+ bottom: 0;
77
+
78
+ border: 2px dashed green;
79
+
80
+ // color: white;
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: center;
84
+
85
+ }
86
+ }
87
+
88
+ .windW {
89
+ border: 2px dashed blue;
90
+ width: 1px;
91
+ height: 100%;
92
+ position: absolute;
93
+ // left: calc( 200px * ( 23.5 - 23.46 ) );
94
+
95
+ }
96
+
97
+ .recklessDefenseW {
98
+ height: 20px;
99
+ border: 2px dashed green;
100
+
101
+ position: absolute;
102
+ bottom: 5px;
103
+
104
+ .recklessDefense {
105
+ .recklessDefenseC {
106
+ height: 20px;
107
+ border-left: 2px dashed green;
108
+ position: absolute;
109
+ right: 0;
110
+ }
111
+ }
112
+ }
113
+
114
+ }
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,127 @@
1
+
2
+ class ::IshManager::IroOptionGetsController < IshManager::ApplicationController
3
+
4
+ # before_action :set_lists
5
+
6
+ def create
7
+ @item = Iro::OptionGet.new params[:iro_option_get].permit!
8
+ @item.kind = Iro::OptionGet::KIND_GET_CHAINS
9
+ authorize! :create, @item
10
+ flag = @item.save
11
+ if flag
12
+ flash[:notice] = 'Created option_get.'
13
+ else
14
+ flash[:alert] = "Cannot create option_get: #{@item.errors.full_messages.join(', ')}."
15
+ end
16
+ redirect_to action: 'index', controller: 'ish_manager/iro_watches'
17
+ end
18
+
19
+ def max_pain
20
+ @ticker = params[:ticker]
21
+ @date = params[:date].to_time.to_i
22
+
23
+ ## 1689364800000
24
+ ## Fri, 14 Jul 2023 15:00:00.000000000 CDT -05:00
25
+
26
+ authorize! :max_pain, Iro::Iro
27
+
28
+ @expirationDate = ( params[:date].to_date + 15.hours ).to_time.to_i * 1000 # '1689364800000'
29
+ # expirationDate = '1689969600000'
30
+ # expirationDate = '1690574400000'
31
+ @all_items = {}
32
+
33
+ calls_sql = "select distinct symbol, strikePrice, putCall, openInterest
34
+ from iro_option_price_items
35
+ where expirationDate = #{@expirationDate} and putCall = 'CALL' and ticker = '#{@ticker}'
36
+ group by symbol, strikePrice, putCall
37
+ order by putCall, strikePrice, created_at desc;"
38
+ @calls_items = []
39
+ @calls_array = ActiveRecord::Base.connection.execute(calls_sql)
40
+ calls_subtotal = 0
41
+ @calls_array.each do |_item|
42
+ item = {
43
+ symbol: _item[0],
44
+ strikePrice: _item[1],
45
+ putCall: _item[2],
46
+ oi: _item[3],
47
+ }
48
+ item[:subtotal] = item[:strikePrice] * 100 * item[:oi]
49
+ calls_subtotal = calls_subtotal + item[:subtotal]
50
+ item[:total] = calls_subtotal
51
+ puts! item, 'item'
52
+ @calls_items.push( item )
53
+
54
+ @all_items[item[:strikePrice]] ||= {
55
+ subtotal: 0,
56
+ strikePrice: item[:strikePrice],
57
+ }
58
+ @all_items[item[:strikePrice]][:calls_subtotal] = calls_subtotal
59
+ @all_items[item[:strikePrice]][:calls_oi] = item[:oi]
60
+ @all_items[item[:strikePrice]][:subtotal] = @all_items[item[:strikePrice]][:subtotal] + calls_subtotal
61
+ end
62
+
63
+ puts_sql = "select distinct symbol, strikePrice, putCall, openInterest
64
+ from iro_option_price_items
65
+ where expirationDate = #{@expirationDate} and putCall = 'PUT' and ticker = '#{@ticker}'
66
+ group by symbol, strikePrice, putCall
67
+ order by putCall, strikePrice, created_at desc;"
68
+ @puts_items = []
69
+ @puts_array = ActiveRecord::Base.connection.execute(puts_sql)
70
+ puts_subtotal = 0
71
+ @puts_array.each do |_item|
72
+ item = {
73
+ symbol: _item[0],
74
+ strikePrice: _item[1],
75
+ putCall: _item[2],
76
+ oi: _item[3],
77
+ }
78
+ item[:subtotal] = item[:strikePrice] * 100 * item[:oi]
79
+ puts_subtotal = puts_subtotal + item[:subtotal]
80
+ item[:total] = puts_subtotal
81
+ puts! item, 'item'
82
+ @puts_items.push( item )
83
+
84
+ @all_items[item[:strikePrice]] ||= {
85
+ subtotal: 0,
86
+ strikePrice: item[:strikePrice],
87
+ }
88
+ @all_items[item[:strikePrice]][:puts_subtotal] = puts_subtotal
89
+ @all_items[item[:strikePrice]][:puts_oi] = item[:oi]
90
+ @all_items[item[:strikePrice]][:subtotal] = @all_items[item[:strikePrice]][:subtotal] + puts_subtotal
91
+ end
92
+
93
+
94
+ render 'ish_manager/iro_watches/max_pain'
95
+ end
96
+
97
+ # def destroy
98
+ # @w = Iro::OptionWatch.find params[:id]
99
+ # authorize! :destroy, @w
100
+ # flag = @w.destroy
101
+ # if flag
102
+ # flash[:notice] = 'Success.'
103
+ # else
104
+ # flash[:alert] = @w.errors.full_messages.join(", ")
105
+ # end
106
+ # redirect_to action: 'index'
107
+ # end
108
+
109
+ # def index
110
+ # authorize! :index, Iro::OptionWatch
111
+ # @watches = Iro::OptionWatch.order_by( ticker: :asc, direction: :asc, price: :desc)
112
+ # @option_get_chains = Iro::OptionGet.all_get_chains
113
+ # end
114
+
115
+ # def update
116
+ # @option_watch = Iro::OptionWatch.find params[:id]
117
+ # authorize! :update, @option_watch
118
+ # flag = @option_watch.update_attributes params[:iro_watch].permit!
119
+ # if flag
120
+ # flash[:notice] = 'Updated option watch.'
121
+ # else
122
+ # flash[:alert] = "Cannot update option watch: #{@option_watch.errors.full_messages.join(', ')}."
123
+ # end
124
+ # redirect_to action: 'index'
125
+ # end
126
+
127
+ end
@@ -28,15 +28,6 @@ class ::IshManager::IroPositionsController < IshManager::ApplicationController
28
28
  authorize! :new, @position
29
29
  end
30
30
 
31
- ## prepare to roll
32
- def roll
33
- @position = Iro::Position.find( params[:id] )
34
- # puts! @position, 'zze'
35
-
36
- authorize! :roll, @position
37
- @next_positions = Iro::Position.find( 13, 14, 15, 16 )
38
- end
39
-
40
31
  def update
41
32
  @position = Iro::Position.find params[:id]
42
33
  authorize! :update, @position
@@ -33,22 +33,64 @@ class ::IshManager::IroPursesController < IshManager::ApplicationController
33
33
  authorize! :new, @iro_purse
34
34
  end
35
35
 
36
+ ## show_gameui too
36
37
  def show
37
38
  @purse = Iro::Purse.find params[:id]
38
39
  authorize! :my, @purse
39
40
 
40
41
  @strategies = Iro::CoveredCallStrategy.all
42
+ @current_underlying_strike = @strategies[0].current_underlying_strike
41
43
  underlyings = Tda::Stock.get_quotes( @strategies.map(&:ticker).compact.uniq.join(",") )
42
- # json_puts! underlyings, 'out'
43
44
  underlyings.each do |ticker, v|
44
- # puts! v[:mark], 'ze mark'
45
45
  Iro::CoveredCallStrategy.where( ticker: ticker ).update( current_underlying_strike: v[:mark] )
46
46
  end
47
47
 
48
- @positions = @purse.positions.order({ expires_on: :asc, strike: :asc })
48
+ if params[:statuses]
49
+ @positions = @purse.positions.where( :status.in => params[:statuses].split(',') )
50
+ else
51
+ @positions = @purse.positions
52
+ end
53
+ @positions = @positions.order({ expires_on: :asc, strike: :asc })
49
54
  @positions.map &:refresh
50
55
 
51
- render @purse.parsed_config[:kind] || params[:kind] || 'show'
56
+ render params[:kind] || @purse.parsed_config[:kind] || 'show'
57
+ end
58
+
59
+ def roll_prep
60
+ @strategies = Iro::CoveredCallStrategy.all
61
+ @position = Iro::Position.find params[:id]
62
+ puts! @position, '@position'
63
+ @positions = [ @position ]
64
+ @purse = @position.purse
65
+ @strategy = @position.strategy
66
+ authorize! :roll_prep, @position
67
+
68
+ @next_positions = []
69
+ next_date = @position.expires_on + 7.days # @TODO: change, watch hout for holidays
70
+
71
+ [ -0.5, 0, 0.5, 1, 1.5 ].each do |price_step|
72
+ next_position = Iro::CoveredCall.new({
73
+ expires_on: next_date,
74
+ strike: @position.strike + price_step,
75
+ ticker: @strategy.ticker,
76
+ opened_price: @position.current_price, # gain or loss upon roll
77
+ # current_price: , # the price (size matters)
78
+ })
79
+ @next_positions.push( next_position )
80
+ end
81
+ @next_positions.map &:refresh
82
+ @next_positions.map do |p|
83
+ current_price = p.current_price
84
+ p.opened_price = p.current_price
85
+ current_price = current_price - @position.current_price # gain/loss diff
86
+ p.current_price = p.opened_price - current_price
87
+ end
88
+
89
+ @next_positions.each do |p|
90
+ puts! p, 'nexxt'
91
+ end
92
+
93
+ render params[:kind] || @purse.parsed_config[:kind] || 'show'
52
94
  end
53
95
 
54
96
  def update
@@ -30,6 +30,7 @@ class ::IshManager::IroWatchesController < IshManager::ApplicationController
30
30
  def index
31
31
  authorize! :index, Iro::OptionWatch
32
32
  @watches = Iro::OptionWatch.order_by( ticker: :asc, direction: :asc, price: :desc)
33
+ @option_get_chains = Iro::OptionGet.all_get_chains
33
34
  end
34
35
 
35
36
  def update
@@ -106,8 +106,8 @@
106
106
  %li
107
107
  = link_to 'Purses', iro_purses_path
108
108
  - Iro::Purse.all.map do |p|
109
- = link_to "[#{p.id}]", iro_purse_path(p)
110
- = link_to "[gui]", iro_purse_gameui_path(p)
109
+ = link_to "[#{p.id} show]", iro_purse_path(p)
110
+ = link_to "[#{p.id} gui]", iro_purse_path({ id: p.id, kind: 'show_gameui' })
111
111
  = link_to '[+]', new_iro_purse_path
112
112
  %li
113
113
  = link_to 'Watches', iro_watches_path
@@ -0,0 +1,23 @@
1
+ Subject: Acknowledgement of Document Receipt
2
+
3
+ Dear [Sender's Name],
4
+
5
+ I hope this email finds you well. I am writing to confirm the successful receipt of the document you sent to our company.
6
+
7
+ We acknowledge the reception of [Document Name] on [Date Received]. Rest assured, our team is currently reviewing the contents, and we appreciate the promptness of your submission.
8
+
9
+ Should any further actions be required or if we have any queries regarding the document, we will reach out to you directly.
10
+
11
+ Thank you for your cooperation and for providing us with the necessary information. We value your contribution to our business processes.
12
+
13
+ If you have any questions or need any additional assistance, please feel free to get in touch with our team at [Contact Email/Phone].
14
+
15
+ Once again, thank you for your cooperation.
16
+
17
+ Best regards,
18
+
19
+ [Your Name]
20
+ [Your Title/Position]
21
+ [Company Name]
22
+ [Email Address]
23
+ [Phone Number]