{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell   #-}

module CoinbasePro.WebSocketFeed.Channel.Ticker
    ( Ticker (..)
    ) where

import           Data.Aeson.Casing (snakeCase)
import           Data.Aeson.TH     (defaultOptions, deriveJSON,
                                    fieldLabelModifier)
import           Data.Time.Clock   (UTCTime)

import           CoinbasePro.Types (Price, ProductId, Sequence, Side, Size)


data Ticker = Ticker
    { Ticker -> Maybe Int
tradeId   :: Maybe Int
    , Ticker -> Int
sequence  :: Sequence
    , Ticker -> Maybe UTCTime
time      :: Maybe UTCTime
    , Ticker -> ProductId
productId :: ProductId
    , Ticker -> Price
price     :: Price
    , Ticker -> Maybe Side
side      :: Maybe Side
    , Ticker -> Maybe Size
lastSize  :: Maybe Size
    , Ticker -> Price
bestBid   :: Price
    , Ticker -> Price
bestAsk   :: Price
    } deriving (Ticker -> Ticker -> Bool
(Ticker -> Ticker -> Bool)
-> (Ticker -> Ticker -> Bool) -> Eq Ticker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ticker -> Ticker -> Bool
$c/= :: Ticker -> Ticker -> Bool
== :: Ticker -> Ticker -> Bool
$c== :: Ticker -> Ticker -> Bool
Eq, Eq Ticker
Eq Ticker
-> (Ticker -> Ticker -> Ordering)
-> (Ticker -> Ticker -> Bool)
-> (Ticker -> Ticker -> Bool)
-> (Ticker -> Ticker -> Bool)
-> (Ticker -> Ticker -> Bool)
-> (Ticker -> Ticker -> Ticker)
-> (Ticker -> Ticker -> Ticker)
-> Ord Ticker
Ticker -> Ticker -> Bool
Ticker -> Ticker -> Ordering
Ticker -> Ticker -> Ticker
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Ticker -> Ticker -> Ticker
$cmin :: Ticker -> Ticker -> Ticker
max :: Ticker -> Ticker -> Ticker
$cmax :: Ticker -> Ticker -> Ticker
>= :: Ticker -> Ticker -> Bool
$c>= :: Ticker -> Ticker -> Bool
> :: Ticker -> Ticker -> Bool
$c> :: Ticker -> Ticker -> Bool
<= :: Ticker -> Ticker -> Bool
$c<= :: Ticker -> Ticker -> Bool
< :: Ticker -> Ticker -> Bool
$c< :: Ticker -> Ticker -> Bool
compare :: Ticker -> Ticker -> Ordering
$ccompare :: Ticker -> Ticker -> Ordering
$cp1Ord :: Eq Ticker
Ord, Int -> Ticker -> ShowS
[Ticker] -> ShowS
Ticker -> String
(Int -> Ticker -> ShowS)
-> (Ticker -> String) -> ([Ticker] -> ShowS) -> Show Ticker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ticker] -> ShowS
$cshowList :: [Ticker] -> ShowS
show :: Ticker -> String
$cshow :: Ticker -> String
showsPrec :: Int -> Ticker -> ShowS
$cshowsPrec :: Int -> Ticker -> ShowS
Show)


deriveJSON defaultOptions {fieldLabelModifier = snakeCase} ''Ticker