Class: InvestTinkoff::V2::Quotation

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

Class Method Summary collapse

Instance 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(
    units,
    nano
  )
end

Instance Method Details

#to_jsonObject



18
19
20
# File 'lib/invest_tinkoff/v2/quotation.rb', line 18

def to_json(*)
  to_h.to_json
end