iron_warbler 2.0.7.3 → 2.0.7.5

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: 7749289ed7e8a7219b042aad08c08fb7010e5c395dbe0865bb07dc8c78fa45f7
4
- data.tar.gz: 875a7cdc16b68fb4c70aaaf9db0a93eb0ba1bf7995420b4a3cea478c7b91b0bf
3
+ metadata.gz: d9623b43de3ec1bea0d40e439f10c024c16b573b2ec1b0fe57dc4e48f4535a1c
4
+ data.tar.gz: 2574f8e0c95b1bd7977732d94ff49212baed00a25efcbec363ef6d456bf70ae0
5
5
  SHA512:
6
- metadata.gz: f5d94b1bb120aa7ae0573ed95b014b2656bdb3579fae55b014701cdc1d6c366efdf6d21dc1e656696dbfdbaebee451dc7e552975bf8e2c3827c69b7593977558
7
- data.tar.gz: 48b8de44fb84f21357f6d9e73051e00b5c3476514ddccfa5f8b6b1d3912bcba4bc0cc09d99e950b667b936c45395e3bda2742484ea72a399a66cc5f4ae499f5b
6
+ metadata.gz: d2776f402509e6a1ca51c5f5e804ff03818904b4d980dc786c59af234b2d90b772d5f8d772a942d02eadb2e513d7080f6df0397de8c5295e673fc651b26a8948
7
+ data.tar.gz: 00b17d296e59c53dca6d07f731608763d7768db7d5841bd2bbc9885135320bc45600a31af9044b9fb10151edb3952b698375abd2557feb6298d43e42e62a9d07
@@ -2,10 +2,22 @@
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
6
+
5
7
  DIRECTION_ABOVE = 'ABOVE'
6
8
  DIRECTION_BELOW = 'BELOW'
7
9
  def self.directions_list
8
10
  [ nil, DIRECTION_ABOVE, DIRECTION_BELOW ]
9
11
  end
10
12
 
13
+ STATUS_ACTIVE = 'active'
14
+ STATUS_INACTIVE = 'inactive'
15
+ STATUSES = [ 'active', 'inactive' ]
16
+
17
+
18
+ def self.active
19
+ where( status: STATUS_ACTIVE )
20
+ end
21
+
22
+
11
23
  end
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_warbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7.3
4
+ version: 2.0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-20 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails