ish_manager 0.1.8.415 → 0.1.8.416

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 613aa0218db8158e91ee2892cc31c54a8d39d97cd9f9515eaf8fd432d898c62a
4
- data.tar.gz: 1b35c0e649fbf0cbc8e6a1884bef677ee6d89565bae9832facb313c89659e49f
3
+ metadata.gz: dc54a836a0fb0b1a3c99d313011c26d16e22ba75b6c631b82eec0dcd2854ac7c
4
+ data.tar.gz: aa7e5a284ebb5646eb2288e4e1e9009b4409ed22b08e09895a3a8b1aaec5f78a
5
5
  SHA512:
6
- metadata.gz: 488a0e826ecc70bb707c8fa021645871387c9d21c5f7560dd077d3fba9c48317186c3b27be923f45f25cbbcfd65d9d0cec8f9da51bc93bcb3a5c8d6eef0b1893
7
- data.tar.gz: 8329b75417ae55e85be51d38e69721dd7c8f72c2b1a2d7f661015c2bb5a95868fa793cbb2c84833ae6dd3f4d00b633430b04c1c291ad893614197170052ba977
6
+ metadata.gz: 75e169cb64cb20dec6c015c9c8e9c9057cecb7a62549ae25ca6144a90259fcc0c98c99391350b85d25973403eb61ca679305e2fd4195dd905fda28a5e4a5fee9
7
+ data.tar.gz: 15badb0af441666f1b14c3d874e4c9b7dd6e31a7d8a540f8a5f2915fea7f6c041fee9c47f74c0384458a362b04f96c46bee2f67311d5dbb26b8561da34361d28
@@ -7,18 +7,22 @@ $(document).ready(function () {
7
7
 
8
8
 
9
9
  $(".gameuiW").each( function (idx, w) {
10
+ // logg($(w).data(), 'data')
11
+
12
+ let ans
10
13
 
11
14
  let ccStrike = $(w).data('ccStrike')
12
15
  let ccStartPrice = $(w).data('ccStartprice') // e.g. 0.88
13
16
  let ccCurrentPrice = $(w).data('ccCurrentprice')
14
- let cUS = $(w).data('cus')
17
+ let cUS = $(w).data('ccCus')
15
18
 
16
19
  $(".c-u-s").each(function (idx, elem) {
17
20
  $(elem).html(cUS)
18
21
  })
19
22
 
20
23
  $(".windW").each(function (idx, elem) {
21
- $(elem).css('left', (origin - cUS)*scale)
24
+ ans = ( origin - cUS ) * scale
25
+ $(elem).css('left', ans)
22
26
  })
23
27
 
24
28
  $($(w).find('.elephantW')).css('left', (origin - ccStrike)* scale )
@@ -28,24 +32,37 @@ $(document).ready(function () {
28
32
  $(w).find('.riderStart').css('left', -1 * scale * ccStartPrice )
29
33
  $(w).find('.riderStart2').css('width', scale * ccStartPrice )
30
34
 
31
- let currentAmount = ((ccStartPrice - ccCurrentPrice)*100).toPrecision(1)/100
35
+ let currentAmount = ((ccStartPrice - ccCurrentPrice)*100).toPrecision(2)/100
32
36
  let ccCurrentGain = ccStartPrice - ccCurrentPrice
33
- // logg(ccCurrentGain, 'ccCurrentGain')
34
- // logg(currentAmount, 'currentAmount')
35
37
  $(w).find('.riderCurrent > .amount').html( " $" + currentAmount )
36
- let ans = `${-1*ccCurrentGain*scale}px`
37
- logg(ans, 'ans')
38
+ ans = `${-1*ccCurrentGain*scale}px`
38
39
  $(w).find('.riderW').css('left', ans)
39
40
 
40
41
  if (ccCurrentGain > 0) {
41
42
  $(w).find('.riderCurrent').css('width', scale * ccCurrentGain )
42
43
  } else {
43
- ccCurrentGain = -1 * ccCurrentGain
44
- $(w).find('.riderCurrent').css('width', scale * ccCurrentGain )
45
- $(w).find('.riderCurrent').css('background', 'red')
46
- $(w).find('.riderCurrent').css('right', `-${ccCurrentGain*scale}px`)
44
+ $(w).find('.riderCurrent').css('display', 'none')
45
+ $(w).find('.riderCurrent2').css('display', 'block')
46
+ $(w).find('.riderCurrent2').css('width', -1 * scale * ccCurrentGain )
47
47
  $(w).find('.rider').addClass('riderF')
48
48
  }
49
49
  })
50
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
+
51
68
  })
@@ -122,6 +122,7 @@
122
122
 
123
123
  /*
124
124
  * GameUI in Purse
125
+ * 2023-04-06 _vp_ Continue
125
126
  **/
126
127
  .gameuiW {
127
128
  border: 1px solid #ff9966;
@@ -146,8 +147,8 @@
146
147
  left: 50%;
147
148
  width: 600px;
148
149
 
149
- .gameuiC {
150
- // border: 2px solid red;
150
+ .gameuiC { /* 1/2 of the ground */
151
+ // border: 2px solid #ff9900;
151
152
 
152
153
  background-color: brown;
153
154
 
@@ -181,6 +182,7 @@
181
182
  .elephantW {
182
183
  border: 2px solid black;
183
184
  position: absolute;
185
+ bottom: 0;
184
186
  // left: ?? ; /* data: cc strike */
185
187
  }
186
188
 
@@ -214,9 +216,6 @@
214
216
  .elephantC {
215
217
  // border: 10px solid black;
216
218
 
217
- // width: 10px;
218
- // height: 10px;
219
-
220
219
  z-index: 1;
221
220
  position: absolute;
222
221
  color: #333;
@@ -235,23 +234,8 @@
235
234
  top: -25px;
236
235
  }
237
236
  }
238
-
239
-
240
237
  }
241
238
 
242
- .elephantNext {
243
- // border: 5px solid white;
244
- border-radius: 50%;
245
-
246
- display: none;
247
-
248
- position: absolute;
249
- bottom: -50px;
250
- margin-left: 50px;
251
- transform: scale(1.2);
252
- opacity: 0.33;
253
- background-color: green;
254
- }
255
239
 
256
240
  .groundedW {
257
241
  position: absolute;
@@ -294,15 +278,21 @@
294
278
  }
295
279
 
296
280
  .riderCurrent {
297
- display: none;
298
-
299
- position: absolute;
300
281
  background: #339933;
301
- bottom: -7px;
302
- height: 5px;
303
- right: 0;
304
- // width: 105px;
282
+ left: 0;
283
+ }
305
284
 
285
+ .riderCurrent,
286
+ .riderCurrent2,
287
+ ._ {
288
+ position: absolute;
289
+ bottom: 7px;
290
+ top: -7px;
291
+ }
292
+ .riderCurrent2 {
293
+ display: none;
294
+ lefts: 0;
295
+ background: #993333;
306
296
  }
307
297
  .riderStart {
308
298
  // border: 2px solid #cc33ff;
@@ -387,7 +377,7 @@
387
377
  border: 2px solid blue;
388
378
 
389
379
  position: absolute;
390
- left: 232px; /* Data: current underlying strike */
380
+ // left: 232px; /* Data: current underlying strike */
391
381
  bottom: 0;
392
382
 
393
383
 
@@ -439,3 +429,32 @@
439
429
  }
440
430
  }
441
431
  }
432
+ .next-position {
433
+ .elephant {
434
+ border: 1px solid white; /* 4.5% more */
435
+ border-radius: 50% 50% 0 0;
436
+ // background-size: 120%;
437
+
438
+ background-image: url('https://d15g8hc4183yn4.cloudfront.net/wp-content/uploads/2023/04/04103931/200x125-elephant-1rmTiny.png');
439
+ width: 200px;
440
+ height: 125px;
441
+
442
+ padding-left: 100px;
443
+
444
+ position: absolute;
445
+ left: -100px;
446
+ bottom: 0;
447
+
448
+ z-index: 1;
449
+ }
450
+ .elephantLoss {
451
+ border: 1px solid red;
452
+ border-radius: 50% 50% 0 0;
453
+ width: 200px;
454
+ height: 125px;
455
+
456
+ position: absolute;
457
+ left: 0;
458
+ bottom: 0;
459
+ }
460
+ }
@@ -28,6 +28,15 @@ 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
+
31
40
  def update
32
41
  @position = Iro::Position.find params[:id]
33
42
  authorize! :update, @position
@@ -34,9 +34,11 @@ class ::IshManager::IroPursesController < IshManager::ApplicationController
34
34
 
35
35
  @strategies = @purse.strategies
36
36
 
37
+
37
38
  underlyings = Tda::Stock.get_quotes( @strategies.map(&:ticker).compact.uniq.join(",") )
38
- # json_puts! underlyings, 'out'
39
+ json_puts! underlyings, 'out'
39
40
  underlyings.each do |ticker, v|
41
+ puts! v[:mark], 'ze mark'
40
42
  Iro::CoveredCallStrategy.where( ticker: ticker ).update( current_underlying_strike: v[:mark] )
41
43
  end
42
44
 
@@ -31,7 +31,7 @@ class ::IshManager::IroStrategiesController < IshManager::ApplicationController
31
31
  flag = @strategy.update params[:iro_strategy].permit!
32
32
  if flag
33
33
  flash[:notice] = 'Success.'
34
- redirect_to my_purse_path
34
+ redirect_to controller: 'ish_manager/iro_purses', action: :show, id: @strategy.iro_purse_id
35
35
  else
36
36
  flash[:alert] = "No luck: #{@strategy.errors.full_messages.join(', ')}."
37
37
  render action: 'new'
@@ -0,0 +1,105 @@
1
+
2
+
3
+ .iro-positions-roll.max-width
4
+
5
+ - p = @position
6
+ .gameuiW.show-amounts{ data: { cc: { strike: p.strike, startPrice: p.opened_price, currentPrice: p.current_price, cus: p.strategy.current_underlying_strike } } }
7
+ .gameui
8
+ .gameuiC
9
+ = link_to '[roll]', roll_iro_position_path(p)
10
+
11
+ .elephantW
12
+ .elephant
13
+ .elephantC
14
+
15
+ .amount
16
+
17
+ .q= p.quantity
18
+
19
+ .riderW
20
+ .rider
21
+ .riderC
22
+
23
+ .riderStart
24
+ .amount
25
+ .riderCurrent
26
+ .amount
27
+
28
+ .riderStart2
29
+ .amount
30
+ .riderCurrent2
31
+ .amount
32
+
33
+
34
+ .sunflowerW
35
+ .sunflower
36
+ .sunflowerC
37
+
38
+ .days-left= (p.expires_on.to_date - Time.now.to_date).to_i
39
+
40
+ .windW
41
+ .wind
42
+ .c-u-s= pp_currency p.strategy.current_underlying_strike
43
+ .windC
44
+
45
+
46
+ .spearW
47
+ .spear
48
+ .spearC
49
+ .spearStart
50
+ .spearCurrent
51
+ .c
52
+
53
+ -# next position
54
+ - @next_positions.each do |p|
55
+ - gainp = p.strike / @position.strike - 1
56
+ .gameuiW.next-position.show-amounts{ data: { cc: { gainp: gainp, strike: p.strike, startPrice: p.current_price, currentPrice: @position.current_price, cus: p.strategy.current_underlying_strike } } }
57
+ .gameui
58
+ .gameuiC
59
+ = link_to '[roll]', roll_iro_position_path(p)
60
+
61
+ .elephantW
62
+
63
+ .elephant
64
+ .elephantLoss
65
+ .elephantC
66
+
67
+ .amount
68
+
69
+ .q= p.quantity
70
+
71
+ .riderW
72
+ .rider
73
+ .riderC
74
+
75
+ .riderStart
76
+ .amount
77
+ .riderCurrent
78
+ .amount
79
+
80
+ .riderStart2
81
+ .amount
82
+ .riderCurrent2
83
+ .amount
84
+
85
+
86
+ .sunflowerW
87
+ .sunflower
88
+ .sunflowerC
89
+
90
+ .days-left= (p.expires_on.to_date - Time.now.to_date).to_i
91
+
92
+ .windW
93
+ .wind
94
+ .c-u-s= pp_currency p.strategy.current_underlying_strike
95
+ .windC
96
+
97
+
98
+ .spearW
99
+ .spear
100
+ .spearC
101
+ .spearStart
102
+ .spearCurrent
103
+ .c
104
+
105
+
@@ -26,8 +26,6 @@
26
26
  Positions (#{@positions.length})
27
27
  = link_to '[+]', new_iro_position_path({ iro_purse_id: @purse.id })
28
28
  .positions
29
-
30
-
31
29
  %table.bordered
32
30
  %thead
33
31
  %tr
@@ -92,7 +90,8 @@
92
90
  %td.q= p.quantity
93
91
  %td.begin-on= pp_date p.opened_on
94
92
  %td.price= p.opened_price
95
- %td.to-open= pp_amount( p.opened_price * 100 * p.quantity )
93
+ %td.to-open
94
+ -# pp_amount( p.opened_price * 100 * p.quantity )
96
95
  %td.begin-delta= sprintf('%.2f', p.opened_delta ) rescue nil
97
96
  %td= pp_money p.current_price
98
97
  %td.net= pp_money ( p.opened_price - p.current_price ) * 100 - 1.3
@@ -9,10 +9,9 @@
9
9
 
10
10
  %h5.collapse-expand#iroPurseConfig
11
11
  Config
12
- -# #{link_to '[~]', edit_iro_purse_path(@purse)}
13
12
  .config
14
- -# %pre= @purse.config
15
13
  = render 'form', iro_purse: @purse
14
+ .c
16
15
 
17
16
  %h5.collapse-expand#strategies
18
17
  Strategies (#{@strategies.length})
@@ -20,12 +19,11 @@
20
19
  .strategies.items
21
20
  - @strategies.each do |strat|
22
21
  .strategy.item= render 'ish_manager/iro_strategies/form', strategy: strat
23
-
22
+ .c
24
23
 
25
24
  %h5.collapse-expand#gameuiPositions
26
25
  Gameui Positions (#{@positions.length})
27
26
  = link_to '[+]', new_iro_position_path({ iro_purse_id: @purse.id })
28
-
29
27
  .gameui-positions
30
28
  - @positions.each do |p|
31
29
 
@@ -33,6 +31,7 @@
33
31
  .gameuiW.show-amounts{ data: { cc: { strike: p.strike, startPrice: p.opened_price, currentPrice: p.current_price, cus: p.strategy.current_underlying_strike } } }
34
32
  .gameui
35
33
  .gameuiC
34
+ = link_to '[roll]', roll_iro_position_path(p)
36
35
 
37
36
  .elephantW
38
37
  .elephant
@@ -50,7 +49,12 @@
50
49
  .amount
51
50
  .riderCurrent
52
51
  .amount
52
+
53
53
  .riderStart2
54
+ .amount
55
+ .riderCurrent2
56
+ .amount
57
+
54
58
 
55
59
  .sunflowerW
56
60
  .sunflower
@@ -69,14 +73,12 @@
69
73
  .spearC
70
74
  .spearStart
71
75
  .spearCurrent
72
-
76
+ .c
73
77
 
74
78
  %h5.collapse-expand#spreadsheetPositions
75
79
  Positions (#{@positions.length})
76
80
  = link_to '[+]', new_iro_position_path({ iro_purse_id: @purse.id })
77
81
  .positions
78
-
79
-
80
82
  %table.bordered
81
83
  %thead
82
84
  %tr
@@ -99,7 +101,7 @@
99
101
  %td
100
102
  .begin-on Begin On
101
103
  %td
102
- .price Price
104
+ .price Begin Price
103
105
  %td
104
106
  .to-open To Open
105
107
  %td
@@ -140,12 +142,15 @@
140
142
  %td.days-left= (p.expires_on.to_date - Time.now.to_date).to_i
141
143
  %td.q= p.quantity
142
144
  %td.begin-on= pp_date p.opened_on
143
- %td.price= p.opened_price
144
- %td.to-open= pp_amount( p.opened_price * 100 * p.quantity )
145
+ %td.price= pp_amount p.opened_price
146
+ %td.to-open
147
+ -# = pp_amount( p.opened_price * p.quantity )
145
148
  %td.begin-delta= sprintf('%.2f', p.opened_delta ) rescue nil
146
149
  %td= pp_money p.current_price
147
- %td.net= pp_money ( p.opened_price - p.current_price ) * 100 - 1.3
148
- %td.netp= pp_percent ( p.opened_price - p.current_price ) / p.opened_price
150
+ %td.net
151
+ = pp_money ( p.opened_price - p.current_price ) - 0.013
152
+ %td.netp
153
+ = pp_percent ( p.opened_price - p.current_price ) / p.opened_price
149
154
  %td= sprintf('%.2f', p.current_delta ) rescue nil
150
155
  %td= (p.expires_on.to_date - p.opened_on).to_i
151
156
  %td.must-roll= pp_bool p.must_roll?
@@ -157,5 +162,5 @@
157
162
  %td.next-delta= p.next_position[:delta]
158
163
  %td.next-outcome= pp_money p.next_outcome
159
164
  %td.state= p.status
160
-
165
+ .c
161
166
 
@@ -2,7 +2,8 @@
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
- = hidden_field_tag 'iro_strategy[iro_purse_id]', params[:iro_purse_id]
5
+ - if params[:iro_purse_id]
6
+ = hidden_field_tag 'iro_strategy[iro_purse_id]', params[:iro_purse_id]
6
7
  .field
7
8
  = "#{strategy.id}." if strategy.id
8
9
  = f.label :slug
data/config/routes.rb CHANGED
@@ -24,6 +24,7 @@ IshManager::Engine.routes.draw do
24
24
  # end
25
25
  # resources :orders
26
26
 
27
+ get 'iro_positions/roll/:id', to: 'iro_positions#roll', as: :roll_iro_position
27
28
  resources :iro_positions
28
29
 
29
30
  resources :iro_watches
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.415
4
+ version: 0.1.8.416
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-06 00:00:00.000000000 Z
11
+ date: 2023-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -468,6 +468,7 @@ files:
468
468
  - app/views/ish_manager/iro_positions/_form.haml
469
469
  - app/views/ish_manager/iro_positions/edit.haml
470
470
  - app/views/ish_manager/iro_positions/new.haml
471
+ - app/views/ish_manager/iro_positions/roll.haml
471
472
  - app/views/ish_manager/iro_purses/_form.haml
472
473
  - app/views/ish_manager/iro_purses/edit.haml
473
474
  - app/views/ish_manager/iro_purses/new.haml