bitx-bitcoin-0.2.0.2: A Haskell library for working with the BitX bitcoin exchange.

CopyrightNo Rights Reserved
LicensePublic Domain
MaintainerTebello Thejane <zyxoas+hackage@gmail.com>
StabilityExperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellNone
LanguageHaskell2010

Network.Bitcoin.BitX.Public

Description

Usage example

As a small example, to get the current selling price of bitcoin on the BitX exchange, do the following:

{-# LANGUAGE QuasiQuotes #-}

import Record.Lens (view)
import Record (lens)
import Network.Bitcoin.BitX (BitXAPIResponse(..), getTicker, CcyPair(..))
import Data.Text (unpack)
import Network.HTTP.Types.Status (Status(..))
import Network.HTTP.Conduit (responseStatus)

main :: IO ()
main = do
  bitXResponse <- getTicker XBTZAR
  case bitXResponse of
    ValidResponse tic        -> print (view [lens| ask |] tic)
    ErrorResponse err        ->
        error $ "BitX error received: "" ++ (unpack (view [lens| error |] err)) ++ """
    ExceptionResponse ex     ->
        error $ "Exception was thrown: "" ++ (unpack ex) ++ """
    UnparseableResponse resp ->
        error $ "Bad HTTP response; HTTP status code was: ""
                  ++ (show . statusCode . responseStatus $ resp) ++ """
 

Synopsis

Documentation

getTicker :: CcyPair -> IO (BitXAPIResponse Ticker) Source

Returns the latest ticker indicators.

getTickers :: IO (BitXAPIResponse [Ticker]) Source

Returns the latest ticker indicators from all active BitX exchanges.

getOrderBook :: CcyPair -> IO (BitXAPIResponse Orderbook) Source

Returns a list of bids and asks in the order book.

Ask orders are sorted by price ascending. Bid orders are sorted by price descending. Note that multiple orders at the same price are not necessarily conflated.

getTrades :: CcyPair -> IO (BitXAPIResponse [Trade]) Source

Returns a list of the most recent trades