ish_models 0.0.33.226 → 0.0.33.228
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 +4 -4
- data/lib/iro/option_watch.rb +69 -0
- data/lib/ish/user_profile.rb +6 -3
- data/lib/ish_models.rb +4 -9
- 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: 72c17273c98a213fb3173169bf9cf80ac5679d575cf1c0eba0b52862a5a2bf60
|
4
|
+
data.tar.gz: ab4da31fe3114aba80c648b51cf58eef1a9e2f6a78649d37f99f944806596196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7070edc5d664690a478d7c767e742b8881b49c5670474dd5314a6cf85b44b46a2b04132bcc7e0a4de6d036c1168a62e40aecaf7c5d26d091134daf622c5b7b5
|
7
|
+
data.tar.gz: a9eb167806f67e420a6638a1d951a851dc10b22f4975b450bc7b42c015981e2c0d160f9dc47f7830d85e35f088a6d4bb5acd573610e807a59b2c7cd2eee3dadb
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
class Iro::OptionWatch
|
3
|
+
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
store_in collection: 'iro_option_watches'
|
7
|
+
|
8
|
+
field :ticker # like NVDA
|
9
|
+
validates :ticker, presence: true
|
10
|
+
|
11
|
+
field :symbol # like NVDA_021822C230
|
12
|
+
|
13
|
+
KIND_OPTION = 'option'
|
14
|
+
KIND_STOCK = 'stock'
|
15
|
+
KINDS = [ KIND_OPTION, KIND_STOCK ]
|
16
|
+
field :kind, type: String
|
17
|
+
validates :kind, presence: true
|
18
|
+
def self.kinds_list
|
19
|
+
[ nil, 'option', 'stock' ]
|
20
|
+
end
|
21
|
+
|
22
|
+
## Strike isn't the same as price!
|
23
|
+
field :strike, :type => Float
|
24
|
+
# validates :strike, presence: true
|
25
|
+
|
26
|
+
## What is the price of the option at some strike?
|
27
|
+
field :mark, type: Float
|
28
|
+
validates :mark, presence: true
|
29
|
+
|
30
|
+
field :contractType
|
31
|
+
# validates :contractType, presence: true
|
32
|
+
|
33
|
+
field :expirationDate
|
34
|
+
# validates :expirationDate, presence: true
|
35
|
+
|
36
|
+
NOTIFICATION_TYPES = [ :NONE, :EMAIL, :SMS ]
|
37
|
+
ACTIONS = NOTIFICATION_TYPES
|
38
|
+
NOTIFICATION_NONE = :NONE
|
39
|
+
NOTIFICATION_EMAIL = :EMAIL
|
40
|
+
NOTIFICATION_SMS = :SMS
|
41
|
+
field :notification_type, :type => Symbol, :as => :action
|
42
|
+
def self.actions_list
|
43
|
+
[nil] + ACTIONS
|
44
|
+
end
|
45
|
+
|
46
|
+
STATE_ACTIVE = 'active'
|
47
|
+
STATE_INACTIVE = 'inactive'
|
48
|
+
STATES = [ STATE_ACTIVE, STATE_INACTIVE ]
|
49
|
+
field :state, type: String, default: STATE_ACTIVE
|
50
|
+
validates :state, presence: true
|
51
|
+
scope :active, ->{ where( state: STATE_ACTIVE ) }
|
52
|
+
def self.states_list
|
53
|
+
[ nil, 'active', 'inactive' ]
|
54
|
+
end
|
55
|
+
|
56
|
+
DIRECTION_ABOVE = :ABOVE
|
57
|
+
DIRECTION_BELOW = :BELOW
|
58
|
+
DIRECTIONS = [ :ABOVE, :BELOW ]
|
59
|
+
field :direction, :type => Symbol
|
60
|
+
validates :direction, presence: true
|
61
|
+
def self.directions_list
|
62
|
+
[nil] + DIRECTIONS
|
63
|
+
end
|
64
|
+
|
65
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile'
|
66
|
+
field :email
|
67
|
+
field :phone
|
68
|
+
|
69
|
+
end
|
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,16 +6,12 @@ require 'kaminari/mongoid'
|
|
6
6
|
|
7
7
|
::S3_CREDENTIALS ||= {}
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
class Iro; end
|
12
|
-
class Iro::OptionPriceItem; end
|
13
|
-
|
9
|
+
module Gameui; end
|
10
|
+
module Iro; end
|
14
11
|
module Ish; end
|
15
12
|
class Ish::InputError < RuntimeError; end
|
16
13
|
|
17
|
-
|
18
|
-
class Manager; end
|
14
|
+
module Manager; end
|
19
15
|
|
20
16
|
module Office; end
|
21
17
|
|
@@ -44,8 +40,7 @@ require 'gameui/asset3d'
|
|
44
40
|
require 'gameui/map'
|
45
41
|
require 'gameui/marker'
|
46
42
|
|
47
|
-
|
48
|
-
|
43
|
+
require 'iro/option_watch'
|
49
44
|
|
50
45
|
require 'ish/cache_key'
|
51
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.228
|
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
|