Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Request functions & response types for the Gemini Exchange API.
Synopsis
- data GeminiApiM a
- runApi :: GeminiConfig -> GeminiApiM a -> IO a
- data GeminiConfig = GeminiConfig {
- gcApiKey :: Text
- gcApiSecret :: Text
- data GeminiError = GeminiError {}
- getSymbolDetails :: MonadHttp m => Text -> m SymbolDetails
- data SymbolDetails = SymbolDetails {}
- getMyTrades :: Maybe (UTCTime, UTCTime) -> GeminiApiM [Trade]
- data Trade = Trade {
- tId :: Integer
- tSymbol :: Text
- tPrice :: Scientific
- tAmount :: Scientific
- tFeeCurrency :: Text
- tFeeAmount :: Scientific
- tIsBuy :: Bool
- tIsAggressor :: Bool
- tTimestamp :: POSIXTime
- tOrderId :: Text
- getMyTransfers :: Maybe (UTCTime, UTCTime) -> GeminiApiM [Transfer]
- data Transfer = Transfer {}
- getMyEarnTransactions :: Maybe (UTCTime, UTCTime) -> GeminiApiM [EarnTransaction]
- data EarnHistory = EarnHistory {}
- data EarnTransaction = EarnTransaction {}
- protectedGeminiRequest :: (MonadHttp m, HttpMethod method, HttpBodyAllowed (AllowsBody method) (ProvidesBody NoReqBody), ToJSON body, FromJSON response, MonadReader GeminiConfig m) => method -> Url scheme -> body -> m (JsonResponse response)
- retryWithRateLimit :: (MonadHttp m, MonadCatch m) => m a -> m a
- createSignature :: GeminiConfig -> ByteString -> ByteString
- makeNonce :: MonadIO m => m Integer
Documentation
data GeminiApiM a Source #
Monad in which Gemini API requests are run.
Instances
runApi :: GeminiConfig -> GeminiApiM a -> IO a Source #
Run a series of API requests with the given Config.
data GeminiConfig Source #
Required configuration data for making requests to the Gemini API.
GeminiConfig | |
|
Instances
data GeminiError Source #
Potential error response body from the API.
Instances
Requests
Symbol Details
getSymbolDetails :: MonadHttp m => Text -> m SymbolDetails Source #
Fetch the details on a supported symbol.
data SymbolDetails Source #
Currency & Precision details for a Trade
Symbol.
Instances
Trade History
:: Maybe (UTCTime, UTCTime) | Optional |
-> GeminiApiM [Trade] |
Fetch all my Gemini Trades
A single, completed Trade.
Trade | |
|
Instances
Transfer History
:: Maybe (UTCTime, UTCTime) | Optional |
-> GeminiApiM [Transfer] |
Fetch all my Gemini Transfers
A single fiat or cryptocurrency transfer, credit, deposit, or withdrawal.
Instances
Earn History
getMyEarnTransactions :: Maybe (UTCTime, UTCTime) -> GeminiApiM [EarnTransaction] Source #
Fetch all my Gemini Earn Transactions
data EarnHistory Source #
Earn Transactions grouped by a Provider/Borrower.
Instances
FromJSON EarnHistory Source # | |
Defined in Web.Gemini parseJSON :: Value -> Parser EarnHistory # parseJSONList :: Value -> Parser [EarnHistory] # |
data EarnTransaction Source #
A single Earn transaction.
EarnTransaction | |
|
Instances
Helpers
protectedGeminiRequest :: (MonadHttp m, HttpMethod method, HttpBodyAllowed (AllowsBody method) (ProvidesBody NoReqBody), ToJSON body, FromJSON response, MonadReader GeminiConfig m) => method -> Url scheme -> body -> m (JsonResponse response) Source #
Run a request that requires authorization against the Gemini API.
retryWithRateLimit :: (MonadHttp m, MonadCatch m) => m a -> m a Source #
Attempt a request & retry if a 429
RateLimited
error is returned.
We attempt to parse the retry wait time from the message
field but
fallback to one second.
:: GeminiConfig | API Credentials |
-> ByteString | Base64-encoded request body. |
-> ByteString |