packages feed

haskoin-store-data 0.40.0 → 0.40.2

raw patch · 3 files changed

+46/−25 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Haskoin.Store.Data: [binfoTickerLastPrice] :: BinfoTicker -> !Double
- Haskoin.Store.Data: [binfoTickerPrice24h] :: BinfoTicker -> !Double
- Haskoin.Store.Data: [binfoTickerVol24h] :: BinfoTicker -> !Double
+ Haskoin.Store.Data: [binfoTicker15m] :: BinfoTicker -> !Double
+ Haskoin.Store.Data: [binfoTickerBuy] :: BinfoTicker -> !Double
+ Haskoin.Store.Data: [binfoTickerLast] :: BinfoTicker -> !Double
+ Haskoin.Store.Data: [binfoTickerSell] :: BinfoTicker -> !Double
+ Haskoin.Store.Data: instance Data.Default.Class.Default Haskoin.Store.Data.BinfoSymbol
- Haskoin.Store.Data: BinfoTicker :: !Text -> !Double -> !Double -> !Double -> BinfoTicker
+ Haskoin.Store.Data: BinfoTicker :: !Double -> !Double -> !Double -> !Double -> !Text -> BinfoTicker

Files

haskoin-store-data.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 84464e988a1908c7ad47ff0186701bdffc077925760e73de350b8aab941faee3+-- hash: b7e89ff3547ccc60722bcd1c8b04b3cdd082cbf896164e3d11c262989119b326  name:           haskoin-store-data-version:        0.40.0+version:        0.40.2 synopsis:       Data for Haskoin Store description:    Please see the README on GitHub at <https://github.com/haskoin/haskoin-store#readme> category:       Bitcoin, Finance, Network
src/Haskoin/Store/Data.hs view
@@ -1630,12 +1630,12 @@ getBinfoTxId (Just m) h =     case HashMap.lookup h m of         Nothing -> BinfoTxIdIndex (-1)-        Just t -> binfoTransactionIndex False t+        Just t  -> binfoTransactionIndex False t  instance ToJSON BinfoTxId where-    toJSON (BinfoTxIdHash h) = toJSON h+    toJSON (BinfoTxIdHash h)  = toJSON h     toJSON (BinfoTxIdIndex i) = toJSON i-    toEncoding (BinfoTxIdHash h) = toEncoding h+    toEncoding (BinfoTxIdHash h)  = toEncoding h     toEncoding (BinfoTxIdIndex i) = toEncoding i  instance FromJSON BinfoTxId where@@ -1852,7 +1852,7 @@         , "out" .= map (binfoTxOutputToJSON net) getBinfoTxOutputs         ] ++         case getBinfoTxResultBal of-            Nothing -> []+            Nothing         -> []             Just (res, bal) -> ["result" .= res, "balance" .= bal]  binfoTxToEncoding :: Network -> BinfoTx -> Encoding@@ -1875,7 +1875,7 @@         "inputs" `pair` list (binfoTxInputToEncoding net) getBinfoTxInputs <>         "out" `pair` list (binfoTxOutputToEncoding net) getBinfoTxOutputs <>         case getBinfoTxResultBal of-            Nothing -> mempty+            Nothing         -> mempty             Just (res, bal) -> "result" .= res <> "balance" .= bal  binfoTxParseJSON :: Network -> Value -> Parser BinfoTx@@ -2130,35 +2130,46 @@  data BinfoTicker     = BinfoTicker-        { binfoTickerSymbol    :: !Text-        , binfoTickerPrice24h  :: !Double-        , binfoTickerVol24h    :: !Double-        , binfoTickerLastPrice :: !Double+        { binfoTicker15m    :: !Double+        , binfoTickerLast   :: !Double+        , binfoTickerBuy    :: !Double+        , binfoTickerSell   :: !Double+        , binfoTickerSymbol :: !Text         }     deriving (Eq, Show, Generic, NFData)  instance Default BinfoTicker where     def = BinfoTicker{ binfoTickerSymbol = "XXX"-                     , binfoTickerPrice24h = 0.0-                     , binfoTickerVol24h = 0.0-                     , binfoTickerLastPrice = 0.0+                     , binfoTicker15m = 0.0+                     , binfoTickerLast = 0.0+                     , binfoTickerBuy = 0.0+                     , binfoTickerSell = 0.0                      }  instance ToJSON BinfoTicker where     toJSON BinfoTicker{..} =         object             [ "symbol" .= binfoTickerSymbol-            , "price_24h" .= binfoTickerPrice24h-            , "volume_24h" .= binfoTickerVol24h-            , "last_trade_price" .= binfoTickerLastPrice+            , "sell" .= binfoTickerSell+            , "buy" .= binfoTickerBuy+            , "last" .= binfoTickerLast+            , "15m" .= binfoTicker15m             ]+    toEncoding BinfoTicker{..} =+        pairs $+        "symbol" .= binfoTickerSymbol <>+        "sell" .= binfoTickerSell <>+        "buy" .= binfoTickerBuy <>+        "last" .= binfoTickerLast <>+        "15m" .= binfoTicker15m  instance FromJSON BinfoTicker where     parseJSON = withObject "ticker" $ \o -> do         binfoTickerSymbol <- o .: "symbol"-        binfoTickerPrice24h <- o .: "price_24h"-        binfoTickerVol24h <- o .: "volume_24h"-        binfoTickerLastPrice <- o .: "last_trade_price"+        binfoTicker15m <- o .: "15m"+        binfoTickerSell <- o .: "sell"+        binfoTickerBuy <- o .: "buy"+        binfoTickerLast <- o .: "last"         return BinfoTicker{..}  data BinfoSymbol@@ -2172,6 +2183,15 @@         }     deriving (Eq, Show, Generic, NFData) +instance Default BinfoSymbol where+    def = BinfoSymbol{ getBinfoSymbolCode = "XXX"+                     , getBinfoSymbolString = "¤"+                     , getBinfoSymbolName = "No currency"+                     , getBinfoSymbolConversion = 0.0+                     , getBinfoSymbolAfter = False+                     , getBinfoSymbolLocal = True+                     }+ instance ToJSON BinfoSymbol where     toJSON BinfoSymbol {..} =         object@@ -2301,8 +2321,8 @@         S.putByteString bs  toBinfoBlockIndex :: Transaction -> Maybe BlockHeight-toBinfoBlockIndex Transaction{transactionDeleted = True} = Nothing-toBinfoBlockIndex Transaction{transactionBlock = MemRef _} = Nothing+toBinfoBlockIndex Transaction{transactionDeleted = True}       = Nothing+toBinfoBlockIndex Transaction{transactionBlock = MemRef _}     = Nothing toBinfoBlockIndex Transaction{transactionBlock = BlockRef h _} = Just h  toBinfoTx :: Maybe (HashMap TxHash Transaction)
test/Haskoin/Store/DataSpec.hs view
@@ -526,8 +526,9 @@  instance Arbitrary BinfoTicker where     arbitrary = do+        binfoTicker15m <- arbitrary+        binfoTickerSell <- arbitrary+        binfoTickerBuy <- arbitrary+        binfoTickerLast <- arbitrary         binfoTickerSymbol <- cs <$> listOf1 arbitraryUnicodeChar-        binfoTickerPrice24h <- arbitrary-        binfoTickerVol24h <- arbitrary-        binfoTickerLastPrice <- arbitrary         return BinfoTicker{..}