Skip to content

Instantly share code, notes, and snippets.

@bartavelle
Created February 7, 2017 10:12
Show Gist options
  • Save bartavelle/275c0b946cb2abf79bde2c25a3ebb501 to your computer and use it in GitHub Desktop.
Save bartavelle/275c0b946cb2abf79bde2c25a3ebb501 to your computer and use it in GitHub Desktop.
Financial exchange bis
module Bitfinex where
import Lib
type BitfinexExchange = Exchange
type LevelCount = Int
data BitfinexBookMessage = BitfinexBookMessage { getTime :: Time
, getExchange :: BitfinexExchange
, getBookMessage :: BookMessage
, getLevelCount :: LevelCount
} deriving (Show, Eq)
module Lib where
data Side = Buy | Sell deriving (Eq, Show)
newtype Price = Price Rational deriving (Eq, Show)
newtype Amount = Amount Rational deriving (Eq, Show)
newtype Currency = Currency String deriving (Eq, Show)
newtype Time = Time Integer deriving (Eq, Show)
type ExchangeName = String
data Exchange = Exchange { getName :: ExchangeName
, getBase :: Currency
, getQuote :: Currency
} deriving (Show, Eq)
newtype Message = Message { getTime :: Time }
deriving (Show, Eq)
data BookMessage = BookMessage { getPrice :: Price
, getSide :: Side
, getAmount :: Maybe Amount
} deriving (Show, Eq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment