Class: Bitbot::Trader::Providers::MtGox::ValueWithCurrencyCoercer
- Inherits:
-
Virtus::Attribute
- Object
- Virtus::Attribute
- Bitbot::Trader::Providers::MtGox::ValueWithCurrencyCoercer
- Defined in:
- lib/bitbot/trader/providers/mt_gox/value_with_currency_coercer.rb
Overview
Helps managing values with currencies
Class Method Summary collapse
-
.call(data) ⇒ Hash
private
Parses value with currency hash.
Class Method Details
.call(data) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses value with currency hash
19 20 21 22 23 |
# File 'lib/bitbot/trader/providers/mt_gox/value_with_currency_coercer.rb', line 19 def self.call(data) value, currency = data.values_at("value_int", "currency") decimal_point = currency == "BTC" ? 8 : 5 {value: BigDecimal(value) / (10 ** decimal_point), currency: currency} end |