Sha256: 7be4f1437560599c167110d323c6b8797a9e87cb5dc20421e701f1c04776df2d

Contents?: true

Size: 803 Bytes

Versions: 13

Compression:

Stored size: 803 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 => 'Ish::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

13 entries across 13 versions & 1 rubygems

Version Path
ish_models-0.0.33.153 lib/warbler/stock_option.rb
ish_models-0.0.33.152 lib/warbler/stock_option.rb
ish_models-0.0.33.151 lib/warbler/stock_option.rb
ish_models-0.0.33.150 lib/warbler/stock_option.rb
ish_models-0.0.33.149 lib/warbler/stock_option.rb
ish_models-0.0.33.148 lib/warbler/stock_option.rb
ish_models-0.0.33.147 lib/warbler/stock_option.rb
ish_models-0.0.33.146 lib/warbler/stock_option.rb
ish_models-0.0.33.145 lib/warbler/stock_option.rb
ish_models-0.0.33.144 lib/warbler/stock_option.rb
ish_models-0.0.33.143 lib/warbler/stock_option.rb
ish_models-0.0.33.142 lib/warbler/stock_option.rb
ish_models-0.0.33.141 lib/warbler/stock_option.rb