Browse Source

Price test fix

master
Denis Tereshkin 8 years ago
parent
commit
f3427b4b87
  1. 6
      src/ATrade/Types.hs
  2. 3
      test/ArbitraryInstances.hs

6
src/ATrade/Types.hs

@ -49,7 +49,7 @@ import System.ZMQ4.ZAP
type TickerId = T.Text type TickerId = T.Text
data DataType = Unknown data DataType = Unknown
| Price | LastTradePrice
| OpenInterest | OpenInterest
| BestBid | BestBid
| BestOffer | BestOffer
@ -62,7 +62,7 @@ data DataType = Unknown
instance Enum DataType where instance Enum DataType where
fromEnum x fromEnum x
| x == Price = 1 | x == LastTradePrice = 1
| x == OpenInterest = 3 | x == OpenInterest = 3
| x == BestBid = 4 | x == BestBid = 4
| x == BestOffer = 5 | x == BestOffer = 5
@ -75,7 +75,7 @@ instance Enum DataType where
| otherwise = -1 | otherwise = -1
toEnum x toEnum x
| x == 1 = Price | x == 1 = LastTradePrice
| x == 3 = OpenInterest | x == 3 = OpenInterest
| x == 4 = BestBid | x == 4 = BestBid
| x == 5 = BestOffer | x == 5 = BestOffer

3
test/ArbitraryInstances.hs

@ -120,4 +120,5 @@ instance Arbitrary BrokerServerResponse where
| t == 4 -> ResponseError <$> arbitrary | t == 4 -> ResponseError <$> arbitrary
instance Arbitrary P.Price where instance Arbitrary P.Price where
arbitrary = P.Price <$> arbitrary arbitrary = P.Price <$> (arbitrary `suchThat` (\p -> abs p < 1000000000 * 10000000))

Loading…
Cancel
Save