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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7b14f0b96452f68ed6ab5862cc62252d77bbb59d2609a416d74e8e4da8bc503
4
- data.tar.gz: b4b5e486087969d999f015a0df69fac64a253a66608525951e533b92449a59c9
3
+ metadata.gz: c5a2776eca852c5a7e11aa0a03e7d9032e54ff2b3d0d7f8a6b4364df63029d8f
4
+ data.tar.gz: 9ad2d817b825868f4e299c99eb8c915a0436df006c43499d5ea834b0072487a4
5
5
  SHA512:
6
- metadata.gz: 916c01143a3b402f5e21ddd4c90b70027e4a427e9ed6870cc1049b706b91b18a2ea482135c1730ec4b09d2813f7a7a90d2f6580931648ef86d005750c918644f
7
- data.tar.gz: 4d3c8b684f3a9c21365477668019a9c7f1f48e929a340aea99c408fd7d8fa043ffe7a047a7c467eda575e9d884eb1800bfea08ab503e0dd7a97305251b6b32c0
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
@@ -49,14 +49,18 @@ class ::Ish::EmailContext
49
49
  field :send_at, type: DateTime
50
50
 
51
51
 
52
- def self.unsent; new.unsent; end
53
- def unsent; Ish::EmailContext.where( sent_at: nil ); end
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
@@ -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.order_by( :domain => :asc, :lang => :asc )
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
- class Gameui; end
10
-
9
+ module Gameui; end
10
+ module Iro; end
11
11
  module Ish; end
12
12
  class Ish::InputError < RuntimeError; end
13
13
 
14
- # I need this thing for permissions???
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
- # require 'iro/option_price_item'
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.227
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