iron_warbler 2.0.7.45 → 2.0.7.48
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/README.txt +3 -0
- data/app/assets/javascript/iron_warbler/gameui.js +16 -1
- data/app/assets/stylesheets/iron_warbler/application.css +18 -0
- data/app/assets/stylesheets/iron_warbler/positions.scss +13 -3
- data/app/assets/stylesheets/iron_warbler/positions_gameui.scss +12 -3
- data/app/assets/stylesheets/iron_warbler/purses_gameui.scss +16 -17
- data/app/controllers/iro/api_controller.rb +37 -4
- data/app/controllers/iro/application_controller.rb +9 -4
- data/app/controllers/iro/datapoints_controller.rb +4 -1
- data/app/controllers/iro/positions_controller.rb +284 -186
- data/app/controllers/iro/purses_controller.rb +67 -7
- data/app/controllers/iro/stocks_controller.rb +15 -15
- data/app/controllers/iro/strategies_controller.rb +0 -9
- data/app/views/iro/_main_header.haml +9 -2
- data/app/views/iro/positions/_form_credit_call.haml +62 -0
- data/app/views/iro/positions/_form_spread.haml +55 -0
- data/app/views/iro/positions/_gameui_covered_call.haml +10 -11
- data/app/views/iro/positions/_gameui_long_credit_put_spread.haml +38 -0
- data/app/views/iro/positions/_gameui_short_credit_call_spread.haml +40 -0
- data/app/views/iro/positions/_header.haml +1 -1
- data/app/views/iro/positions/_header_covered_call.haml +9 -7
- data/app/views/iro/positions/_header_long_credit_put_spread.haml +16 -0
- data/app/views/iro/positions/_header_short_credit_call_spread.haml +17 -0
- data/app/views/iro/positions/_header_spread.haml +25 -7
- data/app/views/iro/positions/_new.haml +5 -4
- data/app/views/iro/positions/_prepare_covered_call.haml +18 -13
- data/app/views/iro/positions/_prepare_header_covered_call.haml +15 -0
- data/app/views/iro/positions/_prepare_header_long_credit_put_spread.haml +16 -0
- data/app/views/iro/positions/_prepare_header_short_credit_call_spread.haml +18 -0
- data/app/views/iro/positions/_prepare_long_credit_put_spread.haml +30 -0
- data/app/views/iro/positions/_prepare_short_credit_call_spread.haml +35 -0
- data/app/views/iro/positions/_reasons.haml +1 -1
- data/app/views/iro/positions/_table.haml +11 -92
- data/app/views/iro/positions/_table_tr_covered_call.haml +66 -0
- data/app/views/iro/positions/_table_tr_long_credit_put_spread.haml +89 -0
- data/app/views/iro/positions/_table_tr_short_credit_call_spread.haml +1 -0
- data/app/views/iro/positions/edit.haml +5 -2
- data/app/views/iro/positions/new.haml +5 -1
- data/app/views/iro/positions/prepare.haml +8 -10
- data/app/views/iro/positions/prepare2.haml +5 -5
- data/app/views/iro/purses/_form.haml +1 -1
- data/app/views/iro/purses/_header.haml +28 -14
- data/app/views/iro/purses/show.haml +3 -1
- data/app/views/iro/stocks/_form.haml +7 -2
- data/app/views/iro/stocks/_grid.haml +20 -0
- data/app/views/iro/stocks/_grid_long.haml +1 -0
- data/app/views/iro/stocks/_grid_short.haml +6 -0
- data/app/views/iro/stocks/_show_card.haml +4 -0
- data/app/views/iro/stocks/index.haml +11 -4
- data/app/views/iro/stocks/show.haml +46 -13
- data/app/views/iro/strategies/{_form_wheel.haml → _form.haml-bk} +21 -9
- data/app/views/iro/strategies/_form_covered_call.haml +52 -0
- data/app/views/iro/strategies/_form_spread.haml +50 -42
- data/app/views/iro/strategies/_header.haml +5 -2
- data/app/views/iro/strategies/_list.haml +7 -0
- data/app/views/iro/strategies/_show.haml +6 -3
- data/app/views/iro/strategies/_table.haml +24 -15
- data/app/views/iro/strategies/edit.haml +11 -1
- data/app/views/iro/strategies/index.haml +4 -3
- data/app/views/iro/strategies/new.haml +10 -1
- data/app/views/iro/strategies/show.haml +3 -1
- data/config/routes.rb +12 -7
- data/lib/iron_warbler.rb +29 -0
- metadata +20 -9
- data/app/jobs/tda_job.rb-bk +0 -14
- data/app/mailers/iro/alert_mailer.rb +0 -12
- data/app/mailers/iro/application_mailer.rb +0 -6
- data/app/models/tda/option.rb +0 -285
- data/app/models/tda/stock.rb +0 -59
- data/app/views/iro/positions/_form.haml +0 -38
- data/app/views/iro/positions/_prepare_short_credit_call_spread.haml +0 -1
- data/app/views/iro/stocks/_grid_long.haml +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a3df374cfa080a6f1eeb4ed4644184e739cc398264e09412ecaf43d6e516bfb2
|
|
4
|
+
data.tar.gz: 8e29f3320d558a274b17f9f79902197e81441eeba1c97d495f416e53bafcf82e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de25201bd6197b74a46baba0d4aa07a4712a840e2d6e657acdbada383d646de6395bef04d27eb8529873bd6cf2ab749ffe9c64fa315a12392e8b30971b4dd778
|
|
7
|
+
data.tar.gz: 2ac509fba9351eeaeb5e406f253a66e24eb13353ef58207c82f7d0942140ef5ceb82d61c59c21838b34ac8be7dc0c1e117568d5514cf9a5b01c585ce29e06d18
|
data/README.txt
CHANGED
|
@@ -12,6 +12,9 @@ calculator: https://www.omnicalculator.com/finance/black-scholes
|
|
|
12
12
|
From: https://pythoninoffice.com/calculate-black-scholes-option-price-in-python/
|
|
13
13
|
|
|
14
14
|
= schwab =
|
|
15
|
+
callback: https://email.wasya.co/trading/api/oauth2-redirect.html
|
|
16
|
+
callback: https://email.wasya.co/trading/api/schwab-exec-redirect.html
|
|
17
|
+
|
|
15
18
|
== swagger ==
|
|
16
19
|
|
|
17
20
|
* https://developer.schwab.com/products/trader-api--individual
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
$(function() {
|
|
3
|
+
logg('gameui-init')
|
|
3
4
|
|
|
4
5
|
const tmp = $('.purses-gameuiW').attr('data-margin-left')
|
|
5
|
-
logg(tmp, 'tmp')
|
|
6
6
|
|
|
7
7
|
$('.purses-gameuiW').scrollLeft( tmp );
|
|
8
8
|
|
|
9
|
+
// positions-xmulti
|
|
10
|
+
let positions_xmulti = {}
|
|
11
|
+
$('input[type="checkbox"].positions-xmulti').on('change', function () {
|
|
12
|
+
let val = $(this).val()
|
|
13
|
+
logg(val, 'xmulti val?')
|
|
14
|
+
if ($(this).is(":checked")) {
|
|
15
|
+
positions_xmulti[val] = true
|
|
16
|
+
} else {
|
|
17
|
+
delete positions_xmulti[val]
|
|
18
|
+
}
|
|
19
|
+
logg(Object.keys(positions_xmulti).join(','), 'positions_xmulti after event')
|
|
20
|
+
$("form#positionsXmultiSubmit input[type='hidden']#positions_xmulti").val( Object.keys(positions_xmulti).join(',') )
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
|
|
9
24
|
}); // END
|
|
@@ -39,3 +39,21 @@ html {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
.red {
|
|
43
|
+
border: 1px solid red;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.no-dot {
|
|
47
|
+
list-style-type: decimal;
|
|
48
|
+
li {
|
|
49
|
+
padding-left: 5px;
|
|
50
|
+
text-align: center;
|
|
51
|
+
}
|
|
52
|
+
li::marker {
|
|
53
|
+
content: counter(list-item);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.strategies--show {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
z-index: 1;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
.begin-inner-price,
|
|
8
|
+
.begin-outer-price,
|
|
9
|
+
.end-inner-price,
|
|
10
|
+
.end-outer-price {
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
.positions--table {
|
|
8
15
|
|
|
9
16
|
table {
|
|
@@ -24,7 +31,7 @@
|
|
|
24
31
|
// rotate: -40deg;
|
|
25
32
|
|
|
26
33
|
padding: .4em 0;
|
|
27
|
-
width: 120px;
|
|
34
|
+
min-width: 120px;
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
|
|
@@ -37,6 +44,9 @@
|
|
|
37
44
|
th.end_delta {
|
|
38
45
|
width: 50px;
|
|
39
46
|
}
|
|
47
|
+
th.end_priceW {
|
|
48
|
+
width: 160px;
|
|
49
|
+
}
|
|
40
50
|
th.next_position {
|
|
41
51
|
width: 160px;
|
|
42
52
|
}
|
|
@@ -44,10 +54,10 @@
|
|
|
44
54
|
width: 120px;
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
tr.
|
|
57
|
+
tr.is-long {
|
|
48
58
|
border-left: 5px solid var(--iro-color-long);
|
|
49
59
|
}
|
|
50
|
-
tr.
|
|
60
|
+
tr.is-short {
|
|
51
61
|
border-left: 5px solid var(--iro-color-short);
|
|
52
62
|
}
|
|
53
63
|
|
|
@@ -7,13 +7,22 @@
|
|
|
7
7
|
right: 0;
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
}
|
|
10
|
+
.PositionW.is-short .RollGuide {
|
|
11
|
+
right: auto;
|
|
12
|
+
left: 0;
|
|
13
|
+
}
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
.select {
|
|
16
|
+
.PositionW .select {
|
|
13
17
|
position: absolute;
|
|
18
|
+
width: calc(100px - 1em);
|
|
14
19
|
z-index: 5;
|
|
15
|
-
|
|
20
|
+
}
|
|
21
|
+
.PositionW.is-long .select {
|
|
22
|
+
left: -100px;
|
|
23
|
+
text-align: right;
|
|
24
|
+
}
|
|
25
|
+
.PositionW.is-short .select {
|
|
16
26
|
right: -100px;
|
|
17
27
|
text-align: left;
|
|
18
|
-
width: calc(100px - 1em);
|
|
19
28
|
}
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
z-index: 2;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
.PositionW.covered_call {
|
|
36
|
+
width: 5px;
|
|
37
|
+
background: yellow;
|
|
38
|
+
}
|
|
35
39
|
.PositionW.short_debit_put_spread {
|
|
36
40
|
background: rgba(255,153,0, 0.25);
|
|
37
41
|
}
|
|
@@ -51,25 +55,14 @@
|
|
|
51
55
|
|
|
52
56
|
.Position {
|
|
53
57
|
position: absolute;
|
|
54
|
-
width: 100%;
|
|
55
|
-
height: 100%;
|
|
56
|
-
|
|
57
58
|
left: 0;
|
|
58
59
|
top: 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/* only for covered calls */
|
|
63
|
-
.PositionC {
|
|
64
|
-
background: rgba(255,153,51, 0.5);
|
|
65
|
-
position: absolute;
|
|
66
|
-
|
|
67
|
-
right: 0;
|
|
68
60
|
|
|
69
|
-
width:
|
|
61
|
+
width: 100%;
|
|
70
62
|
height: 100%;
|
|
71
63
|
}
|
|
72
64
|
|
|
65
|
+
|
|
73
66
|
.MaxGain,
|
|
74
67
|
.Breakeven {
|
|
75
68
|
position: absolute;
|
|
@@ -79,6 +72,11 @@
|
|
|
79
72
|
background: rgba(0,255,0, 0.5);
|
|
80
73
|
height: 0.5em;
|
|
81
74
|
}
|
|
75
|
+
.PositionW.is-short .MaxGain {
|
|
76
|
+
right: auto;
|
|
77
|
+
left: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
82
80
|
|
|
83
81
|
.sprite {
|
|
84
82
|
position: absolute;
|
|
@@ -121,13 +119,17 @@
|
|
|
121
119
|
height: 100%;
|
|
122
120
|
}
|
|
123
121
|
|
|
122
|
+
.PositionW.is-short .Net .label {
|
|
123
|
+
text-align: right;
|
|
124
|
+
position: absolute;
|
|
125
|
+
right: 0;
|
|
126
|
+
}
|
|
124
127
|
.Net {
|
|
125
128
|
position: absolute;
|
|
126
129
|
// bottom: 3em;
|
|
127
130
|
// z-index: 3;
|
|
128
131
|
height: 90%;
|
|
129
132
|
|
|
130
|
-
// border-bottom: 5px solid red;
|
|
131
133
|
.label {
|
|
132
134
|
color: white;
|
|
133
135
|
text-shadow: 1px 1px black;
|
|
@@ -161,9 +163,6 @@
|
|
|
161
163
|
border-left-color: white;
|
|
162
164
|
}
|
|
163
165
|
.label {
|
|
164
|
-
|
|
165
|
-
// border: 1px solid red;
|
|
166
|
-
|
|
167
166
|
transform: rotate(-45deg);
|
|
168
167
|
transform-origin: center left;
|
|
169
168
|
|
|
@@ -37,16 +37,49 @@ class Iro::ApiController < ActionController::Base
|
|
|
37
37
|
render json: { status: :ok }
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
def schwab_exec_redirect
|
|
41
|
+
out = Schwab.post( "https://api.schwabapi.com/v1/oauth/token", {
|
|
42
|
+
headers: {
|
|
43
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
44
|
+
},
|
|
45
|
+
basic_auth: { username: SCHWAB_EXEC[:key], password: SCHWAB_EXEC[:secret] },
|
|
46
|
+
body: {
|
|
47
|
+
grant_type: 'authorization_code',
|
|
48
|
+
code: params[:code].sub('%40', '@'),
|
|
49
|
+
redirect_uri: SCHWAB_EXEC[:redirect_url],
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
out = out.parsed_response
|
|
53
|
+
|
|
54
|
+
attrs = {
|
|
55
|
+
schwab_exec_access_token: out['access_token'],
|
|
56
|
+
schwab_exec_refresh_token: out['refresh_token'],
|
|
57
|
+
schwab_exec_id_token: out['id_token'],
|
|
58
|
+
}
|
|
59
|
+
# puts! attrs, 'attrs'
|
|
60
|
+
|
|
61
|
+
profile = Wco::Profile.find_by email: 'piousbox@gmail.com'
|
|
62
|
+
profile.update(attrs)
|
|
63
|
+
profile.save!
|
|
64
|
+
|
|
65
|
+
render json: { status: :ok }
|
|
66
|
+
end
|
|
67
|
+
|
|
40
68
|
##
|
|
41
69
|
## private
|
|
42
70
|
##
|
|
43
71
|
private
|
|
44
72
|
|
|
45
73
|
def decode_jwt
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
74
|
+
# puts! current_user, '#decode_jwt'
|
|
75
|
+
if current_user
|
|
76
|
+
;
|
|
77
|
+
else
|
|
78
|
+
out = JWT.decode params[:jwt_token], nil, false
|
|
79
|
+
email = out[0]['email']
|
|
80
|
+
user = User.find_by({ email: email })
|
|
81
|
+
sign_in user
|
|
82
|
+
end
|
|
50
83
|
end
|
|
51
84
|
|
|
52
85
|
def set_stock
|
|
@@ -15,19 +15,24 @@ class Iro::ApplicationController < Wco::ApplicationController
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def schwab_sync
|
|
18
|
-
authorize! :
|
|
18
|
+
authorize! :schwab_sync, Iro
|
|
19
19
|
render json: Iro::Iro.schwab_sync
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
def schwab_sync_exec
|
|
23
|
+
authorize! :schwab_sync_exec, Iro
|
|
24
|
+
render json: Iro::Iro.schwab_sync_exec
|
|
25
|
+
end
|
|
26
|
+
|
|
22
27
|
##
|
|
23
28
|
## private
|
|
24
29
|
##
|
|
25
30
|
private
|
|
26
31
|
|
|
27
32
|
def set_lists
|
|
28
|
-
@purses = Iro::Purse.all
|
|
29
|
-
@strategies = Iro::Strategy.all
|
|
30
|
-
@strategies_list = Iro::Strategy.list
|
|
33
|
+
@purses = Iro::Purse.all.order_by( slug: :asc )
|
|
34
|
+
# @strategies = Iro::Strategy.all
|
|
35
|
+
# @strategies_list = Iro::Strategy.list
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
|
|
@@ -3,6 +3,8 @@ class Iro::DatapointsController < Iro::ApplicationController
|
|
|
3
3
|
|
|
4
4
|
## params: d, k, v
|
|
5
5
|
def create
|
|
6
|
+
# puts! params, 'datapoints#create'
|
|
7
|
+
|
|
6
8
|
authorize! :create, Iro::Datapoint
|
|
7
9
|
begin
|
|
8
10
|
Iro::Datapoint.create!(
|
|
@@ -11,7 +13,8 @@ class Iro::DatapointsController < Iro::ApplicationController
|
|
|
11
13
|
value: params[:v],
|
|
12
14
|
)
|
|
13
15
|
render json: { status: :ok }
|
|
14
|
-
rescue Mongoid::Errors::Validations =>
|
|
16
|
+
rescue Mongoid::Errors::Validations => err
|
|
17
|
+
puts! err, 'could not create datapoint'
|
|
15
18
|
render json: { status: 401 }, status: 401
|
|
16
19
|
end
|
|
17
20
|
end
|