Sha256: f4f0b8b8ff45d0db40232008e1119c40b2a30499437f6fad7a18668c3957726f
Contents?: true
Size: 816 Bytes
Versions: 3
Compression:
Stored size: 816 Bytes
Contents
class Iro::Stock include Mongoid::Document include Mongoid::Timestamps store_in collection: 'iro_stocks' STATUS_ACTIVE = 'active' STATUS_INACTIVE = 'inactive' STATUSES = [ nil, 'active', 'inactive' ] def self.active where( status: STATUS_ACTIVE ) end field :status, default: STATUS_ACTIVE field :ticker validates :ticker, uniqueness: true, presence: true index({ ticker: -1 }, { unique: true }) field :last, type: :float has_many :positions, class_name: 'Iro::Position', inverse_of: :stock has_many :strategies, class_name: 'Iro::Strategy', inverse_of: :stock def to_s ticker end def self.list [[nil,nil]] + all.map { |sss| [ sss.ticker, sss.id ] } end def self.tickers_list [[nil,nil]] + all.map { |sss| [ sss.ticker, sss.ticker ] } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
iron_warbler-2.0.7.22 | app/models/iro/stock.rb |
iron_warbler-2.0.7.21 | app/models/iro/stock.rb |
iron_warbler-2.0.7.20 | app/models/iro/stock.rb |