content: {-
     CoinAPI Market Data REST API
  
     No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
  
     OpenAPI Version: 3.0.4
     CoinAPI Market Data REST API API version: v1
     Contact: support@apibricks.io
     Generated by OpenAPI Generator (https://openapi-generator.tech)
  -}
  
  {-|
  Module : CoinAPIMarketDataREST.API.Ohlcv
  -}
  
  {-# LANGUAGE FlexibleContexts #-}
  {-# LANGUAGE FlexibleInstances #-}
  {-# LANGUAGE MonoLocalBinds #-}
  {-# LANGUAGE MultiParamTypeClasses #-}
  {-# LANGUAGE OverloadedStrings #-}
  {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}
  
  module CoinAPIMarketDataREST.API.Ohlcv where
  
  import CoinAPIMarketDataREST.Core
  import CoinAPIMarketDataREST.MimeTypes
  import CoinAPIMarketDataREST.Model as M
  
  import qualified Data.Aeson as A
  import qualified Data.ByteString as B
  import qualified Data.ByteString.Lazy as BL
  import qualified Data.Data as P (Typeable, TypeRep, typeOf, typeRep)
  import qualified Data.Foldable as P
  import qualified Data.Map as Map
  import qualified Data.Maybe as P
  import qualified Data.Proxy as P (Proxy(..))
  import qualified Data.Set as Set
  import qualified Data.String as P
  import qualified Data.Text as T
  import qualified Data.Text.Encoding as T
  import qualified Data.Text.Lazy as TL
  import qualified Data.Text.Lazy.Encoding as TL
  import qualified Data.Time as TI
  import qualified Network.HTTP.Client.MultipartFormData as NH
  import qualified Network.HTTP.Media as ME
  import qualified Network.HTTP.Types as NH
  import qualified Web.FormUrlEncoded as WH
  import qualified Web.HttpApiData as WH
  
  import Data.Text (Text)
  import GHC.Base ((<|>))
  
  import Prelude ((==),(/=),($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)
  import qualified Prelude as P
  
  -- * Operations
  
  
  -- ** Ohlcv
  
  -- *** v1OhlcvExchangesExchangeIdHistoryGet
  
  -- | @GET \/v1\/ohlcv\/exchanges\/{exchange_id}\/history@
  -- 
  -- Historical data by exchange
  -- 
  -- Get OHLCV timeseries data returned in time ascending order. Data can be requested by the period and for the specific exchange eg `BITSTAMP`              :::info The OHLCV Historical endpoint data can be delayed a few seconds. Use OHLCV real-time data stream to get data without delay. The difference between `time_end` and `time_start` cannot be higher than 1 day. The `period_id` cannot be higher than `1DAY`. :::
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey', 'AuthBasicJWT'
  -- 
  v1OhlcvExchangesExchangeIdHistoryGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> ExchangeId -- ^ "exchangeId" -  Exchange identifier of requested timeseries (from the Metadata -> Exchanges)
    -> PeriodId -- ^ "periodId" -  Identifier of requested timeseries period (e.g. `5SEC` or `1DAY`)
    -> TimeStart -- ^ "timeStart" -  Timeseries starting time in ISO 8601
    -> TimeEnd -- ^ "timeEnd" -  Timeseries ending time in ISO 8601
    -> CoinAPIMarketDataRESTRequest V1OhlcvExchangesExchangeIdHistoryGet MimeNoContent [ModelsExchangeTimeseriesItem] accept
  v1OhlcvExchangesExchangeIdHistoryGet  _ (ExchangeId exchangeId) (PeriodId periodId) (TimeStart timeStart) (TimeEnd timeEnd) =
    _mkRequest "GET" ["/v1/ohlcv/exchanges/",toPath exchangeId,"/history"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
      `_hasAuthType` (P.Proxy :: P.Proxy AuthBasicJWT)
      `addQuery` toQuery ("period_id", Just periodId)
      `addQuery` toQuery ("time_start", Just timeStart)
      `addQuery` toQuery ("time_end", Just timeEnd)
  
  data V1OhlcvExchangesExchangeIdHistoryGet  
  -- | @application/json@
  instance Produces V1OhlcvExchangesExchangeIdHistoryGet MimeJSON
  -- | @application/x-msgpack@
  instance Produces V1OhlcvExchangesExchangeIdHistoryGet MimeXMsgpack
  -- | @text/json@
  instance Produces V1OhlcvExchangesExchangeIdHistoryGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvExchangesExchangeIdHistoryGet MimePlainText
  
  
  -- *** v1OhlcvPeriodsGet
  
  -- | @GET \/v1\/ohlcv\/periods@
  -- 
  -- List all periods
  -- 
  -- Get full list of supported time periods available for requesting OHLCV timeseries data.              ### Available periods              Time unit | Period identifiers --------- | ----------- Second | 1SEC, 2SEC, 3SEC, 4SEC, 5SEC, 6SEC, 10SEC, 15SEC, 20SEC, 30SEC Minute | 1MIN, 2MIN, 3MIN, 4MIN, 5MIN, 6MIN, 10MIN, 15MIN, 20MIN, 30MIN Hour | 1HRS, 2HRS, 3HRS, 4HRS, 6HRS, 8HRS, 12HRS Day | 1DAY, 2DAY, 3DAY, 5DAY, 7DAY, 10DAY Month | 1MTH, 2MTH, 3MTH, 4MTH, 6MTH Year | 1YRS, 2YRS, 3YRS, 4YRS, 5YRS              :::tip You can assume that we will not remove any periods from this response, however, we may add new ones. :::
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey', 'AuthBasicJWT'
  -- 
  v1OhlcvPeriodsGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> CoinAPIMarketDataRESTRequest V1OhlcvPeriodsGet MimeNoContent [V1TimeseriesPeriod] accept
  v1OhlcvPeriodsGet  _ =
    _mkRequest "GET" ["/v1/ohlcv/periods"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
      `_hasAuthType` (P.Proxy :: P.Proxy AuthBasicJWT)
  
  data V1OhlcvPeriodsGet  
  -- | @application/json@
  instance Produces V1OhlcvPeriodsGet MimeJSON
  -- | @application/x-msgpack@
  instance Produces V1OhlcvPeriodsGet MimeXMsgpack
  -- | @text/json@
  instance Produces V1OhlcvPeriodsGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvPeriodsGet MimePlainText
  
  
  -- *** v1OhlcvSymbolIdHistoryGet
  
  -- | @GET \/v1\/ohlcv\/{symbol_id}\/history@
  -- 
  -- Historical data
  -- 
  -- Get OHLCV timeseries data returned in time ascending order. Data can be requested by the period and for the specific symbol eg `BITSTAMP_SPOT_BTC_USD`, if you need to query timeseries by asset pairs eg. `BTC/USD`, then please reffer to the Exchange Rates Timeseries data              :::info The OHLCV Historical endpoint data can be delayed a few seconds. Use OHLCV real-time data stream to get data without delay. :::
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey', 'AuthBasicJWT'
  -- 
  v1OhlcvSymbolIdHistoryGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> SymbolId -- ^ "symbolId" -  Symbol identifier of requested timeseries (from the Metadata -> Symbols)
    -> PeriodId -- ^ "periodId" -  Identifier of requested timeseries period (e.g. `5SEC` or `2MTH`)
    -> CoinAPIMarketDataRESTRequest V1OhlcvSymbolIdHistoryGet MimeNoContent [V1TimeseriesItem] accept
  v1OhlcvSymbolIdHistoryGet  _ (SymbolId symbolId) (PeriodId periodId) =
    _mkRequest "GET" ["/v1/ohlcv/",toPath symbolId,"/history"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
      `_hasAuthType` (P.Proxy :: P.Proxy AuthBasicJWT)
      `addQuery` toQuery ("period_id", Just periodId)
  
  data V1OhlcvSymbolIdHistoryGet  
  
  -- | /Optional Param/ "time_start" - Timeseries starting time in ISO 8601
  instance HasOptionalParam V1OhlcvSymbolIdHistoryGet TimeStart where
    applyOptionalParam req (TimeStart xs) =
      req `addQuery` toQuery ("time_start", Just xs)
  
  -- | /Optional Param/ "time_end" - Timeseries ending time in ISO 8601
  instance HasOptionalParam V1OhlcvSymbolIdHistoryGet TimeEnd where
    applyOptionalParam req (TimeEnd xs) =
      req `addQuery` toQuery ("time_end", Just xs)
  
  -- | /Optional Param/ "limit" - Amount of items to return (mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
  instance HasOptionalParam V1OhlcvSymbolIdHistoryGet Limit where
    applyOptionalParam req (Limit xs) =
      req `addQuery` toQuery ("limit", Just xs)
  -- | @application/json@
  instance Produces V1OhlcvSymbolIdHistoryGet MimeJSON
  -- | @application/x-msgpack@
  instance Produces V1OhlcvSymbolIdHistoryGet MimeXMsgpack
  -- | @text/json@
  instance Produces V1OhlcvSymbolIdHistoryGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvSymbolIdHistoryGet MimePlainText
  
  
  -- *** v1OhlcvSymbolIdLatestGet
  
  -- | @GET \/v1\/ohlcv\/{symbol_id}\/latest@
  -- 
  -- Latest data
  -- 
  -- Get OHLCV latest timeseries data returned in time descending order. Data can be requested by the period and for the specific symbol eg `BITSTAMP_SPOT_BTC_USD`, if you need to query timeseries by asset pairs eg. `BTC/USD`, then please reffer to the Exchange Rates Timeseries data              :::info OHLCV Latest endpoint is just the shortcut to the OHLCV Historical endpoint with substituted `time_start` and `time_end` parameters.  The OHLCV Historical endpoint data can be delayed a few seconds. Use OHLCV real-time data stream to get data without delay. :::
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey', 'AuthBasicJWT'
  -- 
  v1OhlcvSymbolIdLatestGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> SymbolId -- ^ "symbolId" -  Symbol identifier of requested timeseries (from the Metadata -> Symbols)
    -> PeriodId -- ^ "periodId" -  Identifier of requested timeseries period (e.g. `5SEC` or `2MTH`)
    -> CoinAPIMarketDataRESTRequest V1OhlcvSymbolIdLatestGet MimeNoContent [V1TimeseriesItem] accept
  v1OhlcvSymbolIdLatestGet  _ (SymbolId symbolId) (PeriodId periodId) =
    _mkRequest "GET" ["/v1/ohlcv/",toPath symbolId,"/latest"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
      `_hasAuthType` (P.Proxy :: P.Proxy AuthBasicJWT)
      `addQuery` toQuery ("period_id", Just periodId)
  
  data V1OhlcvSymbolIdLatestGet  
  
  -- | /Optional Param/ "limit" - Amount of items to return (mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
  instance HasOptionalParam V1OhlcvSymbolIdLatestGet Limit where
    applyOptionalParam req (Limit xs) =
      req `addQuery` toQuery ("limit", Just xs)
  -- | @application/json@
  instance Produces V1OhlcvSymbolIdLatestGet MimeJSON
  -- | @application/x-msgpack@
  instance Produces V1OhlcvSymbolIdLatestGet MimeXMsgpack
  -- | @text/json@
  instance Produces V1OhlcvSymbolIdLatestGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvSymbolIdLatestGet MimePlainText
  
  