Sha256: 0ecbd06743de535c0e00cf3caa46865ae3ee20218612f13c275047cee73801ec

Contents?: true

Size: 809 Bytes

Versions: 96

Compression:

Stored size: 809 Bytes

Contents

#
# Stock Option. Owned by a person. This is a position that is held (or historical data).
# _vp_ 20171026
#
class Ish::StockOption
  include Mongoid::Document
  include Mongoid::Timestamps

  store_in :collection => 'ish_stock_option'

  field :ticker
  field :expires_on, :type => Date
  field :strike, :type => Float

  DIRECTIONS = [ :CALL, :PUT ]
  field :direction, :type => Symbol

  field :quantity, :type => Integer
  field :is_active, :type => Integer, :default => true # whether this position is current or in the past

  belongs_to :profile,      :class_name => 'IshModels::UserProfile'
  belongs_to :stock_action, :class_name => 'Ish::StockAction', :optional => true

  def to_s
    "#{self.ticker} #{self.expires_on.to_time.strftime('%b %d %Y')} #{self.strike} (x #{self.quantity})"
  end

end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
ish_models-0.0.33.140 lib/ish/stock_option.rb
ish_models-0.0.33.139 lib/ish/stock_option.rb
ish_models-0.0.33.138 lib/ish/stock_option.rb
ish_models-0.0.33.137 lib/ish/stock_option.rb
ish_models-0.0.33.136 lib/ish/stock_option.rb
ish_models-0.0.33.135 lib/ish/stock_option.rb
ish_models-0.0.33.134 lib/ish/stock_option.rb
ish_models-0.0.33.133 lib/ish/stock_option.rb
ish_models-0.0.33.132 lib/ish/stock_option.rb
ish_models-0.0.33.131 lib/ish/stock_option.rb
ish_models-0.0.33.130 lib/ish/stock_option.rb
ish_models-0.0.33.129 lib/ish/stock_option.rb
ish_models-0.0.33.128 lib/ish/stock_option.rb
ish_models-0.0.33.127 lib/ish/stock_option.rb
ish_models-0.0.33.124 lib/ish/stock_option.rb
ish_models-0.0.33.123 lib/ish/stock_option.rb
ish_models-0.0.33.122 lib/ish/stock_option.rb
ish_models-0.0.33.121 lib/ish/stock_option.rb
ish_models-0.0.33.120 lib/ish/stock_option.rb
ish_models-0.0.33.119 lib/ish/stock_option.rb