# coinbase-pro ## Request API ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import Control.Monad.IO.Class (liftIO) import CoinbasePro.Authenticated import CoinbasePro.Authenticated.Accounts import CoinbasePro.Authenticated.Orders import CoinbasePro.Headers import CoinbasePro.MarketData.Types hiding (time) import CoinbasePro.Request import CoinbasePro.Types hiding (time) import CoinbasePro.Unauthenticated main :: IO () main = do stats btcusd >>= print candles btcusd Nothing Nothing Minute >>= print trades btcusd >>= print time >>= print products >>= print aggregateOrderBook btcusd (Just Best) >>= print aggregateOrderBook btcusd (Just TopFifty) >>= print fullOrderBook btcusd >>= print runCbAuthT cpc $ do accounts >>= liftIO . print account accountId >>= liftIO . print fills (Just btcusd) Nothing >>= liftIO . print listOrders (Just [All]) (Just btcusd) >>= liftIO . print placeOrder btcusd Sell (Size 0.001) (Price 99999.00) True Nothing Nothing Nothing >>= liftIO . print placeOrder btcusd Buy (Size 1.0) (Price 1.00) True Nothing Nothing Nothing >>= liftIO . print cancelOrder (OrderId "") cancelAll (Just btcusd) >>= liftIO . print where accessKey = CBAccessKey "" secretKey = CBSecretKey "" passphrase = CBAccessPassphrase "" cpc = CoinbaseProCredentials accessKey secretKey passphrase accountId = AccountId "" btcusd = ProductId "BTC-USD" ``` ## Websocket API To print out all of the full order book updates for BTC-USD: ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import Control.Monad (forever) import qualified System.IO.Streams as Streams import CoinbasePro.Types (ProductId (..)) import CoinbasePro.WebSocketFeed (subscribeToFeed) import CoinbasePro.WebSocketFeed.Request (ChannelName (..)) main :: IO () main = do msgs <- subscribeToFeed [ProductId "BTC-USD"] [Ticker] forever $ Streams.read msgs >>= print ``` ## Example Example execs can be found in `src/example/`