iron_warbler 2.0.7.4 → 2.0.7.5

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: f2b30096d80bf9a313e727c174b2d7f1255954e7eb4ab4cc158a80395ae13af5
4
- data.tar.gz: 7dbc3734a72d4669fb1daa9a400ce4b6e1409dae04eaf9d37de189fd5706fd2e
3
+ metadata.gz: d9623b43de3ec1bea0d40e439f10c024c16b573b2ec1b0fe57dc4e48f4535a1c
4
+ data.tar.gz: 2574f8e0c95b1bd7977732d94ff49212baed00a25efcbec363ef6d456bf70ae0
5
5
  SHA512:
6
- metadata.gz: 1c0a7e7f057d4c065b6976b4ff0bf236a6ce5e43ab0ca6943878e4567b6fbef7aa420a16b28ad7142accb1c0f359f873e4ef05a028c62b1530a417b24afe384b
7
- data.tar.gz: 444a6658828e564757d82133822defa0964497c4a4e7c63d188a33024b4f8c4f0a54960a915be8d9de7da5ffa7006cff7f8ba0bda082766e4b9e9856e03ce802
6
+ metadata.gz: d2776f402509e6a1ca51c5f5e804ff03818904b4d980dc786c59af234b2d90b772d5f8d772a942d02eadb2e513d7080f6df0397de8c5295e673fc651b26a8948
7
+ data.tar.gz: 00b17d296e59c53dca6d07f731608763d7768db7d5841bd2bbc9885135320bc45600a31af9044b9fb10151edb3952b698375abd2557feb6298d43e42e62a9d07
@@ -2,6 +2,7 @@
2
2
  class Iro::Alert < Iro::ApplicationRecord
3
3
  self.table_name = 'iro_alerts'
4
4
 
5
+ SLEEP_TIME_SECONDS = Rails.env.production? ? 60 : 15
5
6
 
6
7
  DIRECTION_ABOVE = 'ABOVE'
7
8
  DIRECTION_BELOW = 'BELOW'
@@ -20,15 +20,24 @@ namespace :iro do
20
20
 
21
21
  desc 'alerts'
22
22
  task alerts: :environment do
23
+ print 'iro:alerts'
23
24
  while true
24
25
  Iro::Alert.active.each do |alert|
26
+
25
27
  # price = Iro::Stock.latest( alert.ticker ).price
26
28
  price = Tda::Api.get_quote( alert.symbol ).last
29
+
27
30
  if alert.direction == Iro::Alert::DIRECTION_ABOVE && price >= alert.strike ||
28
31
  alert.direction == Iro::Alert::DIRECTION_BELOW && price <= alert.strike
32
+
29
33
  Iro::AlertMailer.stock_alert( alert ).deliver_later
34
+ alert.update_attributes({ status: Iro::Alert::STATUS_INACTIVE })
35
+ print '^'
36
+
30
37
  end
31
38
  end
39
+
40
+ print '.'
32
41
  sleep Iro::Alert::SLEEP_TIME_SECONDS
33
42
  end
34
43
  end
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.4
4
+ version: 2.0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev