iron_warbler 2.0.7.14 → 2.0.7.15
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 +1 -1
- data/lib/tasks/iro_tasks.rake +32 -24
- 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: fac41a67df823d5a9c3f4d49565d18e172727cd973dcf041adb468461b2cbb63
|
4
|
+
data.tar.gz: e08beb7f8cc982cabb8563944bcaa70d8441baab09f2552d5ef246806aec1a83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 118dc29fe619b994b0265b7aed1c84aefc5d7f221b0815840222b208b72caf7625a0bdd639545cb8b58ea348dac1215a9489afaf21c72b421ac80eafcf28547d
|
7
|
+
data.tar.gz: 19b1a9f804a801a921fb1663a4ab719b347fb8cafc80fe093faa487ae846c66a642166fe2cc414243004448be8ce71ea26e90cdd27f4e8b0b6e7373e607cdaa3
|
data/app/models/iro/alert.rb
CHANGED
data/lib/tasks/iro_tasks.rake
CHANGED
@@ -1,6 +1,38 @@
|
|
1
1
|
|
2
2
|
namespace :iro do
|
3
3
|
|
4
|
+
desc 'alerts'
|
5
|
+
task alerts: :environment do
|
6
|
+
print 'iro:alerts'
|
7
|
+
while true
|
8
|
+
Iro::Alert.active.each do |alert|
|
9
|
+
begin
|
10
|
+
|
11
|
+
# price = Iro::Stock.latest( alert.ticker ).price
|
12
|
+
price = Tda::Api.get_quote( alert.symbol ).last
|
13
|
+
|
14
|
+
if alert.direction == Iro::Alert::DIRECTION_ABOVE && price >= alert.strike ||
|
15
|
+
alert.direction == Iro::Alert::DIRECTION_BELOW && price <= alert.strike
|
16
|
+
|
17
|
+
Iro::AlertMailer.stock_alert( alert ).deliver_later
|
18
|
+
alert.update({ status: Iro::Alert::STATUS_INACTIVE })
|
19
|
+
print '^'
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
rescue => err
|
24
|
+
::ExceptionNotifier.notify_exception(
|
25
|
+
err,
|
26
|
+
data: { alert: alert }
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
print '.'
|
32
|
+
sleep Rails.env.production? ? 60 : 15
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
4
36
|
desc 'recommend position actions'
|
5
37
|
task recommend_position_actions: :environment do
|
6
38
|
Iro::Position.active.where({ kind: 'covered_call' }).map &:should_roll?
|
@@ -53,30 +85,6 @@ namespace :iro do
|
|
53
85
|
end
|
54
86
|
end
|
55
87
|
|
56
|
-
desc 'alerts'
|
57
|
-
task alerts: :environment do
|
58
|
-
print 'iro:alerts'
|
59
|
-
while true
|
60
|
-
Iro::Alert.active.each do |alert|
|
61
|
-
|
62
|
-
# price = Iro::Stock.latest( alert.ticker ).price
|
63
|
-
price = Tda::Api.get_quote( alert.symbol ).last
|
64
|
-
|
65
|
-
if alert.direction == Iro::Alert::DIRECTION_ABOVE && price >= alert.strike ||
|
66
|
-
alert.direction == Iro::Alert::DIRECTION_BELOW && price <= alert.strike
|
67
|
-
|
68
|
-
Iro::AlertMailer.stock_alert( alert ).deliver_later
|
69
|
-
alert.update({ status: Iro::Alert::STATUS_INACTIVE })
|
70
|
-
print '^'
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
print '.'
|
76
|
-
sleep Iro::Alert::SLEEP_TIME_SECONDS
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
88
|
end
|
81
89
|
|
82
90
|
|