You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
873 B
27 lines
873 B
{-# LANGUAGE DeriveGeneric #-} |
|
|
|
module ATrade.Driver.Junction.QuoteStream |
|
( |
|
QuoteSubscription(..), |
|
QuoteStream(..), |
|
SubscriptionId(..) |
|
) where |
|
|
|
import ATrade.QuoteSource.Client (QuoteData) |
|
import ATrade.Types (BarTimeframe, TickerId) |
|
import Control.Concurrent.BoundedChan (BoundedChan) |
|
import Data.Hashable (Hashable) |
|
import GHC.Generics (Generic) |
|
|
|
data QuoteSubscription = |
|
QuoteSubscription TickerId BarTimeframe |
|
deriving (Generic, Eq) |
|
|
|
instance Hashable BarTimeframe |
|
instance Hashable QuoteSubscription |
|
|
|
newtype SubscriptionId = SubscriptionId { unSubscriptionId :: Int } |
|
|
|
class (Monad m) => QuoteStream m where |
|
addSubscription :: QuoteSubscription -> BoundedChan QuoteData -> m SubscriptionId |
|
removeSubscription :: SubscriptionId -> m ()
|
|
|