Class: InvestTinkoff::V2::Quotation

Inherits:
Object
  • Object
show all
Defined in:
lib/invest_tinkoff/v2/quotation.rb

Class Method Summary collapse

Class Method Details

.create(price) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/invest_tinkoff/v2/quotation.rb', line 9

def self.create price
  units = price.to_i
  nano = ((price.to_d - units) * 1_000_000_000).to_i
  new(
    "#{price.positive? ? '' : '-'}#{units.abs}",
    nano
  )
end