packages feed

coinbase-pro-0.7.0.0: src/example/request/Main.hs

{-# LANGUAGE OverloadedStrings #-}

module Main where

import           Control.Monad.IO.Class             (liftIO)

import           CoinbasePro.Authenticated
import           CoinbasePro.Authenticated.Accounts
import           CoinbasePro.Authenticated.Headers
import           CoinbasePro.Authenticated.Orders
import           CoinbasePro.Authenticated.Request
import           CoinbasePro.MarketData.Types       hiding (time)
import           CoinbasePro.Request
import           CoinbasePro.Types                  hiding (time)
import           CoinbasePro.Unauthenticated


main :: IO ()
main = do
    run (stats btcusd) >>= print
    run (stats btcusd) >>= print
    run (candles btcusd Nothing Nothing Minute) >>= print
    run (trades btcusd) >>= print
    run time >>= print
    run products >>= print
    run (aggregateOrderBook btcusd (Just Best)) >>= print
    run (aggregateOrderBook btcusd (Just TopFifty)) >>= print
    run (fullOrderBook btcusd) >>= print
    run_ $ do
        currencies
        products
    -- runCbAuthT cpc $ do
        -- accounts >>= liftIO . print
        -- fees >>= liftIO . print
        -- trailingVolume >>= liftIO . print
        -- account aid >>= 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
        -- cancelAll (Just btcusd) >>= liftIO . print
  where
    accessKey  = CBAccessKey "315dd0794fd50876e0c3235e79fb7a92"
    secretKey  = CBSecretKey "M37/sDmlZtI+Qxm9ODr6RNWzfoW+4w/fyyx5x8LxSRg8keHjt8Aepr+RmlprYzUaOQoi/ZHsYu0bNGiMUDl35g=="
    passphrase = CBAccessPassphrase "test123"
    cpc        = CoinbaseProCredentials accessKey secretKey passphrase
    accountId  = AccountId "e4a37481-12e7-4564-b073-90627d202c2a"
    btcusd     = ProductId "BTC-USD"