iron_warbler 2.0.7.17 → 2.0.7.19

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: a9a1d4d1eda9f6a71ac418d24a0e8588efbbe3d8d0c145964f55feef14393aed
4
- data.tar.gz: 30c1242bfd9f12e1809a8fb2aa4289057aa8b1cc336e3e7020d98c9f98c84768
3
+ metadata.gz: 3323961dddbc46a423f2f913a487c0944d1a39c88ace9517f42b02eb7e4951a9
4
+ data.tar.gz: 2f28158b88fe50b7d190c5151da808819c816de9abf773c70063e39b8ed6a8da
5
5
  SHA512:
6
- metadata.gz: db2fcb877e026eabbb1786607e5c64256946f029f8d5175e53cb2295f8b8adf262222ca1af39810bc68aed6ce6953f78c716bf7985bb3d24b92c0d1d907af90f
7
- data.tar.gz: 4020c6358719dea41655172bbc96d3fbc15124a2af4797ceeaa24bb76d8b36cea199c6dfa3cf1c3a63982f83fde03aa4930eeeb011f73014c7bcd3d559d37cd9
6
+ metadata.gz: 509add67004fa9cda9757fc71bd3319db109acb0cb981a4ac265dc5777f39680bbcfb265a0685f357b0b073604087df756c084b98d333f0c21616d535d205a62
7
+ data.tar.gz: f1b24ce8505853cbc1723b5117ff3a3c79f85bf793f2f8aa00f7bdd4d57ae47e2a9014f0739920609595c16376b2b7c2e0b4a1c13822f4477455fec68aa55d74
@@ -23,24 +23,23 @@ 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
36
36
  alert = self
37
37
  begin
38
- price = Tda::Stock.get_quote( alert.symbol ).last
39
-
40
- if alert.direction == alert.class::DIRECTION_ABOVE && price >= alert.strike ||
41
- alert.direction == alert.class::DIRECTION_BELOW && price <= alert.strike
42
-
38
+ price = Tda::Stock.get_quote( alert.symbol )&.last
39
+ return if !price
43
40
 
41
+ if ( alert.direction == alert.class::DIRECTION_ABOVE && price >= alert.strike ) ||
42
+ ( alert.direction == alert.class::DIRECTION_BELOW && price <= alert.strike )
44
43
 
45
44
  Iro::AlertMailer.stock_alert( alert.id.to_s ).deliver_later
46
45
  alert.update({ status: alert.class::STATUS_INACTIVE })
@@ -16,6 +16,9 @@ class Tda::Stock
16
16
  path = "/v1/marketdata/quotes"
17
17
  inns = self.get path, { query: { apikey: ::TD_AMERITRADE[:apiKey], symbol: tickers } }
18
18
  inns = inns.parsed_response
19
+ if [ NilClass, String ].include?( inns.class )
20
+ return []
21
+ end
19
22
  inns.each do |k, v|
20
23
  inns[k] = v.deep_symbolize_keys
21
24
  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.17
4
+ version: 2.0.7.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-07 00:00:00.000000000 Z
11
+ date: 2024-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: business_time