coinbase-pro 0.7.1.0 → 0.7.2.0
raw patch · 7 files changed
+50/−12 lines, 7 filesdep ~aeson-casingdep ~http-client
Dependency ranges changed: aeson-casing, http-client
Files
- README.md +1/−1
- changelog.md +3/−0
- coinbase-pro.cabal +11/−9
- src/example/stream/Main.hs +1/−1
- src/lib/CoinbasePro/WebSocketFeed/Channel.hs +3/−0
- src/lib/CoinbasePro/WebSocketFeed/Channel/Status.hs +27/−0
- src/lib/CoinbasePro/WebSocketFeed/Request.hs +4/−1
README.md view
@@ -50,7 +50,7 @@ - Websocket Feed - [x] Channels - [x] The heartbeat channel- - [ ] The status channel+ - [x] The status channel - [x] The ticker channel - [x] The level2 channel - [ ] The user channel
changelog.md view
@@ -1,3 +1,6 @@+# Version 0.7.2.0+ - Upgraded to stack lts-14.17+ # Version 0.7.1.0 - Fixed broken examples
coinbase-pro.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: 1b0e7a2a88033345218e186ffcb056ef043bd04fc8557f5aadb11e0ef9805efb+-- hash: e58a9cfeb1d43417b9df67df9f0855f31e070618162e2ef3836257eb606a9670 name: coinbase-pro-version: 0.7.1.0+version: 0.7.2.0 synopsis: Client for Coinbase Pro description: Client for Coinbase Pro REST and Websocket APIs category: Web, Finance@@ -21,6 +21,7 @@ build-type: Simple extra-source-files: README.md+ changelog.md source-repository head type: git@@ -53,6 +54,7 @@ CoinbasePro.WebSocketFeed.Channel.Full.Received CoinbasePro.WebSocketFeed.Channel.Heartbeat CoinbasePro.WebSocketFeed.Channel.Level2+ CoinbasePro.WebSocketFeed.Channel.Status CoinbasePro.WebSocketFeed.Channel.Ticker CoinbasePro.WebSocketFeed.Request CoinbasePro.WebSocketFeed.Response@@ -63,7 +65,7 @@ build-depends: HsOpenSSL >=0.11 && <0.12 , aeson >=1.2 && <1.5- , aeson-casing >=0.1 && <0.2+ , aeson-casing >=0.1 && <0.3 , async >=2.1 && <2.3 , base >=4.7 && <5 , binary >=0.8 && <0.9@@ -71,7 +73,7 @@ , containers >=0.5 && <0.7 , cryptonite >=0.24 && <0.27 , http-api-data >=0.3 && <0.5- , http-client >=0.5 && <0.6+ , http-client >=0.5 && <0.7 , http-client-tls >=0.3 && <0.4 , http-streams >=0.8 && <0.9 , http-types >=0.12 && <0.13@@ -100,7 +102,7 @@ build-depends: HsOpenSSL >=0.11 && <0.12 , aeson >=1.2 && <1.5- , aeson-casing >=0.1 && <0.2+ , aeson-casing >=0.1 && <0.3 , async >=2.1 && <2.3 , base >=4.7 && <5 , binary >=0.8 && <0.9@@ -109,7 +111,7 @@ , containers >=0.5 && <0.7 , cryptonite >=0.24 && <0.27 , http-api-data >=0.3 && <0.5- , http-client >=0.5 && <0.6+ , http-client >=0.5 && <0.7 , http-client-tls >=0.3 && <0.4 , http-streams >=0.8 && <0.9 , http-types >=0.12 && <0.13@@ -138,7 +140,7 @@ build-depends: HsOpenSSL >=0.11 && <0.12 , aeson >=1.2 && <1.5- , aeson-casing >=0.1 && <0.2+ , aeson-casing >=0.1 && <0.3 , async >=2.1 && <2.3 , base >=4.7 && <5 , binary >=0.8 && <0.9@@ -147,7 +149,7 @@ , containers >=0.5 && <0.7 , cryptonite >=0.24 && <0.27 , http-api-data >=0.3 && <0.5- , http-client >=0.5 && <0.6+ , http-client >=0.5 && <0.7 , http-client-tls >=0.3 && <0.4 , http-streams >=0.8 && <0.9 , http-types >=0.12 && <0.13
src/example/stream/Main.hs view
@@ -11,5 +11,5 @@ main :: IO () main = do- msgs <- subscribeToFeed [ProductId "BTC-USD"] [Ticker]+ msgs <- subscribeToFeed [ProductId "BTC-USD"] [Status] forever $ Streams.read msgs >>= print
src/lib/CoinbasePro/WebSocketFeed/Channel.hs view
@@ -19,6 +19,7 @@ import CoinbasePro.WebSocketFeed.Channel.Level2 (L2Update (..), Snapshot (..)) import qualified CoinbasePro.WebSocketFeed.Channel.Level2 as L2+import CoinbasePro.WebSocketFeed.Channel.Status (Status (..)) import CoinbasePro.WebSocketFeed.Channel.Ticker (Ticker (..)) import CoinbasePro.WebSocketFeed.Response (Subscription) @@ -27,6 +28,7 @@ | ChangeMessage Change | DoneMessage Done | HeartbeatMessage Heartbeat+ | StatusMessage Status | L2ChangeMessage L2.Change | L2SnapshotMessage Snapshot | L2UpdateMessage L2Update@@ -46,6 +48,7 @@ "change" -> ChangeMessage <$> parseJSON (Object o) "done" -> DoneMessage <$> parseJSON (Object o) "heartbeat" -> HeartbeatMessage <$> parseJSON (Object o)+ "status" -> StatusMessage <$> parseJSON (Object o) "l2update" -> L2UpdateMessage <$> parseJSON (Object o) "last_match" -> MatchMessage <$> parseJSON (Object o) "match" -> MatchMessage <$> parseJSON (Object o)
+ src/lib/CoinbasePro/WebSocketFeed/Channel/Status.hs view
@@ -0,0 +1,27 @@+{-# LANGUAGE OverloadedStrings #-}++module CoinbasePro.WebSocketFeed.Channel.Status+ ( Status (..)+ ) where++import Data.Aeson (FromJSON, parseJSON, withObject,+ (.:))+import Data.Aeson.Casing (snakeCase)+import Data.Aeson.TH (defaultOptions, deriveJSON,+ fieldLabelModifier)+import Data.Text (Text)++import CoinbasePro.MarketData.Types (Product)+import CoinbasePro.Types (Currency)+++data Status = Status+ { currencies :: [Currency]+ , products :: [Product]+ } deriving (Eq, Show)+++instance FromJSON Status where+ parseJSON = withObject "status" $ \o -> Status+ <$> o .: "currencies"+ <*> o .: "products"
src/lib/CoinbasePro/WebSocketFeed/Request.hs view
@@ -39,12 +39,13 @@ show Unsubscribe = "unsubscribe" -data ChannelName = Heartbeat | Ticker | Level2 | Matches | Full+data ChannelName = Heartbeat | Status | Ticker | Level2 | Matches | Full deriving (Eq, Ord) instance Show ChannelName where show Heartbeat = "heartbeat"+ show Status = "status" show Ticker = "ticker" show Level2 = "level2" show Matches = "matches"@@ -53,6 +54,7 @@ instance ToJSON ChannelName where toJSON Heartbeat = toJSON $ show Heartbeat+ toJSON Status = toJSON $ show Status toJSON Ticker = toJSON $ show Ticker toJSON Level2 = toJSON $ show Level2 toJSON Matches = toJSON $ show Matches@@ -63,6 +65,7 @@ parseJSON = withText "channel name" $ \t -> case t of "heartbeat" -> return Heartbeat+ "status" -> return Status "ticker" -> return Ticker "level2" -> return Level2 "matches" -> return Matches