1 {-# LANGUAGE FlexibleContexts #-}
2 module Cryptsy
.API
.Public
.MarketData
.Old
3 ( getMarketData
, marketData
, jsonMarketData
4 , module Cryptsy
.API
.Public
.MarketData
9 import Data
.Aeson
(withObject
)
12 import Control
.Applicative
(pure
)
15 import Cryptsy
.API
.Public
16 import Cryptsy
.API
.Public
.MarketData
19 marketdataURL
:: String
20 marketdataURL
= pubURL
"marketdata"
23 "Raw" request, does not convert the JSON value, but simply returns the JSON
24 value bound to the "return" key from the response body.
26 getMarketData
:: PubCryptsy Value
27 getMarketData
= pubCryptsy marketdataURL pure
30 "Cooked" request, extracts the JSON object bound to the "market" key of the
31 object boudn to the "return" key and converts it.
33 marketData
:: (Object
-> Parser
(GMarketData p q dt t
)) -- ^ market data parser
34 -> PubCryptsy
(GMarketData p q dt t
)
35 marketData parseMarkets
= pubCryptsy marketdataURL
. onMarkets
36 $ withObject
"MarketData" parseMarkets
38 -- |"Cooked" request with implicit parser.
39 jsonMarketData
:: FromJSON
(GMarketData p q dt t
)
40 => PubCryptsy
(GMarketData p q dt t
)
41 jsonMarketData
= pubCryptsy marketdataURL parseJSON