Copyright | 2015 Tebello Thejane |
---|---|
License | BSD3 |
Maintainer | Tebello Thejane <zyxoas+hackage@gmail.com> |
Stability | Experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | None |
Language | Haskell2010 |
The types used for the various BitX API calls.
- data Ticker = Ticker {}
- data CcyPair
- data Orderbook = Orderbook {
- orderbookTimestamp :: UTCTime
- orderbookBids :: [Bid]
- orderbookAsks :: [Ask]
- data Order = Order {}
- type Bid = Order
- type Ask = Order
- data Trade = Trade {}
- data BitXAuth = BitXAuth {
- bitXAuthId :: Text
- bitXAuthSecret :: Text
- data PrivateOrder = PrivateOrder {
- privateOrderBase :: Scientific
- privateOrderCounter :: Scientific
- privateOrderCreationTimestamp :: UTCTime
- privateOrderExpirationTimestamp :: UTCTime
- privateOrderFeeBase :: Scientific
- privateOrderFeeCounter :: Scientific
- privateOrderLimitPrice :: Int
- privateOrderLimitVolume :: Scientific
- privateOrderId :: OrderID
- privateOrderPair :: CcyPair
- privateOrderState :: RequestStatus
- privateOrderOrderType :: OrderType
- type OrderID = Text
- data OrderType
- data RequestStatus
- data OrderRequest = OrderRequest {}
- data MarketOrderRequest = MarketOrderRequest {}
- type RequestSuccess = Bool
- data BitXError = BitXError {}
- data PrivateOrderWithTrades = PrivateOrderWithTrades {
- privateOrderWithTradesBase :: Scientific
- privateOrderWithTradesCounter :: Scientific
- privateOrderWithTradesCreationTimestamp :: UTCTime
- privateOrderWithTradesExpirationTimestamp :: UTCTime
- privateOrderWithTradesFeeBase :: Scientific
- privateOrderWithTradesFeeCounter :: Scientific
- privateOrderWithTradesLimitPrice :: Int
- privateOrderWithTradesLimitVolume :: Scientific
- privateOrderWithTradesId :: OrderID
- privateOrderWithTradesPair :: CcyPair
- privateOrderWithTradesState :: RequestStatus
- privateOrderWithTradesOrderType :: OrderType
- privateOrderWithTradesTrades :: [Trade]
- type AccountID = Text
- data Asset
- data Balance = Balance {}
- data FundingAddress = FundingAddress {}
- data WithdrawalRequest = WithdrawalRequest {}
- data NewWithdrawal = NewWithdrawal {}
- data WithdrawalType
- data BitcoinSendRequest = BitcoinSendRequest {}
- data QuoteRequest = QuoteRequest {}
- data OrderQuote = OrderQuote {}
- data QuoteType
- type BitXClientAuth = BitXAuth
- data Transaction = Transaction {}
- data Account = Account {
- accountId :: Text
- accountName :: Text
- accountCurrency :: Asset
- mkBitXAuth :: BitXAuth
- mkAccount :: Account
- mkBitcoinSendRequest :: BitcoinSendRequest
- mkOrderRequest :: OrderRequest
- mkQuoteRequest :: QuoteRequest
- mkNewWithdrawal :: NewWithdrawal
- mkMarketOrderRequest :: MarketOrderRequest
- class HasError s a | s -> a where
- class HasErrorCode s a | s -> a where
- class HasTimestamp s a | s -> a where
- class HasBid s a | s -> a where
- class HasAsk s a | s -> a where
- class HasLastTrade s a | s -> a where
- class HasRolling24HourVolume s a | s -> a where
- rolling24HourVolume :: Lens' s a
- class HasPair s a | s -> a where
- class HasVolume s a | s -> a where
- class HasPrice s a | s -> a where
- class HasBids s a | s -> a where
- class HasAsks s a | s -> a where
- class HasSecret s a | s -> a where
- class HasId s a | s -> a where
- class HasBase s a | s -> a where
- class HasCounter s a | s -> a where
- class HasCreationTimestamp s a | s -> a where
- creationTimestamp :: Lens' s a
- class HasExpirationTimestamp s a | s -> a where
- expirationTimestamp :: Lens' s a
- class HasFeeBase s a | s -> a where
- class HasFeeCounter s a | s -> a where
- feeCounter :: Lens' s a
- class HasLimitPrice s a | s -> a where
- limitPrice :: Lens' s a
- class HasState s a | s -> a where
- class HasOrderType s a | s -> a where
- class HasLimitVolume s a | s -> a where
- limitVolume :: Lens' s a
- class HasTrades s a | s -> a where
- class HasRowIndex s a | s -> a where
- class HasBalance s a | s -> a where
- class HasAvailable s a | s -> a where
- class HasBalanceDelta s a | s -> a where
- balanceDelta :: Lens' s a
- class HasAvailableDelta s a | s -> a where
- availableDelta :: Lens' s a
- class HasCurrency s a | s -> a where
- class HasDescription s a | s -> a where
- description :: Lens' s a
- class HasAsset s a | s -> a where
- class HasReserved s a | s -> a where
- class HasUnconfirmed s a | s -> a where
- unconfirmed :: Lens' s a
- class HasAddress s a | s -> a where
- class HasTotalReceived s a | s -> a where
- totalReceived :: Lens' s a
- class HasTotalUnconfirmed s a | s -> a where
- totalUnconfirmed :: Lens' s a
- class HasAmount s a | s -> a where
- class HasWithdrawalType s a | s -> a where
- withdrawalType :: Lens' s a
- class HasMessage s a | s -> a where
- class HasQuoteType s a | s -> a where
- class HasBaseAmount s a | s -> a where
- baseAmount :: Lens' s a
- class HasCounterAmount s a | s -> a where
- counterAmount :: Lens' s a
- class HasCreatedAt s a | s -> a where
- class HasExpiresAt s a | s -> a where
- class HasDiscarded s a | s -> a where
- class HasExercised s a | s -> a where
- class HasName s a | s -> a where
Documentation
The state of a single market, identified by the currency pair.
As usual, the ask/sell price is the price of the last filled ask order, and the bid/buy price is
the price of the last filled bid order. Necessarily bid <= ask.
Ticker | |
|
A currency pair
XBTZAR | Bitcoin vs. ZAR |
XBTNAD | Bitcoin vs. Namibian Dollar |
ZARXBT | ZAR vs. Namibian Dollar |
NADXBT | Namibian Dollar vs. Bitcoin |
XBTKES | Bitcoin vs. Kenyan Shilling |
KESXBT | Kenyan Shilling vs Bitcoin |
XBTMYR | Bitcoin vs. Malaysian Ringgit |
MYRXBT | Malaysian Ringgit vs. Bitcoin |
XBTNGN | Bitcoin vs. Nigerian Naira |
NGNXBT | Nigerian Naira vs. Bitcoin |
The current state of the publically accessible orderbook. Bid orders are requests to buy, ask orders are requests to sell.
Orderbook | |
|
A single placed order in the orderbook
Order | |
|
Trade | |
|
An auth type used by all private API calls, after authorisation.
BitXAuth | |
|
data PrivateOrder Source
A recently placed (private) order, containing a lot more information than is available on the public order book.
The type of a placed order.
data RequestStatus Source
The state of a (private) placed request -- either an order or a withdrawal request.
type RequestSuccess = Bool Source
A possible error which the BitX API might return, instead of returning the requested data. Note that as yet there is no exhaustive list of error codes available, so comparisons will have to be done via Text comparisons (as opposed to typed pattern matching). Sorry...
data PrivateOrderWithTrades Source
A recently placed (private) order, containing a lot more information than is available on the public order book, together with details of any trades which have (partially) filled it.
A trade-able asset. Essentially, a currency.
ZAR | South African Rand |
NAD | Namibian Dollar |
XBT | Bitcoin |
KES | Kenyan Shilling |
MYR | Malaysian Ringgit |
NGN | Nigerian Naira |
The current balance of a private account.
data FundingAddress Source
A registered address for an acocunt.
data WithdrawalRequest Source
The state of a request to withdraw from an account.
data NewWithdrawal Source
A request to withdraw from an account.
data WithdrawalType Source
The type of a withdrawal request.
data BitcoinSendRequest Source
A request to send bitcoin to a bitcoin address or email address.
data OrderQuote Source
A temporarily locked-in quote.
type BitXClientAuth = BitXAuth Source
data Transaction Source
A transaction on a private user account.
A registered account.
Account | |
|
Convenient constructors for records which serve as input parameters to functions. These are not completely safe (since you can forget to set a field and the Haskell compiler won't notice), but they are a bit more convenient than dealing with the raw records directly, as long as you're careful.
mkBitXAuth = BitXAuth "" ""
mkBitcoinSendRequest :: BitcoinSendRequest Source
mkBitcoinSendRequest = BitcoinSendRequest 0 ZAR "" Nothing Nothing
mkOrderRequest :: OrderRequest Source
mkOrderRequest = OrderRequest ZARXBT BID 0 0
mkQuoteRequest :: QuoteRequest Source
mkQuoteRequest = QuoteRequest BUY ZARXBT 0
mkNewWithdrawal :: NewWithdrawal Source
mkNewWithdrawal = NewWithdrawal ZAR_EFT 0
mkMarketOrderRequest :: MarketOrderRequest Source
mkMarketOrderRequest = MarketOrderRequest ZARXBT BID 0
Lens Has*
instances for convenient record accessors and mutators.
For a broader view of how these function (and why you can generally ignore them) see the
documentation for lens'
s makeFields
.
Essentially, an instance declaration of the form
instance HasFoo MyRecord Int
implies that we can pretend that the data type MyRecord
has a field called Foo
of type Int
(although in reality the field would be called myRecordFoo
or such), and that there exists a
lens called foo
which can be used -- among other things -- as a setter and getter on
MyRecord
.
class HasErrorCode s a | s -> a where Source
class HasTimestamp s a | s -> a where Source
class HasLastTrade s a | s -> a where Source
class HasRolling24HourVolume s a | s -> a where Source
rolling24HourVolume :: Lens' s a Source
class HasCounter s a | s -> a where Source
class HasCreationTimestamp s a | s -> a where Source
creationTimestamp :: Lens' s a Source
class HasExpirationTimestamp s a | s -> a where Source
expirationTimestamp :: Lens' s a Source
class HasFeeBase s a | s -> a where Source
class HasFeeCounter s a | s -> a where Source
feeCounter :: Lens' s a Source
class HasLimitPrice s a | s -> a where Source
limitPrice :: Lens' s a Source
class HasOrderType s a | s -> a where Source
class HasLimitVolume s a | s -> a where Source
limitVolume :: Lens' s a Source
class HasRowIndex s a | s -> a where Source
class HasBalance s a | s -> a where Source
class HasAvailable s a | s -> a where Source
class HasBalanceDelta s a | s -> a where Source
balanceDelta :: Lens' s a Source
class HasAvailableDelta s a | s -> a where Source
availableDelta :: Lens' s a Source
class HasCurrency s a | s -> a where Source
class HasDescription s a | s -> a where Source
description :: Lens' s a Source
class HasReserved s a | s -> a where Source
class HasUnconfirmed s a | s -> a where Source
unconfirmed :: Lens' s a Source
class HasAddress s a | s -> a where Source
class HasTotalReceived s a | s -> a where Source
totalReceived :: Lens' s a Source
class HasTotalUnconfirmed s a | s -> a where Source
totalUnconfirmed :: Lens' s a Source
class HasWithdrawalType s a | s -> a where Source
withdrawalType :: Lens' s a Source
class HasMessage s a | s -> a where Source
class HasQuoteType s a | s -> a where Source
class HasBaseAmount s a | s -> a where Source
baseAmount :: Lens' s a Source
class HasCounterAmount s a | s -> a where Source
counterAmount :: Lens' s a Source
class HasCreatedAt s a | s -> a where Source
class HasExpiresAt s a | s -> a where Source
class HasDiscarded s a | s -> a where Source
class HasExercised s a | s -> a where Source