iron_warbler 2.0.7.15 → 2.0.7.16

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: fac41a67df823d5a9c3f4d49565d18e172727cd973dcf041adb468461b2cbb63
4
- data.tar.gz: e08beb7f8cc982cabb8563944bcaa70d8441baab09f2552d5ef246806aec1a83
3
+ metadata.gz: 18954e909b6d16fbfd4f1edaede8493c0a011308febb3c37ad3e539a6d4d78b0
4
+ data.tar.gz: 22b2c2e0cd159318cfb8f674aafecdcf70640fabf42872b72b839fcde1ebd099
5
5
  SHA512:
6
- metadata.gz: 118dc29fe619b994b0265b7aed1c84aefc5d7f221b0815840222b208b72caf7625a0bdd639545cb8b58ea348dac1215a9489afaf21c72b421ac80eafcf28547d
7
- data.tar.gz: 19b1a9f804a801a921fb1663a4ab719b347fb8cafc80fe093faa487ae846c66a642166fe2cc414243004448be8ce71ea26e90cdd27f4e8b0b6e7373e607cdaa3
6
+ metadata.gz: 3e0609f0dfd3a5d97ac09523110f558c99f0e2acc2e7d646ef2a974b107b65c4fd0001e44bb64079d1baaaa05dd5d52a8c3e853166cd08a384a7fe0ea0d29d47
7
+ data.tar.gz: bee57f8a6d5ab1006d5bba159cec53e7cf86dbeeda98f73cc5a6d2c24a89b88c0362639c9b03eabade29316f615f67869114a665a95dfe851efcfca312203cbf
@@ -3,10 +3,10 @@ class Iro::AlertMailer < ActionMailer::Base
3
3
  default from: 'no-reply@wasya.co'
4
4
  layout 'mailer'
5
5
 
6
- def stock_alert alert
7
- @alert = alert
6
+ def stock_alert id
7
+ @alert = Iro::Alert.find id
8
8
  mail( to: 'poxlovi@gmail.com',
9
- subject: 'Iro::AlertMailer#stock_alert' )
9
+ subject: 'Iro::AlertMailer#stock_alert' )
10
10
  end
11
11
 
12
12
  end
@@ -32,4 +32,28 @@ class Iro::Alert
32
32
  field :strike
33
33
  validates :strike, presence: true
34
34
 
35
+ def do_run
36
+ alert = self
37
+ begin
38
+ price = Tda::Stock.get_quote( alert.symbol ).last
39
+
40
+ if alert.direction == self.class::DIRECTION_ABOVE && price >= alert.strike ||
41
+ alert.direction == self.class::DIRECTION_BELOW && price <= alert.strike
42
+
43
+
44
+
45
+ Iro::AlertMailer.stock_alert( alert.id.to_s ).deliver_later
46
+ alert.update({ status: self.class::STATUS_INACTIVE })
47
+ print '^'
48
+
49
+ end
50
+ rescue => err
51
+ puts! err, 'err'
52
+ ::ExceptionNotifier.notify_exception(
53
+ err,
54
+ data: { alert: alert }
55
+ )
56
+ end
57
+ end
58
+
35
59
  end
@@ -4,4 +4,26 @@ class Iro::PriceItem
4
4
  include Mongoid::Timestamps
5
5
  store_in collection: 'iro_price_items'
6
6
 
7
+ field :putCall, type: String
8
+ field :symbol, type: String
9
+ field :ticker, type: String
10
+
11
+ field :bid, type: Float
12
+ field :bidSize, type: Integer
13
+ field :ask, type: Float
14
+ field :askSize, type: Integer
15
+ field :last, type: Float
16
+
17
+ field :openPrice, type: Float
18
+ field :closePrice, type: Float
19
+ field :lowPrice, type: Float
20
+ field :highPrice, type: Float
21
+
22
+ field :quoteTimeInLong, type: Integer
23
+ field :timestamp, type: Integer
24
+ field :totalVolume, type: Integer
25
+ field :mark, type: Float
26
+ field :exchangeName, type: String
27
+ field :volatility, type: Float
28
+
7
29
  end
@@ -6,26 +6,7 @@ namespace :iro do
6
6
  print 'iro:alerts'
7
7
  while true
8
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
9
+ alert.do_run
29
10
  end
30
11
 
31
12
  print '.'
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.15
4
+ version: 2.0.7.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev