bitx-bitcoin alternatives and similar packages
Based on the "bitcoin" category
Do you think we are missing an alternative of bitx-bitcoin or a related project?
As a minimal example, to get the current selling price (in South African Rand) of Bitcoin on the Luno exchange, do the following:
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 -> case tic ^. BitX.ask of Nothing -> putStrLn "The BTC-ZAR exchange not currently have an ask price..." Just p -> putStrLn ("1 Bitcoin will set you back ZAR" ++ show p ++ ".") 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) ++ "\""
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. Your best bet might be to just
*Note that all licence references and agreements mentioned in the bitx-bitcoin README section above are relevant to that project's source code only.