ish_models 0.0.33.227 → 0.0.33.229
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iro/option_watch.rb +71 -0
- data/lib/ish/email_context.rb +7 -3
- data/lib/ish/user_profile.rb +6 -3
- data/lib/ish_models.rb +4 -6
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5a2776eca852c5a7e11aa0a03e7d9032e54ff2b3d0d7f8a6b4364df63029d8f
|
4
|
+
data.tar.gz: 9ad2d817b825868f4e299c99eb8c915a0436df006c43499d5ea834b0072487a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8441aa5354f28cbeaf28273b1a896066d7416e46258bbf5245d041f4a53ae6fe6f2613456a80c4e4568f49c9a6df3feeb7c29090bca50c5e12138ee41b389fe
|
7
|
+
data.tar.gz: be17d74a00957011492cdf197f17c2666bb187bcdbf9bd55c2d0d18db83846e743c5071c2d1afadd176a4e85472caad6917daa553b38ee083aadce65bf38dfb5
|
@@ -0,0 +1,71 @@
|
|
1
|
+
|
2
|
+
##
|
3
|
+
## for alerting
|
4
|
+
##
|
5
|
+
class Iro::OptionWatch
|
6
|
+
include Mongoid::Document
|
7
|
+
include Mongoid::Timestamps
|
8
|
+
store_in collection: 'iro_option_watches'
|
9
|
+
|
10
|
+
field :ticker # like NVDA
|
11
|
+
validates :ticker, presence: true
|
12
|
+
|
13
|
+
field :symbol # like NVDA_021822C230
|
14
|
+
|
15
|
+
KIND_OPTION = 'option'
|
16
|
+
KIND_STOCK = 'stock'
|
17
|
+
KINDS = [ KIND_OPTION, KIND_STOCK ]
|
18
|
+
field :kind, type: String
|
19
|
+
validates :kind, presence: true
|
20
|
+
def self.kinds_list
|
21
|
+
[ nil, 'option', 'stock' ]
|
22
|
+
end
|
23
|
+
|
24
|
+
## Strike isn't the same as price!
|
25
|
+
field :strike, :type => Float
|
26
|
+
# validates :strike, presence: true
|
27
|
+
|
28
|
+
## What is the price of the option at some strike?
|
29
|
+
field :mark, type: Float
|
30
|
+
validates :mark, presence: true
|
31
|
+
|
32
|
+
field :contractType
|
33
|
+
# validates :contractType, presence: true
|
34
|
+
|
35
|
+
field :expirationDate
|
36
|
+
# validates :expirationDate, presence: true
|
37
|
+
|
38
|
+
NOTIFICATION_TYPES = [ :NONE, :EMAIL, :SMS ]
|
39
|
+
ACTIONS = NOTIFICATION_TYPES
|
40
|
+
NOTIFICATION_NONE = :NONE
|
41
|
+
NOTIFICATION_EMAIL = :EMAIL
|
42
|
+
NOTIFICATION_SMS = :SMS
|
43
|
+
field :notification_type, :type => Symbol, :as => :action
|
44
|
+
def self.actions_list
|
45
|
+
[nil] + ACTIONS
|
46
|
+
end
|
47
|
+
|
48
|
+
STATE_ACTIVE = 'active'
|
49
|
+
STATE_INACTIVE = 'inactive'
|
50
|
+
STATES = [ STATE_ACTIVE, STATE_INACTIVE ]
|
51
|
+
field :state, type: String, default: STATE_ACTIVE
|
52
|
+
validates :state, presence: true
|
53
|
+
scope :active, ->{ where( state: STATE_ACTIVE ) }
|
54
|
+
def self.states_list
|
55
|
+
[ nil, 'active', 'inactive' ]
|
56
|
+
end
|
57
|
+
|
58
|
+
DIRECTION_ABOVE = :ABOVE
|
59
|
+
DIRECTION_BELOW = :BELOW
|
60
|
+
DIRECTIONS = [ :ABOVE, :BELOW ]
|
61
|
+
field :direction, :type => Symbol
|
62
|
+
validates :direction, presence: true
|
63
|
+
def self.directions_list
|
64
|
+
[nil] + DIRECTIONS
|
65
|
+
end
|
66
|
+
|
67
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile'
|
68
|
+
field :email
|
69
|
+
field :phone
|
70
|
+
|
71
|
+
end
|
data/lib/ish/email_context.rb
CHANGED
@@ -49,14 +49,18 @@ class ::Ish::EmailContext
|
|
49
49
|
field :send_at, type: DateTime
|
50
50
|
|
51
51
|
|
52
|
-
def
|
53
|
-
|
52
|
+
def notsent
|
53
|
+
Ish::EmailContext.where( sent_at: nil )
|
54
|
+
end
|
55
|
+
def self.notsent; new.notsent; end
|
56
|
+
|
54
57
|
|
55
|
-
def self.scheduled; new.scheduled; end
|
56
58
|
def scheduled
|
57
59
|
# or({ :send_at.lte => Time.now }, { :send_at => nil }) ## This won't work b/c I need draft state!
|
58
60
|
Ish::EmailContext.where({ :send_at.lte => Time.now })
|
59
61
|
end
|
62
|
+
def self.scheduled; new.scheduled; end
|
63
|
+
|
60
64
|
|
61
65
|
def self.from_email_list
|
62
66
|
Ish::EmailCampaign.from_email_list
|
data/lib/ish/user_profile.rb
CHANGED
@@ -17,6 +17,7 @@ class Ish::UserProfile
|
|
17
17
|
validates_format_of :email,:with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
|
18
18
|
validates_uniqueness_of :email
|
19
19
|
|
20
|
+
|
20
21
|
field :name
|
21
22
|
|
22
23
|
def export_fields
|
@@ -57,10 +58,12 @@ class Ish::UserProfile
|
|
57
58
|
%w( piousbox@gmail.com victor@wasya.co ).include?( self.email )
|
58
59
|
end
|
59
60
|
|
60
|
-
## manager uses it.
|
61
|
-
## @TODO: check this, this is shit. _vp_ 20170527
|
62
61
|
def self.list
|
63
|
-
out = self.all
|
62
|
+
out = self.all
|
63
|
+
[['', nil]] + out.map { |item| [ item.email, item.id ] }
|
64
|
+
end
|
65
|
+
def self.list_lg
|
66
|
+
out = self.all
|
64
67
|
[['', nil]] + out.map { |item| [ "#{item.email} :: #{item.name}", item.id ] }
|
65
68
|
end
|
66
69
|
|
data/lib/ish_models.rb
CHANGED
@@ -6,13 +6,12 @@ require 'kaminari/mongoid'
|
|
6
6
|
|
7
7
|
::S3_CREDENTIALS ||= {}
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
module Gameui; end
|
10
|
+
module Iro; end
|
11
11
|
module Ish; end
|
12
12
|
class Ish::InputError < RuntimeError; end
|
13
13
|
|
14
|
-
|
15
|
-
class Manager; end
|
14
|
+
module Manager; end
|
16
15
|
|
17
16
|
module Office; end
|
18
17
|
|
@@ -41,8 +40,7 @@ require 'gameui/asset3d'
|
|
41
40
|
require 'gameui/map'
|
42
41
|
require 'gameui/marker'
|
43
42
|
|
44
|
-
|
45
|
-
|
43
|
+
require 'iro/option_watch'
|
46
44
|
|
47
45
|
require 'ish/cache_key'
|
48
46
|
require 'ish/crawler'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.33.
|
4
|
+
version: 0.0.33.229
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- lib/gameui/map.rb
|
136
136
|
- lib/gameui/map_bookmark.rb
|
137
137
|
- lib/gameui/marker.rb
|
138
|
+
- lib/iro/option_watch.rb
|
138
139
|
- lib/ish/cache_key.rb
|
139
140
|
- lib/ish/configuration.rb
|
140
141
|
- lib/ish/crawler.rb
|