Sha256: fc8d9aff3e4ae9335c93fe344ec672ef242120d8e8549c400c387a4baa0ac0ca

Contents?: true

Size: 898 Bytes

Versions: 2

Compression:

Stored size: 898 Bytes

Contents

class Iro::Purse
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paranoia
  store_in collection: 'iro_purses'

  field :slug
  validates :slug, presence: true, uniqueness: true
  index({ slug: -1 }, { unique: true })

  has_many :positions, class_name: 'Iro::Position', inverse_of: :purse

  belongs_to :stock, class_name: 'Iro::Stock', inverse_of: :strategies

  field :unit,             type: :integer, default: 10

  ## for rolling only:
  field :height,           type: :integer, default: 100

  field :mark_every_n_usd, type: :float, default: 1
  field :n_next_positions, type: :integer, default: 5
  ## with unit 10, sum_scale .001
  ## with unit 100, sum_scale .0001
  field :summary_scale,    type: :float, default: 0.001

  field :available_amount, type: :float

  def to_s
    slug
  end
  def self.list
    [[nil,nil]] + all.map { |p| [p, p.id] }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.25 app/models/iro/purse.rb
iron_warbler-2.0.7.24 app/models/iro/purse.rb