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.
18 lines
749 B
18 lines
749 B
|
4 years ago
|
|
||
|
|
module Test.Mock.TickerInfoProvider
|
||
|
|
(
|
||
|
|
mkMockTickerInfoProvider
|
||
|
|
) where
|
||
|
|
|
||
|
|
import ATrade.Quotes.TickerInfoProvider
|
||
|
|
import ATrade.RoboCom.Types (InstrumentParameters)
|
||
|
|
import ATrade.Types (TickerId)
|
||
|
|
import qualified Data.Map.Strict as M
|
||
|
|
import Data.Maybe (catMaybes, mapMaybe)
|
||
|
|
|
||
|
|
mkMockTickerInfoProvider :: M.Map TickerId InstrumentParameters -> TickerInfoProvider
|
||
|
|
mkMockTickerInfoProvider params = TickerInfoProvider $ mockGetInstrumentParameters params
|
||
|
|
|
||
|
|
mockGetInstrumentParameters :: M.Map TickerId InstrumentParameters -> [TickerId] -> IO [InstrumentParameters]
|
||
|
|
mockGetInstrumentParameters params = return . mapMaybe (`M.lookup` params)
|