The bitx-bitcoin package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Haskell bindings to the BitX REST API, as described here: https://bitx.co/api.

Note that since this library interfaces directly with a financial API, great care must be taken in its use. In particular, the author cannot be held accountable for any financial losses as a result of programming error, whether that error is in your code, the code of the author of this library, or BitX's code. This is just common sense.

If you need to make sure that nothing funny happens in the code, apart from reading the source yourself, you should also perform a few test transations with very small denominations, as I will strive to do every time before releasing a new version.

For a very small usage example, see Network.Bitcoin.BitX.Public.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.3.0.0, 0.4.0.0, 0.4.0.1, 0.5.0.0, 0.5.0.1, 0.6.0.0, 0.6.0.0, 0.7.0.0, 0.7.0.1, 0.7.0.2, 0.8.0.0, 0.9.0.0, 0.9.0.1, 0.10.0.0, 0.11.0.0, 0.11.0.1
Change logCHANGES
Dependenciesaeson (>=0.8), base (>=4.5 && <5), bytestring, http-client (>=0.4.6.1), http-client-tls, http-types, microlens, microlens-th, network, scientific, split (>=0.2.0.0), text, time [details]
LicenseBSD3
AuthorTebello Thejane
MaintainerTebello Thejane <zyxoas+hackage@gmail.com>
CategoryWeb, Bitcoin, Finance
Home pagehttps://github.com/tebello-thejane/bitx-haskell
Source repositoryhead: git clone git://github.com/tebello-thejane/bitx-haskell.git
UploadedFri Oct 23 04:35:58 UTC 2015 by tebello_thejane

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for bitx-bitcoin-0.6.0.0

Build Status Hackage BSD3

(Hopefully useful) Haskell bindings to the BitX bitcoin exchange's API.

As a minimal example, to get the current selling price (in South African Rand) of bitcoin on the BitX exchange, do the following:

{-# LANGUAGE DataKinds #-}

import Control.Lens ((^.))
import Network.Bitcoin.BitX (BitXAPIResponse(..), getTicker, CcyPair(..))
import qualified Network.Bitcoin.BitX as BitX
import Data.Text (unpack)
import Network.HTTP.Types.Status (Status(..))
import Network.HTTP.Client (responseStatus)

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

Note that the code snippet above depends on http-types, text, http-client, lens (or any lens-compatible package, such as microlens), and finally bitx-bitcoin.

This library is known to work on Windows, but if you wish to use it then you will have to do a bit more work due to the Network library not building on Windows out of the box. See this blog post by Neil Mitchell.