iron_warbler 2.0.7.16 → 2.0.7.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/iro/alert.rb +6 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b3c19fdfe0c9cd47b253a92b6065f067d3004022865d700059ad3190287f35
|
4
|
+
data.tar.gz: abd93b990583e6ab2c644b74647014767a43947d81fdf7f1b15abf198efad96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106e70eda991a01d9ce69a265958ea2dbe25fb27a0b316297b303ec97c5cffb6cb274b78a4ceb827d107f7644122947038c8cce696fcd8f8240cffb6cfe9e28f
|
7
|
+
data.tar.gz: 3b51d655011169c98ef738174c054733aaa4ebe737ebd53b0725f4f062e7b939bc4d72e3561a8c12d309240b68ded7d311ac91819da0b74d21f411240a249987
|
data/app/models/iro/alert.rb
CHANGED
@@ -23,13 +23,13 @@ class Iro::Alert
|
|
23
23
|
field :class_name, default: 'Iro::Stock'
|
24
24
|
validates :class_name, presence: true
|
25
25
|
|
26
|
-
field :symbol
|
26
|
+
field :symbol, type: String
|
27
27
|
validates :symbol, presence: true
|
28
28
|
|
29
|
-
field :direction
|
29
|
+
field :direction, type: String
|
30
30
|
validates :direction, presence: true
|
31
31
|
|
32
|
-
field :strike
|
32
|
+
field :strike, type: Float
|
33
33
|
validates :strike, presence: true
|
34
34
|
|
35
35
|
def do_run
|
@@ -37,13 +37,11 @@ class Iro::Alert
|
|
37
37
|
begin
|
38
38
|
price = Tda::Stock.get_quote( alert.symbol ).last
|
39
39
|
|
40
|
-
if
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
if ( alert.direction == alert.class::DIRECTION_ABOVE && price >= alert.strike ) ||
|
41
|
+
( alert.direction == alert.class::DIRECTION_BELOW && price <= alert.strike )
|
44
42
|
|
45
43
|
Iro::AlertMailer.stock_alert( alert.id.to_s ).deliver_later
|
46
|
-
alert.update({ status:
|
44
|
+
alert.update({ status: alert.class::STATUS_INACTIVE })
|
47
45
|
print '^'
|
48
46
|
|
49
47
|
end
|