iron_warbler 2.0.7.14 → 2.0.7.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08950feb78bbd2b496a19f3dd46a8cf689167bba60a700814182aba57e13e56d'
4
- data.tar.gz: a459e6b34168a50c4e68d50c1c7f005027b48760162e662db0f4bf9f746d0a62
3
+ metadata.gz: fac41a67df823d5a9c3f4d49565d18e172727cd973dcf041adb468461b2cbb63
4
+ data.tar.gz: e08beb7f8cc982cabb8563944bcaa70d8441baab09f2552d5ef246806aec1a83
5
5
  SHA512:
6
- metadata.gz: ee7779864feda3323a58c513f31c1b4f8b7d23b3338ddf72d34f404652189577cd759aa0635be173de9e75dec94112714a227cc7c7ca949da16e57ec997c29e3
7
- data.tar.gz: b8ec7aeff649eb60172ff42aaeb5bf33f58e13533ffe04c9e11b5a4b30df70c8cfc9da43a62f10153eec7207a04d9e7973eca21bff2a4f093480a7851e81a50e
6
+ metadata.gz: 118dc29fe619b994b0265b7aed1c84aefc5d7f221b0815840222b208b72caf7625a0bdd639545cb8b58ea348dac1215a9489afaf21c72b421ac80eafcf28547d
7
+ data.tar.gz: 19b1a9f804a801a921fb1663a4ab719b347fb8cafc80fe093faa487ae846c66a642166fe2cc414243004448be8ce71ea26e90cdd27f4e8b0b6e7373e607cdaa3
@@ -4,7 +4,7 @@ class Iro::Alert
4
4
  include Mongoid::Timestamps
5
5
  store_in collection: 'iro_alerts'
6
6
 
7
- SLEEP_TIME_SECONDS = Rails.env.production? ? 60 : 15
7
+ # SLEEP_TIME_SECONDS = Rails.env.production? ? 60 : 15
8
8
 
9
9
  DIRECTION_ABOVE = 'ABOVE'
10
10
  DIRECTION_BELOW = 'BELOW'
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_warbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7.14
4
+ version: 2.0.7.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev