Copyright | No Rights Reserved |
---|---|
License | Public Domain |
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.
Note that these are all record
types, as provided by Nikita Volkov's
Record library. The main motivation for using the record
library was
to avoid using record field prefixes and other awkward hacks to get around
the fact that Haskell does not yet have a real records' system.
For example, the declaration of BitXAuth
is
type BitXAuth = [record
| {id ::Text
, secret ::Text
} |]
To declare a BitXAuth, one might use
myAuth :: BitXAuth myAuth = [record| {id = "46793", secret = "387ffBd56eEAA7C59"} |]
and to read the fields you would use
theID =view
[lens
| id |] myAuth
Note that all uses of Volkov's record
s requires importing Record and
enabling the DataKinds
and QuasiQuotes
extensions.
- type Ticker = Record6 "ask" Scientific "bid" Scientific "lastTrade" Scientific "pair" CcyPair "rolling24HourVolume" Scientific "timestamp" UTCTime
- data CcyPair
- type Orderbook = Record3 "asks" [Ask] "bids" [Bid] "timestamp" UTCTime
- type Order = Record2 "price" Scientific "volume" Scientific
- type Bid = Order
- type Ask = Order
- type Trade = Record3 "price" Scientific "timestamp" UTCTime "volume" Scientific
- type BitXAuth = Record2 "id" Text "secret" Text
- type PrivateOrder = Record12 "base" Scientific "counter" Scientific "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Scientific "feeCounter" Scientific "id" OrderID "limitPrice" Scientific "limitVolume" Scientific "pair" CcyPair "state" RequestStatus "type" OrderType
- type OrderID = Text
- data OrderType
- data RequestStatus
- type OrderRequest = Record4 "pair" CcyPair "price" Scientific "type" OrderType "volume" Scientific
- type RequestSuccess = Bool
- type BitXError = Record2 "error" Text "errorCode" Text
- type PrivateOrderWithTrades = Record13 "base" Scientific "counter" Scientific "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Scientific "feeCounter" Scientific "id" OrderID "limitPrice" Scientific "limitVolume" Scientific "pair" CcyPair "state" RequestStatus "trades" [Trade] "type" OrderType
- type AccountID = Text
- data Asset
- type Balance = Record5 "asset" Asset "balance" Scientific "id" AccountID "reserved" Scientific "unconfirmed" Scientific
- type FundingAddress = Record4 "address" Text "asset" Asset "totalReceived" Scientific "totalUnconfirmed" Scientific
- type WithdrawalRequest = Record2 "id" Text "status" RequestStatus
- type NewWithdrawal = Record2 "amount" Scientific "type" WithdrawalType
- data WithdrawalType
- type BitcoinSendRequest = Record5 "address" Text "amount" Scientific "currency" Asset "description" (Maybe Text) "message" (Maybe Text)
- type QuoteRequest = Record3 "baseAmount" Scientific "pair" CcyPair "type" QuoteType
- type OrderQuote = Record9 "baseAmount" Scientific "counterAmount" Scientific "createdAt" UTCTime "discarded" Bool "exercised" Bool "expiresAt" UTCTime "id" Text "pair" CcyPair "type" QuoteType
- data QuoteType
- type BitXClientAuth = BitXAuth
- type Transaction = Record8 "available" Scientific "availableDelta" Scientific "balance" Scientific "balanceDelta" Scientific "currency" Asset "description" Text "rowIndex" Int "timestamp" UTCTime
- type Account = Record3 "currency" Asset "id" Text "name" Text
Documentation
type Ticker = Record6 "ask" Scientific "bid" Scientific "lastTrade" Scientific "pair" CcyPair "rolling24HourVolume" Scientific "timestamp" UTCTime Source
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.
type Ticker = [record| {ask ::Scientific
, timestamp ::UTCTime
, bid ::Scientific
, rolling24HourVolume ::Scientific
, lastTrade ::Scientific
, pair ::CcyPair
} |]
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 |
type Order = Record2 "price" Scientific "volume" Scientific Source
A single placed order in the orderbook
type Order = [record| {volume ::Scientific
, price ::Scientific
} |]
type Trade = Record3 "price" Scientific "timestamp" UTCTime "volume" Scientific Source
type PrivateOrder = Record12 "base" Scientific "counter" Scientific "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Scientific "feeCounter" Scientific "id" OrderID "limitPrice" Scientific "limitVolume" Scientific "pair" CcyPair "state" RequestStatus "type" OrderType Source
A recently placed (private) order, containing a lot more information than is available on the public order book.
type PrivateOrder = [record| {base ::Scientific
, counter ::Scientific
, creationTimestamp ::UTCTime
, expirationTimestamp ::UTCTime
, feeBase ::Scientific
, feeCounter ::Scientific
, limitPrice ::Scientific
, limitVolume ::Scientific
, id ::OrderID
, pair ::CcyPair
, state ::RequestStatus
, type ::OrderType
} |]
The type of a placed order.
data RequestStatus Source
The state of a (private) placed request -- either an order or a withdrawal request.
type OrderRequest = Record4 "pair" CcyPair "price" Scientific "type" OrderType "volume" Scientific Source
A request to place an order.
type OrderRequest = [record| {pair ::CcyPair
, type ::OrderType
, volume ::Scientific
, price ::Scientific
} |]
type RequestSuccess = Bool Source
type BitXError = Record2 "error" Text "errorCode" Text 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...
type BitXError = [record| {error ::Text
, errorCode ::Text
} |]
type PrivateOrderWithTrades = Record13 "base" Scientific "counter" Scientific "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Scientific "feeCounter" Scientific "id" OrderID "limitPrice" Scientific "limitVolume" Scientific "pair" CcyPair "state" RequestStatus "trades" [Trade] "type" OrderType 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.
type PrivateOrderWithTrades = [record| {base ::Scientific
, counter ::Scientific
, creationTimestamp ::UTCTime
, expirationTimestamp ::UTCTime
, feeBase ::Scientific
, feeCounter ::Scientific
, limitPrice ::Scientific
, limitVolume ::Scientific
, id ::OrderID
, pair ::CcyPair
, state ::RequestStatus
, type ::OrderType
, trades :: [Trade
] } |]
A trade-able asset. Essentially, a currency.
type Balance = Record5 "asset" Asset "balance" Scientific "id" AccountID "reserved" Scientific "unconfirmed" Scientific Source
The current balance of a private account.
type Balance = [record| {id ::AccountID
, asset ::Asset
, balance ::Scientific
, reserved ::Scientific
, unconfirmed ::Scientific
} |]
type FundingAddress = Record4 "address" Text "asset" Asset "totalReceived" Scientific "totalUnconfirmed" Scientific Source
A registered address for an acocunt.
type FundingAddress = [record| {asset ::Asset
, address ::Text
, totalReceived ::Scientific
, totalUnconfirmed ::Scientific
} |]
type WithdrawalRequest = Record2 "id" Text "status" RequestStatus Source
The state of a request to withdraw from an account.
type WithdrawalRequest = [record| {status ::RequestStatus
, id ::Text
} |]
type NewWithdrawal = Record2 "amount" Scientific "type" WithdrawalType Source
A request to withdraw from an account.
type NewWithdrawal = [record| {type ::WithdrawalType
, amount ::Scientific
} |]
data WithdrawalType Source
The type of a withdrawal request.
type BitcoinSendRequest = Record5 "address" Text "amount" Scientific "currency" Asset "description" (Maybe Text) "message" (Maybe Text) Source
type QuoteRequest = Record3 "baseAmount" Scientific "pair" CcyPair "type" QuoteType Source
A request to lock in a quote.
type QuoteRequest = [record| {type ::QuoteType
, pair ::CcyPair
, baseAmount ::Scientific
} |]
type OrderQuote = Record9 "baseAmount" Scientific "counterAmount" Scientific "createdAt" UTCTime "discarded" Bool "exercised" Bool "expiresAt" UTCTime "id" Text "pair" CcyPair "type" QuoteType Source
A temporarily locked in quote.
type OrderQuote = [record| {id ::Text
, type ::QuoteType
, pair ::CcyPair
, baseAmount ::Scientific
, counterAmount ::Scientific
, createdAt ::UTCTime
, expiresAt ::UTCTime
, discarded ::Bool
, exercised ::Bool
} |]
type BitXClientAuth = BitXAuth Source
type Transaction = Record8 "available" Scientific "availableDelta" Scientific "balance" Scientific "balanceDelta" Scientific "currency" Asset "description" Text "rowIndex" Int "timestamp" UTCTime Source
A transaction on a private user account.
type Transaction = [record| {rowIndex ::Int
, timestamp ::UTCTime
, balance ::Scientific
, available ::Scientific
, balanceDelta ::Scientific
, availableDelta ::Scientific
, currency ::Asset
, description ::Text
}|]