Browse Source

Price: Show instance

master
Denis Tereshkin 8 years ago
parent
commit
066a651141
  1. 6
      src/ATrade/Price.hs

6
src/ATrade/Price.hs

@ -18,7 +18,7 @@ import Data.Scientific
data Price = Price { data Price = Price {
priceQuants :: !Int64 priceQuants :: !Int64
} deriving (Eq, Show, Ord) } deriving (Eq, Ord)
giga :: Int64 giga :: Int64
giga = 1000000000 giga = 1000000000
@ -74,3 +74,7 @@ instance Real Price where
instance Fractional Price where instance Fractional Price where
fromRational a = fromInteger (numerator a) / fromInteger (denominator a) fromRational a = fromInteger (numerator a) / fromInteger (denominator a)
a / b = fromDouble $ toDouble a / toDouble b a / b = fromDouble $ toDouble a / toDouble b
instance Show Price where
show = show . toDouble

Loading…
Cancel
Save