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

3
test/ArbitraryInstances.hs

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

Loading…
Cancel
Save