content: {-
     FinFeedAPI Stock REST API
  
     No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
  
     OpenAPI Version: 3.0.4
     FinFeedAPI Stock REST API API version: v1
     Contact: support@apibricks.io
     Generated by OpenAPI Generator (https://openapi-generator.tech)
  -}
  
  {-|
  Module : FinFeedAPIStockREST.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 FinFeedAPIStockREST.API.Ohlcv where
  
  import FinFeedAPIStockREST.Core
  import FinFeedAPIStockREST.MimeTypes
  import FinFeedAPIStockREST.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
  
  -- *** v1OhlcvExchangeExchangeIdHistoryGet
  
  -- | @GET \/v1\/ohlcv\/exchange\/{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.
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey', 'AuthBasicJWT'
  -- 
  v1OhlcvExchangeExchangeIdHistoryGet
    :: 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
    -> FinFeedAPIStockRESTRequest V1OhlcvExchangeExchangeIdHistoryGet MimeNoContent [OHLCVExchangeTimeseriesItem] accept
  v1OhlcvExchangeExchangeIdHistoryGet  _ (ExchangeId exchangeId) (PeriodId periodId) (TimeStart timeStart) (TimeEnd timeEnd) =
    _mkRequest "GET" ["/v1/ohlcv/exchange/",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 V1OhlcvExchangeExchangeIdHistoryGet  
  -- | @application/json@
  instance Produces V1OhlcvExchangeExchangeIdHistoryGet MimeJSON
  -- | @text/json@
  instance Produces V1OhlcvExchangeExchangeIdHistoryGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvExchangeExchangeIdHistoryGet MimePlainText
  
  
  -- *** v1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet
  
  -- | @GET \/v1\/ohlcv\/exchange-symbol\/{exchange_id}\/{symbol_id}\/history@
  -- 
  -- Historical data
  -- 
  -- Get OHLCV timeseries data returned in time ascending order.
  -- 
  -- AuthMethod: 'AuthApiKeyAPIKey', 'AuthBasicJWT'
  -- 
  v1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> ExchangeId -- ^ "exchangeId" -  Exchange identifier of requested timeseries (from the Metadata -> Exchanges)
    -> SymbolId -- ^ "symbolId" -  Symbol identifier of requested timeseries (from the Metadata -> Symbols)
    -> PeriodId -- ^ "periodId" -  Identifier of requested timeseries period (e.g. `5SEC` or `2MTH`)
    -> FinFeedAPIStockRESTRequest V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet MimeNoContent [OHLCVTimeseriesItem] accept
  v1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet  _ (ExchangeId exchangeId) (SymbolId symbolId) (PeriodId periodId) =
    _mkRequest "GET" ["/v1/ohlcv/exchange-symbol/",toPath exchangeId,"/",toPath symbolId,"/history"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
      `_hasAuthType` (P.Proxy :: P.Proxy AuthBasicJWT)
      `addQuery` toQuery ("period_id", Just periodId)
  
  data V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet  
  
  -- | /Optional Param/ "time_start" - Timeseries starting time in ISO 8601
  instance HasOptionalParam V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet 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 V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet 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 V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet Limit where
    applyOptionalParam req (Limit xs) =
      req `addQuery` toQuery ("limit", Just xs)
  -- | @application/json@
  instance Produces V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet MimeJSON
  -- | @text/json@
  instance Produces V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvExchangeSymbolExchangeIdSymbolIdHistoryGet MimePlainText
  
  
  -- *** v1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet
  
  -- | @GET \/v1\/ohlcv\/exchange-symbol\/{exchange_id}\/{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'
  -- 
  v1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet
    :: Accept accept -- ^ request accept ('MimeType')
    -> ExchangeId -- ^ "exchangeId" -  Exchange identifier of requested timeseries (from the Metadata -> Exchanges)
    -> SymbolId -- ^ "symbolId" -  Symbol identifier of requested timeseries (from the Metadata -> Symbols)
    -> PeriodId -- ^ "periodId" -  Identifier of requested timeseries period (e.g. `5SEC` or `2MTH`)
    -> FinFeedAPIStockRESTRequest V1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet MimeNoContent [OHLCVTimeseriesItem] accept
  v1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet  _ (ExchangeId exchangeId) (SymbolId symbolId) (PeriodId periodId) =
    _mkRequest "GET" ["/v1/ohlcv/exchange-symbol/",toPath exchangeId,"/",toPath symbolId,"/latest"]
      `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyAPIKey)
      `_hasAuthType` (P.Proxy :: P.Proxy AuthBasicJWT)
      `addQuery` toQuery ("period_id", Just periodId)
  
  data V1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet  
  
  -- | /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 V1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet Limit where
    applyOptionalParam req (Limit xs) =
      req `addQuery` toQuery ("limit", Just xs)
  -- | @application/json@
  instance Produces V1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet MimeJSON
  -- | @text/json@
  instance Produces V1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvExchangeSymbolExchangeIdSymbolIdLatestGet 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')
    -> FinFeedAPIStockRESTRequest V1OhlcvPeriodsGet MimeNoContent [OHLCVTimeseriesPeriod] 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
  -- | @text/json@
  instance Produces V1OhlcvPeriodsGet MimeTextJson
  -- | @text/plain@
  instance Produces V1OhlcvPeriodsGet MimePlainText
  
  