Sha256: 705e96c5b0a0988c7b3428462da985d15e615489213211fc24ed3f25b7a16811

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

class Warbler::OptionWatch
  include Mongoid::Document
  include Mongoid::Timestamps
  store_in collection: 'ish_option_watches'

  SLEEP_TIME_SECONDS = 60

  field :ticker # like NVDA
  validates :ticker, presence: true
  # field :symbol # like NVDA_021822C230

  ## Strike isn't the same as price!
  field :strike, :type => Float
  validates :strike, presence: true

  ## What is the price of the option at some strike?
  field :price, type: Float
  validates :price, presence: true

  field :contractType
  validates :contractType, presence: true

  field :date
  validates :date, presence: true

  NOTIFICATION_TYPES = [ :NONE, :EMAIL, :SMS ]
  ACTIONS            = NOTIFICATION_TYPES
  NOTIFICATION_NONE  = :NONE
  NOTIFICATION_EMAIL = :EMAIL
  NOTIFICATION_SMS   = :SMS
  field :notification_type, :type => Symbol, :as => :action

  DIRECTIONS      = [ :ABOVE, :BELOW ]
  DIRECTION_ABOVE = :ABOVE
  DIRECTION_BELOW = :BELOW
  field :direction, :type => Symbol

  belongs_to :profile, :class_name => 'Ish::UserProfile'

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ish_models-0.0.33.153 lib/warbler/option_watch.rb
ish_models-0.0.33.152 lib/warbler/option_watch.rb
ish_models-0.0.33.151 lib/warbler/option_watch.rb